kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* How to log USB modem data for a specific device?
@ 2019-11-11 16:11 Jeffrey Walton
  2019-11-11 16:31 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Walton @ 2019-11-11 16:11 UTC (permalink / raw)
  To: kernelnewbies

Hi Everyone,

I'm having trouble with a C application that opens a USB modem. The
application is not receiving some data from a USR modem. Conexant
modems are OK.

I'm working through
https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
modem at Bus=01 Dev=24:

T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0baf ProdID=0303 Rev= 2.00
S:  Manufacturer=U.S.Robotics
S:  Product=USB Modem

This is where my confusion lies. It is not clear to me how to
determine which socket to use for step #3 in usbmon.txt. Step #3 says:

   # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out

How do I determine which socket to use for Bus=01 Dev=24?

Thanks in advance.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-11 16:11 How to log USB modem data for a specific device? Jeffrey Walton
@ 2019-11-11 16:31 ` Greg KH
  2019-11-11 16:40   ` Jeffrey Walton
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2019-11-11 16:31 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: kernelnewbies

On Mon, Nov 11, 2019 at 11:11:06AM -0500, Jeffrey Walton wrote:
> Hi Everyone,
> 
> I'm having trouble with a C application that opens a USB modem. The
> application is not receiving some data from a USR modem. Conexant
> modems are OK.
> 
> I'm working through
> https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
> modem at Bus=01 Dev=24:
> 
> T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
> D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> P:  Vendor=0baf ProdID=0303 Rev= 2.00
> S:  Manufacturer=U.S.Robotics
> S:  Product=USB Modem
> 
> This is where my confusion lies. It is not clear to me how to
> determine which socket to use for step #3 in usbmon.txt. Step #3 says:
> 
>    # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out
> 
> How do I determine which socket to use for Bus=01 Dev=24?

From the above documentation, it says to use "3u" for all devices on the
3rd bus.  You want the 1st bus, right?  So did you try using "1u"?

I think wireshark can intrepret usbmon output, so maybe just use that
instead and point it at the USB bus you want to watch?

good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-11 16:31 ` Greg KH
@ 2019-11-11 16:40   ` Jeffrey Walton
  2019-11-11 17:24     ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Walton @ 2019-11-11 16:40 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Mon, Nov 11, 2019 at 11:31 AM Greg KH <greg@kroah.com> wrote:
>
> On Mon, Nov 11, 2019 at 11:11:06AM -0500, Jeffrey Walton wrote:
> > Hi Everyone,
> >
> > I'm having trouble with a C application that opens a USB modem. The
> > application is not receiving some data from a USR modem. Conexant
> > modems are OK.
> >
> > I'm working through
> > https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
> > modem at Bus=01 Dev=24:
> >
> > T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
> > D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > P:  Vendor=0baf ProdID=0303 Rev= 2.00
> > S:  Manufacturer=U.S.Robotics
> > S:  Product=USB Modem
> >
> > This is where my confusion lies. It is not clear to me how to
> > determine which socket to use for step #3 in usbmon.txt. Step #3 says:
> >
> >    # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out
> >
> > How do I determine which socket to use for Bus=01 Dev=24?
>
> From the above documentation, it says to use "3u" for all devices on the
> 3rd bus.  You want the 1st bus, right?  So did you try using "1u"?
>
> I think wireshark can intrepret usbmon output, so maybe just use that
> instead and point it at the USB bus you want to watch?

Thanks Greg.

I want Bus 1, but I want Device 24 (not all devices).

