Linux USB

 

All USB devices have a hierarchy of descriptors which describe to the host information such as what device is, who makes it, what version

 

of USB it supports, how many ways it can be configured, the number of endpoints and their types etc. The more common USB descriptions

 

are: Device Descriptors, Configurations Descriptors, Interface Descriptors, Endpoint Descriptors, String Descriptors

 

USB devices can only have one device descriptor. The device descriptor includes information such as what USB revision the device

 

complies to, the Vendor ID and the Product ID used to load appropriated drivers and the numbers of configurations the device can have.

 

The number of configurations indicate how many configuration descriptors branches are to follow.

 

The configuration descriptor specifies values such as the amount of power this particular configuration uses, if the device is self or bus

 

powered and the number of interfaces it has. When a device is enumerated, the host reads the device descriptors and can make a

 

decision of which configuration to enable. It can only enable one configuration at a time.

 

For example, it is possible to have a high power bus powered configuration and a self powered configuration. If the device is plugged into

 

a host with a mains power supply, the device driver choose to enable high power bus powered configuration enabling the device to be

 

powered without a connection to the mains, yet it it is connected to a laptop or personal organiser it could enable the 2nd configuration

 

(self powered) requiring the user to plug your device into the power point. The configuration settings are not limited to power differences.

 

Each configuration could be powered in the same way and draw the same current, yet have different interface or endpoint combinations.

 

However it should be noted that changing the configuration requires all activity on each endpoint to stop. While USB offers flexiability,

 

very few devices have more than 1 configuration.

 

 

 

To enumerate USB devices: usb.h + usb1.c

 

usb.h >>

 

 

 

usb.c >>

 

 

 

执行结果:

 

 

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值