您的位置:首页 > 其它

USB_interface结构体分析

2016-11-25 17:40 363 查看
转自http://liu1227787871.blog.163.com/blog/static/20536319720129149102907/

struct usb_interface {
//本接口对应的所有的设置(与配置不是一个概念)
struct usb_host_interface *altsetting;

struct usb_host_interface *cur_altsetting;//当前活跃的设置
unsigned num_altsetting; //可选设置的数量

/* If there is an interface association descriptor then it will list
* the associated interfaces */
struct usb_interface_assoc_descriptor *intf_assoc;

int minor; //本接口绑定的次设备号
enum usb_interface_condition condition; //接口是否绑定
unsigned sysfs_files_created:1; /* 文件系统存在的文件的属性 */
unsigned ep_devs_created:1; /* endpoint "devices" exist */
unsigned unregistering:1; /* 标识卸载interface */
unsigned needs_remote_wakeup:1; /* 驱动要求远程唤醒 */
unsigned needs_altsetting0:1; /* 当设置0被推迟时标识 */
unsigned needs_binding:1; /* needs delayed unbind/rebind */
unsigned reset_running:1;
unsigned resetting_device:1; /* true: bandwidth alloc after reset */

struct device dev; /* interface specific device info */

//当接口被绑定到usb主设备号的时候,它指向文件系统中表示的usb设备
struct device *usb_dev;
atomic_t pm_usage_cnt; /* usage counter for autosuspend */
struct work_struct reset_ws; /* for resets in atomic context */
};

/* host-side wrapper for one interface setting's parsed descriptors */
struct usb_host_interface {
struct usb_interface_descriptor desc;//接口描述符

/* array of desc.bNumEndpoint endpoints associated with this
* interface setting. these will be in no particular order.
*/
struct usb_host_endpoint *endpoint; //本接口对应的端点

char *string; /* iInterface string, if present */
unsigned char *extra; /* Extra descriptors */
int extralen;
};

struct usb_interface_descriptor {
__u8 bLength; //描述符的size
__u8 bDescriptorType; //描述符的类型

__u8 bInterfaceNumber;//接口号
__u8 bAlternateSetting;//用与选择接口的设置
__u8 bNumEndpoints; //本接口对应的端口的数量
__u8 bInterfaceClass;//指明本接口属于哪一个类
__u8 bInterfaceSubClass;//根据bInterfaceClass确定
__u8 bInterfaceProtocol;//协议码
__u8 iInterface;//字符串描述符中本接口描述符的索引
} __attribute__ ((packed));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: