点击(此处)折叠或打开

  1. ray@BIG:/sys/bus/usb/devices$ ls -l
  2. 总用量 0
  3. 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
  4. lrwxrwxrwx 1 root root 0 10月 28 17:31 1-1 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-1
  5. lrwxrwxrwx 1 root root 0 10月 28 17:31 1-10 -> ../../../devices/pci0000:00/0000:00:14.0/usb1/1-10
  6. ...
  7. 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
/sys/bus/usb/devices都是实际指向/sys/devices/platform/下的文件
文件的命名是根据USB命名的规则
例如:
命名规则是:roothub-port:configuration.interface.
usb1,usb2表示表示两个usb hub,是root bug.

点击(此处)折叠或打开

  1. ray@BIG:/sys/bus/usb/devices$ cat usb1/bDeviceClass 
  2. 09
  3. include/linux/usb/ch9.h #define USB_CLASS_HUB 9 说明 usb1 是个 HUB.
1-0:1.0是usb hub1自己占有的, 在没有接入任何usb设备的时候,1-0:1.0都存在
在用户接入USB设备之后并且该设备挂载在usb hug1下,那么就多出设备目录. 如

点击(此处)折叠或打开

  1. #ls -l /sys/bus/usb/devices

  2. 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
  3. 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 目录.

点击(此处)折叠或打开

  1. /sys/bus/usb/devices/usb1/1-1/1-1.1/1-1.1.4$ cat devnum
  2. 13
  3. /sys/bus/usb/devices/usb1/1-1/1-1.1/1-1.1.4$ cat busnum
  4. 1

  5. # lsusb
  6. 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
但是修改时 , 实际上用不了阿


































































10-26 02:30
查看更多