ͨÓô®ÐÐ×ÜÏߣ¨USB£©±»Éè¼Æ³ÉΪÁ¬½Ó¼ÆËã»úÍâÉèµÄ±ê×¼£¬Èç¼üÅÌ¡¢Êó±ê¡¢´òÓ¡»ú¡¢ÊýÂëÏà»ú¡¢±ãЯʽýÌå²¥·ÅÆ÷¡¢´ÅÅ̺ÍÍøÂçÊÊÅäÆ÷µÈµÈ¡£
ËüÒѾ³ÉΪÁËÒ»¸ö¹¤Òµ±ê×¼£¬ÏÖÔÚºÜÄÑ¿´µ½Ò»¸öûÓÐUSB¿ÚµÄ¼ÆËã»úÁË¡£USBÉÁ´æµÄʹÓÃʹµÃËü¸ü¼ÓÁ÷ÐС£ÔÚLinuxÉÏ£¬ÎÒÃÇ¿ÉÒÔʹÓÃlsusbÀ´ÁгöUSBÉ豸ºÍËüµÄÊôÐÔ¡£
ʲôÊÇlsusb
ÔÚËüµÄÊÖ²áÉÏ£¬lsusb¶¨Òå³É£º
ÏÔʾϵͳÖÐÒÔ¼°Á¬½Óµ½ÏµÍ³µÄUSB×ÜÏßÐÅÏ¢µÄ¹¤¾ß¡£
ÈçºÎÔËÐÐlsusb? ÒªÔËÐÐlsusb£¬Äã¿ÉÒÔÖ±½ÓÔÚ¿ØÖÆÌ¨ÊäÈëlsusb¡£
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 003: ID 17ef:4811 Lenovo Integrated Webcam [R5U877]
Bus 008 Device 002: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
lsusb»áÏÔʾÇý¶¯ºÍÄÚ²¿Á¬½Óµ½ÄãϵͳµÄÉ豸¡£
ÏÂÃæ½éÉÜÈçºÎÀí½âÊä³ö¡£ÎÒץȡÁËÉÏÃæÊä³öµÄ×îºóÒ»ÐУº
Bus 008 Device 002 : ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 008 : Ö¸Ã÷É豸Á¬½Óµ½ÄÄ£¨ÄÄÌõ×ÜÏߣ©
Device 002 : ±íÃ÷ÕâÊÇÁ¬½Óµ½×ÜÏßÉϵĵڶþ̨É豸
ID : É豸µÄID
Broadcom Corp. Bluetooth Controller :Éú²úÉÌÃû×ÖºÍÉ豸Ãû
ÎÒÃÇͬÑù¿ÉÒÔ¿´µ½ÔÚÎÒÃǵÄϵͳÖÐͬʱʹÓÃÁËUSB2.0 root hubÇý¶¯ºÍUSB 1.1 root hubÇý¶¯¡£
ÓÃdmesgÃüÁîͬÑù¿ÉÒÔ¿´µ½¡£ÏÂÃæÊÇÒ»¸öÀý×Ó¡£
$ dmesg |grep -i usb
[ 0.353138] usbcore: registered new interface driver usbfs
[ 0.353150] usbcore: registered new interface driver hub
[ 0.353182] usbcore: registered new device driver usb
[ 0.730026] ehci_hcd: USB 2.0 ¡®Enhanced¡¯ Host Controller (EHCI) Driver
[ 0.730116] ehci_hcd 0000:00:1a.7: new USB bus registered, assigned bus number 1
[ 0.748019] ehci_hcd 0000:00:1a.7: USB 2.0 started, EHCI 1.00
[ 0.748169] hub 1-0:1.0: USB hub found
[ 0.748336] ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 2
[ 0.768019] ehci_hcd 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[ 0.768147] hub 2-0:1.0: USB hub found
[ 0.768236] ohci_hcd: USB 1.1 ¡®Open¡¯ Host Controller (OHCI) Driver
[ 0.768251] uhci_hcd: USB Universal Host Controller Interface driver
ÈçºÎÁгöUSBÏêϸÐÅÏ¢
ʹÓÃ-vÑ¡ÏîÀ´¿ªÆô¡£ÏÂÃæÊÇÒ»¸öÀý×Ó¡£
$ lsusb -v
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 2
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0¡Á83 EP 3 IN
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0¡Á0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0¡Á03 EP 3 OUT
bmAttributes 1
Transfer Type Isochronous
Synch Type None
Usage Type Data
wMaxPacketSize 0¡Á0040 1x 64 bytes
bInterval 1
ÕÒ³öÁ¬½ÓÁ˶àÉÙUSBÉ豸
ʹÓÃÏÂÃæµÄÃüÁî
$ find /dev/bus
½Ó×ÅÄã»á¿´µ½ÏñÏÂÃæµÄÊä³ö£º
/dev/bus
/dev/bus/usb
/dev/bus/usb/008
/dev/bus/usb/008/002
/dev/bus/usb/008/001
/dev/bus/usb/007
/dev/bus/usb/007/001
/dev/bus/usb/006
/dev/bus/usb/006/001
/dev/bus/usb/005
/dev/bus/usb/005/001
/dev/bus/usb/004
/dev/bus/usb/004/001
/dev/bus/usb/003
/dev/bus/usb/003/001
/dev/bus/usb/002
/dev/bus/usb/002/004
/dev/bus/usb/002/003
/dev/bus/usb/002/001
/dev/bus/usb/001
/dev/bus/usb/001/001
ʹÓÃlsusb ÃüÁî µÄ-D Ñ¡ÏÄã¿ÉÒÔ´òÓ¡ÌØ¶¨É豸µÄÏêϸÐÅÏ¢¡£ÏÂÃæÊÇÒ»¸ö²©Í¨À¶ÑÀÉ豸µÄʾÀý¡£
$ lsusb -D /dev/bus/usb/008/002
Device: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Couldn¡¯t open device, some information will be missing
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 224 Wireless
bDeviceSubClass 1 Radio Frequency
bDeviceProtocol 1 Bluetooth
bMaxPacketSize0 64
idVendor 0x0a5c Broadcom Corp.
idProduct 0x217f Bluetooth Controller
bcdDevice 3.60
iManufacturer 1
iProduct 2
iSerial 3
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 216
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower 0mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 224 Wireless
bInterfaceSubClass 1 Radio Frequency
bInterfaceProtocol 1 Bluetooth
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0¡Á81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0¡Á0010 1x 16 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0¡Á82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0¡Á0040 1x 64 bytes
bInterval 1
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0¡Á02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0¡Á0040 1x 64 bytes
bInterval 1
ÕÒ³ö´óÈÝÁ¿´æ´¢É豸
¼ÈÈ» lsusb -v¸øÎÒÃǺÜÏêϸµÄÐÅÏ¢£¬ÄÇôÄã»òÐí»á´í¹ýһЩÐÅÏ¢¡£ÎÒÃÇ¿ÉÒÔʹÓÃgrepÃüÁîÖ¸¶¨Ìض¨µÄÐÅÏ¢¡£
´óÈÝÁ¿´æ´¢É豸»áÓÐÒ»¸ö¹©Ó¦ÉÌÃûºÍID¡£ÎÒÃÇ¿ÉÒÔÓÃËü×÷Ϊһ¸öÆðµã¡£
$ lsusb -v |grep -Ei ¡®(idVendor|Mass\ Storage)¡¯
idVendor 0¡Á1005 Apacer Technology, Inc.
bInterfaceClass 8 Mass Storage
Äã¿ÉÒÔ¿´µ½£¬ÎÒÃÇϵͳÉÏÓÐÒ»¸öÀ´×ÔApacer Technology, IncµÄUSB´óÈÝÁ¿´æ´¢É豸¡£
ÒÔÊ÷²ã¼¶½á¹¹Êä³öUSBÉ豸
ʹÓà -tÑ¡ÏîÂú×ãÕâ¸öÒªÇó
$ lsusb -t
/: Bus 08.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 05.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M
|__ Port 1: Dev 4, If 0, Class=stor., Driver=usb-storage, 480M
|__ Port 6: Dev 3, If 0, Class=¡¯bInterfaceClass 0x0e not yet handled¡¯, Driver=uvcvideo, 480M
|__ Port 6: Dev 3, If 1, Class=¡¯bInterfaceClass 0x0e not yet handled¡¯, Driver=uvcvideo, 480M
/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M
Êý×Ö12MºÍ480M ÊÇÖ¸USBÀàÐ͵Ĵ«ÊäËÙÂÊ¡£
12M Òâζ×Å USB 1.0 / 1.1µÄËÙÂÊÊÇ 12Mbit/s
480M Òâζ×Å USB 2.0µÄËÙÂÊÊÇ 480Mbit/s
Èç¹ûÄãÕÒµ½5.0G£¬ÄÇÒâζÕâÄãÓÐUSB 3.0ÀàÐͽӿڡ£ËüÓÐ5.0Gbit/sµÄ´«ÊäËÙÂÊ¡£Linux´Ó/var/lib/usbutils/usb.idsʶ±ðUSBÉ豸µÄÏêϸÐÅÏ¢¡£»òÕßÄã¿ÉÒÔ·ÃÎÊLinux-USB.org»ñÈ¡×îеÄUSB IDÁÐ±í¡£
ÕâЩ¾ÍÊÇlsusbÃüÁîµÄ»ù´¡¡£Äã¿ÉÒÔÓÃlsusbÃüÁî¶ÔÄãµÄϵͳÉϵÄUSBÉ豸×öÒ»¸öÕï¶Ï¡£Ò»°ãÀ´Ëµ£¬Äã¿ÉÒÔͨ¹ýlsusbµÄÊÖ²á̽Ë÷ÃüÁîµÄ¸ü¶àÏêϸϸ½Ú¡£Ö»ÒªÊäÈëman lsabÀ´´ò¿ªËüµÄÊֲᡣ
À´Ô´£ºlinux.cn