proc_usb_info.txt 15 KB

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