Summary:
While capturing USB traffic with wireshark, I see that devices enumerate properly when plugged in, but I never see the USB address getting assigned by the host.
Details:
I have tried this on both Windows 10 and Linux, and on several types of USB devices.
I plug in a device, and capture the USB traffic using Wireshark. I expect to see a Setup transaction, with the data packet containing bRequest = 0x05 (SET_ADDRESS) and the wValue word containing the address to be assigned. But I never see this.
The wireshark capture does show the other traffic I expect, like "GET DESCRIPTOR" request and response for the device, but no SET_ADDRESS.
The simplest device I have is a USB 1.1 mouse, and the wireshark capture (summary lines only) is below.
No. Time Source Destination Protocol Length Info
1 0.000000 1.1.1 host USB 66 URB_INTERRUPT in
2 0.000013 host 1.1.1 USB 64 URB_INTERRUPT in
3 0.000029 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
4 0.000040 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
5 0.000093 host 1.1.0 USBHUB 64 CLEAR_FEATURE Request [Port 7: C_PORT_CONNECTION]
6 0.000102 1.1.0 host USBHUB 64 CLEAR_FEATURE Response [Port 7: C_PORT_CONNECTION]
7 0.000107 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
8 0.000111 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
9 0.025302 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
10 0.025316 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
11 0.051308 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
12 0.051322 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
13 0.077299 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
14 0.077313 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
15 0.103306 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
16 0.103319 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
17 0.103370 host 1.1.0 USBHUB 64 SET_FEATURE Request [Port 7: PORT_RESET]
18 0.103377 1.1.0 host USBHUB 64 SET_FEATURE Response [Port 7: PORT_RESET]
19 0.154307 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
20 0.154321 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
21 0.205298 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
22 0.205312 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
23 0.205319 host 1.1.0 USBHUB 64 CLEAR_FEATURE Request [Port 7: C_PORT_RESET]
24 0.205324 1.1.0 host USBHUB 64 CLEAR_FEATURE Response [Port 7: C_PORT_RESET]
25 0.256351 host 1.0.0 USB 64 GET DESCRIPTOR Request DEVICE
26 0.257055 1.0.0 host USB 82 GET DESCRIPTOR Response DEVICE
27 0.257095 host 1.1.0 USBHUB 64 SET_FEATURE Request [Port 7: PORT_RESET]
28 0.257108 1.1.0 host USBHUB 64 SET_FEATURE Response [Port 7: PORT_RESET]
29 0.307248 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
30 0.307259 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
31 0.358299 host 1.1.0 USBHUB 64 GET_STATUS Request [Port 7]
32 0.358313 1.1.0 host USBHUB 68 GET_STATUS Response [Port 7]
33 0.358319 host 1.1.0 USBHUB 64 CLEAR_FEATURE Request [Port 7: C_PORT_RESET]
34 0.358325 1.1.0 host USBHUB 64 CLEAR_FEATURE Response [Port 7: C_PORT_RESET]
35 0.420304 host 1.49.0 USB 64 GET DESCRIPTOR Request DEVICE
36 0.421084 1.49.0 host USB 82 GET DESCRIPTOR Response DEVICE
37 0.421113 host 1.49.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
38 0.421678 1.49.0 host USB 73 GET DESCRIPTOR Response CONFIGURATION
39 0.421696 host 1.49.0 USB 64 GET DESCRIPTOR Request CONFIGURATION
40 0.422754 1.49.0 host USB 98 GET DESCRIPTOR Response CONFIGURATION
41 0.422773 host 1.49.0 USB 64 GET DESCRIPTOR Request STRING
42 0.423173 1.49.0 host USB 68 GET DESCRIPTOR Response STRING
43 0.423189 host 1.49.0 USB 64 GET DESCRIPTOR Request STRING
44 0.424279 1.49.0 host USB 100 GET DESCRIPTOR Response STRING
45 0.424297 host 1.49.0 USB 64 GET DESCRIPTOR Request STRING
46 0.424955 1.49.0 host USB 78 GET DESCRIPTOR Response STRING
47 0.425460 host 1.49.0 USB 64 SET CONFIGURATION Request
48 0.425747 1.49.0 host USB 64 SET CONFIGURATION Response
49 0.425778 host 1.49.0 USB 64 GET DESCRIPTOR Request STRING
50 0.426997 1.49.0 host USB 104 GET DESCRIPTOR Response STRING
51 0.427139 host 1.49.0 USBHID 64 SET_IDLE Request
52 0.427345 1.49.0 host USBHID 64 SET_IDLE Response
53 0.427389 host 1.49.0 USBHID 64 GET DESCRIPTOR Request HID Report
54 0.428913 1.49.0 host USBHID 116 GET DESCRIPTOR Response HID Report
55 0.429551 host 1.49.1 USB 64 URB_INTERRUPT in
56 0.487331 1.49.1 host USB 64 URB_INTERRUPT in
57 0.496308 host 1.49.1 USB 64 URB_INTERRUPT in
As expected, the host is communicating with the hub (at bus1, address 1), and then suddenly in transaction 35, the host can communicate with the device at address 49 which is the mouse. (I verified this by looking in the response, captured in transaction 36, which contains the idVendor and idProduct for the mouse.)
Every document I've seen so far says that the device address is assigned by the host, using a Setup Transaction of type SET_ADDRESS. And yet there is none here. Also, the address 49 (0x31) does not appear in any packets preceding the use of the address in transaction 35.
This same behavior is seen on both Windows 10 and Linux. It is seen on various devices: a mouse, a TI development board, and a USB headset. All of the devices enumerate, and are usable, and end up with reasonable USB addresses.
I don't understand how the device gets its USB address. What am I missing?
Background: Someone always asks "Why do you want to do this?". I am writing embedded code for a TI processor that supports USB. I am debugging some of the traffic, and at one point I decided to go back to basics, and trace through the entire startup sequence. The SET_ADDRESS was missing, and I then found that it is missing on other devices, too. I'd like to know why. Perhaps other transactions/packets are missing, as well?
