All of lore.kernel.org
 help / color / mirror / Atom feed
* Question for usbmon/SET_ADDRESS request
@ 2019-12-09  4:08 Yuan, Shengquan
  2019-12-09 15:24 ` Alan Stern
  0 siblings, 1 reply; 3+ messages in thread
From: Yuan, Shengquan @ 2019-12-09  4:08 UTC (permalink / raw)
  To: linux-usb

Hi,

I tried to use usbmon to capture the USB packets when inserting a u-disk, however, I didn't see the SET_ADDRESS request

Below is the packet list,  in packet 88, the host suddenly uses address 74 to communicate with U-disk.  I am wondering whether usbmon will capture SET_ADDRESS request?

71	8.463514	host	1.1.1	USB	64	URB_INTERRUPT in
72	8.463536	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
73	8.463553	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
74	8.463613	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
75	8.463626	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
76	8.523469	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
77	8.523487	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
78	8.523495	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
79	8.523501	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
80	8.583690	host	1.0.0	USB	64	GET DESCRIPTOR Request DEVICE
81	8.583781	1.0.0	host	USB	82	GET DESCRIPTOR Response DEVICE
82	8.583820	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
83	8.583837	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
84	8.643643	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
85	8.643666	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
86	8.643675	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
87	8.643680	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
88	8.723558	host	1.74.0	USB	64	GET DESCRIPTOR Request DEVICE
89	8.723650	1.74.0	host	USB	82	GET DESCRIPTOR Response DEVICE
90	8.723692	host	1.74.0	USB	64	GET DESCRIPTOR Request BOS

Thanks
-Austin

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

* Re: Question for usbmon/SET_ADDRESS request
  2019-12-09  4:08 Question for usbmon/SET_ADDRESS request Yuan, Shengquan
@ 2019-12-09 15:24 ` Alan Stern
  2019-12-10  6:20   ` Yuan, Shengquan
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Stern @ 2019-12-09 15:24 UTC (permalink / raw)
  To: Yuan, Shengquan; +Cc: linux-usb

On Mon, 9 Dec 2019, Yuan, Shengquan wrote:

> Hi,
> 
> I tried to use usbmon to capture the USB packets when inserting a
> u-disk, however, I didn't see the SET_ADDRESS request

To understand what's going on, you need to know how usbmon works.  It
intercepts data at the point where the kernel sends it to or receives
it from the host controller driver.  usbmon is not directly aware of
the actual packets that get transmitted on the USB bus.

> Below is the packet list, in packet 88, the host suddenly uses
> address 74 to communicate with U-disk.  I am wondering whether usbmon
> will capture SET_ADDRESS request?
> 
> 71	8.463514	host	1.1.1	USB	64	URB_INTERRUPT in
> 72	8.463536	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> 73	8.463553	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> 74	8.463613	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
> 75	8.463626	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
> 76	8.523469	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> 77	8.523487	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> 78	8.523495	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
> 79	8.523501	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
> 80	8.583690	host	1.0.0	USB	64	GET DESCRIPTOR Request DEVICE
> 81	8.583781	1.0.0	host	USB	82	GET DESCRIPTOR Response DEVICE
> 82	8.583820	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
> 83	8.583837	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
> 84	8.643643	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> 85	8.643666	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> 86	8.643675	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
> 87	8.643680	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
> 88	8.723558	host	1.74.0	USB	64	GET DESCRIPTOR Request DEVICE
> 89	8.723650	1.74.0	host	USB	82	GET DESCRIPTOR Response DEVICE
> 90	8.723692	host	1.74.0	USB	64	GET DESCRIPTOR Request BOS

usbmon _will_ capture Set-Address packets if the kernel sends them.  
However, the kernel does not always send them.

I'm going to guess that the USB host controller for your bus 1 is xHCI.  
Unlike other types of host controller, an xHCI host controller
automatically sends a Set-Address packet whenever it discovers a new
device has been plugged in, with no need for the kernel to tell it to
do so.  As a result, there is no data for usbmon to intercept and so no
Set-Address packet shows up in the usbmon output.

Alan Stern


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

* RE: Question for usbmon/SET_ADDRESS request
  2019-12-09 15:24 ` Alan Stern
@ 2019-12-10  6:20   ` Yuan, Shengquan
  0 siblings, 0 replies; 3+ messages in thread
From: Yuan, Shengquan @ 2019-12-10  6:20 UTC (permalink / raw)
  To: Alan Stern; +Cc: linux-usb

> 
> On Mon, 9 Dec 2019, Yuan, Shengquan wrote:
> 
> > Hi,
> >
> > I tried to use usbmon to capture the USB packets when inserting a
> > u-disk, however, I didn't see the SET_ADDRESS request
> 
> To understand what's going on, you need to know how usbmon works.  It
> intercepts data at the point where the kernel sends it to or receives it from the
> host controller driver.  usbmon is not directly aware of the actual packets that
> get transmitted on the USB bus.
> 
> > Below is the packet list, in packet 88, the host suddenly uses address
> > 74 to communicate with U-disk.  I am wondering whether usbmon will
> > capture SET_ADDRESS request?
> >
> > 71	8.463514	host	1.1.1	USB	64	URB_INTERRUPT in
> > 72	8.463536	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> > 73	8.463553	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> > 74	8.463613	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
> > 75	8.463626	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
> > 76	8.523469	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> > 77	8.523487	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> > 78	8.523495	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
> > 79	8.523501	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
> > 80	8.583690	host	1.0.0	USB	64	GET DESCRIPTOR Request DEVICE
> > 81	8.583781	1.0.0	host	USB	82	GET DESCRIPTOR Response DEVICE
> > 82	8.583820	host	1.1.0	USBHUB	64	SET_FEATURE Request    [Port 6: PORT_RESET]
> > 83	8.583837	1.1.0	host	USBHUB	64	SET_FEATURE Response   [Port 6: PORT_RESET]
> > 84	8.643643	host	1.1.0	USBHUB	64	GET_STATUS Request     [Port 6]
> > 85	8.643666	1.1.0	host	USBHUB	68	GET_STATUS Response    [Port 6]
> > 86	8.643675	host	1.1.0	USBHUB	64	CLEAR_FEATURE Request  [Port 6: C_PORT_RESET]
> > 87	8.643680	1.1.0	host	USBHUB	64	CLEAR_FEATURE Response [Port 6: C_PORT_RESET]
> > 88	8.723558	host	1.74.0	USB	64	GET DESCRIPTOR Request DEVICE
> > 89	8.723650	1.74.0	host	USB	82	GET DESCRIPTOR Response DEVICE
> > 90	8.723692	host	1.74.0	USB	64	GET DESCRIPTOR Request BOS
> 
> usbmon _will_ capture Set-Address packets if the kernel sends them.
> However, the kernel does not always send them.
> 
> I'm going to guess that the USB host controller for your bus 1 is xHCI.
> Unlike other types of host controller, an xHCI host controller automatically
> sends a Set-Address packet whenever it discovers a new device has been
> plugged in, with no need for the kernel to tell it to do so.  As a result, there is
> no data for usbmon to intercept and so no Set-Address packet shows up in the
> usbmon output.
> 
> Alan Stern

Yes. You are right. I re-do the capture on an old laptop with UHCI controller, and now get the SET ADDRESS message.

67      4.616278        1.1.0   host    USBHUB  64      CLEAR_FEATURE Response [Port 5: C_PORT_RESET]
68      4.676011        host    1.0.0   USB     64      GET DESCRIPTOR Request DEVICE
69      4.676123        1.0.0   host    USB     82      GET DESCRIPTOR Response DEVICE
70      4.676139        host    1.1.0   USBHUB  64      SET_FEATURE Request    [Port 5: PORT_RESET]
71      4.676152        1.1.0   host    USBHUB  64      SET_FEATURE Response   [Port 5: PORT_RESET]
72      4.744000        host    1.1.0   USBHUB  64      GET_STATUS Request     [Port 5]
73      4.744250        1.1.0   host    USBHUB  68      GET_STATUS Response    [Port 5]
74      4.744266        host    1.1.0   USBHUB  64      CLEAR_FEATURE Request  [Port 5: C_PORT_RESET]
75      4.744278        1.1.0   host    USBHUB  64      CLEAR_FEATURE Response [Port 5: C_PORT_RESET]
76      4.804004        host    1.0.0   USB     64      SET ADDRESS Request
77      4.804122        1.0.0   host    USB     64      SET ADDRESS Response
78      4.832003        host    1.6.0   USB     64      GET DESCRIPTOR Request DEVICE
79      4.832117        1.6.0   host    USB     82      GET DESCRIPTOR Response DEVICE
80      4.832141        host    1.6.0   USB     64      GET DESCRIPTOR Request BOS

Thank you very much :)


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

end of thread, other threads:[~2019-12-10  6:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-09  4:08 Question for usbmon/SET_ADDRESS request Yuan, Shengquan
2019-12-09 15:24 ` Alan Stern
2019-12-10  6:20   ` Yuan, Shengquan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.