⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hid.h

📁 linux-2.6.15.6
💻 H
📖 第 1 页 / 共 2 页
字号:
	__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_DESCRIPTOR_SIZE		4096#define HID_MAX_USAGES			1024#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_CTRL_RUNNING	1#define HID_OUT_RUNNING		2struct 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 version;						/* HID version */	unsigned country;						/* HID country */	struct hid_report_enum report_enum[HID_REPORT_TYPES];	struct usb_device *dev;						/* USB device */	struct usb_interface *intf;					/* USB interface */	int ifnum;							/* USB interface number */	unsigned long iofl;						/* I/O flags (CTRL_RUNNING, OUT_RUNNING) */	unsigned int bufsize;						/* URB buffer size */	struct urb *urbin;						/* Input URB */	char *inbuf;							/* Input buffer */	dma_addr_t inbuf_dma;						/* Input buffer dma */	struct urb *urbctrl;						/* Control URB */	struct usb_ctrlrequest *cr;					/* Control request struct */	dma_addr_t cr_dma;						/* Control request struct dma */	struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE];		/* Control fifo */	unsigned char ctrlhead, ctrltail;				/* Control fifo head & tail */	char *ctrlbuf;							/* Control buffer */	dma_addr_t ctrlbuf_dma;						/* Control buffer dma */	spinlock_t ctrllock;						/* Control fifo spinlock */	struct urb *urbout;						/* Output URB */	struct hid_report *out[HID_CONTROL_FIFO_SIZE];			/* Output pipe fifo */	unsigned char outhead, outtail;					/* Output pipe fifo head & tail */	char *outbuf;							/* Output buffer */	dma_addr_t outbuf_dma;						/* Output buffer dma */	spinlock_t outlock;						/* Output fifo spinlock */	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 */	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 *ff_private;                                               /* Private data for the force-feedback driver */	void (*ff_exit)(struct hid_device*);                            /* Called by hid_exit_ff(hid) */	int (*ff_event)(struct hid_device *hid, struct input_dev *input,			unsigned int type, unsigned int code, int value);};#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));#ifdef DEBUG#include "hid-debug.h"#else#define hid_dump_input(a,b)	do { } while (0)#define hid_dump_device(c)	do { } while (0)#define hid_dump_field(a,b)	do { } while (0)#define resolv_usage(a)		do { } while (0)#define resolv_event(a,b)	do { } while (0)#endif#endif#ifdef CONFIG_USB_HIDINPUT/* 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))extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32, struct pt_regs *regs);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 *);#else#define IS_INPUT_APPLICATION(a) (0)static inline void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) { }static inline void hidinput_report_event(struct hid_device *hid, struct hid_report *report) { }static inline int hidinput_connect(struct hid_device *hid) { return -ENODEV; }static inline void hidinput_disconnect(struct hid_device *hid) { }#endifint hid_open(struct hid_device *);void hid_close(struct hid_device *);int hid_set_field(struct hid_field *, unsigned, __s32);void hid_submit_report(struct hid_device *, struct hid_report *, unsigned char dir);void hid_init_reports(struct hid_device *hid);struct hid_field *hid_find_field_by_usage(struct hid_device *hid, __u32 wanted_usage, int type);int hid_wait_io(struct hid_device* hid);#ifdef CONFIG_HID_FFint hid_ff_init(struct hid_device *hid);#elsestatic inline int hid_ff_init(struct hid_device *hid) { return -1; }#endifstatic inline void hid_ff_exit(struct hid_device *hid){	if (hid->ff_exit)		hid->ff_exit(hid);}static inline int hid_ff_event(struct hid_device *hid, struct input_dev *input,			unsigned int type, unsigned int code, int value){	if (hid->ff_event)		return hid->ff_event(hid, input, type, code, value);	return -ENOSYS;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -