linux的usb与sys,Linux usb filesystem

Linux usb 文件系统命名规则

The generic form is

X-Y.Z:A.B

Each field identify the connection point of your device. The first two field are mandatory:

X is the USB bus of your motherboard where is connected the USB system.

Y is the port in use on the bus system

So the USB device identified with the string 3-3 is the device connected on the port 3 of the bus 3.

If you connect an USB hub, you are extending the connection capability of a single USB port. The Linux kernel identify this situation by appending the Z field.

Z is the port is use on an hub

So, the USB device identified with the string 1-2.5 is the device connected on the port 5 of the hub connected on the port 2 of the bus 1.

USB specification allow you to connect in cascade more then one USB hub, so the Linux kernel continue to append the port in use on the different hubs. So, the USB device identified with the string 1-2.1.1 is the device connected on the port 1 of the hub connected on the port 1 of the hub connected to the port 2 of the bus 1.

A fast way to retrieve these information is to read the kernel messages (if you can).

$ dmesg | grep usb

[... snip ...]

[ 2.047950] usb 4-1: new full-speed USB device number 2 using ohci_hcd

[ 2.202628] usb 4-1: New USB device found, idVendor=046d, idProduct=c318

[ 2.202638] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0

[ 2.202643] usb 4-1: Product: Logitech Illuminated Keyboard

[ 2.202648] usb 4-1: Manufacturer: Logitech

[... snip ...]

Then, the last two fields of the pattern (after colon) identify an internal section of an USB device :

A is the configuration number of the device

B is the interface number of a configuration

So, the string 4-1:1.1 means: the interface 1, on configuration 1 that is connected on the port 1 of the bus 4.

/sys/bus/usb/devices/usb/下文件内容

/sys/bus/usb/devices都是实际指向/sys/devices/platform/下的文件

power/control文件:设置usb是否可以自动悬挂,有on和auto两种,2.6.3内核之后都为auto,所以今天的usb自动悬挂相当于没做什么工作

power/autosuspend_delay_ms文件:设置内核判断休眠前延时多长时间进入usb自动悬挂,0为越快越好

主要关注的文件也就这两个。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值