0001
0002 #ifndef __USBHID_H
0003 #define __USBHID_H
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include <linux/types.h>
0015 #include <linux/slab.h>
0016 #include <linux/list.h>
0017 #include <linux/mutex.h>
0018 #include <linux/timer.h>
0019 #include <linux/wait.h>
0020 #include <linux/workqueue.h>
0021 #include <linux/input.h>
0022
0023
0024 void usbhid_init_reports(struct hid_device *hid);
0025 struct usb_interface *usbhid_find_interface(int minor);
0026
0027
0028 #define HID_CTRL_RUNNING 1
0029 #define HID_OUT_RUNNING 2
0030 #define HID_IN_RUNNING 3
0031 #define HID_RESET_PENDING 4
0032 #define HID_SUSPENDED 5
0033 #define HID_CLEAR_HALT 6
0034 #define HID_DISCONNECTED 7
0035 #define HID_STARTED 8
0036 #define HID_KEYS_PRESSED 10
0037 #define HID_NO_BANDWIDTH 11
0038 #define HID_RESUME_RUNNING 12
0039
0040
0041
0042
0043 #define HID_OPENED 13
0044
0045
0046
0047
0048
0049 #define HID_IN_POLLING 14
0050
0051
0052
0053
0054
0055
0056 struct usbhid_device {
0057 struct hid_device *hid;
0058
0059 struct usb_interface *intf;
0060 int ifnum;
0061
0062 unsigned int bufsize;
0063
0064 struct urb *urbin;
0065 char *inbuf;
0066 dma_addr_t inbuf_dma;
0067
0068 struct urb *urbctrl;
0069 struct usb_ctrlrequest *cr;
0070 struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE];
0071 unsigned char ctrlhead, ctrltail;
0072 char *ctrlbuf;
0073 dma_addr_t ctrlbuf_dma;
0074 unsigned long last_ctrl;
0075
0076 struct urb *urbout;
0077 struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE];
0078 unsigned char outhead, outtail;
0079 char *outbuf;
0080 dma_addr_t outbuf_dma;
0081 unsigned long last_out;
0082
0083 struct mutex mutex;
0084 spinlock_t lock;
0085 unsigned long iofl;
0086 struct timer_list io_retry;
0087 unsigned long stop_retry;
0088 unsigned int retry_delay;
0089 struct work_struct reset_work;
0090 wait_queue_head_t wait;
0091 };
0092
0093 #define hid_to_usb_dev(hid_dev) \
0094 to_usb_device(hid_dev->dev.parent->parent)
0095
0096 #endif
0097