INTERFACE:
struct usb_interface
/* 我们肉眼看得到的USB接口 */
struct usb_host_interface * /* the currently
* active alternate setting */
struct usb_interface_descriptor{
__u8 bLength;
__u8 bDescriptorType;
__u8 bInterfaceNumber;
__u8 bAlternateSetting;
__u8 bNumEndpoints;
__u8 bInterfaceClass;
__u8 bInterfaceSubClass;
__u8 bInterfaceProtocol;
__u8 iInterface;
}
struct usb_host_endpoint *
struct usb_endpoint_descriptor /* the real usb endpoint */
{
__u8 bLength;
__u8 bDescriptorType;
__u8 bEndpointAddress;
__u8 bmAttributes;
__u16 wMaxPacketSize;
__u8 bInterval;
// NOTE: these two are _only_ in audio endpoints.
// use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof.
__u8 bRefresh;
__u8 bSynchAddress;
}
...
enum usb_interface_condition /* state of binding */
...
CONFIGURATION:
struct usb_host_config /* 计算机内部的USB硬件控制器 */
struct usb_config_descriptor{
__u8 bLength;
__u8 bDescriptorType;
__u16 wTotalLength;
__u8 bNumInterfaces;
__u8 bConfigurationValue;
__u8 iConfiguration;
__u8 bmAttributes;
__u8 bMaxPower;
}
struct usb_interface **
struct usb_interface_cache **
...
--------------------------------------------
USB_DEVICE: /* USB核心对USB硬件的抽象*/
struct usb_device
struct usb_device_descriptor{
__u8 bLength;
__u8 bDescriptorType;
__u16 bcdUSB;
__u8 bDeviceClass;
__u8 bDeviceSubClass;
__u8 bDeviceProtocol;
__u8 bMaxPacketSize0;
__u16 idVendor;
__u16 idProduct;
__u16 bcdDevice;
__u8 iManufacturer;
__u8 iProduct;
__u8 iSerialNumber;
__u8 bNumConfigurations;
}
struct usb_host_config *
enum usb_device_speed
...
usb端点到usb接口的抽象,端点传输数据时只能进行单向传输(时域上)
传送方式:控制,中断,批量(块),同步(等时)
/sys/bus/usb/drivers/usb目录下可以看见系统usb设备个数usb1 usb2 ....
usb1目录下有很多文件(不包括目录),其中包括是usb_config_descriptor,usb_device_descriptor的字段描述符(ldd3中的所说的配置)还有命名为*-*:*.*该目录表示接口该目录内有存放 usb_interface_descriptor的字段描述符,接口目录下有endpoint字符串的目录表示usb端口(真实的硬件),例如我虚拟机下有usb_endpoint:usbdev1.1_ep81目录,该目下存放usb_endpoint_descriptor的字段描述符
阅读(1518) | 评论(0) | 转发(0) |