前面我们学习了USB 驱动的一个描述符,下面来学习 USB 驱动的几个重要数据结构
一、struct usb_interface 接口函数
struct usb_interface
{
struct usb_host_interface *altsetting;
struct usb_host_interface *cur_altsetting;
unsigned num_altsetting;
int minor;
enum usb_interface_condition condition;
unsigned is_active:1;
unsigned needs_remote_wakeup:1;
struct device dev;
struct device *usb_dev;
int pm_usage_cnt;
};
struct usb_interface中的struct usb_host_interface *cur_altsetting成员,表示当前正在使用的设置
1、struct usb_host_interface
struct usb_host_interface
{
struct usb_interface_descriptor desc;//usb描述符,主要有四种usb描述符,设备描述符,配置描述符,接口描述符和端点描述符,协议里规定一个usb设备是必须支持这四大描述符的。
//usb描述符放在usb设备的eeprom里边
/* 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;
};
具体到接口描述