1
2 #ifndef __USBHID_H
3 #define __USBHID_H
4
5
6
7
8
9
10
11
12
13
14 #include <linux/types.h>
15 #include <linux/slab.h>
16 #include <linux/list.h>
17 #include <linux/mutex.h>
18 #include <linux/timer.h>
19 #include <linux/wait.h>
20 #include <linux/workqueue.h>
21 #include <linux/input.h>
22
23
24 void usbhid_init_reports(struct hid_device *hid);
25 struct usb_interface *usbhid_find_interface(int minor);
26
27
28 #define HID_CTRL_RUNNING 1
29 #define HID_OUT_RUNNING 2
30 #define HID_IN_RUNNING 3
31 #define HID_RESET_PENDING 4
32 #define HID_SUSPENDED 5
33 #define HID_CLEAR_HALT 6
34 #define HID_DISCONNECTED 7
35 #define HID_STARTED 8
36 #define HID_KEYS_PRESSED 10
37 #define HID_NO_BANDWIDTH 11
38 #define HID_RESUME_RUNNING 12
39
40
41
42
43 #define HID_OPENED 13
44
45
46
47
48
49 #define HID_IN_POLLING 14
50
51
52
53
54
55
56 struct usbhid_device {
57 struct hid_device *hid;
58
59 struct usb_interface *intf;
60 int ifnum;
61
62 unsigned int bufsize;
63
64 struct urb *urbin;
65 char *inbuf;
66 dma_addr_t inbuf_dma;
67
68 struct urb *urbctrl;
69 struct usb_ctrlrequest *cr;
70 struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE];
71 unsigned char ctrlhead, ctrltail;
72 char *ctrlbuf;
73 dma_addr_t ctrlbuf_dma;
74 unsigned long last_ctrl;
75
76 struct urb *urbout;
77 struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE];
78 unsigned char outhead, outtail;
79 char *outbuf;
80 dma_addr_t outbuf_dma;
81 unsigned long last_out;
82
83 struct mutex mutex;
84 spinlock_t lock;
85 unsigned long iofl;
86 struct timer_list io_retry;
87 unsigned long stop_retry;
88 unsigned int retry_delay;
89 struct work_struct reset_work;
90 wait_queue_head_t wait;
91 };
92
93 #define hid_to_usb_dev(hid_dev) \
94 to_usb_device(hid_dev->dev.parent->parent)
95
96 #endif
97