Jef

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-11 16:40   ` Jeffrey Walton
@ 2019-11-11 17:24     ` Greg KH
  2019-11-11 22:57       ` Jeffrey Walton
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2019-11-11 17:24 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: kernelnewbies

On Mon, Nov 11, 2019 at 11:40:51AM -0500, Jeffrey Walton wrote:
> On Mon, Nov 11, 2019 at 11:31 AM Greg KH <greg@kroah.com> wrote:
> >
> > On Mon, Nov 11, 2019 at 11:11:06AM -0500, Jeffrey Walton wrote:
> > > Hi Everyone,
> > >
> > > I'm having trouble with a C application that opens a USB modem. The
> > > application is not receiving some data from a USR modem. Conexant
> > > modems are OK.
> > >
> > > I'm working through
> > > https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
> > > modem at Bus=01 Dev=24:
> > >
> > > T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
> > > D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > > P:  Vendor=0baf ProdID=0303 Rev= 2.00
> > > S:  Manufacturer=U.S.Robotics
> > > S:  Product=USB Modem
> > >
> > > This is where my confusion lies. It is not clear to me how to
> > > determine which socket to use for step #3 in usbmon.txt. Step #3 says:
> > >
> > >    # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out
> > >
> > > How do I determine which socket to use for Bus=01 Dev=24?
> >
> > From the above documentation, it says to use "3u" for all devices on the
> > 3rd bus.  You want the 1st bus, right?  So did you try using "1u"?
> >
> > I think wireshark can intrepret usbmon output, so maybe just use that
> > instead and point it at the USB bus you want to watch?
> 
> Thanks Greg.
> 
> I want Bus 1, but I want Device 24 (not all devices).

That's not what usbmon will show.  Look at wireshark and see if it can
filter the output for just that one device.

There's also the old-style USB device snoop interface, that works on a
per-device level.

good luck!

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-11 17:24     ` Greg KH
@ 2019-11-11 22:57       ` Jeffrey Walton
  2019-11-12  5:37         ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Walton @ 2019-11-11 22:57 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Mon, Nov 11, 2019 at 12:24 PM Greg KH <greg@kroah.com> wrote:
>
> On Mon, Nov 11, 2019 at 11:40:51AM -0500, Jeffrey Walton wrote:
> > On Mon, Nov 11, 2019 at 11:31 AM Greg KH <greg@kroah.com> wrote:
> > >
> > > On Mon, Nov 11, 2019 at 11:11:06AM -0500, Jeffrey Walton wrote:
> > > > Hi Everyone,
> > > >
> > > > I'm having trouble with a C application that opens a USB modem. The
> > > > application is not receiving some data from a USR modem. Conexant
> > > > modems are OK.
> > > >
> > > > I'm working through
> > > > https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
> > > > modem at Bus=01 Dev=24:
> > > >
> > > > T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
> > > > D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > > > P:  Vendor=0baf ProdID=0303 Rev= 2.00
> > > > S:  Manufacturer=U.S.Robotics
> > > > S:  Product=USB Modem
> > > >
> > > > This is where my confusion lies. It is not clear to me how to
> > > > determine which socket to use for step #3 in usbmon.txt. Step #3 says:
> > > >
> > > >    # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out
> > > >
> > > > How do I determine which socket to use for Bus=01 Dev=24?
> > >
> > > From the above documentation, it says to use "3u" for all devices on the
> > > 3rd bus.  You want the 1st bus, right?  So did you try using "1u"?
> > >
> > > I think wireshark can intrepret usbmon output, so maybe just use that
> > > instead and point it at the USB bus you want to watch?
> >
> > Thanks Greg.
> >
> > I want Bus 1, but I want Device 24 (not all devices).
>
> That's not what usbmon will show.  Look at wireshark and see if it can
> filter the output for just that one device.
>
> There's also the old-style USB device snoop interface, that works on a
> per-device level.

Ack, thanks.

Would you happen to know the old-style program name? I am having
trouble finding it.

Here's why I want to specify a device number:

    $ cat /sys/kernel/debug/usb/devices | grep -i -c 'Bus=01'
    13

It is too much information for me to sift through. I'll do it if I
have to, but I prefer the tools do the work for me (rather than me do
the work of the tools).

Jeff

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-11 22:57       ` Jeffrey Walton
@ 2019-11-12  5:37         ` Greg KH
  2019-11-12  6:20           ` Jeffrey Walton
  0 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2019-11-12  5:37 UTC (permalink / raw)
  To: Jeffrey Walton; +Cc: kernelnewbies

