?? hid.h
字號:
/* * Separate quirks for runtime report descriptor fixup */#define HID_QUIRK_RDESC_CYMOTION 0x00000001#define HID_QUIRK_RDESC_LOGITECH 0x00000002#define HID_QUIRK_RDESC_SWAPPED_MIN_MAX 0x00000004#define HID_QUIRK_RDESC_PETALYNX 0x00000008#define HID_QUIRK_RDESC_MACBOOK_JIS 0x00000010/* * This is the global environment of the parser. This information is * persistent for main-items. The global environment can be saved and * restored with PUSH/POP statements. */struct hid_global { unsigned usage_page; __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; __s32 unit_exponent; unsigned unit; unsigned report_id; unsigned report_size; unsigned report_count;};/* * This is the local environment. It is persistent up the next main-item. */#define HID_MAX_USAGES 8192#define HID_DEFAULT_NUM_COLLECTIONS 16struct hid_local { unsigned usage[HID_MAX_USAGES]; /* usage array */ unsigned collection_index[HID_MAX_USAGES]; /* collection index array */ unsigned usage_index; unsigned usage_minimum; unsigned delimiter_depth; unsigned delimiter_branch;};/* * This is the collection stack. We climb up the stack to determine * application and function of each field. */struct hid_collection { unsigned type; unsigned usage; unsigned level;};struct hid_usage { unsigned hid; /* hid usage code */ unsigned collection_index; /* index into collection array */ /* hidinput data */ __u16 code; /* input driver code */ __u8 type; /* input driver type */ __s8 hat_min; /* hat switch fun */ __s8 hat_max; /* ditto */ __s8 hat_dir; /* ditto */};struct hid_input;struct hid_field { unsigned physical; /* physical usage for this field */ unsigned logical; /* logical usage for this field */ unsigned application; /* application usage for this field */ struct hid_usage *usage; /* usage table for this function */ unsigned maxusage; /* maximum usage index */ unsigned flags; /* main-item flags (i.e. volatile,array,constant) */ unsigned report_offset; /* bit offset in the report */ unsigned report_size; /* size of this field in the report */ unsigned report_count; /* number of this field in the report */ unsigned report_type; /* (input,output,feature) */ __s32 *value; /* last known value(s) */ __s32 logical_minimum; __s32 logical_maximum; __s32 physical_minimum; __s32 physical_maximum; __s32 unit_exponent; unsigned unit; struct hid_report *report; /* associated report */ unsigned index; /* index into report->field[] */ /* hidinput data */ struct hid_input *hidinput; /* associated input structure */ __u16 dpad; /* dpad input code */};#define HID_MAX_FIELDS 64struct hid_report { struct list_head list; unsigned id; /* id of this report */ unsigned type; /* report type */ struct hid_field *field[HID_MAX_FIELDS]; /* fields of the report */ unsigned maxfield; /* maximum valid field index */ unsigned size; /* size of the report (bits) */ struct hid_device *device; /* associated device */};struct hid_report_enum { unsigned numbered; struct list_head report_list; struct hid_report *report_id_hash[256];};#define HID_REPORT_TYPES 3#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */#define HID_OUTPUT_FIFO_SIZE 64struct hid_control_fifo { unsigned char dir; struct hid_report *report;};#define HID_CLAIMED_INPUT 1#define HID_CLAIMED_HIDDEV 2#define HID_CLAIMED_HIDRAW 4#define HID_CTRL_RUNNING 1#define HID_OUT_RUNNING 2#define HID_IN_RUNNING 3#define HID_RESET_PENDING 4#define HID_SUSPENDED 5#define HID_CLEAR_HALT 6struct hid_input { struct list_head list; struct hid_report *report; struct input_dev *input;};struct hid_device { /* device report descriptor */ __u8 *rdesc; unsigned rsize; struct hid_collection *collection; /* List of HID collections */ unsigned collection_size; /* Number of allocated hid_collections */ unsigned maxcollection; /* Number of parsed collections */ unsigned maxapplication; /* Number of applications */ unsigned short bus; /* BUS ID */ unsigned short vendor; /* Vendor ID */ unsigned short product; /* Product ID */ unsigned version; /* HID version */ unsigned country; /* HID country */ struct hid_report_enum report_enum[HID_REPORT_TYPES]; struct device *dev; /* device */ unsigned claimed; /* Claimed by hidinput, hiddev? */ unsigned quirks; /* Various quirks the device can pull on us */ struct list_head inputs; /* The list of inputs */ void *hiddev; /* The hiddev structure */ void *hidraw; int minor; /* Hiddev minor number */ wait_queue_head_t wait; /* For sleeping */ int open; /* is the device open by anyone? */ char name[128]; /* Device name */ char phys[64]; /* Device physical location */ char uniq[64]; /* Device unique identifier (serial #) */ void *driver_data; /* device-specific function pointers */ int (*hidinput_input_event) (struct input_dev *, unsigned int, unsigned int, int); int (*hid_open) (struct hid_device *); void (*hid_close) (struct hid_device *); /* hiddev event handler */ void (*hiddev_hid_event) (struct hid_device *, struct hid_field *field, struct hid_usage *, __s32); void (*hiddev_report_event) (struct hid_device *, struct hid_report *); /* handler for raw output data, used by hidraw */ int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t);#ifdef CONFIG_USB_HIDINPUT_POWERBOOK unsigned long pb_pressed_fn[BITS_TO_LONGS(KEY_CNT)]; unsigned long pb_pressed_numlock[BITS_TO_LONGS(KEY_CNT)];#endif};#define HID_GLOBAL_STACK_SIZE 4#define HID_COLLECTION_STACK_SIZE 4struct hid_parser { struct hid_global global; struct hid_global global_stack[HID_GLOBAL_STACK_SIZE]; unsigned global_stack_ptr; struct hid_local local; unsigned collection_stack[HID_COLLECTION_STACK_SIZE]; unsigned collection_stack_ptr; struct hid_device *device;};struct hid_class_descriptor { __u8 bDescriptorType; __u16 wDescriptorLength;} __attribute__ ((packed));struct hid_descriptor { __u8 bLength; __u8 bDescriptorType; __u16 bcdHID; __u8 bCountryCode; __u8 bNumDescriptors; struct hid_class_descriptor desc[1];} __attribute__ ((packed));/* Applications from HID Usage Tables 4/8/99 Version 1.1 *//* We ignore a few input applications that are not widely used */#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001))/* HID core API */#ifdef CONFIG_HID_DEBUGextern int hid_debug;#endifextern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32);extern void hidinput_report_event(struct hid_device *hid, struct hid_report *report);extern int hidinput_connect(struct hid_device *);extern void hidinput_disconnect(struct hid_device *);int hid_set_field(struct hid_field *, unsigned, __s32);int hid_input_report(struct hid_device *, int type, u8 *, int, int);int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt);void hid_output_report(struct hid_report *report, __u8 *data);void hid_free_device(struct hid_device *device);struct hid_device *hid_parse_report(__u8 *start, unsigned size);/* HID quirks API */u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct);int usbhid_modify_dquirk(const u16 idVendor, const u16 idProduct, const u32 quirks);int usbhid_quirks_init(char **quirks_param);void usbhid_quirks_exit(void);void usbhid_fixup_report_descriptor(const u16, const u16, char *, unsigned, char **);#ifdef CONFIG_HID_FFint hid_ff_init(struct hid_device *hid);int hid_lgff_init(struct hid_device *hid);int hid_plff_init(struct hid_device *hid);int hid_tmff_init(struct hid_device *hid);int hid_zpff_init(struct hid_device *hid);#ifdef CONFIG_HID_PIDint hid_pidff_init(struct hid_device *hid);#elsestatic inline int hid_pidff_init(struct hid_device *hid) { return -ENODEV; }#endif#elsestatic inline int hid_ff_init(struct hid_device *hid) { return -1; }#endif#ifdef CONFIG_HID_DEBUG#define dbg_hid(format, arg...) if (hid_debug) \ printk(KERN_DEBUG "%s: " format ,\ __FILE__ , ## arg)#define dbg_hid_line(format, arg...) if (hid_debug) \ printk(format, ## arg)#else#define dbg_hid(format, arg...) do {} while (0)#define dbg_hid_line dbg_hid#endif#define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ __FILE__ , ## arg)#endif#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -