proc_usb_info.txt 15 KB

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