/sys/devices/pci0000:00/0000:00:09.0/usb2/2-1|-- 2-1:1.0| |-- bAlternateSetting | |-- bInterfaceClass | |-- bInterfaceNumber | |-- bInterfaceProtocol | |-- bInterfaceSubClass | |-- bNumEndpoints | |-- detach_state | |-- iInterface | `-- power | `-- state |-- bConfigurationValue|-- bDeviceClass|-- bDeviceProtocol|-- bDeviceSubClass|-- bMaxPower|-- bNumConfigurations|-- bNumInterfaces|-- bcdDevice|-- bmAttributes|-- detach_state|-- devnum|-- idProduct|-- idVendor|-- maxchild|-- power| `-- state|-- speed`-- version
Sysfs does not expose all different parts of a USB device because it stops at the interface level. no preparations for this device may be displayed, along with the details of the endpoints associated with the interface. this information can be found in the usb fs file system, which is loaded in the/proc/bus/USB/directory of the system. the file/proc/bus/USB/devices displays all information exposed in sysfs, together with the backup configuration and Endpoint information of all USB devices that appear in the system. usb fs also allows the user space program to directly talk to the USB device, which has enabled many kernel drivers to be removed from the user space, which is easy to maintain and debug.
The USB device filesystem is a dynamically generated filesystem that complements the normal device node system, and can be used to write user space device drivers. writing of user space device drivers is covered in the programmer's section of this Guide. in addition to the device nodes, there are two files that are also generated-DriversAndDevicesFiles. If you followed the instructions in the installation chapter, you shocould find them/Proc/bus/USB/DriversAnd/Proc/bus/USB/DeviceRespectively. If/Proc/bus/USBDirectory is empty, you have not mounted the filesystem, or you have mounted it in the wrong location.
/Proc/bus/USB/DriversJust lists the currently registered drivers (even if the driver is not being used by any device ). this is most useful when testing module installation, and checking for USB support in an unknown kernel. here is an example of its use:
[bradh@rachel bradh]$ more /proc/bus/usb/drivers hid ov511 cpia printer hub |
/Proc/bus/USB/devicesLists information about the devices currently attached to the USB bus. this is very useful when trying to figure out if the device is correctly enumerated. here is an example of its use, showing the root hub, a hub, a mouse and a camera:
T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2 B: Alloc= 28/900 us ( 3%), #Int= 2, #Iso= 0 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0000 ProdID=0000 Rev= 0.00 C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr= 0mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=255ms T: Bus=00 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 4 D: Ver= 1.00 Cls=09(hub ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0451 ProdID=1446 Rev= 1.00 C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=255ms T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=0553 ProdID=0002 Rev= 1.00 C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=400mA I: If#= 1 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=ff Driver=cpia E: Ad=81(I) Atr=01(Isoc) MxPS= 0 Ivl= 1ms I: If#= 1 Alt= 1 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=ff Driver=cpia E: Ad=81(I) Atr=01(Isoc) MxPS= 448 Ivl= 1ms I: If#= 1 Alt= 2 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=ff Driver=cpia E: Ad=81(I) Atr=01(Isoc) MxPS= 704 Ivl= 1ms I: If#= 1 Alt= 3 #EPs= 1 Cls=ff(vend.) Sub=00 Prot=ff Driver=cpia E: Ad=81(I) Atr=01(Isoc) MxPS= 960 Ivl= 1ms T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 5 Spd=1.5 MxCh= 0 D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1 P: Vendor=046d ProdID=c001 Rev= 1.10 S: Manufacturer=Logitech S: Product=USB-PS/2 Mouse C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr= 50mA I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=hid E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl= 10ms |
The information in/Proc/bus/USB/devicesOutput is arranged in groups:
The line that startsT:Is the topology.BusIndicates which bus the device is on.EVIndicates the level of the device, starting at level 00 for the root hub, level 01 for any device attached to the root hub, level 02 for devices attached to hubs at level 01, and so on.PrntIs the parent device for this device (always 00 for the root hub, and 01 for the devices attached to the root hub ).PortIs the port on the parent device, starting at 00 for the first port on each device.Prnt/PortIs unique per bus.CNTIndicates what number device this is, at this level, based on the enumeration order within that level of the topology, starting at 01 for the first device.Dev #Indicates what number device this is, irrespective of level, based on the bus enumeration order. This is unique per bus.SPDIndicates what speed this device is running at, in Mbps (either 1.5 or 12 with the current version of USB ).MxchIndicates how many devices can be connected to this device, and is 00 for anything before t a hub.DriverIndicates which device driver is being used for this device-an entry(None)Indicates that no driver is being used.
The line that startsD:Is information from the device descriptor.VerIndicates which USB Specification Version the device claims to meet.CLSIndicates which device class the device is claiming to meet, in both hexadecimal and as a string.CLSEntry00 (> IFC)Indicates that the device class specification compliance is interface dependent, and the interface descriptor shocould be read for device class information.SubIndicates which sub-class (withinCLSEntry), the device meets.ProtIndicates which Protocol within a class or sub-class the device claims to meet.MxpsIndicates how big the packets from endpoint 0 are.# CfgsIndicates how many commands ations this device has.
Much likeD:, The line that startsP:Is information from the device descriptor, and is seperated mainly because it wouldn't all fit on one line.VendorIndicates the vendor identification code for the device, andProdidIndicates the product identification code for the device.RevIndicates the product revision number.
Refer to the USB specification clause 9.7.1 for further information on device descriptors.
The lines that startS:, If any, are the vendor and product strings that the device returned.
The line that startsC:Is information from the configuration descriptor-the numberC:Lines per device is given# Cfgs, And the entry followed by an asterisk is the current configuration.# IfIndicates how many interfaces the device has.CFG #Indicates which configuration is being described.RecognitionIs a hexadecimal indication of the device attributes (0x80 for bus-powered, 0x40 for self-powered, 0x20 for Remote Wake-up capable ).MxpwrIs the maximum power draw for this device configuration, in milliamps. Refer to USB specification clause 9.7.2 for further information on configuration descriptors.
The line that startsI:Is information from the interface descriptor-the numberI:Lines perC:Line is given by# IFSEntry.If #Indicates which interface is being described within a given device configuration.ALTIndicates which alternate setting of this interface is being described.# EPSIndicates how many endpoints there are within the alternate setting for this endpoint.CLSIndicates which class the alternate setting of the interface corresponds to, in both hexadecimal and as a character string.SubIndicates which sub-class the alternate setting of the interface belongs.ProtIndicates which interface protocol (within a class and sub-class tuple) the alternate setting of the interface conforms.DriverIndicates which of the various USB drivers has claimed this interface. See USB specification clause 9.7.3 for further information.
The line that startsE:Is information from the endpoint descriptor-the numberE:Lines perI:Line is given by# EPSEntry. endpoint 0 is not displayed.AdIndicates the endpoint address, with a letter to indicate whether the endpoint is an in or out endpoint.RecognitionIndicate the attribute (Transfer Type) associated with the endpoint, followed by a string translating the transfer type.MxpsIndicates the maximum packet size this endpoint is capable of sending or caching ing, as appropriate.IVLIndicates the interval, in milliseconds, between polling of Interrupt endpoints.IVLIs ignored for bulk and control transfers, and is set to 1 for isochronous transfers. See USB specification clause 9.7.4 for further information on endpoint descriptors.
ReferLinux/documentation/USB/proc_usb_info.txtFor more information on using the USB device filesystem information.