On Mon, Nov 11, 2019 at 05:57:24PM -0500, Jeffrey Walton wrote:
> On Mon, Nov 11, 2019 at 12:24 PM Greg KH <greg@kroah.com> wrote:
> >
> > On Mon, Nov 11, 2019 at 11:40:51AM -0500, Jeffrey Walton wrote:
> > > On Mon, Nov 11, 2019 at 11:31 AM Greg KH <greg@kroah.com> wrote:
> > > >
> > > > On Mon, Nov 11, 2019 at 11:11:06AM -0500, Jeffrey Walton wrote:
> > > > > Hi Everyone,
> > > > >
> > > > > I'm having trouble with a C application that opens a USB modem. The
> > > > > application is not receiving some data from a USR modem. Conexant
> > > > > modems are OK.
> > > > >
> > > > > I'm working through
> > > > > https://www.kernel.org/doc/Documentation/usb/usbmon.txt . I found the
> > > > > modem at Bus=01 Dev=24:
> > > > >
> > > > > T:  Bus=01 Lev=03 Prnt=07 Port=00 Cnt=01 Dev#= 24 Spd=480  MxCh= 0
> > > > > D:  Ver= 2.00 Cls=02(comm.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
> > > > > P:  Vendor=0baf ProdID=0303 Rev= 2.00
> > > > > S:  Manufacturer=U.S.Robotics
> > > > > S:  Product=USB Modem
> > > > >
> > > > > This is where my confusion lies. It is not clear to me how to
> > > > > determine which socket to use for step #3 in usbmon.txt. Step #3 says:
> > > > >
> > > > >    # cat /sys/kernel/debug/usb/usbmon/3u > /tmp/1.mon.out
> > > > >
> > > > > How do I determine which socket to use for Bus=01 Dev=24?
> > > >
> > > > From the above documentation, it says to use "3u" for all devices on the
> > > > 3rd bus.  You want the 1st bus, right?  So did you try using "1u"?
> > > >
> > > > I think wireshark can intrepret usbmon output, so maybe just use that
> > > > instead and point it at the USB bus you want to watch?
> > >
> > > Thanks Greg.
> > >
> > > I want Bus 1, but I want Device 24 (not all devices).
> >
> > That's not what usbmon will show.  Look at wireshark and see if it can
> > filter the output for just that one device.
> >
> > There's also the old-style USB device snoop interface, that works on a
> > per-device level.
> 
> Ack, thanks.
> 
> Would you happen to know the old-style program name? I am having
> trouble finding it.

It's the "usbfs_snoop" module parameter for the usb core.  It only works
on usbfs connections, sorry, not for anything that you already have a
kernel driver bound for.

> Here's why I want to specify a device number:
> 
>     $ cat /sys/kernel/debug/usb/devices | grep -i -c 'Bus=01'
>     13
> 
> It is too much information for me to sift through. I'll do it if I
> have to, but I prefer the tools do the work for me (rather than me do
> the work of the tools).

That explains why you only want one device's data, but does not answer
why you want that data at all :)

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-12  5:37         ` Greg KH
@ 2019-11-12  6:20           ` Jeffrey Walton
  2019-11-12 18:15             ` Jeffrey Walton
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Walton @ 2019-11-12  6:20 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Tue, Nov 12, 2019 at 12:37 AM Greg KH <greg@kroah.com> wrote:
> ...
>
> > Here's why I want to specify a device number:
> >
> >     $ cat /sys/kernel/debug/usb/devices | grep -i -c 'Bus=01'
> >     13
> >
> > It is too much information for me to sift through. I'll do it if I
> > have to, but I prefer the tools do the work for me (rather than me do
> > the work of the tools).
>
> That explains why you only want one device's data, but does not answer
> why you want that data at all :)

I have a pet project like NoMoRobo. It is essentially a call blocking
service that depends on Caller ID. My pet project takes things a step
further by initiating a call trace on suspicious numbers, and also
files FCC and FTC complaints.

The program works well with Conexant, Accura/Hayes and MultiTech
modems. The program chokes on USR modems. For USR I get the RING
message, but not the Caller ID information. From my program's
perspective, it looks like the Caller ID information is never sent.

So I want to perform some low level traces to understand why I am
mishandling things.

The GNU screen program receives the information as expected. The
problem is, GNU screen does not show me individual messages. I don't
know where one message ends and another begins. (One of my theories is
the USR modem is batching RING and Caller ID into a single message).

Jeff

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to log USB modem data for a specific device?
  2019-11-12  6:20           ` Jeffrey Walton
@ 2019-11-12 18:15             ` Jeffrey Walton
  0 siblings, 0 replies; 8+ messages in thread
From: Jeffrey Walton @ 2019-11-12 18:15 UTC (permalink / raw)
  To: Greg KH; +Cc: kernelnewbies

On Tue, Nov 12, 2019 at 1:20 AM Jeffrey Walton <noloader@gmail.com> wrote:
>
> On Tue, Nov 12, 2019 at 12:37 AM Greg KH <greg@kroah.com> wrote:
> > ...
> >
> > > Here's why I want to specify a device number:
> > >
> > >     $ cat /sys/kernel/debug/usb/devices | grep -i -c 'Bus=01'
> > >     13
> > >
> > > It is too much information for me to sift through. I'll do it if I
> > > have to, but I prefer the tools do the work for me (rather than me do
> > > the work of the tools).
> >
> > That explains why you only want one device's data, but does not answer
> > why you want that data at all :)
>
> I have a pet project like NoMoRobo. It is essentially a call blocking
> service that depends on Caller ID. My pet project takes things a step
> further by initiating a call trace on suspicious numbers, and also
> files FCC and FTC complaints.
>
> The program works well with Conexant, Accura/Hayes and MultiTech
> modems. The program chokes on USR modems. For USR I get the RING
> message, but not the Caller ID information. From my program's
> perspective, it looks like the Caller ID information is never sent.
>
> So I want to perform some low level traces to understand why I am
> mishandling things.
>
> The GNU screen program receives the information as expected. The
> problem is, GNU screen does not show me individual messages. I don't
> know where one message ends and another begins. (One of my theories is
> the USR modem is batching RING and Caller ID into a single message).

I think I tracked down the problem.

The Caller ID information was not sent from the USR modem to my
program. It seems reading the ring count from the S1 register after a
RING is destructive for USR modems. My program fetches the ring count
for each RING message.

GNU's screen did not witness the problem because screen did not fetch
ring count when it encountered a RING message.

Getting the ring count is as simple as 'write(fd, "ATS1?\r", 6);' and
then parsing the result of 'read(fd, buff, size);'. The ASCII result
will be 001, 002, 003, etc. There's not much to it.

Fetching the ring count from the modem was a simple way to track
state. I guess I have to rethink the way I track state and perform
state transitions.

Jeff

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-11-12 18:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-11 16:11 How to log USB modem data for a specific device? Jeffrey Walton
2019-11-11 16:31 ` Greg KH
2019-11-11 16:40   ` Jeffrey Walton
2019-11-11 17:24     ` Greg KH
2019-11-11 22:57       ` Jeffrey Walton
2019-11-12  5:37         ` Greg KH
2019-11-12  6:20           ` Jeffrey Walton
2019-11-12 18:15             ` Jeffrey Walton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).