| lsusb |
| |
| Output: |
| |
| Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub |
| Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub |
| 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 001 Device 003: ID 05c8:021e Cheng Uei Precision Industry Co., Ltd (Foxlink) |
| Bus 001 Device 007: ID 0cf3:3005 Atheros Communications, Inc. AR3011 Bluetooth |
| Bus 002 Device 003: ID 0781:5567 San Disk Corp. Cruzer Blade |
| |
| 参数解析:Bus 002 Device 003: ID 0781:5567 SanDisk Corp. Cruzer Blade |
| Bus 002 : This is bus number where SanDisk USB stick is attached. |
| |
| Device 003: This is the third device attached to bus 002, the other two devices are “Linux Foundation 2.0 root hub” and ” Intel Corp. Integrated Rate Matching Hub” |
| |
| ID 0781:5567 is the number given to this SanDisk, The number before : indicates the manufacture ID and number after : indicates device ID. To get more info on this visit Linux-USB site. |
| |
| SanDisk Corp. Cruzer Blade is the name of manufacture and device name. |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
| find /dev/bus/ |
| |
| Output: |
| |
| /dev/bus/ |
| /dev/bus/usb |
| /dev/bus/usb/002 |
| /dev/bus/usb/002/006 |
| /dev/bus/usb/002/005 |
| /dev/bus/usb/002/004 |
| /dev/bus/usb/002/002 |
| /dev/bus/usb/002/001 |
| /dev/bus/usb/001 |
| /dev/bus/usb/001/007 |
| /dev/bus/usb/001/003 |
| /dev/bus/usb/001/002 |
| /dev/bus/usb/001/001 |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
获取USB设备的详细信息
| lsusb -D /dev/bus/usb/002/005 |
| |
| Output: |
| |
| |
| Device: ID 0951:1643 Kingston Technology Data Traveler G3 4GB |
| Couldn't open device, some information will be missing |
| Device Descriptor: |
| bLength 18 |
| bDescriptorType 1 |
| bcdUSB 2.00 |
| bDeviceClass 0 (Defined at Interface level) |
| bDeviceSubClass 0 |
| bDeviceProtocol 0 |
| bMaxPacketSize0 64 |
| idVendor 0x0951 Kingston Technology |
| idProduct 0x1643 DataTraveler G3 4GB |
| bcdDevice 1.00 |
| iManufacturer 1 |
| iProduct 2 |
| iSerial 3 |
| bNumConfigurations 1 |
| Configuration Descriptor: |
| bLength 9 |
| bDescriptorType 2 |
| wTotalLength 32 |
| bNumInterfaces 1 |
| bConfigurationValue 1 |
| iConfiguration 0 |
| bmAttributes 0x80 |
| (Bus Powered) |
| MaxPower 200mA |
| Interface Descriptor: |
| bLength 9 |
| bDescriptorType 4 |
| bInterfaceNumber 0 |
| bAlternateSetting 0 |
| bNumEndpoints 2 |
| bInterfaceClass 8 Mass Storage |
| bInterfaceSubClass 6 SCSI |
| bInterfaceProtocol 80 Bulk-Only |
| iInterface 0 |
| Endpoint Descriptor: |
| bLength 7 |
| bDescriptorType 5 |
| bEndpointAddress 0x81 EP 1 IN |
| bmAttributes 2 |
| Transfer Type Bulk |
| Synch Type None |
| Usage Type Data |
| wMaxPacketSize 0x0200 1x 512 bytes |
| bInterval 0 |
| Endpoint Descriptor: |
| bLength 7 |
| bDescriptorType 5 |
| bEndpointAddress 0x02 EP 2 OUT |
| bmAttributes 2 |
| Transfer Type Bulk |
| Synch Type None |
| Usage Type Data |
| wMaxPacketSize 0x0200 1x 512 bytes |
| bInterval 0 |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
| lsusb -v |
| |
| Clipped output: |
| |
| Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub |
| Couldn't open device, some information will be missing |
| Device Descriptor: |
| bLength 18 |
| bDescriptorType 1 |
| bcdUSB 2.00 |
| bDeviceClass 9 Hub |
| bDeviceSubClass 0 Unused |
| bDeviceProtocol 1 Single TT |
| bMaxPacketSize0 64 |
| idVendor 0x8087 Intel Corp. |
| idProduct 0x0024 Integrated Rate Matching Hub |
| bcdDevice 0.00 |
| iManufacturer 0 |
| iProduct 0 |
| iSerial 0 |
| bNumConfigurations 1 |
| Configuration Descriptor: |
| bLength 9 |
| bDescriptorType 2 |
| wTotalLength 25 |
| bNumInterfaces 1 |
| bConfigurationValue 1 |
| iConfiguration 0 |
| bmAttributes 0xe0 |
| Self Powered |
| Remote Wakeup |
| MaxPower 0mA |
| Interface Descriptor: |
| bLength 9 |
| bDescriptorType 4 |
| bInterfaceNumber 0 |
| bAlternateSetting 0 |
| bNumEndpoints 1 |
| bInterfaceClass 9 Hub |
| bInterfaceSubClass 0 Unused |
| bInterfaceProtocol 0 Full speed (or root) hub |
| iInterface 0 |
| Endpoint Descriptor: |
| bLength 7 |
| bDescriptorType 5 |
| bEndpointAddress 0x81 EP 1 IN |
| bmAttributes 3 |
| Transfer Type Interrupt |
| Synch Type None |
| Usage Type Data |
| wMaxPacketSize 0x0001 1x 1 bytes |
| bInterval 12 |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
| lsusb -v | grep -Ei '(idVendor|Mass Storage)' |
| |
| Output: |
| idVendor 0x2006 |
| bInterfaceClass 8 Mass Storage |
| idVendor 0x0781 SanDisk Corp. |
| bInterfaceClass 8 Mass Storage |
| idVendor 0x0951 Kingston Technology |
| bInterfaceClass 8 Mass Storage |
从上述结果可以看出,共有三个大容量存储设备挂在总线上。
| lsusb -v | grep -i bcdusb |
| |
| Output: |
| |
| bcdUSB 1.10 |
| bcdUSB 2.00 |
| bcdUSB 2.00 |
| bcdUSB 2.00 |
USB设备依据协议版本的不同,传输速率也是不同的。下面是USB协议版本与传输速率的对应关系:
USB 1.10 | 12Mb/s |
---|
USB 2.00 | 480Mb/s |
USB 3.00 | 5Gb/s |
| lsusb -t |
| |
| Otuput: |
| |
| 2-1.1:1.1: No such file or directory |
| /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |
| |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M |
| |__ Port 1: Dev 6, If 0, Class=stor., Driver=usb-storage, 480M |
| |__ Port 1: Dev 6, If 1, Class=vend., Driver=, 480M |
| |__ Port 2: Dev 7, If 0, Class=stor., Driver=usb-storage, 480M |
| |__ Port 3: Dev 5, If 0, Class=stor., Driver=usb-storage, 480M |
| /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci_hcd/2p, 480M |
| |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/6p, 480M |
| |__ Port 3: Dev 3, If 0, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |
| |__ Port 3: Dev 3, If 1, Class='bInterfaceClass 0x0e not yet handled', Driver=uvcvideo, 480M |
| |__ Port 4: Dev 7, If 0, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |
| |__ Port 4: Dev 7, If 1, Class='bInterfaceClass 0xe0 not yet handled', Driver=btusb, 12M |
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
| cd /sys/bus/pci/drivers/xhci_hcd |
| ls |
| result |
| 0000:00:xx.y |
一旦知道了设备的ID,那么就可以通过命令disable
和enable
设备控制器。
| //disable controller |
| echo -n "0000:00:xx.y" > unbind |
| |
| //enable the controller |
| echo -n "0000:00:xx.y" > bind |
| |
| echo disabled > /sys/bus/usb/devices/usb1/power/wakeup |
| |
| echo on > /sys/bus/usb/devices/usb1/power/control # turn on |
| echo suspend > /sys/bus/usb/devices/usb1/powercontrol # turn off |
| |
| |
| |
| According to the docs, there were several changes to the USB power management from kernels 2.6.32, which seem to settle in 2.6.38. Now you'll need to wait for the device to become idle, which is governed by the particular device driver. The driver needs to support it, otherwise the device will never reach this state. Unluckily, now the user has no chance to force this. However, if you're lucky and your device can become idle, then to turn this off you need to: |
| |
| echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend" |
| echo "auto" > "/sys/bus/usb/devices/usbX/power/level" |
| |
| or, for kernels around 2.6.38 and above: |
| |
| echo "0" > "/sys/bus/usb/devices/usbX/power/autosuspend_delay_ms" |
| echo "auto" > "/sys/bus/usb/devices/usbX/power/control" |
| |
| This literally means, go suspend at the moment the device becomes idle. |
| |
| So unless your fan is something "intelligent" that can be seen as a device and controlled by a driver, you probably won't have much luck on current kernels. |