http://blog.csdn.net/workingon/archive/2005/08/31/468684.aspx
/proc/bus/usb 檔案系統輸出
===============================
(version 2000.08.15)
/proc 檔案系統中USB devices 部分產生
/proc/bus/usb/drivers 和 /proc/bus/usb/devices.
/proc/bus/usb/drivers 列出已經註冊的drivers,
每行一個driver, 可能的話給出每個driver's USB 次裝置節點號的範圍
**注意**: 如果 /proc/bus/usb 是空的, 需要以root使用者掛載檔案系統:
mount -t usbdevfs none /proc/bus/usb
或者在/etc/fstab檔案中添加
none /proc/bus/usb usbdevfs defaults 0 0
這將在每次重啟時自動掛載usbdevfs.
可以用 `cat /proc/bus/usb/devices` 查看USB裝置資訊。
掛載USB的更多協助資訊可以查看USB指南的"USB Device Filesystem" 節,USB指南的
最新拷貝見http://www.linux-usb.org/
在 /proc/bus/usb/devices中, 每個device具有多行ASCII 輸出.
如果使用輔助程式, "T:" 行的頭4列可以用以建立一個USB拓撲圖 (拓撲資訊:
Lev, Prnt, Port, Cnt)
每行由一個字元的ID來標識:
T = Topology (etc.)
B = Bandwidth (只用於USB host控制器 它被虛擬為root hubs)
D = Device 描述資訊.
P = Product ID 資訊.
S = String 描述.
C = Configuration 描述資訊(* = 活動配置)
I = Interface 描述資訊.
E = Endpoint 描述資訊.
=======================================================================
/proc/bus/usb/devices 輸出格式:
Legend:
d = 十進位數 (用spaces or 0's開頭)
x = 十六進位數 (用spaces or 0's開頭)
s = string
拓撲資訊:
T: Bus=dd Lev=dd Prnt=dd Port=dd Cnt=dd Dev#=ddd Spd=ddd MxCh=dd
| | | | | | | | |__MaxChildren(最在子節點)
| | | | | | | |__Device Speed in Mbps(裝置速度,單位是Mbps)
| | | | | | |__DeviceNumber(裝置號)
| | | | | |__Count of devices at this level(本層次的裝置數)
| | | | |__Connector/Port on Parent for this device(本裝置在父節點的介面)
| | | |__Parent DeviceNumber(父裝置號)
| | |__Level in topology for this bus(本BUS的拓撲層次)
| |__Bus number(匯流排號)
|__Topology info tag(拓撲資訊標識)
頻寬資訊:
B: Alloc=ddd/ddd us (xx%), #Int=ddd, #Iso=ddd
| | | |__Number if isochronous requests(同步請求號)
| | |__Number of interrupt requests(插斷要求號)
| |__Total Bandwidth allocated to this bus(分到本bus的總頻寬)
|__Bandwidth info tag(頻寬資訊標識)
裝置描述資訊與產品ID資訊:
D: Ver=x.xx Cls=xx(s) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
其中
D: Ver=x.xx Cls=xx(sssss) Sub=xx Prot=xx MxPS=dd #Cfgs=dd
| | | | | | |__NumberConfigurations(配置數)
| | | | | |__MaxPacketSize of Default Endpoint(預設端點的最大包大小)
| | | | |__DeviceProtocol(裝置協議)
| | | |__DeviceSubClass(裝置子類)
| | |__DeviceClass(裝置類)
| |__Device USB version(裝置的USB版本)
|__Device info tag #1(裝置標識#1)
其中
P: Vendor=xxxx ProdID=xxxx Rev=xx.xx
| | | |__Product revision number(產品修訂編號)
| | |__Product ID code(產品ID編碼)
| |__Vendor ID code(廠家ID編碼)
|__Device info tag #2(裝置標識#2)
字串描述資訊:
S: Manufacturer=ssss
| |__Manufacturer of this device as read from the device.(從裝置讀得的生產者)
|__String info tag(字元資訊標識)
S: Product=ssss
| |__從裝置讀得的產品資訊,除去那些USB主控制器產生的字串,格式 "USB *HCI Root Hub".
|__String info tag(字元資訊標識)
S: SerialNumber=ssss
| |__從裝置讀得的裝置Serial Number ,除去那些USB主控制器產生的字串, 代表主控制器
| 在系統中唯一標識 (當前是 I/O 或 memory-mapped base 地址).
|__String info tag(字元資訊標識)
配置描述資訊:
C: #Ifs=dd Cfg#=dd Atr=xx MPwr=dddmA
| | | | |__MaxPower in mA(最大功率,mA)
| | | |__Attributes(屬性)
| | |__ConfiguratioNumber(配置數)
| |__NumberOfInterfaces(介面數)
|__Config info tag(配置資訊標識)
介面描述資訊 (每配置可以是多個):
I: If#=dd Alt=dd #EPs=dd Cls=xx(sssss) Sub=xx Prot=xx Driver=ssss
| | | | | | | |__Driver name(驅動名)
| | | | | | |__InterfaceProtocol(介面協議)
| | | | | |__InterfaceSubClass(介面子類)
| | | | |__InterfaceClass(介面類)
| | | |__NumberOfEndpoints(端點號)
| | |__AlternateSettingNumber(介面設定號)
| |__InterfaceNumber(介面號)
|__Interface info tag(介面資訊標識)
端點描述資訊(每介面可以是多個):
E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddms
E: Ad=xx(s) Atr=xx(ssss) MxPS=dddd Ivl=dddms
| | | | |__Interval(間隔)
| | | |__EndpointMaxPacketSize(端點最大包大小)
| | |__Attributes(EndpointType)(端點屬性)
| |__EndpointAddress(I=In,O=Out) (端點地址)
|__Endpoint info tag(端點資訊標識)
=======================================================================
如果使用者只對拓撲資訊感興趣,可以用:"grep ^T: /proc/bus/usb/devices"只顯示拓撲行。
而命令列:"grep -i ^[tdp]: /proc/bus/usb/devices" 可用於只顯示出以tdp開頭的行。
例如, 系統有一個UHCI root hub,一個外部hub串連到root hub,一個mouse和串列轉換器連到該hub.
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
S: Product=USB UHCI Root Hub
S: SerialNumber=dce0
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=00 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=1.5 MxCh= 0
D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=04b4 ProdID=0001 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
E: Ad=81(I) Atr=03(Int.) MxPS= 3 Ivl= 10ms
T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0565 ProdID=0001 Rev= 1.08
S: Manufacturer=Peracom Networks, Inc.
S: Product=Peracom USB to Serial Converter
C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl= 16ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 16 Ivl= 16ms
E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl= 8ms
只選擇 "T:" and "I:" 行 :
T: Bus=00 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
T: Bus=00 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=12 MxCh= 4
I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
T: Bus=00 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=1.5 MxCh= 0
I: If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=02 Driver=mouse
T: Bus=00 Lev=02 Prnt=02 Port=02 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
I: If#= 0 Alt= 0 #EPs= 3 Cls=00(>ifc ) Sub=00 Prot=00 Driver=serial
物理上應該是這樣的 (或者說可以變為):
+------------------+
| PC/root_hub (12)| Dev# = 1
+------------------+ (nn) is Mbps.
Level 0 | CN.0 | CN.1 | [CN = connector/port #]
+------------------+
/
/
+-----------------------+
Level 1 | Dev#2: 4-port hub (12)|
+-----------------------+
|CN.0 |CN.1 |CN.2 |CN.3 |
+-----------------------+
/ /____________________
/_____ /
/ /
+--------------------+ +--------------------+
Level 2 | Dev# 3: mouse (1.5)| | Dev# 4: serial (12)|
+--------------------+ +--------------------+
以樹型結構表示 (沒有實際串連的ports [Connectors] 被省略):
PC: Dev# 1, root hub, 2 ports, 12 Mbps
|_ CN.0: Dev# 2, hub, 4 ports, 12 Mbps
|_ CN.0: Dev #3, mouse, 1.5 Mbps
|_ CN.1:
|_ CN.2: Dev #4, serial, 12 Mbps
|_ CN.3:
|_ CN.1:
另外,USB裝置分類
USB從裝置的分類可以從USB裝置介面描述符(Standard Interface Descriptor)對應的的bInterfaceClass這一個byte得到。
bInterfaceClass的典型代碼為1,2,3,6,7,8,9,10,11,255。分別代表意思為1-audio:表示一個音頻設 備。2-communication device:通訊裝置,如電話,moden等等。3-HID:人機互動裝置,如鍵盤,滑鼠等。6-image圖象裝置,如掃描器,網路攝影機等,有時數位相 機也可歸到這一類。7-印表機類。如單向,雙向列印機等。8-mass storage海量儲存類。所有帶有一定儲存功能的都可以歸到這一類。如數位相機大多數都歸這一類。9-hub類。11-chip card/smart card。255-vendor specific.廠家的自訂類,主要用於一些特殊的裝置。如介面轉接卡等。