proc_usb_info.txt
1 [from http://www.charmed.com/txt/proc_usb_info.txt] 2 /proc/bus/usb filesystem output 3 =============================== 4 (version 2000.08.15) 5 6 7 The /proc filesystem for USB devices generates 8 /proc/bus/usb/drivers and /proc/bus/usb/devices. 9 10 /proc/bus/usb/drivers lists the registered drivers, 11 one per line, with each driver's USB minor dev node 12 number range if applicable. 13 14 **NOTE**: If /proc/bus/usb appears empty, you need 15 to mount the filesystem, issue the command (as root): 16 17 mount -t usbdevfs none /proc/bus/usb 18 19 An alternative and more permanent method would be to add 20 21 none /proc/bus/usb usbdevfs defaults 0 0 22 23 to /etc/fstab. This will mount usbdevfs at each reboot. 24 You can then issue `cat /proc/bus/usb/devices` to extract 25 USB device information. 26 27 For more information on mounting the usbdevfs file system, see the 28 "USB Device Filesystem" section of the USB Guide. The latest copy 29 of the USB Guide can be found at http://www.linux-usb.org/ 30 31 In /proc/bus/usb/devices, each device's output has multiple 32 lines of ASCII output. 33 I made it ASCII instead of binary on purpose, so that someone 34 can obtain some useful data from it without the use of an 35 auxiliary program. However, with an auxiliary program, the numbers 36 in the first 4 columns of each "T:" line (topology info: 37 Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram. 38 (I think. I haven't proved this, but I have tested it with 3 39 different topo/connections and it looked possible.) 40 41 Each line is tagged with a one-character ID for that line: 42 43 T = Topology (etc.) 44 B = Bandwidth (applies only to USB host controllers, which are 45 virtualized as root hubs) 46 D = Device descriptor info. 47 P = Product ID info. (from Device descriptor, but they won't fit 48 together on one line) 49 S = String descriptors. 50 C = Configuration descriptor info. (* = active configuration) 51 I = Interface descriptor info. 52 E = Endpoint descriptor info. 53 54 ======================================================================= 55 56 /proc/bus/usb/devices output format: 57 58 Legend: 59 d = decimal number (may have leading spaces or 0's) 60 x = hexadecimal number (may have leading spaces or 0's) 61 s = string 62 63 64 Topology info: 65 66 T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd 67 | | | | | | | | |__MaxChildren 68 | | | | | | | |__Device Speed in Mbps 69 | | | | | | |__DeviceNumber 70 | | | | | |__Count of devices at this level 71 | | | | |__Connector/Port on Parent for this device 72 | | | |__Parent DeviceNumber 73 | | |__Level in topology for this bus 74 | |__Bus number 75 |__Topology info tag 76 77 78 Bandwidth info: 79 B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd 80 | | | |__Number if isochronous requests 81 | | |__Number of interrupt requests 82 | |__Total Bandwidth allocated to this bus 83 |__Bandwidth info tag 84 85 86 Device descriptor info & Product ID info: 87 88 D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd 89 P: Vendor=xxxx ProdID=xxxx Rev=xx.xx 90 91 where 92 D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd 93 | | | | | | |__NumberConfigurations 94 | | | | | |__MaxPacketSize of Default Endpoint 95 | | | | |__DeviceProtocol 96 | | | |__DeviceSubClass 97 | | |__DeviceClass 98 | |__Device USB version 99 |__Device info tag #1 100 101 where 102 P: Vendor=xxxx ProdID=xxxx Rev=xx.xx 103 | | | |__Product revision number 104 | | |__Product ID code 105 | |__Vendor ID code 106 |__Device info tag #2 107 108 109 String descriptor info: 110 111 S: Manufacturer=ssss 112 | |__Manufacturer of this device as read from the device. 113 |__String info tag 114 115 S: Product=ssss 116 | |__Product description of this device as read from the device, 117 | except that it is a generated string for USB host controllers 118 | (virtual root hubs), in the form "USB *HCI Root Hub". 119 |__String info tag 120 121 S: SerialNumber=ssss 122 | |__Serial Number of this device as read from the device, 123 | except that it is a generated string for USB host controllers 124 | (virtual root hubs), and represents the host controller's 125 | unique identification in the system (currently I/O or 126 | memory-mapped base address). 127 |__String info tag 128 129 130 Configuration descriptor info: 131 132 C: #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA 133 | | | | |__MaxPower in mA 134 | | | |__Attributes 135 | | |__ConfiguratioNumber 136 | |__NumberOfInterfaces 137 |__Config info tag 138 139 140 Interface descriptor info (can be multiple per Config): 141 142 I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss 143 | | | | | | | |__Driver name 144 | | | | | | |__InterfaceProtocol 145 | | | | | |__InterfaceSubClass 146 | | | | |__InterfaceClass 147 | | | |__NumberOfEndpoints 148 | | |__AlternateSettingNumber 149 | |__InterfaceNumber 150 |__Interface info tag 151 152 153 Endpoint descriptor info (can be multiple per Interface): 154 155 E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddms 156 E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddms 157 | | | | |__Interval 158 | | | |__EndpointMaxPacketSize 159 | | |__Attributes(EndpointType) 160 | |__EndpointAddress(I=In,O=Out) 161 |__Endpoint info tag 162 163 ======================================================================= 164 165 166 If a user or script is interested only in Topology info, for 167 example, use something like "grep ^T: /proc/bus/usb/devices" 168 for only the Topology lines. A command like 169 "grep -i ^[tdp]: /proc/bus/usb/devices" can be used to list 170 only the lines that begin with the characters in square brackets, 171 where the valid characters are TDPCIE. With a slightly more able 172 script, it can display any selected lines (for example, only T, D, 173 and P lines) and change their output format. (The "procusb" 174 Perl script is the beginning of this idea. It will list only 175 selected lines [selected from TBDPSCIE] or "All" lines from 176 /proc/bus/usb/devices.) 177 178 The Topology lines can be used to generate a graphic/pictorial 179 of the USB devices on a system's root hub. (See more below 180 on how to do this.) 181 182 The Interface lines can be used to determine what driver is 183 being used for each device. 184 185 The Configuration lines could be used to list maximum power 186 (in milliamps) that a system's USB devices are using. 187 For example, "grep ^C: /proc/bus/usb/devices". 188 189 190 Here's an example, from a system which has a UHCI root hub, 191 an external hub connected to the root hub, and a mouse and 192 a serial converter connected to the external hub. 193 194 T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 195 B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0 196 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 197 P: Vendor=0000 ProdID=0000 Rev= 0.00 198 S: Product=USB UHCI Root Hub 199 S: SerialNumber=dce0 200 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA 201 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub 202 E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms 203 T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 204 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 205 P: Vendor=0451 ProdID=1446 Rev= 1.00 206 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA 207 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub 208 E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms 209 T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 210 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 211 P: Vendor=04b4 ProdID=0001 Rev= 0.00 212 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA 213 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse 214 E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms 215 T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 216 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 217 P: Vendor=0565 ProdID=0001 Rev= 1.08 218 S: Manufacturer=Peracom Networks, Inc. 219 S: Product=Peracom USB to Serial Converter 220 C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA 221 I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial 222 E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms 223 E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms 224 E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms 225 226 227 Selecting only the "T:" and "I:" lines from this (for example, by using 228 "procusb ti"), we have: 229 230 T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 231 T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 232 I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub 233 T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0 234 I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse 235 T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0 236 I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial 237 238 239 Physically this looks like (or could be converted to): 240 241 +------------------+ 242 | PC/root_hub (12)| Dev# = 1 243 +------------------+ (nn) is Mbps. 244 Level 0 | CN.0 | CN.1 | [CN = connector/port #] 245 +------------------+ 246 / 247 / 248 +-----------------------+ 249 Level 1 | Dev#2: 4-port hub (12)| 250 +-----------------------+ 251 |CN.0 |CN.1 |CN.2 |CN.3 | 252 +-----------------------+ 253 \ \____________________ 254 \_____ \ 255 \ \ 256 +--------------------+ +--------------------+ 257 Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)| 258 +--------------------+ +--------------------+ 259 260 261 262 Or, in a more tree-like structure (ports [Connectors] without 263 connections could be omitted): 264 265 PC: Dev# 1, root hub, 2 ports, 12 Mbps 266 |_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps 267 |_ CN.0: Dev #3, mouse, 1.5 Mbps 268 |_ CN.1: 269 |_ CN.2: Dev #4, serial, 12 Mbps 270 |_ CN.3: 271 |_ CN.1: 272 273 274 ### END ###