diff options
| author | Ping Cheng <pingc@wacom.com> | 2008-11-24 11:44:27 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-11-26 10:14:18 -0500 |
| commit | 545f4e99dee7284ed57c79384c5c1d5ac58dcd59 (patch) | |
| tree | 96505bbc39ca58b2e7b9617d49ccba866938455d /drivers | |
| parent | 8442c87d2f6c73cdc9a391e4dd9390523d242bda (diff) | |
Input: wacom - add support for new USB Tablet PCs
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/input/tablet/wacom.h | 13 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_sys.c | 228 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.c | 160 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.h | 4 |
4 files changed, 356 insertions, 49 deletions
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h index ca62ec639f8f..677680e9f54f 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/input/tablet/wacom.h | |||
| @@ -66,6 +66,7 @@ | |||
| 66 | * - Support Intuos3 4x6 | 66 | * - Support Intuos3 4x6 |
| 67 | * v1.47 (pc) - Added support for Bamboo | 67 | * v1.47 (pc) - Added support for Bamboo |
| 68 | * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX | 68 | * v1.48 (pc) - Added support for Bamboo1, BambooFun, and Cintiq 12WX |
| 69 | * v1.49 (pc) - Added support for USB Tablet PC (0x90, 0x93, and 0x9A) | ||
| 69 | */ | 70 | */ |
| 70 | 71 | ||
| 71 | /* | 72 | /* |
| @@ -86,7 +87,7 @@ | |||
| 86 | /* | 87 | /* |
| 87 | * Version Information | 88 | * Version Information |
| 88 | */ | 89 | */ |
| 89 | #define DRIVER_VERSION "v1.48" | 90 | #define DRIVER_VERSION "v1.49" |
| 90 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 91 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
| 91 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" | 92 | #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" |
| 92 | #define DRIVER_LICENSE "GPL" | 93 | #define DRIVER_LICENSE "GPL" |
| @@ -103,15 +104,15 @@ struct wacom { | |||
| 103 | struct usb_device *usbdev; | 104 | struct usb_device *usbdev; |
| 104 | struct usb_interface *intf; | 105 | struct usb_interface *intf; |
| 105 | struct urb *irq; | 106 | struct urb *irq; |
| 106 | struct wacom_wac * wacom_wac; | 107 | struct wacom_wac *wacom_wac; |
| 107 | struct mutex lock; | 108 | struct mutex lock; |
| 108 | unsigned int open:1; | 109 | unsigned int open:1; |
| 109 | char phys[32]; | 110 | char phys[32]; |
| 110 | }; | 111 | }; |
| 111 | 112 | ||
| 112 | struct wacom_combo { | 113 | struct wacom_combo { |
| 113 | struct wacom * wacom; | 114 | struct wacom *wacom; |
| 114 | struct urb * urb; | 115 | struct urb *urb; |
| 115 | }; | 116 | }; |
| 116 | 117 | ||
| 117 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); | 118 | extern int wacom_wac_irq(struct wacom_wac * wacom_wac, void * wcombo); |
| @@ -132,7 +133,7 @@ extern void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wa | |||
| 132 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); | 133 | extern void input_dev_bee(struct input_dev *input_dev, struct wacom_wac *wacom_wac); |
| 133 | extern __u16 wacom_le16_to_cpu(unsigned char *data); | 134 | extern __u16 wacom_le16_to_cpu(unsigned char *data); |
| 134 | extern __u16 wacom_be16_to_cpu(unsigned char *data); | 135 | extern __u16 wacom_be16_to_cpu(unsigned char *data); |
| 135 | extern struct wacom_features * get_wacom_feature(const struct usb_device_id *id); | 136 | extern struct wacom_features *get_wacom_feature(const struct usb_device_id *id); |
| 136 | extern const struct usb_device_id * get_device_table(void); | 137 | extern const struct usb_device_id *get_device_table(void); |
| 137 | 138 | ||
| 138 | #endif | 139 | #endif |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 5fbc463baf5a..7fe73586e024 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -14,8 +14,41 @@ | |||
| 14 | #include "wacom.h" | 14 | #include "wacom.h" |
| 15 | #include "wacom_wac.h" | 15 | #include "wacom_wac.h" |
| 16 | 16 | ||
| 17 | /* defines to get HID report descriptor */ | ||
| 18 | #define HID_DEVICET_HID (USB_TYPE_CLASS | 0x01) | ||
| 19 | #define HID_DEVICET_REPORT (USB_TYPE_CLASS | 0x02) | ||
| 20 | #define HID_USAGE_UNDEFINED 0x00 | ||
| 21 | #define HID_USAGE_PAGE 0x05 | ||
| 22 | #define HID_USAGE_PAGE_DIGITIZER 0x0d | ||
| 23 | #define HID_USAGE_PAGE_DESKTOP 0x01 | ||
| 24 | #define HID_USAGE 0x09 | ||
| 25 | #define HID_USAGE_X 0x30 | ||
| 26 | #define HID_USAGE_Y 0x31 | ||
| 27 | #define HID_USAGE_X_TILT 0x3d | ||
| 28 | #define HID_USAGE_Y_TILT 0x3e | ||
| 29 | #define HID_USAGE_FINGER 0x22 | ||
| 30 | #define HID_USAGE_STYLUS 0x20 | ||
| 31 | #define HID_COLLECTION 0xc0 | ||
| 32 | |||
| 33 | enum { | ||
| 34 | WCM_UNDEFINED = 0, | ||
| 35 | WCM_DESKTOP, | ||
| 36 | WCM_DIGITIZER, | ||
| 37 | }; | ||
| 38 | |||
| 39 | struct hid_descriptor { | ||
| 40 | struct usb_descriptor_header header; | ||
| 41 | __le16 bcdHID; | ||
| 42 | u8 bCountryCode; | ||
| 43 | u8 bNumDescriptors; | ||
| 44 | u8 bDescriptorType; | ||
| 45 | __le16 wDescriptorLength; | ||
| 46 | } __attribute__ ((packed)); | ||
| 47 | |||
| 48 | /* defines to get/set USB message */ | ||
| 17 | #define USB_REQ_GET_REPORT 0x01 | 49 | #define USB_REQ_GET_REPORT 0x01 |
| 18 | #define USB_REQ_SET_REPORT 0x09 | 50 | #define USB_REQ_SET_REPORT 0x09 |
| 51 | #define WAC_HID_FEATURE_REPORT 0x03 | ||
| 19 | 52 | ||
| 20 | static int usb_get_report(struct usb_interface *intf, unsigned char type, | 53 | static int usb_get_report(struct usb_interface *intf, unsigned char type, |
| 21 | unsigned char id, void *buf, int size) | 54 | unsigned char id, void *buf, int size) |
| @@ -80,25 +113,21 @@ static void wacom_sys_irq(struct urb *urb) | |||
| 80 | void wacom_report_key(void *wcombo, unsigned int key_type, int key_data) | 113 | void wacom_report_key(void *wcombo, unsigned int key_type, int key_data) |
| 81 | { | 114 | { |
| 82 | input_report_key(get_input_dev((struct wacom_combo *)wcombo), key_type, key_data); | 115 | input_report_key(get_input_dev((struct wacom_combo *)wcombo), key_type, key_data); |
| 83 | return; | ||
| 84 | } | 116 | } |
| 85 | 117 | ||
| 86 | void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data) | 118 | void wacom_report_abs(void *wcombo, unsigned int abs_type, int abs_data) |
| 87 | { | 119 | { |
| 88 | input_report_abs(get_input_dev((struct wacom_combo *)wcombo), abs_type, abs_data); | 120 | input_report_abs(get_input_dev((struct wacom_combo *)wcombo), abs_type, abs_data); |
| 89 | return; | ||
| 90 | } | 121 | } |
| 91 | 122 | ||
| 92 | void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data) | 123 | void wacom_report_rel(void *wcombo, unsigned int rel_type, int rel_data) |
| 93 | { | 124 | { |
| 94 | input_report_rel(get_input_dev((struct wacom_combo *)wcombo), rel_type, rel_data); | 125 | input_report_rel(get_input_dev((struct wacom_combo *)wcombo), rel_type, rel_data); |
| 95 | return; | ||
| 96 | } | 126 | } |
| 97 | 127 | ||
| 98 | void wacom_input_event(void *wcombo, unsigned int type, unsigned int code, int value) | 128 | void wacom_input_event(void *wcombo, unsigned int type, unsigned int code, int value) |
| 99 | { | 129 | { |
| 100 | input_event(get_input_dev((struct wacom_combo *)wcombo), type, code, value); | 130 | input_event(get_input_dev((struct wacom_combo *)wcombo), type, code, value); |
| 101 | return; | ||
| 102 | } | 131 | } |
| 103 | 132 | ||
| 104 | __u16 wacom_be16_to_cpu(unsigned char *data) | 133 | __u16 wacom_be16_to_cpu(unsigned char *data) |
| @@ -118,7 +147,6 @@ __u16 wacom_le16_to_cpu(unsigned char *data) | |||
| 118 | void wacom_input_sync(void *wcombo) | 147 | void wacom_input_sync(void *wcombo) |
| 119 | { | 148 | { |
| 120 | input_sync(get_input_dev((struct wacom_combo *)wcombo)); | 149 | input_sync(get_input_dev((struct wacom_combo *)wcombo)); |
| 121 | return; | ||
| 122 | } | 150 | } |
| 123 | 151 | ||
| 124 | static int wacom_open(struct input_dev *dev) | 152 | static int wacom_open(struct input_dev *dev) |
| @@ -160,7 +188,7 @@ static void wacom_close(struct input_dev *dev) | |||
| 160 | 188 | ||
| 161 | void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | 189 | void input_dev_mo(struct input_dev *input_dev, struct wacom_wac *wacom_wac) |
| 162 | { | 190 | { |
| 163 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_1) | | 191 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_1) | |
| 164 | BIT_MASK(BTN_5); | 192 | BIT_MASK(BTN_5); |
| 165 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | 193 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
| 166 | } | 194 | } |
| @@ -170,7 +198,7 @@ void input_dev_g4(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
| 170 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); | 198 | input_dev->evbit[0] |= BIT_MASK(EV_MSC); |
| 171 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); | 199 | input_dev->mscbit[0] |= BIT_MASK(MSC_SERIAL); |
| 172 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); | 200 | input_dev->keybit[BIT_WORD(BTN_DIGI)] |= BIT_MASK(BTN_TOOL_FINGER); |
| 173 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_0) | | 201 | input_dev->keybit[BIT_WORD(BTN_MISC)] |= BIT_MASK(BTN_0) | |
| 174 | BIT_MASK(BTN_4); | 202 | BIT_MASK(BTN_4); |
| 175 | } | 203 | } |
| 176 | 204 | ||
| @@ -178,7 +206,7 @@ void input_dev_g(struct input_dev *input_dev, struct wacom_wac *wacom_wac) | |||
| 178 | { | 206 | { |
| 179 | input_dev->evbit[0] |= BIT_MASK(EV_REL); | 207 | input_dev->evbit[0] |= BIT_MASK(EV_REL); |
| 180 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); | 208 | input_dev->relbit[0] |= BIT_MASK(REL_WHEEL); |
| 181 | input_dev->keybit[BIT_WORD(BTN_LEFT)] |= BIT_MASK(BTN_LEFT) | | 209 | input_dev->keybit[BIT_WORD(BTN_MOUSE)] |= BIT_MASK(BTN_LEFT) | |
| 182 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); | 210 | BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE); |
| 183 | input_dev->keybit[BIT_ | ||
