proc_usb_info.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /proc/bus/usb filesystem output
  2. ===============================
  3. (version 2010.09.13)
  4. The usbfs filesystem for USB devices is traditionally mounted at
  5. /proc/bus/usb. It provides the /proc/bus/usb/devices file, as well as
  6. the /proc/bus/usb/BBB/DDD files.
  7. In many modern systems the usbfs filesystem isn't used at all. Instead
  8. USB device nodes are created under /dev/usb/ or someplace similar. The
  9. "devices" file is available in debugfs, typically as
  10. /sys/kernel/debug/usb/devices.
  11. **NOTE**: If /proc/bus/usb appears empty, and a host controller
  12. driver has been linked, then you need to mount the
  13. filesystem. Issue the command (as root):
  14. mount -t usbfs none /proc/bus/usb
  15. An alternative and more permanent method would be to add
  16. none /proc/bus/usb usbfs defaults 0 0
  17. to /etc/fstab. This will mount usbfs at each reboot.
  18. You can then issue `cat /proc/bus/usb/devices` to extract
  19. USB device information, and user mode drivers can use usbfs
  20. to interact with USB devices.
  21. There are a number of mount options supported by usbfs.
  22. Consult the source code (linux/drivers/usb/core/inode.c) for
  23. information about those options.
  24. **NOTE**: The filesystem has been renamed from "usbdevfs" to
  25. "usbfs", to reduce confusion with "devfs". You may
  26. still see references to the older "usbdevfs" name.
  27. For more information on mounting the usbfs 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. THE /proc/bus/usb/BBB/DDD FILES:
  31. --------------------------------
  32. Each connected USB device has one file. The BBB indicates the bus
  33. number. The DDD indicates the device address on that bus. Both
  34. of these numbers are assigned sequentially, and can be reused, so
  35. you can't rely on them for stable access to devices. For example,
  36. it's relatively common for devices to re-enumerate while they are
  37. still connected (perhaps someone jostled their power supply, hub,
  38. or USB cable), so a device might be 002/027 when you first connect
  39. it and 002/048 sometime later.
  40. These files can be read as binary data. The binary data consists
  41. of first the device descriptor, then the descriptors for each
  42. configuration of the device. Multi-byte fields in the device and
  43. configuration descriptors, but not other descriptors, are converted
  44. to host endianness by the kernel. This information is also shown
  45. in text form by the /proc/bus/usb/devices file, described later.
  46. These files may also be used to write user-level drivers for the USB
  47. devices. You would open the /proc/bus/usb/BBB/DDD file read/write,
  48. read its descriptors to make sure it's the device you expect, and then
  49. bind to an interface (or perhaps several) using an ioctl call. You
  50. would issue more ioctls to the device to communicate to it using
  51. control, bulk, or other kinds of USB transfers. The IOCTLs are
  52. listed in the <linux/usbdevice_fs.h> file, and at this writing the
  53. source code (linux/drivers/usb/core/devio.c) is the primary reference
  54. for how to access devices through those files.
  55. Note that since by default these BBB/DDD files are writable only by
  56. root, only root can write such user mode drivers. You can selectively
  57. grant read/write permissions to other users by using "chmod". Also,
  58. usbfs mount options such as "devmode=0666" may be helpful.
  59. THE /proc/bus/usb/devices FILE:
  60. -------------------------------
  61. In /proc/bus/usb/devices, each device's output has multiple
  62. lines of ASCII output.
  63. I made it ASCII instead of binary on purpose, so that someone
  64. can obtain some useful data from it without the use of an
  65. auxiliary program. However, with an auxiliary program, the numbers
  66. in the first 4 columns of each "T:" line (topology info:
  67. Lev, Prnt, Port, Cnt) can be used to build a USB topology diagram.
  68. Each line is tagged with a one-character ID for that line:
  69. T = Topology (etc.)
  70. B = Bandwidth (applies only to USB host controllers, which are
  71. virtualized as root hubs)
  72. D = Device descriptor info.
  73. P = Product ID info. (from Device descriptor, but they won't fit
  74. together on one line)
  75. S = String descriptors.
  76. C = Configuration descriptor info. (* = active configuration)
  77. I = Interface descriptor info.
  78. E = Endpoint descriptor info.
  79. =======================================================================
  80. /proc/bus/usb/devices output format:
  81. Legend:
  82. d = decimal number (may have leading spaces or 0's)
  83. x = hexadecimal number (may have leading spaces or 0's)
  84. s = string
  85. Topology info:
  86. T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=dddd MxCh=dd
  87. | | | | | | | | |__MaxChildren
  88. | | | | | | | |__Device Speed in Mbps
  89. | | | | | | |__DeviceNumber
  90. | | | | | |__Count of devices at this level
  91. | | | | |__Connector/Port on Parent for this device
  92. | | | |__Parent DeviceNumber
  93. | | |__Level in topology for this bus
  94. | |__Bus number
  95. |__Topology info tag
  96. Speed may be:
  97. 1.5 Mbit/s for low speed USB
  98. 12 Mbit/s for full speed USB
  99. 480 Mbit/s for high speed USB (added for USB 2.0);
  100. also used for Wireless USB, which has no fixed speed
  101. 5000 Mbit/s for SuperSpeed USB (added for USB 3.0)
  102. For reasons lost in the mists of time, the Port number is always
  103. too low by 1. For example, a device plugged into port 4 will
  104. show up with "Port=03".
  105. Bandwidth info:
  106. B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd
  107. | | | |__Number of isochronous requests
  108. | | |__Number of interrupt requests
  109. | |__Total Bandwidth allocated to this bus
  110. |__Bandwidth info tag
  111. Bandwidth allocation is an approximation of how much of one frame
  112. (millisecond) is in use. It reflects only periodic transfers, which
  113. are the only transfers that reserve bandwidth. Control and bulk
  114. transfers use all other bandwidth, including reserved bandwidth that
  115. is not used for transfers (such as for short packets).
  116. The percentage is how much of the "reserved" bandwidth is scheduled by
  117. those transfers. For a low or full speed bus (loosely, "USB 1.1"),
  118. 90% of the bus bandwidth is reserved. For a high speed bus (loosely,
  119. "USB 2.0") 80% is reserved.
  120. Device descriptor info & Product ID info:
  121. D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
  122. P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
  123. where
  124. D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
  125. | | | | | | |__NumberConfigurations
  126. | | | | | |__MaxPacketSize of Default Endpoint
  127. | | | | |__DeviceProtocol
  128. | | | |__DeviceSubClass
  129. | | |__DeviceClass
  130. | |__Device USB version
  131. |__Device info tag #1
  132. where
  133. P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
  134. | | | |__Product revision number
  135. | | |__Product ID code
  136. | |__Vendor ID code
  137. |__Device info tag #2
  138. String descriptor info:
  139. S: Manufacturer=ssss
  140. | |__Manufacturer of this device as read from the device.
  141. | For USB host controller drivers (virtual root hubs) this may
  142. | be omitted, or (for newer drivers) will identify the kernel
  143. | version and the driver which provides this hub emulation.
  144. |__String info tag
  145. S: Product=ssss
  146. | |__Product description of this device as read from the device.
  147. | For older USB host controller drivers (virtual root hubs) this
  148. | indicates the driver; for newer ones, it's a product (and vendor)
  149. | description that often comes from the kernel's PCI ID database.
  150. |__String info tag
  151. S: SerialNumber=ssss
  152. | |__Serial Number of this device as read from the device.
  153. | For USB host controller drivers (virtual root hubs) this is
  154. | some unique ID, normally a bus ID (address or slot name) that
  155. | can't be shared with any other device.
  156. |__String info tag
  157. Configuration descriptor info:
  158. C:* #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
  159. | | | | | |__MaxPower in mA
  160. | | | | |__Attributes
  161. | | | |__ConfiguratioNumber
  162. | | |__NumberOfInterfaces
  163. | |__ "*" indicates the active configuration (others are " ")
  164. |__Config info tag
  165. USB devices may have multiple configurations, each of which act
  166. rather differently. For example, a bus-powered configuration
  167. might be much less capable than one that is self-powered. Only
  168. one device configuration can be active at a time; most devices
  169. have only one configuration.
  170. Each configuration consists of one or more interfaces. Each
  171. interface serves a distinct "function", which is typically bound
  172. to a different USB device driver. One common example is a USB
  173. speaker with an audio interface for playback, and a HID interface
  174. for use with software volume control.
  175. Interface descriptor info (can be multiple per Config):
  176. I:* If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
  177. | | | | | | | | |__Driver name
  178. | | | | | | | | or "(none)"
  179. | | | | | | | |__InterfaceProtocol
  180. | | | | | | |__InterfaceSubClass
  181. | | | | | |__InterfaceClass
  182. | | | | |__NumberOfEndpoints
  183. | | | |__AlternateSettingNumber
  184. | | |__InterfaceNumber
  185. | |__ "*" indicates the active altsetting (others are " ")
  186. |__Interface info tag
  187. A given interface may have one or more "alternate" settings.
  188. For example, default settings may not use more than a small
  189. amount of periodic bandwidth. To use significant fractions
  190. of bus bandwidth, drivers must select a non-default altsetting.
  191. Only one setting for an interface may be active at a time, and
  192. only one driver may bind to an interface at a time. Most devices
  193. have only one alternate setting per interface.
  194. Endpoint descriptor info (can be multiple per Interface):
  195. E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddss
  196. | | | | |__Interval (max) between transfers
  197. | | | |__EndpointMaxPacketSize
  198. | | |__Attributes(EndpointType)
  199. | |__EndpointAddress(I=In,O=Out)
  200. |__Endpoint info tag
  201. The interval is nonzero for all periodic (interrupt or isochronous)
  202. endpoints. For high speed endpoints the transfer interval may be
  203. measured in microseconds rather than milliseconds.
  204. For high speed periodic endpoints, the "MaxPacketSize" reflects
  205. the per-microframe data transfer size. For "high bandwidth"
  206. endpoints, that can reflect two or three packets (for up to
  207. 3KBytes every 125 usec) per endpoint.
  208. With the Linux-USB stack, periodic bandwidth reservations use the
  209. transfer intervals and sizes provided by URBs, which can be less
  210. than those found in endpoint descriptor.
  211. =======================================================================
  212. If a user or script is interested only in Topology info, for
  213. example, use something like "grep ^T: /proc/bus/usb/devices"
  214. for only the Topology lines. A command like
  215. "grep -i ^[tdp]: /proc/bus/usb/devices" can be used to list
  216. only the lines that begin with the characters in square brackets,
  217. where the valid characters are TDPCIE. With a slightly more able
  218. script, it can display any selected lines (for example, only T, D,
  219. and P lines) and change their output format. (The "procusb"
  220. Perl script is the beginning of this idea. It will list only
  221. selected lines [selected from TBDPSCIE] or "All" lines from
  222. /proc/bus/usb/devices.)
  223. The Topology lines can be used to generate a graphic/pictorial
  224. of the USB devices on a system's root hub. (See more below
  225. on how to do this.)
  226. The Interface lines can be used to determine what driver is
  227. being used for each device, and which altsetting it activated.
  228. The Configuration lines could be used to list maximum power
  229. (in milliamps) that a system's USB devices are using.
  230. For example, "grep ^C: /proc/bus/usb/devices".
  231. Here's an example, from a system which has a UHCI root hub,
  232. an external hub connected to the root hub, and a mouse and
  233. a serial converter connected to the external hub.
  234. T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
  235. B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0
  236. D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
  237. P: Vendor=0000 ProdID=0000 Rev= 0.00
  238. S: Product=USB UHCI Root Hub
  239. S: SerialNumber=dce0
  240. C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA
  241. I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
  242. E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms
  243. T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
  244. D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
  245. P: Vendor=0451 ProdID=1446 Rev= 1.00
  246. C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
  247. I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
  248. E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms
  249. T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
  250. D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
  251. P: Vendor=04b4 ProdID=0001 Rev= 0.00
  252. C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
  253. I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
  254. E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms
  255. T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
  256. D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
  257. P: Vendor=0565 ProdID=0001 Rev= 1.08
  258. S: Manufacturer=Peracom Networks, Inc.
  259. S: Product=Peracom USB to Serial Converter
  260. C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
  261. I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
  262. E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms
  263. E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms
  264. E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms
  265. Selecting only the "T:" and "I:" lines from this (for example, by using
  266. "procusb ti"), we have:
  267. T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
  268. T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
  269. I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
  270. T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
  271. I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
  272. T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
  273. I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
  274. Physically this looks like (or could be converted to):
  275. +------------------+
  276. | PC/root_hub (12)| Dev# = 1
  277. +------------------+ (nn) is Mbps.
  278. Level 0 | CN.0 | CN.1 | [CN = connector/port #]
  279. +------------------+
  280. /
  281. /
  282. +-----------------------+
  283. Level 1 | Dev#2: 4-port hub (12)|
  284. +-----------------------+
  285. |CN.0 |CN.1 |CN.2 |CN.3 |
  286. +-----------------------+
  287. \ \____________________
  288. \_____ \
  289. \ \
  290. +--------------------+ +--------------------+
  291. Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)|
  292. +--------------------+ +--------------------+
  293. Or, in a more tree-like structure (ports [Connectors] without
  294. connections could be omitted):
  295. PC: Dev# 1, root hub, 2 ports, 12 Mbps
  296. |_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps
  297. |_ CN.0: Dev #3, mouse, 1.5 Mbps
  298. |_ CN.1:
  299. |_ CN.2: Dev #4, serial, 12 Mbps
  300. |_ CN.3:
  301. |_ CN.1:
  302. ### END ###