USB相关结构体之struct usb_device
生活随笔
收集整理的這篇文章主要介紹了
USB相关结构体之struct usb_device
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
?
struct usb_device { int devnum; ? ? //設備號,也稱設備地址 char devpath[16]; u32 route; enum usb_device_state state;? enum usb_device_speed speed;?struct usb_tt *tt; int ttport;
unsigned int toggle[2];
struct usb_device *parent; struct usb_bus *bus; ? ? //usb設備所在的總線 ? ? ? ? //0號端口,可以雙向傳輸 struct usb_host_endpoint ep0; //usb主機端口結構體,詳見注釋1
struct device dev;
struct usb_device_descriptor descriptor;//usb設備描述符,詳見注釋2 struct usb_host_bos *bos; struct usb_host_config *config;
struct usb_host_config *actconfig; //配置結構體,詳見注釋3 ? ? ? ? ?//由此我們看出usb最多支持33個端口,1個控制端口,16個輸入端口,16個輸出端口 struct usb_host_endpoint *ep_in[16];//輸入端口 struct usb_host_endpoint *ep_out[16];//輸出端口
char **rawdescriptors;
unsigned short bus_mA; u8 portnum; u8 level;
unsigned can_submit:1; unsigned persist_enabled:1; unsigned have_langid:1; unsigned authorized:1; unsigned authenticated:1; unsigned wusb:1; unsigned lpm_capable:1; unsigned usb2_hw_lpm_capable:1; unsigned usb2_hw_lpm_enabled:1; int string_langid;
/* static strings from the device */ char *product; char *manufacturer; char *serial;
struct list_head filelist; #ifdef CONFIG_USB_DEVICE_CLASS struct device *usb_classdev; #endif #ifdef CONFIG_USB_DEVICEFS struct dentry *usbfs_dentry; #endif
int maxchild; struct usb_device **children;
u32 quirks; atomic_t urbnum;
unsigned long active_duration;
#ifdef CONFIG_PM unsigned long connect_time;
unsigned do_remote_wakeup:1; unsigned reset_resume:1; #endif struct wusb_dev *wusb_dev; int slot_id; enum usb_device_removable removable; };
注釋1: struct usb_host_endpoint { struct usb_endpoint_descriptor desc; //端口描述符,詳見注釋1-1 struct usb_ss_ep_comp_descriptor ss_ep_comp; struct list_head urb_list; ?//本端點的請求塊的隊列 void *hcpriv; struct ep_device *ep_dev; /* For sysfs info */
unsigned char *extra; ? /* Extra descriptors */ int extralen; int enabled; };
注釋1-1: struct usb_endpoint_descriptor { __u8 ?bLength; __u8 ?bDescriptorType;
__u8 ?bEndpointAddress; ?//端口地址 __u8 ?bmAttributes; __le16 wMaxPacketSize; //一次傳輸的最大數據量 __u8 ?bInterval;
/* NOTE: ?these two are _only_ in audio endpoints. */ /* use USB_DT_ENDPOINT*_SIZE in bLength, not sizeof. */ __u8 ?bRefresh; __u8 ?bSynchAddress; } __attribute__ ((packed));
注釋2: struct usb_device_descriptor { __u8 ?bLength; __u8 ?bDescriptorType;
__le16 bcdUSB; __u8 ?bDeviceClass; __u8 ?bDeviceSubClass; __u8 ?bDeviceProtocol; __u8 ?bMaxPacketSize0;//一次傳輸的最大數據量 __le16 idVendor; __le16 idProduct; __le16 bcdDevice; __u8 ?iManufacturer; __u8 ?iProduct; __u8 ?iSerialNumber; __u8 ?bNumConfigurations; } __attribute__ ((packed));
注釋3: struct usb_host_config { struct usb_config_descriptor desc; //配置描述符,詳見注釋3-1
char *string; /* iConfiguration string, if present */
? ? ? ? ?//接口代表一種功能,而配置是功能的組合 struct usb_interface_assoc_descriptor *intf_assoc[USB_MAXIADS];
/* the interfaces associated with this configuration, * stored in no particular order */ struct usb_interface *interface[USB_MAXINTERFACES];
/* Interface information available even when this is not the * active configuration */ struct usb_interface_cache *intf_cache[USB_MAXINTERFACES];
unsigned char *extra; ? /* Extra descriptors */ int extralen; };
總結
以上是生活随笔為你收集整理的USB相关结构体之struct usb_device的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: usb_get_device_descr
- 下一篇: Android Nand Flash 分