struct usb_device_id

来源:互联网 发布:虚拟局域网属于网络层 编辑:程序博客网 时间:2024/06/08 19:49
struct usb_device_id {/* which fields to match against? */__u16match_flags;/* Used for product specific matches; range is inclusive */__u16idVendor;                   //供应商ID__u16idProduct;                  //产品ID__u16bcdDevice_lo;__u16bcdDevice_hi;/* Used for device class matches */__u8bDeviceClass;               //设备类型__u8bDeviceSubClass;            //设备子类型__u8bDeviceProtocol;            //协议/* Used for interface class matches */__u8bInterfaceClass;            //接口类__u8bInterfaceSubClass;         //接口子类__u8bInterfaceProtocol;         //接口协议/* not matched against */kernel_ulong_tdriver_info;};

相关宏:

/* Some useful macros to use to create struct usb_device_id */#define USB_DEVICE_ID_MATCH_VENDOR0x0001#define USB_DEVICE_ID_MATCH_PRODUCT0x0002#define USB_DEVICE_ID_MATCH_DEV_LO0x0004#define USB_DEVICE_ID_MATCH_DEV_HI0x0008#define USB_DEVICE_ID_MATCH_DEV_CLASS0x0010#define USB_DEVICE_ID_MATCH_DEV_SUBCLASS0x0020#define USB_DEVICE_ID_MATCH_DEV_PROTOCOL0x0040#define USB_DEVICE_ID_MATCH_INT_CLASS0x0080#define USB_DEVICE_ID_MATCH_INT_SUBCLASS0x0100#define USB_DEVICE_ID_MATCH_INT_PROTOCOL0x0200

#define USB_DEVICE_ID_MATCH_DEVICE \(USB_DEVICE_ID_MATCH_VENDOR | USB_DEVICE_ID_MATCH_PRODUCT)#define USB_DEVICE_ID_MATCH_DEV_RANGE \(USB_DEVICE_ID_MATCH_DEV_LO | USB_DEVICE_ID_MATCH_DEV_HI)#define USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION \(USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_DEV_RANGE)#define USB_DEVICE_ID_MATCH_DEV_INFO \(USB_DEVICE_ID_MATCH_DEV_CLASS | \USB_DEVICE_ID_MATCH_DEV_SUBCLASS | \USB_DEVICE_ID_MATCH_DEV_PROTOCOL)#define USB_DEVICE_ID_MATCH_INT_INFO \(USB_DEVICE_ID_MATCH_INT_CLASS | \USB_DEVICE_ID_MATCH_INT_SUBCLASS | \USB_DEVICE_ID_MATCH_INT_PROTOCOL)/** * USB_DEVICE - macro used to describe a specific usb device * @vend: the 16 bit USB Vendor ID * @prod: the 16 bit USB Product ID * * This macro is used to create a struct usb_device_id that matches a * specific device. */#define USB_DEVICE(vend, prod) \.match_flags = USB_DEVICE_ID_MATCH_DEVICE, \.idVendor = (vend), \.idProduct = (prod)/** * USB_DEVICE_VER - describe a specific usb device with a version range * @vend: the 16 bit USB Vendor ID * @prod: the 16 bit USB Product ID * @lo: the bcdDevice_lo value * @hi: the bcdDevice_hi value * * This macro is used to create a struct usb_device_id that matches a * specific device, with a version range. */#define USB_DEVICE_VER(vend, prod, lo, hi) \.match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \.idVendor = (vend), \.idProduct = (prod), \.bcdDevice_lo = (lo), \.bcdDevice_hi = (hi)/** * USB_DEVICE_INTERFACE_PROTOCOL - describe a usb device with a specific interface protocol * @vend: the 16 bit USB Vendor ID * @prod: the 16 bit USB Product ID * @pr: bInterfaceProtocol value * * This macro is used to create a struct usb_device_id that matches a * specific interface protocol of devices. */#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \.match_flags = USB_DEVICE_ID_MATCH_DEVICE | \       USB_DEVICE_ID_MATCH_INT_PROTOCOL, \.idVendor = (vend), \.idProduct = (prod), \.bInterfaceProtocol = (pr)/** * USB_DEVICE_INFO - macro used to describe a class of usb devices * @cl: bDeviceClass value * @sc: bDeviceSubClass value * @pr: bDeviceProtocol value * * This macro is used to create a struct usb_device_id that matches a * specific class of devices. */#define USB_DEVICE_INFO(cl, sc, pr) \.match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \.bDeviceClass = (cl), \.bDeviceSubClass = (sc), \.bDeviceProtocol = (pr)/** * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces * @cl: bInterfaceClass value * @sc: bInterfaceSubClass value * @pr: bInterfaceProtocol value * * This macro is used to create a struct usb_device_id that matches a * specific class of interfaces. */#define USB_INTERFACE_INFO(cl, sc, pr) \.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \.bInterfaceClass = (cl), \.bInterfaceSubClass = (sc), \.bInterfaceProtocol = (pr)/** * USB_DEVICE_AND_INTERFACE_INFO - describe a specific usb device with a class of usb interfaces * @vend: the 16 bit USB Vendor ID * @prod: the 16 bit USB Product ID * @cl: bInterfaceClass value * @sc: bInterfaceSubClass value * @pr: bInterfaceProtocol value * * This macro is used to create a struct usb_device_id that matches a * specific device with a specific class of interfaces. * * This is especially useful when explicitly matching devices that have * vendor specific bDeviceClass values, but standards-compliant interfaces. */#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \| USB_DEVICE_ID_MATCH_DEVICE, \.idVendor = (vend), \.idProduct = (prod), \.bInterfaceClass = (cl), \.bInterfaceSubClass = (sc), \.bInterfaceProtocol = (pr)


0 0