点击(此处)折叠或打开
- ray@BIG:/sys/bus/usb/devices$ ls -l
- 总用量 0
- lrwxrwxrwx 1 root root 0 10月 28 17:31 1-0:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-0:1.0
- lrwxrwxrwx 1 root root 0 10月 28 17:31 1-1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1
- lrwxrwxrwx 1 root root 0 10月 28 17:31 1-10 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-10
- ...
- lrwxrwxrwx 1 root root 0 10月 28 17:31 usb1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1
lrwxrwxrwx 1 root root 0 10月 28 17:31 usb2 -> ../../../devices/pci0000:00/0000:00:14.0/usb2
文件的命名是根据USB命名的规则
例如:
命名规则是:roothub-port:configuration.interface.
usb1,usb2表示表示两个usb hub,是root bug.
点击(此处)折叠或打开
- ray@BIG:/sys/bus/usb/devices$ cat usb1/bDeviceClass
- 09
- include/linux/usb/ch9.h #define USB_CLASS_HUB 9 说明 usb1 是个 HUB.
在用户接入USB设备之后并且该设备挂载在usb hug1下,那么就多出设备目录. 如
点击(此处)折叠或打开
- #ls -l /sys/bus/usb/devices
- lrwxrwxrwx 1 root root 0 10月 28 18:13 1-1.1.4 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1/1-1.1.4
- lrwxrwxrwx 1 root root 0 10月 28 18:13 1-1.1.4:1.0 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.1/1-1.1.4/1-1.1.4:1.0
同时在 usb1/1-1/1-1.1/目录下也会多出来 1-1.1.4 目录.
点击(此处)折叠或打开
- /sys/bus/usb/devices/usb1/1-1/1-1.1/1-1.1.4$ cat devnum
- 13
- /sys/bus/usb/devices/usb1/1-1/1-1.1/1-1.1.4$ cat busnum
- 1
- # lsusb
- Bus 001 Device 013: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
由此可见, 即可得到1-1.1.4即为 ttyUSB0 对应的设备.
# disable external wake-up; do this only once echo auto > /sys/bus/usb/devices/1-1.1.4/power/control # on
echo 0 > autosuspend_delay_ms
echo on > /sys/bus/usb/devices/1-1.1.4/power/level # turn on echo suspend > /sys/bus/usb/devices/1-1.1.4/power/level # turn off但是修改时 , 实际上用不了阿