diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-08-07 02:31:48 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-08-07 02:31:48 -0400 |
| commit | fc8104bc5a3f6f49d79f45f2706f79f77a9fb2ae (patch) | |
| tree | c30f3c27cb719f1e268f485640cfab9898557676 | |
| parent | 62238f3aadc9bc56da70100e19ec61b9f8d72a5f (diff) | |
| parent | f2e0a7d4a0b94b4274e3b7e15bf650d45a866f3c (diff) | |
Merge branch 'wacom' into next
Merge large update to Wacom driver, converting it from USB to a HID
driver and unifying wired and bluetooth support, from Benjamin
Tissoires.
| -rw-r--r-- | drivers/hid/Kconfig | 13 | ||||
| -rw-r--r-- | drivers/hid/Makefile | 4 | ||||
| -rw-r--r-- | drivers/hid/hid-core.c | 12 | ||||
| -rw-r--r-- | drivers/hid/hid-wacom.c | 973 | ||||
| -rw-r--r-- | drivers/hid/wacom.h (renamed from drivers/input/tablet/wacom.h) | 27 | ||||
| -rw-r--r-- | drivers/hid/wacom_sys.c (renamed from drivers/input/tablet/wacom_sys.c) | 1229 | ||||
| -rw-r--r-- | drivers/hid/wacom_wac.c (renamed from drivers/input/tablet/wacom_wac.c) | 1176 | ||||
| -rw-r--r-- | drivers/hid/wacom_wac.h (renamed from drivers/input/tablet/wacom_wac.h) | 22 | ||||
| -rw-r--r-- | drivers/input/tablet/Kconfig | 16 | ||||
| -rw-r--r-- | drivers/input/tablet/Makefile | 3 | ||||
| -rw-r--r-- | include/linux/hid.h | 5 |
11 files changed, 1361 insertions, 2119 deletions
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 5e79c6ad914f..4ed682cd1236 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
| @@ -748,12 +748,17 @@ config THRUSTMASTER_FF | |||
| 748 | Rumble Force or Force Feedback Wheel. | 748 | Rumble Force or Force Feedback Wheel. |
| 749 | 749 | ||
| 750 | config HID_WACOM | 750 | config HID_WACOM |
| 751 | tristate "Wacom Bluetooth devices support" | 751 | tristate "Wacom Intuos/Graphire tablet support (USB)" |
| 752 | depends on HID | 752 | depends on HID |
| 753 | depends on LEDS_CLASS | ||
| 754 | select POWER_SUPPLY | 753 | select POWER_SUPPLY |
| 755 | ---help--- | 754 | select NEW_LEDS |
| 756 | Support for Wacom Graphire Bluetooth and Intuos4 WL tablets. | 755 | select LEDS_CLASS |
| 756 | help | ||
| 757 | Say Y here if you want to use the USB or BT version of the Wacom Intuos | ||
| 758 | or Graphire tablet. | ||
| 759 | |||
| 760 | To compile this driver as a module, choose M here: the | ||
| 761 | module will be called wacom. | ||
| 757 | 762 | ||
| 758 | config HID_WIIMOTE | 763 | config HID_WIIMOTE |
| 759 | tristate "Nintendo Wii / Wii U peripherals" | 764 | tristate "Nintendo Wii / Wii U peripherals" |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index a6fa6baf368e..e38c772ace76 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
| @@ -115,7 +115,9 @@ obj-$(CONFIG_HID_UCLOGIC) += hid-uclogic.o | |||
| 115 | obj-$(CONFIG_HID_XINMO) += hid-xinmo.o | 115 | obj-$(CONFIG_HID_XINMO) += hid-xinmo.o |
| 116 | obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o | 116 | obj-$(CONFIG_HID_ZEROPLUS) += hid-zpff.o |
| 117 | obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o | 117 | obj-$(CONFIG_HID_ZYDACRON) += hid-zydacron.o |
| 118 | obj-$(CONFIG_HID_WACOM) += hid-wacom.o | 118 | |
| 119 | wacom-objs := wacom_wac.o wacom_sys.o | ||
| 120 | obj-$(CONFIG_HID_WACOM) += wacom.o | ||
| 119 | obj-$(CONFIG_HID_WALTOP) += hid-waltop.o | 121 | obj-$(CONFIG_HID_WALTOP) += hid-waltop.o |
| 120 | obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o | 122 | obj-$(CONFIG_HID_WIIMOTE) += hid-wiimote.o |
| 121 | obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o | 123 | obj-$(CONFIG_HID_SENSOR_HUB) += hid-sensor-hub.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 8ed66fd1ea87..b3181ea8f860 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -787,6 +787,15 @@ static int hid_scan_report(struct hid_device *hid) | |||
| 787 | /* hid-rmi should take care of them, not hid-generic */ | 787 | /* hid-rmi should take care of them, not hid-generic */ |
| 788 | hid->group = HID_GROUP_RMI; | 788 | hid->group = HID_GROUP_RMI; |
| 789 | 789 | ||
| 790 | /* | ||
| 791 | * Vendor specific handlings | ||
| 792 | */ | ||
| 793 | switch (hid->vendor) { | ||
| 794 | case USB_VENDOR_ID_WACOM: | ||
| 795 | hid->group = HID_GROUP_WACOM; | ||
| 796 | break; | ||
| 797 | } | ||
| 798 | |||
| 790 | vfree(parser); | 799 | vfree(parser); |
| 791 | return 0; | 800 | return 0; |
| 792 | } | 801 | } |
| @@ -1933,8 +1942,6 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1933 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | 1942 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, |
| 1934 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | 1943 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, |
| 1935 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | 1944 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, |
| 1936 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, | ||
| 1937 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, | ||
| 1938 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, | 1945 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, |
| 1939 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, | 1946 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, |
| 1940 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, | 1947 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, |
| @@ -2339,7 +2346,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
| 2339 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, | 2346 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) }, |
| 2340 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, | 2347 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_CYCLOPS) }, |
| 2341 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, | 2348 | { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LCSPEC) }, |
| 2342 | { HID_USB_DEVICE(USB_VENDOR_ID_WACOM, HID_ANY_ID) }, | ||
| 2343 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, | 2349 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20) }, |
| 2344 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, | 2350 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) }, |
| 2345 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, | 2351 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) }, |
diff --git a/drivers/hid/hid-wacom.c b/drivers/hid/hid-wacom.c deleted file mode 100644 index 902013ec041b..000000000000 --- a/drivers/hid/hid-wacom.c +++ /dev/null | |||
| @@ -1,973 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Bluetooth Wacom Tablet support | ||
| 3 | * | ||
| 4 | * Copyright (c) 1999 Andreas Gal | ||
| 5 | * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> | ||
| 6 | * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc | ||
| 7 | * Copyright (c) 2006-2007 Jiri Kosina | ||
| 8 | * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com> | ||
| 9 | * Copyright (c) 2006 Andrew Zabolotny <zap@homelink.ru> | ||
| 10 | * Copyright (c) 2009 Bastien Nocera <hadess@hadess.net> | ||
| 11 | * Copyright (c) 2011 Przemysław Firszt <przemo@firszt.eu> | ||
| 12 | */ | ||
| 13 | |||
| 14 | /* | ||
| 15 | * This program is free software; you can redistribute it and/or modify it | ||
| 16 | * under the terms of the GNU General Public License as published by the Free | ||
| 17 | * Software Foundation; either version 2 of the License, or (at your option) | ||
| 18 | * any later version. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
| 22 | |||
| 23 | #include <linux/device.h> | ||
| 24 | #include <linux/hid.h> | ||
| 25 | #include <linux/module.h> | ||
| 26 | #include <linux/leds.h> | ||
| 27 | #include <linux/slab.h> | ||
| 28 | #include <linux/power_supply.h> | ||
| 29 | |||
| 30 | #include "hid-ids.h" | ||
| 31 | |||
| 32 | #define PAD_DEVICE_ID 0x0F | ||
| 33 | |||
| 34 | #define WAC_CMD_LED_CONTROL 0x20 | ||
| 35 | #define WAC_CMD_ICON_START_STOP 0x21 | ||
| 36 | #define WAC_CMD_ICON_TRANSFER 0x26 | ||
| 37 | |||
| 38 | struct wacom_data { | ||
| 39 | __u16 tool; | ||
| 40 | __u16 butstate; | ||
| 41 | __u8 whlstate; | ||
| 42 | __u8 features; | ||
| 43 | __u32 id; | ||
| 44 | __u32 serial; | ||
| 45 | unsigned char high_speed; | ||
| 46 | __u8 battery_capacity; | ||
| 47 | __u8 power_raw; | ||
| 48 | __u8 ps_connected; | ||
| 49 | __u8 bat_charging; | ||
| 50 | struct power_supply battery; | ||
| 51 | struct power_supply ac; | ||
| 52 | __u8 led_selector; | ||
| 53 | struct led_classdev *leds[4]; | ||
| 54 | }; | ||
| 55 | |||
| 56 | /*percent of battery capacity for Graphire | ||
| 57 | 8th value means AC online and show 100% capacity */ | ||
| 58 | static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; | ||
| 59 | /*percent of battery capacity for Intuos4 WL, AC has a separate bit*/ | ||
| 60 | static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; | ||
| 61 | |||
| 62 | static enum power_supply_property wacom_battery_props[] = { | ||
| 63 | POWER_SUPPLY_PROP_PRESENT, | ||
| 64 | POWER_SUPPLY_PROP_CAPACITY, | ||
| 65 | POWER_SUPPLY_PROP_SCOPE, | ||
| 66 | POWER_SUPPLY_PROP_STATUS, | ||
| 67 | }; | ||
| 68 | |||
| 69 | static enum power_supply_property wacom_ac_props[] = { | ||
| 70 | POWER_SUPPLY_PROP_PRESENT, | ||
| 71 | POWER_SUPPLY_PROP_ONLINE, | ||
| 72 | POWER_SUPPLY_PROP_SCOPE, | ||
| 73 | }; | ||
| 74 | |||
| 75 | static void wacom_scramble(__u8 *image) | ||
| 76 | { | ||
| 77 | __u16 mask; | ||
| 78 | __u16 s1; | ||
| 79 | __u16 s2; | ||
| 80 | __u16 r1 ; | ||
| 81 | __u16 r2 ; | ||
| 82 | __u16 r; | ||
| 83 | __u8 buf[256]; | ||
| 84 | int i, w, x, y, z; | ||
| 85 | |||
| 86 | for (x = 0; x < 32; x++) { | ||
| 87 | for (y = 0; y < 8; y++) | ||
| 88 | buf[(8 * x) + (7 - y)] = image[(8 * x) + y]; | ||
| 89 | } | ||
| 90 | |||
| 91 | /* Change 76543210 into GECA6420 as required by Intuos4 WL | ||
| 92 | * HGFEDCBA HFDB7531 | ||
| 93 | */ | ||
| 94 | for (x = 0; x < 4; x++) { | ||
| 95 | for (y = 0; y < 4; y++) { | ||
| 96 | for (z = 0; z < 8; z++) { | ||
| 97 | mask = 0x0001; | ||
| 98 | r1 = 0; | ||
| 99 | r2 = 0; | ||
| 100 | i = (x << 6) + (y << 4) + z; | ||
| 101 | s1 = buf[i]; | ||
| 102 | s2 = buf[i+8]; | ||
| 103 | for (w = 0; w < 8; w++) { | ||
| 104 | r1 |= (s1 & mask); | ||
| 105 | r2 |= (s2 & mask); | ||
| 106 | s1 <<= 1; | ||
| 107 | s2 <<= 1; | ||
| 108 | mask <<= 2; | ||
| 109 | } | ||
| 110 | r = r1 | (r2 << 1); | ||
| 111 | i = (x << 6) + (y << 4) + (z << 1); | ||
| 112 | image[i] = 0xFF & r; | ||
| 113 | image[i+1] = (0xFF00 & r) >> 8; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | static void wacom_set_image(struct hid_device *hdev, const char *image, | ||
| 120 | __u8 icon_no) | ||
| 121 | { | ||
| 122 | __u8 rep_data[68]; | ||
| 123 | __u8 p[256]; | ||
| 124 | int ret, i, j; | ||
| 125 | |||
| 126 | for (i = 0; i < 256; i++) | ||
| 127 | p[i] = image[i]; | ||
| 128 | |||
| 129 | rep_data[0] = WAC_CMD_ICON_START_STOP; | ||
| 130 | rep_data[1] = 0; | ||
| 131 | ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2, | ||
| 132 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 133 | if (ret < 0) | ||
| 134 | goto err; | ||
| 135 | |||
| 136 | rep_data[0] = WAC_CMD_ICON_TRANSFER; | ||
| 137 | rep_data[1] = icon_no & 0x07; | ||
| 138 | |||
| 139 | wacom_scramble(p); | ||
| 140 | |||
| 141 | for (i = 0; i < 4; i++) { | ||
| 142 | for (j = 0; j < 64; j++) | ||
| 143 | rep_data[j + 3] = p[(i << 6) + j]; | ||
| 144 | |||
| 145 | rep_data[2] = i; | ||
| 146 | ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 67, | ||
| 147 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 148 | } | ||
| 149 | |||
| 150 | rep_data[0] = WAC_CMD_ICON_START_STOP; | ||
| 151 | rep_data[1] = 0; | ||
| 152 | |||
| 153 | ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2, | ||
| 154 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 155 | |||
| 156 | err: | ||
| 157 | return; | ||
| 158 | } | ||
| 159 | |||
| 160 | static void wacom_leds_set_brightness(struct led_classdev *led_dev, | ||
| 161 | enum led_brightness value) | ||
| 162 | { | ||
| 163 | struct device *dev = led_dev->dev->parent; | ||
| 164 | struct hid_device *hdev; | ||
| 165 | struct wacom_data *wdata; | ||
| 166 | unsigned char *buf; | ||
| 167 | __u8 led = 0; | ||
| 168 | int i; | ||
| 169 | |||
| 170 | hdev = container_of(dev, struct hid_device, dev); | ||
| 171 | wdata = hid_get_drvdata(hdev); | ||
| 172 | for (i = 0; i < 4; ++i) { | ||
| 173 | if (wdata->leds[i] == led_dev) | ||
| 174 | wdata->led_selector = i; | ||
| 175 | } | ||
| 176 | |||
| 177 | led = wdata->led_selector | 0x04; | ||
| 178 | buf = kzalloc(9, GFP_KERNEL); | ||
| 179 | if (buf) { | ||
| 180 | buf[0] = WAC_CMD_LED_CONTROL; | ||
| 181 | buf[1] = led; | ||
| 182 | buf[2] = value >> 2; | ||
| 183 | buf[3] = value; | ||
| 184 | /* use fixed brightness for OLEDs */ | ||
| 185 | buf[4] = 0x08; | ||
| 186 | hid_hw_raw_request(hdev, buf[0], buf, 9, HID_FEATURE_REPORT, | ||
| 187 | HID_REQ_SET_REPORT); | ||
| 188 | kfree(buf); | ||
| 189 | } | ||
| 190 | |||
| 191 | return; | ||
| 192 | } | ||
| 193 | |||
| 194 | static enum led_brightness wacom_leds_get_brightness(struct led_classdev *led_dev) | ||
| 195 | { | ||
| 196 | struct wacom_data *wdata; | ||
| 197 | struct device *dev = led_dev->dev->parent; | ||
| 198 | int value = 0; | ||
| 199 | int i; | ||
| 200 | |||
| 201 | wdata = hid_get_drvdata(container_of(dev, struct hid_device, dev)); | ||
| 202 | |||
| 203 | for (i = 0; i < 4; ++i) { | ||
| 204 | if (wdata->leds[i] == led_dev) { | ||
| 205 | value = wdata->leds[i]->brightness; | ||
| 206 | break; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | return value; | ||
| 211 | } | ||
| 212 | |||
| 213 | |||
| 214 | static int wacom_initialize_leds(struct hid_device *hdev) | ||
| 215 | { | ||
| 216 | struct wacom_data *wdata = hid_get_drvdata(hdev); | ||
| 217 | struct led_classdev *led; | ||
| 218 | struct device *dev = &hdev->dev; | ||
| 219 | size_t namesz = strlen(dev_name(dev)) + 12; | ||
| 220 | char *name; | ||
| 221 | int i, ret; | ||
| 222 | |||
| 223 | wdata->led_selector = 0; | ||
| 224 | |||
| 225 | for (i = 0; i < 4; i++) { | ||
| 226 | led = kzalloc(sizeof(struct led_classdev) + namesz, GFP_KERNEL); | ||
| 227 | if (!led) { | ||
| 228 | hid_warn(hdev, | ||
| 229 | "can't allocate memory for LED selector\n"); | ||
| 230 | ret = -ENOMEM; | ||
| 231 | goto err; | ||
| 232 | } | ||
| 233 | |||
| 234 | name = (void *)&led[1]; | ||
| 235 | snprintf(name, namesz, "%s:selector:%d", dev_name(dev), i); | ||
| 236 | led->name = name; | ||
| 237 | led->brightness = 0; | ||
| 238 | led->max_brightness = 127; | ||
| 239 | led->brightness_get = wacom_leds_get_brightness; | ||
| 240 | led->brightness_set = wacom_leds_set_brightness; | ||
| 241 | |||
| 242 | wdata->leds[i] = led; | ||
| 243 | |||
| 244 | ret = led_classdev_register(dev, wdata->leds[i]); | ||
| 245 | |||
| 246 | if (ret) { | ||
| 247 | wdata->leds[i] = NULL; | ||
| 248 | kfree(led); | ||
| 249 | hid_warn(hdev, "can't register LED\n"); | ||
| 250 | goto err; | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | err: | ||
| 255 | return ret; | ||
| 256 | } | ||
| 257 | |||
| 258 | static void wacom_destroy_leds(struct hid_device *hdev) | ||
| 259 | { | ||
| 260 | struct wacom_data *wdata = hid_get_drvdata(hdev); | ||
| 261 | struct led_classdev *led; | ||
| 262 | int i; | ||
| 263 | |||
| 264 | for (i = 0; i < 4; ++i) { | ||
| 265 | if (wdata->leds[i]) { | ||
| 266 | led = wdata->leds[i]; | ||
| 267 | wdata->leds[i] = NULL; | ||
| 268 | led_classdev_unregister(led); | ||
| 269 | kfree(led); | ||
| 270 | } | ||
| 271 | } | ||
| 272 | |||
| 273 | } | ||
| 274 | |||
| 275 | static int wacom_battery_get_property(struct power_supply *psy, | ||
| 276 | enum power_supply_property psp, | ||
| 277 | union power_supply_propval *val) | ||
| 278 | { | ||
| 279 | struct wacom_data *wdata = container_of(psy, | ||
| 280 | struct wacom_data, battery); | ||
| 281 | int ret = 0; | ||
| 282 | |||
| 283 | switch (psp) { | ||
| 284 | case POWER_SUPPLY_PROP_PRESENT: | ||
| 285 | val->intval = 1; | ||
| 286 | break; | ||
| 287 | case POWER_SUPPLY_PROP_SCOPE: | ||
| 288 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | ||
| 289 | break; | ||
| 290 | case POWER_SUPPLY_PROP_CAPACITY: | ||
| 291 | val->intval = wdata->battery_capacity; | ||
| 292 | break; | ||
| 293 | case POWER_SUPPLY_PROP_STATUS: | ||
| 294 | if (wdata->bat_charging) | ||
| 295 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | ||
| 296 | else | ||
| 297 | if (wdata->battery_capacity == 100 && wdata->ps_connected) | ||
| 298 | val->intval = POWER_SUPPLY_STATUS_FULL; | ||
| 299 | else | ||
| 300 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 301 | break; | ||
| 302 | default: | ||
| 303 | ret = -EINVAL; | ||
| 304 | break; | ||
| 305 | } | ||
| 306 | return ret; | ||
| 307 | } | ||
| 308 | |||
| 309 | static int wacom_ac_get_property(struct power_supply *psy, | ||
| 310 | enum power_supply_property psp, | ||
| 311 | union power_supply_propval *val) | ||
| 312 | { | ||
| 313 | struct wacom_data *wdata = container_of(psy, struct wacom_data, ac); | ||
| 314 | int ret = 0; | ||
| 315 | |||
| 316 | switch (psp) { | ||
| 317 | case POWER_SUPPLY_PROP_PRESENT: | ||
| 318 | /* fall through */ | ||
| 319 | case POWER_SUPPLY_PROP_ONLINE: | ||
| 320 | val->intval = wdata->ps_connected; | ||
| 321 | break; | ||
| 322 | case POWER_SUPPLY_PROP_SCOPE: | ||
| 323 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | ||
| 324 | break; | ||
| 325 | default: | ||
| 326 | ret = -EINVAL; | ||
| 327 | break; | ||
| 328 | } | ||
| 329 | return ret; | ||
| 330 | } | ||
| 331 | |||
| 332 | static void wacom_set_features(struct hid_device *hdev, u8 speed) | ||
| 333 | { | ||
| 334 | struct wacom_data *wdata = hid_get_drvdata(hdev); | ||
| 335 | int limit, ret; | ||
| 336 | __u8 rep_data[2]; | ||
| 337 | |||
| 338 | switch (hdev->product) { | ||
| 339 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: | ||
| 340 | rep_data[0] = 0x03 ; rep_data[1] = 0x00; | ||
| 341 | limit = 3; | ||
| 342 | do { | ||
| 343 | ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2, | ||
| 344 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 345 | } while (ret < 0 && limit-- > 0); | ||
| 346 | |||
| 347 | if (ret >= 0) { | ||
| 348 | if (speed == 0) | ||
| 349 | rep_data[0] = 0x05; | ||
| 350 | else | ||
| 351 | rep_data[0] = 0x06; | ||
| 352 | |||
| 353 | rep_data[1] = 0x00; | ||
| 354 | limit = 3; | ||
| 355 | do { | ||
| 356 | ret = hid_hw_raw_request(hdev, rep_data[0], | ||
| 357 | rep_data, 2, HID_FEATURE_REPORT, | ||
| 358 | HID_REQ_SET_REPORT); | ||
| 359 | } while (ret < 0 && limit-- > 0); | ||
| 360 | |||
| 361 | if (ret >= 0) { | ||
| 362 | wdata->high_speed = speed; | ||
| 363 | return; | ||
| 364 | } | ||
| 365 | } | ||
| 366 | |||
| 367 | /* | ||
| 368 | * Note that if the raw queries fail, it's not a hard failure | ||
| 369 | * and it is safe to continue | ||
| 370 | */ | ||
| 371 | hid_warn(hdev, "failed to poke device, command %d, err %d\n", | ||
| 372 | rep_data[0], ret); | ||
| 373 | break; | ||
| 374 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: | ||
| 375 | if (speed == 1) | ||
| 376 | wdata->features &= ~0x20; | ||
| 377 | else | ||
| 378 | wdata->features |= 0x20; | ||
| 379 | |||
| 380 | rep_data[0] = 0x03; | ||
| 381 | rep_data[1] = wdata->features; | ||
| 382 | |||
| 383 | ret = hid_hw_raw_request(hdev, rep_data[0], rep_data, 2, | ||
| 384 | HID_FEATURE_REPORT, HID_REQ_SET_REPORT); | ||
| 385 | if (ret >= 0) | ||
| 386 | wdata->high_speed = speed; | ||
| 387 | break; | ||
| 388 | } | ||
| 389 | |||
| 390 | return; | ||
| 391 | } | ||
| 392 | |||
| 393 | static ssize_t wacom_show_speed(struct device *dev, | ||
| 394 | struct device_attribute | ||
| 395 | *attr, char *buf) | ||
| 396 | { | ||
| 397 | struct wacom_data *wdata = dev_get_drvdata(dev); | ||
| 398 | |||
| 399 | return snprintf(buf, PAGE_SIZE, "%i\n", wdata->high_speed); | ||
| 400 | } | ||
| 401 | |||
| 402 | static ssize_t wacom_store_speed(struct device *dev, | ||
| 403 | struct device_attribute *attr, | ||
| 404 | const char *buf, size_t count) | ||
| 405 | { | ||
| 406 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 407 | int new_speed; | ||
| 408 | |||
| 409 | if (sscanf(buf, "%1d", &new_speed ) != 1) | ||
| 410 | return -EINVAL; | ||
| 411 | |||
| 412 | if (new_speed == 0 || new_speed == 1) { | ||
| 413 | wacom_set_features(hdev, new_speed); | ||
| 414 | return strnlen(buf, PAGE_SIZE); | ||
| 415 | } else | ||
| 416 | return -EINVAL; | ||
| 417 | } | ||
| 418 | |||
| 419 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, | ||
| 420 | wacom_show_speed, wacom_store_speed); | ||
| 421 | |||
| 422 | #define WACOM_STORE(OLED_ID) \ | ||
| 423 | static ssize_t wacom_oled##OLED_ID##_store(struct device *dev, \ | ||
| 424 | struct device_attribute *attr, \ | ||
| 425 | const char *buf, size_t count) \ | ||
| 426 | { \ | ||
| 427 | struct hid_device *hdev = container_of(dev, struct hid_device, \ | ||
| 428 | dev); \ | ||
| 429 | \ | ||
| 430 | if (count != 256) \ | ||
| 431 | return -EINVAL; \ | ||
| 432 | \ | ||
| 433 | wacom_set_image(hdev, buf, OLED_ID); \ | ||
| 434 | \ | ||
| 435 | return count; \ | ||
| 436 | } \ | ||
| 437 | \ | ||
| 438 | static DEVICE_ATTR(oled##OLED_ID##_img, S_IWUSR | S_IWGRP, NULL, \ | ||
| 439 | wacom_oled##OLED_ID##_store) | ||
| 440 | |||
| 441 | WACOM_STORE(0); | ||
| 442 | WACOM_STORE(1); | ||
| 443 | WACOM_STORE(2); | ||
| 444 | WACOM_STORE(3); | ||
| 445 | WACOM_STORE(4); | ||
| 446 | WACOM_STORE(5); | ||
| 447 | WACOM_STORE(6); | ||
| 448 | WACOM_STORE(7); | ||
| 449 | |||
| 450 | static int wacom_gr_parse_report(struct hid_device *hdev, | ||
| 451 | struct wacom_data *wdata, | ||
| 452 | struct input_dev *input, unsigned char *data) | ||
| 453 | { | ||
| 454 | int tool, x, y, rw; | ||
| 455 | |||
| 456 | tool = 0; | ||
| 457 | /* Get X & Y positions */ | ||
| 458 | x = le16_to_cpu(*(__le16 *) &data[2]); | ||
| 459 | y = le16_to_cpu(*(__le16 *) &data[4]); | ||
| 460 | |||
| 461 | /* Get current tool identifier */ | ||
| 462 | if (data[1] & 0x90) { /* If pen is in the in/active area */ | ||
| 463 | switch ((data[1] >> 5) & 3) { | ||
| 464 | case 0: /* Pen */ | ||
| 465 | tool = BTN_TOOL_PEN; | ||
| 466 | break; | ||
| 467 | |||
| 468 | case 1: /* Rubber */ | ||
| 469 | tool = BTN_TOOL_RUBBER; | ||
| 470 | break; | ||
| 471 | |||
| 472 | case 2: /* Mouse with wheel */ | ||
| 473 | case 3: /* Mouse without wheel */ | ||
| 474 | tool = BTN_TOOL_MOUSE; | ||
| 475 | break; | ||
| 476 | } | ||
| 477 | |||
| 478 | /* Reset tool if out of active tablet area */ | ||
| 479 | if (!(data[1] & 0x10)) | ||
| 480 | tool = 0; | ||
| 481 | } | ||
| 482 | |||
| 483 | /* If tool changed, notify input subsystem */ | ||
| 484 | if (wdata->tool != tool) { | ||
| 485 | if (wdata->tool) { | ||
| 486 | /* Completely reset old tool state */ | ||
| 487 | if (wdata->tool == BTN_TOOL_MOUSE) { | ||
| 488 | input_report_key(input, BTN_LEFT, 0); | ||
| 489 | input_report_key(input, BTN_RIGHT, 0); | ||
| 490 | input_report_key(input, BTN_MIDDLE, 0); | ||
| 491 | input_report_abs(input, ABS_DISTANCE, | ||
| 492 | input_abs_get_max(input, ABS_DISTANCE)); | ||
| 493 | } else { | ||
| 494 | input_report_key(input, BTN_TOUCH, 0); | ||
| 495 | input_report_key(input, BTN_STYLUS, 0); | ||
| 496 | input_report_key(input, BTN_STYLUS2, 0); | ||
| 497 | input_report_abs(input, ABS_PRESSURE, 0); | ||
| 498 | } | ||
| 499 | input_report_key(input, wdata->tool, 0); | ||
| 500 | input_sync(input); | ||
| 501 | } | ||
| 502 | wdata->tool = tool; | ||
| 503 | if (tool) | ||
| 504 | input_report_key(input, tool, 1); | ||
| 505 | } | ||
| 506 | |||
| 507 | if (tool) { | ||
| 508 | input_report_abs(input, ABS_X, x); | ||
| 509 | input_report_abs(input, ABS_Y, y); | ||
| 510 | |||
| 511 | switch ((data[1] >> 5) & 3) { | ||
| 512 | case 2: /* Mouse with wheel */ | ||
| 513 | input_report_key(input, BTN_MIDDLE, data[1] & 0x04); | ||
| 514 | rw = (data[6] & 0x01) ? -1 : | ||
| 515 | (data[6] & 0x02) ? 1 : 0; | ||
| 516 | input_report_rel(input, REL_WHEEL, rw); | ||
| 517 | /* fall through */ | ||
| 518 | |||
| 519 | case 3: /* Mouse without wheel */ | ||
| 520 | input_report_key(input, BTN_LEFT, data[1] & 0x01); | ||
| 521 | input_report_key(input, BTN_RIGHT, data[1] & 0x02); | ||
| 522 | /* Compute distance between mouse and tablet */ | ||
| 523 | rw = 44 - (data[6] >> 2); | ||
| 524 | if (rw < 0) | ||
| 525 | rw = 0; | ||
| 526 | else if (rw > 31) | ||
| 527 | rw = 31; | ||
| 528 | input_report_abs(input, ABS_DISTANCE, rw); | ||
| 529 | break; | ||
| 530 | |||
| 531 | default: | ||
| 532 | input_report_abs(input, ABS_PRESSURE, | ||
| 533 | data[6] | (((__u16) (data[1] & 0x08)) << 5)); | ||
| 534 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); | ||
| 535 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | ||
| 536 | input_report_key(input, BTN_STYLUS2, (tool == BTN_TOOL_PEN) && data[1] & 0x04); | ||
| 537 | break; | ||
| 538 | } | ||
| 539 | |||
| 540 | input_sync(input); | ||
| 541 | } | ||
| 542 | |||
| 543 | /* Report the state of the two buttons at the top of the tablet | ||
| 544 | * as two extra fingerpad keys (buttons 4 & 5). */ | ||
| 545 | rw = data[7] & 0x03; | ||
| 546 | if (rw != wdata->butstate) { | ||
| 547 | wdata->butstate = rw; | ||
| 548 | input_report_key(input, BTN_0, rw & 0x02); | ||
| 549 | input_report_key(input, BTN_1, rw & 0x01); | ||
| 550 | input_report_key(input, BTN_TOOL_FINGER, 0xf0); | ||
| 551 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | ||
| 552 | input_sync(input); | ||
| 553 | } | ||
| 554 | |||
| 555 | /* Store current battery capacity and power supply state*/ | ||
| 556 | rw = (data[7] >> 2 & 0x07); | ||
| 557 | if (rw != wdata->power_raw) { | ||
| 558 | wdata->power_raw = rw; | ||
| 559 | wdata->battery_capacity = batcap_gr[rw]; | ||
| 560 | if (rw == 7) | ||
| 561 | wdata->ps_connected = 1; | ||
| 562 | else | ||
| 563 | wdata->ps_connected = 0; | ||
| 564 | } | ||
| 565 | return 1; | ||
| 566 | } | ||
| 567 | |||
| 568 | static void wacom_i4_parse_button_report(struct wacom_data *wdata, | ||
| 569 | struct input_dev *input, unsigned char *data) | ||
| 570 | { | ||
| 571 | __u16 new_butstate; | ||
| 572 | __u8 new_whlstate; | ||
| 573 | __u8 sync = 0; | ||
| 574 | |||
| 575 | new_whlstate = data[1]; | ||
| 576 | if (new_whlstate != wdata->whlstate) { | ||
| 577 | wdata->whlstate = new_whlstate; | ||
| 578 | if (new_whlstate & 0x80) { | ||
| 579 | input_report_key(input, BTN_TOUCH, 1); | ||
| 580 | input_report_abs(input, ABS_WHEEL, (new_whlstate & 0x7f)); | ||
| 581 | input_report_key(input, BTN_TOOL_FINGER, 1); | ||
| 582 | } else { | ||
| 583 | input_report_key(input, BTN_TOUCH, 0); | ||
| 584 | input_report_abs(input, ABS_WHEEL, 0); | ||
| 585 | input_report_key(input, BTN_TOOL_FINGER, 0); | ||
| 586 | } | ||
| 587 | sync = 1; | ||
| 588 | } | ||
| 589 | |||
| 590 | new_butstate = (data[3] << 1) | (data[2] & 0x01); | ||
| 591 | if (new_butstate != wdata->butstate) { | ||
| 592 | wdata->butstate = new_butstate; | ||
| 593 | input_report_key(input, BTN_0, new_butstate & 0x001); | ||
| 594 | input_report_key(input, BTN_1, new_butstate & 0x002); | ||
| 595 | input_report_key(input, BTN_2, new_butstate & 0x004); | ||
| 596 | input_report_key(input, BTN_3, new_butstate & 0x008); | ||
| 597 | input_report_key(input, BTN_4, new_butstate & 0x010); | ||
| 598 | input_report_key(input, BTN_5, new_butstate & 0x020); | ||
| 599 | input_report_key(input, BTN_6, new_butstate & 0x040); | ||
| 600 | input_report_key(input, BTN_7, new_butstate & 0x080); | ||
| 601 | input_report_key(input, BTN_8, new_butstate & 0x100); | ||
| 602 | input_report_key(input, BTN_TOOL_FINGER, 1); | ||
| 603 | sync = 1; | ||
| 604 | } | ||
| 605 | |||
| 606 | if (sync) { | ||
| 607 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); | ||
| 608 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); | ||
| 609 | input_sync(input); | ||
| 610 | } | ||
| 611 | } | ||
| 612 | |||
| 613 | static void wacom_i4_parse_pen_report(struct wacom_data *wdata, | ||
| 614 | struct input_dev *input, unsigned char *data) | ||
| 615 | { | ||
| 616 | __u16 x, y, pressure; | ||
| 617 | __u8 distance; | ||
| 618 | __u8 tilt_x, tilt_y; | ||
| 619 | |||
| 620 | switch (data[1]) { | ||
| 621 | case 0x80: /* Out of proximity report */ | ||
| 622 | input_report_key(input, BTN_TOUCH, 0); | ||
| 623 | input_report_abs(input, ABS_PRESSURE, 0); | ||
| 624 | input_report_key(input, BTN_STYLUS, 0); | ||
| 625 | input_report_key(input, BTN_STYLUS2, 0); | ||
| 626 | input_report_key(input, wdata->tool, 0); | ||
| 627 | input_report_abs(input, ABS_MISC, 0); | ||
| 628 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); | ||
| 629 | wdata->tool = 0; | ||
| 630 | input_sync(input); | ||
| 631 | break; | ||
| 632 | case 0xC2: /* Tool report */ | ||
| 633 | wdata->id = ((data[2] << 4) | (data[3] >> 4) | | ||
| 634 | ((data[7] & 0x0f) << 20) | | ||
| 635 | ((data[8] & 0xf0) << 12)); | ||
| 636 | wdata->serial = ((data[3] & 0x0f) << 28) + | ||
| 637 | (data[4] << 20) + (data[5] << 12) + | ||
| 638 | (data[6] << 4) + (data[7] >> 4); | ||
| 639 | |||
| 640 | switch (wdata->id) { | ||
| 641 | case 0x100802: | ||
| 642 | wdata->tool = BTN_TOOL_PEN; | ||
| 643 | break; | ||
| 644 | case 0x10080A: | ||
| 645 | wdata->tool = BTN_TOOL_RUBBER; | ||
| 646 | break; | ||
| 647 | } | ||
| 648 | break; | ||
| 649 | default: /* Position/pressure report */ | ||
| 650 | x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1); | ||
| 651 | y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01); | ||
| 652 | pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5) | ||
| 653 | | (data[1] & 0x01); | ||
| 654 | distance = (data[9] >> 2) & 0x3f; | ||
| 655 | tilt_x = ((data[7] << 1) & 0x7e) | (data[8] >> 7); | ||
| 656 | tilt_y = data[8] & 0x7f; | ||
| 657 | |||
| 658 | input_report_key(input, BTN_TOUCH, pressure > 1); | ||
| 659 | |||
| 660 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | ||
| 661 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); | ||
| 662 | input_report_key(input, wdata->tool, 1); | ||
| 663 | input_report_abs(input, ABS_X, x); | ||
| 664 | input_report_abs(input, ABS_Y, y); | ||
| 665 | input_report_abs(input, ABS_PRESSURE, pressure); | ||
| 666 | input_report_abs(input, ABS_DISTANCE, distance); | ||
| 667 | input_report_abs(input, ABS_TILT_X, tilt_x); | ||
| 668 | input_report_abs(input, ABS_TILT_Y, tilt_y); | ||
| 669 | input_report_abs(input, ABS_MISC, wdata->id); | ||
| 670 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); | ||
| 671 | input_report_key(input, wdata->tool, 1); | ||
| 672 | input_sync(input); | ||
| 673 | break; | ||
| 674 | } | ||
| 675 | |||
| 676 | return; | ||
| 677 | } | ||
| 678 | |||
| 679 | static void wacom_i4_parse_report(struct hid_device *hdev, | ||
| 680 | struct wacom_data *wdata, | ||
| 681 | struct input_dev *input, unsigned char *data) | ||
| 682 | { | ||
| 683 | switch (data[0]) { | ||
| 684 | case 0x00: /* Empty report */ | ||
| 685 | break; | ||
| 686 | case 0x02: /* Pen report */ | ||
| 687 | wacom_i4_parse_pen_report(wdata, input, data); | ||
| 688 | break; | ||
| 689 | case 0x03: /* Features Report */ | ||
| 690 | wdata->features = data[2]; | ||
| 691 | break; | ||
| 692 | case 0x0C: /* Button report */ | ||
| 693 | wacom_i4_parse_button_report(wdata, input, data); | ||
| 694 | break; | ||
| 695 | default: | ||
| 696 | hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]); | ||
| 697 | break; | ||
| 698 | } | ||
| 699 | } | ||
| 700 | |||
| 701 | static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, | ||
| 702 | u8 *raw_data, int size) | ||
| 703 | { | ||
| 704 | struct wacom_data *wdata = hid_get_drvdata(hdev); | ||
| 705 | struct hid_input *hidinput; | ||
| 706 | struct input_dev *input; | ||
| 707 | unsigned char *data = (unsigned char *) raw_data; | ||
| 708 | int i; | ||
| 709 | __u8 power_raw; | ||
| 710 | |||
| 711 | if (!(hdev->claimed & HID_CLAIMED_INPUT)) | ||
| 712 | return 0; | ||
| 713 | |||
| 714 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); | ||
| 715 | input = hidinput->input; | ||
| 716 | |||
| 717 | switch (hdev->product) { | ||
| 718 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: | ||
| 719 | if (data[0] == 0x03) { | ||
| 720 | return wacom_gr_parse_report(hdev, wdata, input, data); | ||
| 721 | } else { | ||
| 722 | hid_err(hdev, "Unknown report: %d,%d size:%d\n", | ||
| 723 | data[0], data[1], size); | ||
| 724 | return 0; | ||
| 725 | } | ||
| 726 | break; | ||
| 727 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: | ||
| 728 | i = 1; | ||
| 729 | |||
| 730 | switch (data[0]) { | ||
| 731 | case 0x04: | ||
| 732 | wacom_i4_parse_report(hdev, wdata, input, data + i); | ||
| 733 | i += 10; | ||
| 734 | /* fall through */ | ||
| 735 | case 0x03: | ||
| 736 | wacom_i4_parse_report(hdev, wdata, input, data + i); | ||
| 737 | i += 10; | ||
| 738 | wacom_i4_parse_report(hdev, wdata, input, data + i); | ||
| 739 | power_raw = data[i+10]; | ||
| 740 | if (power_raw != wdata->power_raw) { | ||
| 741 | wdata->power_raw = power_raw; | ||
| 742 | wdata->battery_capacity = batcap_i4[power_raw & 0x07]; | ||
| 743 | wdata->bat_charging = (power_raw & 0x08) ? 1 : 0; | ||
| 744 | wdata->ps_connected = (power_raw & 0x10) ? 1 : 0; | ||
| 745 | } | ||
| 746 | |||
| 747 | break; | ||
| 748 | default: | ||
| 749 | hid_err(hdev, "Unknown report: %d,%d size:%d\n", | ||
| 750 | data[0], data[1], size); | ||
| 751 | return 0; | ||
| 752 | } | ||
| 753 | } | ||
| 754 | return 1; | ||
| 755 | } | ||
| 756 | |||
| 757 | static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, | ||
| 758 | struct hid_field *field, struct hid_usage *usage, unsigned long **bit, | ||
| 759 | int *max) | ||
| 760 | { | ||
| 761 | struct input_dev *input = hi->input; | ||
| 762 | |||
| 763 | __set_bit(INPUT_PROP_POINTER, input->propbit); | ||
| 764 | |||
| 765 | /* Basics */ | ||
| 766 | input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL); | ||
| 767 | |||
| 768 | __set_bit(REL_WHEEL, input->relbit); | ||
| 769 | |||
| 770 | __set_bit(BTN_TOOL_PEN, input->keybit); | ||
| 771 | __set_bit(BTN_TOUCH, input->keybit); | ||
| 772 | __set_bit(BTN_STYLUS, input->keybit); | ||
| 773 | __set_bit(BTN_STYLUS2, input->keybit); | ||
| 774 | __set_bit(BTN_LEFT, input->keybit); | ||
| 775 | __set_bit(BTN_RIGHT, input->keybit); | ||
| 776 | __set_bit(BTN_MIDDLE, input->keybit); | ||
| 777 | |||
| 778 | /* Pad */ | ||
| 779 | input_set_capability(input, EV_MSC, MSC_SERIAL); | ||
| 780 | |||
| 781 | __set_bit(BTN_0, input->keybit); | ||
| 782 | __set_bit(BTN_1, input->keybit); | ||
| 783 | __set_bit(BTN_TOOL_FINGER, input->keybit); | ||
| 784 | |||
| 785 | /* Distance, rubber and mouse */ | ||
| 786 | __set_bit(BTN_TOOL_RUBBER, input->keybit); | ||
| 787 | __set_bit(BTN_TOOL_MOUSE, input->keybit); | ||
| 788 | |||
| 789 | switch (hdev->product) { | ||
| 790 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: | ||
| 791 | input_set_abs_params(input, ABS_X, 0, 16704, 4, 0); | ||
| 792 | input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0); | ||
| 793 | input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0); | ||
| 794 | input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0); | ||
| 795 | break; | ||
| 796 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: | ||
| 797 | __set_bit(ABS_WHEEL, input->absbit); | ||
| 798 | __set_bit(ABS_MISC, input->absbit); | ||
| 799 | __set_bit(BTN_2, input->keybit); | ||
| 800 | __set_bit(BTN_3, input->keybit); | ||
| 801 | __set_bit(BTN_4, input->keybit); | ||
| 802 | __set_bit(BTN_5, input->keybit); | ||
| 803 | __set_bit(BTN_6, input->keybit); | ||
| 804 | __set_bit(BTN_7, input->keybit); | ||
| 805 | __set_bit(BTN_8, input->keybit); | ||
| 806 | input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); | ||
| 807 | input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); | ||
| 808 | input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); | ||
| 809 | input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); | ||
| 810 | input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0); | ||
| 811 | input_set_abs_params(input, ABS_TILT_X, 0, 127, 0, 0); | ||
| 812 | input_set_abs_params(input, ABS_TILT_Y, 0, 127, 0, 0); | ||
| 813 | break; | ||
| 814 | } | ||
| 815 | |||
| 816 | return 0; | ||
| 817 | } | ||
| 818 | |||
| 819 | static int wacom_probe(struct hid_device *hdev, | ||
| 820 | const struct hid_device_id *id) | ||
| 821 | { | ||
| 822 | struct wacom_data *wdata; | ||
| 823 | int ret; | ||
| 824 | |||
| 825 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); | ||
| 826 | if (wdata == NULL) { | ||
| 827 | hid_err(hdev, "can't alloc wacom descriptor\n"); | ||
| 828 | return -ENOMEM; | ||
| 829 | } | ||
| 830 | |||
| 831 | hid_set_drvdata(hdev, wdata); | ||
| 832 | |||
| 833 | /* Parse the HID report now */ | ||
| 834 | ret = hid_parse(hdev); | ||
| 835 | if (ret) { | ||
| 836 | hid_err(hdev, "parse failed\n"); | ||
| 837 | goto err_free; | ||
| 838 | } | ||
| 839 | |||
| 840 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
| 841 | if (ret) { | ||
| 842 | hid_err(hdev, "hw start failed\n"); | ||
| 843 | goto err_free; | ||
| 844 | } | ||
| 845 | |||
| 846 | ret = device_create_file(&hdev->dev, &dev_attr_speed); | ||
| 847 | if (ret) | ||
| 848 | hid_warn(hdev, | ||
| 849 | "can't create sysfs speed attribute err: %d\n", ret); | ||
| 850 | |||
| 851 | #define OLED_INIT(OLED_ID) \ | ||
| 852 | do { \ | ||
| 853 | ret = device_create_file(&hdev->dev, \ | ||
| 854 | &dev_attr_oled##OLED_ID##_img); \ | ||
| 855 | if (ret) \ | ||
| 856 | hid_warn(hdev, \ | ||
| 857 | "can't create sysfs oled attribute, err: %d\n", ret);\ | ||
| 858 | } while (0) | ||
| 859 | |||
| 860 | OLED_INIT(0); | ||
| 861 | OLED_INIT(1); | ||
| 862 | OLED_INIT(2); | ||
| 863 | OLED_INIT(3); | ||
| 864 | OLED_INIT(4); | ||
| 865 | OLED_INIT(5); | ||
| 866 | OLED_INIT(6); | ||
| 867 | OLED_INIT(7); | ||
| 868 | |||
| 869 | wdata->features = 0; | ||
| 870 | wacom_set_features(hdev, 1); | ||
| 871 | |||
| 872 | if (hdev->product == USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) { | ||
| 873 | sprintf(hdev->name, "%s", "Wacom Intuos4 WL"); | ||
| 874 | ret = wacom_initialize_leds(hdev); | ||
| 875 | if (ret) | ||
| 876 | hid_warn(hdev, | ||
| 877 | "can't create led attribute, err: %d\n", ret); | ||
| 878 | } | ||
| 879 | |||
| 880 | wdata->battery.properties = wacom_battery_props; | ||
| 881 | wdata->battery.num_properties = ARRAY_SIZE(wacom_battery_props); | ||
| 882 | wdata->battery.get_property = wacom_battery_get_property; | ||
| 883 | wdata->battery.name = "wacom_battery"; | ||
| 884 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; | ||
| 885 | wdata->battery.use_for_apm = 0; | ||
| 886 | |||
| 887 | |||
| 888 | ret = power_supply_register(&hdev->dev, &wdata->battery); | ||
| 889 | if (ret) { | ||
| 890 | hid_err(hdev, "can't create sysfs battery attribute, err: %d\n", | ||
| 891 | ret); | ||
| 892 | goto err_battery; | ||
| 893 | } | ||
| 894 | |||
| 895 | power_supply_powers(&wdata->battery, &hdev->dev); | ||
| 896 | |||
| 897 | wdata->ac.properties = wacom_ac_props; | ||
| 898 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); | ||
| 899 | wdata->ac.get_property = wacom_ac_get_property; | ||
| 900 | wdata->ac.name = "wacom_ac"; | ||
| 901 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; | ||
| 902 | wdata->ac.use_for_apm = 0; | ||
| 903 | |||
| 904 | ret = power_supply_register(&hdev->dev, &wdata->ac); | ||
| 905 | if (ret) { | ||
| 906 | hid_err(hdev, | ||
| 907 | "can't create ac battery attribute, err: %d\n", ret); | ||
| 908 | goto err_ac; | ||
| 909 | } | ||
| 910 | |||
| 911 | power_supply_powers(&wdata->ac, &hdev->dev); | ||
| 912 | return 0; | ||
| 913 | |||
| 914 | err_ac: | ||
| 915 | power_supply_unregister(&wdata->battery); | ||
| 916 | err_battery: | ||
| 917 | wacom_destroy_leds(hdev); | ||
| 918 | device_remove_file(&hdev->dev, &dev_attr_oled0_img); | ||
| 919 | device_remove_file(&hdev->dev, &dev_attr_oled1_img); | ||
| 920 | device_remove_file(&hdev->dev, &dev_attr_oled2_img); | ||
| 921 | device_remove_file(&hdev->dev, &dev_attr_oled3_img); | ||
| 922 | device_remove_file(&hdev->dev, &dev_attr_oled4_img); | ||
| 923 | device_remove_file(&hdev->dev, &dev_attr_oled5_img); | ||
| 924 | device_remove_file(&hdev->dev, &dev_attr_oled6_img); | ||
| 925 | device_remove_file(&hdev->dev, &dev_attr_oled7_img); | ||
| 926 | device_remove_file(&hdev->dev, &dev_attr_speed); | ||
| 927 | hid_hw_stop(hdev); | ||
| 928 | err_free: | ||
| 929 | kfree(wdata); | ||
| 930 | return ret; | ||
| 931 | } | ||
| 932 | |||
| 933 | static void wacom_remove(struct hid_device *hdev) | ||
| 934 | { | ||
| 935 | struct wacom_data *wdata = hid_get_drvdata(hdev); | ||
| 936 | |||
| 937 | wacom_destroy_leds(hdev); | ||
| 938 | device_remove_file(&hdev->dev, &dev_attr_oled0_img); | ||
| 939 | device_remove_file(&hdev->dev, &dev_attr_oled1_img); | ||
| 940 | device_remove_file(&hdev->dev, &dev_attr_oled2_img); | ||
| 941 | device_remove_file(&hdev->dev, &dev_attr_oled3_img); | ||
| 942 | device_remove_file(&hdev->dev, &dev_attr_oled4_img); | ||
| 943 | device_remove_file(&hdev->dev, &dev_attr_oled5_img); | ||
| 944 | device_remove_file(&hdev->dev, &dev_attr_oled6_img); | ||
| 945 | device_remove_file(&hdev->dev, &dev_attr_oled7_img); | ||
| 946 | device_remove_file(&hdev->dev, &dev_attr_speed); | ||
| 947 | hid_hw_stop(hdev); | ||
| 948 | |||
| 949 | power_supply_unregister(&wdata->battery); | ||
| 950 | power_supply_unregister(&wdata->ac); | ||
| 951 | kfree(hid_get_drvdata(hdev)); | ||
| 952 | } | ||
| 953 | |||
| 954 | static const struct hid_device_id wacom_devices[] = { | ||
| 955 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, | ||
| 956 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, | ||
| 957 | |||
| 958 | { } | ||
| 959 | }; | ||
| 960 | MODULE_DEVICE_TABLE(hid, wacom_devices); | ||
| 961 | |||
| 962 | static struct hid_driver wacom_driver = { | ||
| 963 | .name = "wacom", | ||
| 964 | .id_table = wacom_devices, | ||
| 965 | .probe = wacom_probe, | ||
| 966 | .remove = wacom_remove, | ||
| 967 | .raw_event = wacom_raw_event, | ||
| 968 | .input_mapped = wacom_input_mapped, | ||
| 969 | }; | ||
| 970 | module_hid_driver(wacom_driver); | ||
| 971 | |||
| 972 | MODULE_DESCRIPTION("Driver for Wacom Graphire Bluetooth and Wacom Intuos4 WL"); | ||
| 973 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/tablet/wacom.h b/drivers/hid/wacom.h index 9ebf0ed3b3b3..64bc1b296d91 100644 --- a/drivers/input/tablet/wacom.h +++ b/drivers/hid/wacom.h | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> | 12 | * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> |
| 13 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> | 13 | * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> |
| 14 | * Copyright (c) 2002-2011 Ping Cheng <pingc@wacom.com> | 14 | * Copyright (c) 2002-2011 Ping Cheng <pingc@wacom.com> |
| 15 | * Copyright (c) 2014 Benjamin Tissoires <benjamin.tissoires@redhat.com> | ||
| 15 | * | 16 | * |
| 16 | * ChangeLog: | 17 | * ChangeLog: |
| 17 | * v0.1 (vp) - Initial release | 18 | * v0.1 (vp) - Initial release |
| @@ -72,6 +73,8 @@ | |||
| 72 | * v1.52 (pc) - Query Wacom data upon system resume | 73 | * v1.52 (pc) - Query Wacom data upon system resume |
| 73 | * - add defines for features->type | 74 | * - add defines for features->type |
| 74 | * - add new devices (0x9F, 0xE2, and 0XE3) | 75 | * - add new devices (0x9F, 0xE2, and 0XE3) |
| 76 | * v2.00 (bt) - conversion to a HID driver | ||
| 77 | * - integration of the Bluetooth devices | ||
| 75 | */ | 78 | */ |
| 76 | 79 | ||
| 77 | /* | 80 | /* |
| @@ -93,35 +96,30 @@ | |||
| 93 | /* | 96 | /* |
| 94 | * Version Information | 97 | * Version Information |
| 95 | */ | 98 | */ |
| 96 | #define DRIVER_VERSION "v1.53" | 99 | #define DRIVER_VERSION "v2.00" |
| 97 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" | 100 | #define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" |
| 98 | #define DRIVER_DESC "USB Wacom tablet driver" | 101 | #define DRIVER_DESC "USB Wacom tablet driver" |
| 99 | #define DRIVER_LICENSE "GPL" | 102 | #define DRIVER_LICENSE "GPL" |
| 100 | 103 | ||
| 101 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
| 102 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
| 103 | MODULE_LICENSE(DRIVER_LICENSE); | ||
| 104 | |||
| 105 | #define USB_VENDOR_ID_WACOM 0x056a | 104 | #define USB_VENDOR_ID_WACOM 0x056a |
| 106 | #define USB_VENDOR_ID_LENOVO 0x17ef | 105 | #define USB_VENDOR_ID_LENOVO 0x17ef |
| 107 | 106 | ||
| 108 | struct wacom { | 107 | struct wacom { |
| 109 | dma_addr_t data_dma; | ||
| 110 | struct usb_device *usbdev; | 108 | struct usb_device *usbdev; |
| 111 | struct usb_interface *intf; | 109 | struct usb_interface *intf; |
| 112 | struct urb *irq; | ||
| 113 | struct wacom_wac wacom_wac; | 110 | struct wacom_wac wacom_wac; |
| 111 | struct hid_device *hdev; | ||
| 114 | struct mutex lock; | 112 | struct mutex lock; |
| 115 | struct work_struct work; | 113 | struct work_struct work; |
| 116 | bool open; | ||
| 117 | char phys[32]; | ||
| 118 | struct wacom_led { | 114 | struct wacom_led { |
| 119 | u8 select[2]; /* status led selector (0..3) */ | 115 | u8 select[2]; /* status led selector (0..3) */ |
| 120 | u8 llv; /* status led brightness no button (1..127) */ | 116 | u8 llv; /* status led brightness no button (1..127) */ |
| 121 | u8 hlv; /* status led brightness button pressed (1..127) */ | 117 | u8 hlv; /* status led brightness button pressed (1..127) */ |
| 122 | u8 img_lum; /* OLED matrix display brightness */ | 118 | u8 img_lum; /* OLED matrix display brightness */ |
| 123 | } led; | 119 | } led; |
| 120 | bool led_initialized; | ||
| 124 | struct power_supply battery; | 121 | struct power_supply battery; |
| 122 | struct power_supply ac; | ||
| 125 | }; | 123 | }; |
| 126 | 124 | ||
| 127 | static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) | 125 | static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) |
| @@ -130,10 +128,19 @@ static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) | |||
| 130 | schedule_work(&wacom->work); | 128 | schedule_work(&wacom->work); |
| 131 | } | 129 | } |
| 132 | 130 | ||
| 133 | extern const struct usb_device_id wacom_ids[]; | 131 | static inline void wacom_notify_battery(struct wacom_wac *wacom_wac) |
| 132 | { | ||
| 133 | struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); | ||
| 134 | |||
| 135 | power_supply_changed(&wacom->battery); | ||
| 136 | } | ||
| 137 | |||
| 138 | extern const struct hid_device_id wacom_ids[]; | ||
| 134 | 139 | ||
| 135 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); | 140 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); |
| 136 | void wacom_setup_device_quirks(struct wacom_features *features); | 141 | void wacom_setup_device_quirks(struct wacom_features *features); |
| 137 | int wacom_setup_input_capabilities(struct input_dev *input_dev, | 142 | int wacom_setup_input_capabilities(struct input_dev *input_dev, |
| 138 | struct wacom_wac *wacom_wac); | 143 | struct wacom_wac *wacom_wac); |
| 144 | int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, | ||
| 145 | struct wacom_wac *wacom_wac); | ||
| 139 | #endif | 146 | #endif |
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/hid/wacom_sys.c index 2c613cd41dd6..3e388ec31da8 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
| @@ -13,246 +13,106 @@ | |||
| 13 | 13 | ||
| 14 | #include "wacom_wac.h" | 14 | #include "wacom_wac.h" |
| 15 | #include "wacom.h" | 15 | #include "wacom.h" |
| 16 | #include <linux/hid.h> | ||
| 16 | 17 | ||
| 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 ((HID_USAGE_PAGE_DESKTOP << 16) | 0x30) | ||
| 26 | #define HID_USAGE_Y ((HID_USAGE_PAGE_DESKTOP << 16) | 0x31) | ||
| 27 | #define HID_USAGE_PRESSURE ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x30) | ||
| 28 | #define HID_USAGE_X_TILT ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x3d) | ||
| 29 | #define HID_USAGE_Y_TILT ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x3e) | ||
| 30 | #define HID_USAGE_FINGER ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x22) | ||
| 31 | #define HID_USAGE_STYLUS ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x20) | ||
| 32 | #define HID_USAGE_CONTACTMAX ((HID_USAGE_PAGE_DIGITIZER << 16) | 0x55) | ||
| 33 | #define HID_COLLECTION 0xa1 | ||
| 34 | #define HID_COLLECTION_LOGICAL 0x02 | ||
| 35 | #define HID_COLLECTION_END 0xc0 | ||
| 36 | |||
| 37 | struct hid_descriptor { | ||
| 38 | struct usb_descriptor_header header; | ||
| 39 | __le16 bcdHID; | ||
| 40 | u8 bCountryCode; | ||
| 41 | u8 bNumDescriptors; | ||
| 42 | u8 bDescriptorType; | ||
| 43 | __le16 wDescriptorLength; | ||
| 44 | } __attribute__ ((packed)); | ||
| 45 | |||
| 46 | /* defines to get/set USB message */ | ||
| 47 | #define USB_REQ_GET_REPORT 0x01 | ||
| 48 | #define USB_REQ_SET_REPORT 0x09 | ||
| 49 | |||
| 50 | #define WAC_HID_FEATURE_REPORT 0x03 | ||
| 51 | #define WAC_MSG_RETRIES 5 | 18 | #define WAC_MSG_RETRIES 5 |
| 52 | 19 | ||
| 53 | #define WAC_CMD_LED_CONTROL 0x20 | 20 | #define WAC_CMD_LED_CONTROL 0x20 |
| 54 | #define WAC_CMD_ICON_START 0x21 | 21 | #define WAC_CMD_ICON_START 0x21 |
| 55 | #define WAC_CMD_ICON_XFER 0x23 | 22 | #define WAC_CMD_ICON_XFER 0x23 |
| 23 | #define WAC_CMD_ICON_BT_XFER 0x26 | ||
| 56 | #define WAC_CMD_RETRIES 10 | 24 | #define WAC_CMD_RETRIES 10 |
| 57 | 25 | ||
| 58 | static int wacom_get_report(struct usb_interface *intf, u8 type, u8 id, | 26 | static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, |
| 59 | void *buf, size_t size, unsigned int retries) | 27 | void *buf, size_t size, unsigned int retries) |
| 60 | { | 28 | { |
| 61 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 62 | int retval; | 29 | int retval; |
| 63 | 30 | ||
| 64 | do { | 31 | do { |
| 65 | retval = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | 32 | retval = hid_hw_raw_request(hdev, id, buf, size, type, |
| 66 | USB_REQ_GET_REPORT, | 33 | HID_REQ_GET_REPORT); |
| 67 | USB_DIR_IN | USB_TYPE_CLASS | | ||
| 68 | USB_RECIP_INTERFACE, | ||
| 69 | (type << 8) + id, | ||
| 70 | intf->altsetting[0].desc.bInterfaceNumber, | ||
| 71 | buf, size, 100); | ||
| 72 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); | 34 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); |
| 73 | 35 | ||
| 74 | return retval; | 36 | return retval; |
| 75 | } | 37 | } |
| 76 | 38 | ||
| 77 | static int wacom_set_report(struct usb_interface *intf, u8 type, u8 id, | 39 | static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, |
| 78 | void *buf, size_t size, unsigned int retries) | 40 | size_t size, unsigned int retries) |
| 79 | { | 41 | { |
| 80 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 81 | int retval; | 42 | int retval; |
| 82 | 43 | ||
| 83 | do { | 44 | do { |
| 84 | retval = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 45 | retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, |
| 85 | USB_REQ_SET_REPORT, | 46 | HID_REQ_SET_REPORT); |
| 86 | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 87 | (type << 8) + id, | ||
| 88 | intf->altsetting[0].desc.bInterfaceNumber, | ||
| 89 | buf, size, 1000); | ||
| 90 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); | 47 | } while ((retval == -ETIMEDOUT || retval == -EPIPE) && --retries); |
| 91 | 48 | ||
| 92 | return retval; | 49 | return retval; |
| 93 | } | 50 | } |
| 94 | 51 | ||
| 95 | static void wacom_sys_irq(struct urb *urb) | 52 | static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, |
| 53 | u8 *raw_data, int size) | ||
| 96 | { | 54 | { |
| 97 | struct wacom *wacom = urb->context; | 55 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 98 | struct device *dev = &wacom->intf->dev; | ||
| 99 | int retval; | ||
| 100 | 56 | ||
| 101 | switch (urb->status) { | 57 | if (size > WACOM_PKGLEN_MAX) |
| 102 | case 0: | 58 | return 1; |
| 103 | /* success */ | 59 | |
| 104 | break; | 60 | memcpy(wacom->wacom_wac.data, raw_data, size); |
| 105 | case -ECONNRESET: | ||
| 106 | case -ENOENT: | ||
| 107 | case -ESHUTDOWN: | ||
| 108 | /* this urb is terminated, clean up */ | ||
| 109 | dev_dbg(dev, "%s - urb shutting down with status: %d\n", | ||
| 110 | __func__, urb->status); | ||
| 111 | return; | ||
| 112 | default: | ||
| 113 | dev_dbg(dev, "%s - nonzero urb status received: %d\n", | ||
| 114 | __func__, urb->status); | ||
| 115 | goto exit; | ||
| 116 | } | ||
| 117 | 61 | ||
| 118 | wacom_wac_irq(&wacom->wacom_wac, urb->actual_length); | 62 | wacom_wac_irq(&wacom->wacom_wac, size); |
| 119 | 63 | ||
| 120 | exit: | 64 | return 0; |
| 121 | usb_mark_last_busy(wacom->usbdev); | ||
| 122 | retval = usb_submit_urb(urb, GFP_ATOMIC); | ||
| 123 | if (retval) | ||
| 124 | dev_err(dev, "%s - usb_submit_urb failed with result %d\n", | ||
| 125 | __func__, retval); | ||
| 126 | } | 65 | } |
| 127 | 66 | ||
| 128 | static int wacom_open(struct input_dev *dev) | 67 | static int wacom_open(struct input_dev *dev) |
| 129 | { | 68 | { |
| 130 | struct wacom *wacom = input_get_drvdata(dev); | 69 | struct wacom *wacom = input_get_drvdata(dev); |
| 131 | int retval = 0; | 70 | int retval; |
| 132 | |||
| 133 | if (usb_autopm_get_interface(wacom->intf) < 0) | ||
| 134 | return -EIO; | ||
| 135 | 71 | ||
| 136 | mutex_lock(&wacom->lock); | 72 | mutex_lock(&wacom->lock); |
| 137 | 73 | retval = hid_hw_open(wacom->hdev); | |
| 138 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | ||
| 139 | retval = -EIO; | ||
| 140 | goto out; | ||
| 141 | } | ||
| 142 | |||
| 143 | wacom->open = true; | ||
| 144 | wacom->intf->needs_remote_wakeup = 1; | ||
| 145 | |||
| 146 | out: | ||
| 147 | mutex_unlock(&wacom->lock); | 74 | mutex_unlock(&wacom->lock); |
| 148 | usb_autopm_put_interface(wacom->intf); | 75 | |
| 149 | return retval; | 76 | return retval; |
| 150 | } | 77 | } |
| 151 | 78 | ||
| 152 | static void wacom_close(struct input_dev *dev) | 79 | static void wacom_close(struct input_dev *dev) |
| 153 | { | 80 | { |
| 154 | struct wacom *wacom = input_get_drvdata(dev); | 81 | struct wacom *wacom = input_get_drvdata(dev); |
| 155 | int autopm_error; | ||
| 156 | |||
| 157 | autopm_error = usb_autopm_get_interface(wacom->intf); | ||
| 158 | 82 | ||
| 159 | mutex_lock(&wacom->lock); | 83 | mutex_lock(&wacom->lock); |
| 160 | usb_kill_urb(wacom->irq); | 84 | hid_hw_close(wacom->hdev); |
| 161 | wacom->open = false; | ||
| 162 | wacom->intf->needs_remote_wakeup = 0; | ||
| 163 | mutex_unlock(&wacom->lock); | 85 | mutex_unlock(&wacom->lock); |
| 164 | |||
| 165 | if (!autopm_error) | ||
| 166 | usb_autopm_put_interface(wacom->intf); | ||
| 167 | } | 86 | } |
| 168 | 87 | ||
| 169 | /* | 88 | /* |
| 170 | * Calculate the resolution of the X or Y axis, given appropriate HID data. | 89 | * Calculate the resolution of the X or Y axis using hidinput_calc_abs_res. |
| 171 | * This function is little more than hidinput_calc_abs_res stripped down. | ||
| 172 | */ | 90 | */ |
| 173 | static int wacom_calc_hid_res(int logical_extents, int physical_extents, | 91 | static int wacom_calc_hid_res(int logical_extents, int physical_extents, |
| 174 | unsigned char unit, unsigned char exponent) | 92 | unsigned unit, int exponent) |
| 175 | { | ||
| 176 | int prev, unit_exponent; | ||
| 177 | |||
| 178 | /* Check if the extents are sane */ | ||
| 179 | if (logical_extents <= 0 || physical_extents <= 0) | ||
| 180 | return 0; | ||
| 181 | |||
| 182 | /* Get signed value of nybble-sized twos-compliment exponent */ | ||
| 183 | unit_exponent = exponent; | ||
| 184 | if (unit_exponent > 7) | ||
| 185 | unit_exponent -= 16; | ||
| 186 | |||
| 187 | /* Convert physical_extents to millimeters */ | ||
| 188 | if (unit == 0x11) { /* If centimeters */ | ||
| 189 | unit_exponent += 1; | ||
| 190 | } else if (unit == 0x13) { /* If inches */ | ||
| 191 | prev = physical_extents; | ||
| 192 | physical_extents *= 254; | ||
| 193 | if (physical_extents < prev) | ||
| 194 | return 0; | ||
| 195 | unit_exponent -= 1; | ||
| 196 | } else { | ||
| 197 | return 0; | ||
| 198 | } | ||
| 199 | |||
| 200 | /* Apply negative unit exponent */ | ||
| 201 | for (; unit_exponent < 0; unit_exponent++) { | ||
| 202 | prev = logical_extents; | ||
| 203 | logical_extents *= 10; | ||
| 204 | if (logical_extents < prev) | ||
| 205 | return 0; | ||
| 206 | } | ||
| 207 | /* Apply positive unit exponent */ | ||
| 208 | for (; unit_exponent > 0; unit_exponent--) { | ||
| 209 | prev = physical_extents; | ||
| 210 | physical_extents *= 10; | ||
| 211 | if (physical_extents < prev) | ||
| 212 | return 0; | ||
| 213 | } | ||
| 214 | |||
| 215 | /* Calculate resolution */ | ||
| 216 | return logical_extents / physical_extents; | ||
| 217 | } | ||
| 218 | |||
| 219 | static int wacom_parse_logical_collection(unsigned char *report, | ||
| 220 | struct wacom_features *features) | ||
| 221 | { | 93 | { |
| 222 | int length = 0; | 94 | struct hid_field field = { |
| 223 | 95 | .logical_maximum = logical_extents, | |
| 224 | if (features->type == BAMBOO_PT) { | 96 | .physical_maximum = physical_extents, |
| 225 | 97 | .unit = unit, | |
| 226 | /* Logical collection is only used by 3rd gen Bamboo Touch */ | 98 | .unit_exponent = exponent, |
| 227 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; | 99 | }; |
| 228 | features->device_type = BTN_TOOL_FINGER; | 100 | |
| 229 | 101 | return hidinput_calc_abs_res(&field, ABS_X); | |
| 230 | features->x_max = features->y_max = | ||
| 231 | get_unaligned_le16(&report[10]); | ||
| 232 | |||
| 233 | length = 11; | ||
| 234 | } | ||
| 235 | return length; | ||
| 236 | } | 102 | } |
| 237 | 103 | ||
| 238 | static void wacom_retrieve_report_data(struct usb_interface *intf, | 104 | static void wacom_feature_mapping(struct hid_device *hdev, |
| 239 | struct wacom_features *features) | 105 | struct hid_field *field, struct hid_usage *usage) |
| 240 | { | 106 | { |
| 241 | int result = 0; | 107 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 242 | unsigned char *rep_data; | 108 | struct wacom_features *features = &wacom->wacom_wac.features; |
| 243 | |||
| 244 | rep_data = kmalloc(2, GFP_KERNEL); | ||
| 245 | if (rep_data) { | ||
| 246 | |||
| 247 | rep_data[0] = 12; | ||
| 248 | result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT, | ||
| 249 | rep_data[0], rep_data, 2, | ||
| 250 | WAC_MSG_RETRIES); | ||
| 251 | |||
| 252 | if (result >= 0 && rep_data[1] > 2) | ||
| 253 | features->touch_max = rep_data[1]; | ||
| 254 | 109 | ||
| 255 | kfree(rep_data); | 110 | switch (usage->hid) { |
| 111 | case HID_DG_CONTACTMAX: | ||
| 112 | /* leave touch_max as is if predefined */ | ||
| 113 | if (!features->touch_max) | ||
| 114 | features->touch_max = field->value[0]; | ||
| 115 | break; | ||
| 256 | } | 116 | } |
| 257 | } | 117 | } |
| 258 | 118 | ||
| @@ -285,243 +145,100 @@ static void wacom_retrieve_report_data(struct usb_interface *intf, | |||
| 285 | * interfaces haven't supported pressure or distance, this is enough | 145 | * interfaces haven't supported pressure or distance, this is enough |
| 286 | * information to override invalid values in the wacom_features table. | 146 | * information to override invalid values in the wacom_features table. |
| 287 | * | 147 | * |
| 288 | * 3rd gen Bamboo Touch no longer define a Digitizer-Finger Pysical | 148 | * Intuos5 touch interface and 3rd gen Bamboo Touch do not contain useful |
| 289 | * Collection. Instead they define a Logical Collection with a single | 149 | * data. We deal with them after returning from this function. |
| 290 | * Logical Maximum for both X and Y. | ||
| 291 | * | ||
| 292 | * Intuos5 touch interface does not contain useful data. We deal with | ||
| 293 | * this after returning from this function. | ||
| 294 | */ | 150 | */ |
| 295 | static int wacom_parse_hid(struct usb_interface *intf, | 151 | static void wacom_usage_mapping(struct hid_device *hdev, |
| 296 | struct hid_descriptor *hid_desc, | 152 | struct hid_field *field, struct hid_usage *usage) |
| 297 | struct wacom_features *features) | ||
| 298 | { | 153 | { |
| 299 | struct usb_device *dev = interface_to_usbdev(intf); | 154 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 300 | char limit = 0; | 155 | struct wacom_features *features = &wacom->wacom_wac.features; |
| 301 | /* result has to be defined as int for some devices */ | 156 | bool finger = (field->logical == HID_DG_FINGER) || |
| 302 | int result = 0, touch_max = 0; | 157 | (field->physical == HID_DG_FINGER); |
| 303 | int i = 0, page = 0, finger = 0, pen = 0; | 158 | bool pen = (field->logical == HID_DG_STYLUS) || |
| 304 | unsigned char *report; | 159 | (field->physical == HID_DG_STYLUS); |
| 305 | |||
| 306 | report = kzalloc(hid_desc->wDescriptorLength, GFP_KERNEL); | ||
| 307 | if (!report) | ||
| 308 | return -ENOMEM; | ||
| 309 | |||
| 310 | /* retrive report descriptors */ | ||
| 311 | do { | ||
| 312 | result = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), | ||
| 313 | USB_REQ_GET_DESCRIPTOR, | ||
| 314 | USB_RECIP_INTERFACE | USB_DIR_IN, | ||
| 315 | HID_DEVICET_REPORT << 8, | ||
| 316 | intf->altsetting[0].desc.bInterfaceNumber, /* interface */ | ||
| 317 | report, | ||
| 318 | hid_desc->wDescriptorLength, | ||
| 319 | 5000); /* 5 secs */ | ||
| 320 | } while (result < 0 && limit++ < WAC_MSG_RETRIES); | ||
| 321 | |||
| 322 | /* No need to parse the Descriptor. It isn't an error though */ | ||
| 323 | if (result < 0) | ||
| 324 | goto out; | ||
| 325 | |||
| 326 | for (i = 0; i < hid_desc->wDescriptorLength; i++) { | ||
| 327 | |||
| 328 | switch (report[i]) { | ||
| 329 | case HID_USAGE_PAGE: | ||
| 330 | page = report[i + 1]; | ||
| 331 | i++; | ||
| 332 | break; | ||
| 333 | |||
| 334 | case HID_USAGE: | ||
| 335 | switch (page << 16 | report[i + 1]) { | ||
| 336 | case HID_USAGE_X: | ||
| 337 | if (finger) { | ||
| 338 | features->device_type = BTN_TOOL_FINGER; | ||
| 339 | /* touch device at least supports one touch point */ | ||
| 340 | touch_max = 1; | ||
| 341 | switch (features->type) { | ||
| 342 | case TABLETPC2FG: | ||
| 343 | features->pktlen = WACOM_PKGLEN_TPC2FG; | ||
| 344 | break; | ||
| 345 | |||
| 346 | case MTSCREEN: | ||
| 347 | case WACOM_24HDT: | ||
| 348 | features->pktlen = WACOM_PKGLEN_MTOUCH; | ||
| 349 | break; | ||
| 350 | |||
| 351 | case MTTPC: | ||
| 352 | case MTTPC_B: | ||
| 353 | features->pktlen = WACOM_PKGLEN_MTTPC; | ||
| 354 | break; | ||
| 355 | |||
| 356 | case BAMBOO_PT: | ||
| 357 | features->pktlen = WACOM_PKGLEN_BBTOUCH; | ||
| 358 | break; | ||
| 359 | |||
| 360 | default: | ||
| 361 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
| 362 | break; | ||
| 363 | } | ||
| 364 | |||
| 365 | switch (features->type) { | ||
| 366 | case BAMBOO_PT: | ||
| 367 | features->x_phy = | ||
| 368 | get_unaligned_le16(&report[i + 5]); | ||
| 369 | features->x_max = | ||
| 370 | get_unaligned_le16(&report[i + 8]); | ||
| 371 | i += 15; | ||
| 372 | break; | ||
| 373 | |||
| 374 | case WACOM_24HDT: | ||
| 375 | features->x_max = | ||
| 376 | get_unaligned_le16(&report[i + 3]); | ||
| 377 | features->x_phy = | ||
| 378 | get_unaligned_le16(&report[i + 8]); | ||
| 379 | features->unit = report[i - 1]; | ||
| 380 | features->unitExpo = report[i - 3]; | ||
| 381 | i += 12; | ||
| 382 | break; | ||
| 383 | |||
| 384 | case MTTPC_B: | ||
| 385 | features->x_max = | ||
| 386 | get_unaligned_le16(&report[i + 3]); | ||
| 387 | features->x_phy = | ||
| 388 | get_unaligned_le16(&report[i + 6]); | ||
| 389 | features->unit = report[i - 5]; | ||
| 390 | features->unitExpo = report[i - 3]; | ||
| 391 | i += 9; | ||
| 392 | break; | ||
| 393 | |||
| 394 | default: | ||
| 395 | features->x_max = | ||
| 396 | get_unaligned_le16(&report[i + 3]); | ||
| 397 | features->x_phy = | ||
| 398 | get_unaligned_le16(&report[i + 6]); | ||
| 399 | features->unit = report[i + 9]; | ||
| 400 | features->unitExpo = report[i + 11]; | ||
| 401 | i += 12; | ||
| 402 | break; | ||
| 403 | } | ||
| 404 | } else if (pen) { | ||
| 405 | /* penabled only accepts exact bytes of data */ | ||
| 406 | if (features->type >= TABLETPC) | ||
| 407 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
| 408 | features->device_type = BTN_TOOL_PEN; | ||
| 409 | features->x_max = | ||
| 410 | get_unaligned_le16(&report[i + 3]); | ||
| 411 | i += 4; | ||
| 412 | } | ||
| 413 | break; | ||
| 414 | |||
| 415 | case HID_USAGE_Y: | ||
| 416 | if (finger) { | ||
| 417 | switch (features->type) { | ||
| 418 | case TABLETPC2FG: | ||
| 419 | case MTSCREEN: | ||
| 420 | case MTTPC: | ||
| 421 | features->y_max = | ||
| 422 | get_unaligned_le16(&report[i + 3]); | ||
| 423 | features->y_phy = | ||
| 424 | get_unaligned_le16(&report[i + 6]); | ||
| 425 | i += 7; | ||
| 426 | break; | ||
| 427 | |||
| 428 | case WACOM_24HDT: | ||
| 429 | features->y_max = | ||
| 430 | get_unaligned_le16(&report[i + 3]); | ||
| 431 | features->y_phy = | ||
| 432 | get_unaligned_le16(&report[i - 2]); | ||
| 433 | i += 7; | ||
| 434 | break; | ||
| 435 | |||
| 436 | case BAMBOO_PT: | ||
| 437 | features->y_phy = | ||
| 438 | get_unaligned_le16(&report[i + 3]); | ||
| 439 | features->y_max = | ||
| 440 | get_unaligned_le16(&report[i + 6]); | ||
| 441 | i += 12; | ||
| 442 | break; | ||
| 443 | |||
| 444 | case MTTPC_B: | ||
| 445 | features->y_max = | ||
| 446 | get_unaligned_le16(&report[i + 3]); | ||
| 447 | features->y_phy = | ||
| 448 | get_unaligned_le16(&report[i + 6]); | ||
| 449 | i += 9; | ||
| 450 | break; | ||
| 451 | |||
| 452 | default: | ||
| 453 | features->y_max = | ||
| 454 | features->x_max; | ||
| 455 | features->y_phy = | ||
| 456 | get_unaligned_le16(&report[i + 3]); | ||
| 457 | i += 4; | ||
| 458 | break; | ||
| 459 | } | ||
| 460 | } else if (pen) { | ||
| 461 | features->y_max = | ||
| 462 | get_unaligned_le16(&report[i + 3]); | ||
| 463 | i += 4; | ||
| 464 | } | ||
| 465 | break; | ||
| 466 | |||
| 467 | case HID_USAGE_FINGER: | ||
| 468 | finger = 1; | ||
| 469 | i++; | ||
| 470 | break; | ||
| 471 | 160 | ||
| 472 | /* | 161 | /* |
| 473 | * Requiring Stylus Usage will ignore boot mouse | 162 | * Requiring Stylus Usage will ignore boot mouse |
| 474 | * X/Y values and some cases of invalid Digitizer X/Y | 163 | * X/Y values and some cases of invalid Digitizer X/Y |
| 475 | * values commonly reported. | 164 | * values commonly reported. |
| 476 | */ | 165 | */ |
| 477 | case HID_USAGE_STYLUS: | 166 | if (!pen && !finger) |
| 478 | pen = 1; | 167 | return; |
| 479 | i++; | ||
| 480 | break; | ||
| 481 | 168 | ||
| 482 | case HID_USAGE_CONTACTMAX: | 169 | if (finger && !features->touch_max) |
| 483 | /* leave touch_max as is if predefined */ | 170 | /* touch device at least supports one touch point */ |
| 484 | if (!features->touch_max) | 171 | features->touch_max = 1; |
| 485 | wacom_retrieve_report_data(intf, features); | ||
| 486 | i++; | ||
| 487 | break; | ||
| 488 | 172 | ||
| 489 | case HID_USAGE_PRESSURE: | 173 | switch (usage->hid) { |
| 490 | if (pen) { | 174 | case HID_GD_X: |
| 491 | features->pressure_max = | 175 | features->x_max = field->logical_maximum; |
| 492 | get_unaligned_le16(&report[i + 3]); | 176 | if (finger) { |
| 493 | i += 4; | 177 | features->device_type = BTN_TOOL_FINGER; |
| 494 | } | 178 | features->x_phy = field->physical_maximum; |
| 495 | break; | 179 | if (features->type != BAMBOO_PT) { |
| 180 | features->unit = field->unit; | ||
| 181 | features->unitExpo = field->unit_exponent; | ||
| 496 | } | 182 | } |
| 497 | break; | 183 | } else { |
| 498 | 184 | features->device_type = BTN_TOOL_PEN; | |
| 499 | case HID_COLLECTION_END: | 185 | } |
| 500 | /* reset UsagePage and Finger */ | 186 | break; |
| 501 | finger = page = 0; | 187 | case HID_GD_Y: |
| 502 | break; | 188 | features->y_max = field->logical_maximum; |
| 189 | if (finger) { | ||
| 190 | features->y_phy = field->physical_maximum; | ||
| 191 | if (features->type != BAMBOO_PT) { | ||
| 192 | features->unit = field->unit; | ||
| 193 | features->unitExpo = field->unit_exponent; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | break; | ||
| 197 | case HID_DG_TIPPRESSURE: | ||
| 198 | if (pen) | ||
| 199 | features->pressure_max = field->logical_maximum; | ||
| 200 | break; | ||
| 201 | } | ||
| 202 | } | ||
| 503 | 203 | ||
| 504 | case HID_COLLECTION: | 204 | static void wacom_parse_hid(struct hid_device *hdev, |
| 505 | i++; | 205 | struct wacom_features *features) |
| 506 | switch (report[i]) { | 206 | { |
| 507 | case HID_COLLECTION_LOGICAL: | 207 | struct hid_report_enum *rep_enum; |
| 508 | i += wacom_parse_logical_collection(&report[i], | 208 | struct hid_report *hreport; |
| 509 | features); | 209 | int i, j; |
| 510 | break; | 210 | |
| 211 | /* check features first */ | ||
| 212 | rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; | ||
| 213 | list_for_each_entry(hreport, &rep_enum->report_list, list) { | ||
| 214 | for (i = 0; i < hreport->maxfield; i++) { | ||
| 215 | /* Ignore if report count is out of bounds. */ | ||
| 216 | if (hreport->field[i]->report_count < 1) | ||
| 217 | continue; | ||
| 218 | |||
| 219 | for (j = 0; j < hreport->field[i]->maxusage; j++) { | ||
| 220 | wacom_feature_mapping(hdev, hreport->field[i], | ||
| 221 | hreport->field[i]->usage + j); | ||
| 511 | } | 222 | } |
| 512 | break; | ||
| 513 | } | 223 | } |
| 514 | } | 224 | } |
| 515 | 225 | ||
| 516 | out: | 226 | /* now check the input usages */ |
| 517 | if (!features->touch_max && touch_max) | 227 | rep_enum = &hdev->report_enum[HID_INPUT_REPORT]; |
| 518 | features->touch_max = touch_max; | 228 | list_for_each_entry(hreport, &rep_enum->report_list, list) { |
| 519 | result = 0; | 229 | |
| 520 | kfree(report); | 230 | if (!hreport->maxfield) |
| 521 | return result; | 231 | continue; |
| 232 | |||
| 233 | for (i = 0; i < hreport->maxfield; i++) | ||
| 234 | for (j = 0; j < hreport->field[i]->maxusage; j++) | ||
| 235 | wacom_usage_mapping(hdev, hreport->field[i], | ||
| 236 | hreport->field[i]->usage + j); | ||
| 237 | } | ||
| 522 | } | 238 | } |
| 523 | 239 | ||
| 524 | static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int length, int mode) | 240 | static int wacom_set_device_mode(struct hid_device *hdev, int report_id, |
| 241 | int length, int mode) | ||
| 525 | { | 242 | { |
| 526 | unsigned char *rep_data; | 243 | unsigned char *rep_data; |
| 527 | int error = -ENOMEM, limit = 0; | 244 | int error = -ENOMEM, limit = 0; |
| @@ -534,8 +251,11 @@ static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int | |||
| 534 | rep_data[0] = report_id; | 251 | rep_data[0] = report_id; |
| 535 | rep_data[1] = mode; | 252 | rep_data[1] = mode; |
| 536 | 253 | ||
| 537 | error = wacom_set_report(intf, WAC_HID_FEATURE_REPORT, | 254 | error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, |
| 538 | report_id, rep_data, length, 1); | 255 | length, 1); |
| 256 | if (error >= 0) | ||
| 257 | error = wacom_get_report(hdev, HID_FEATURE_REPORT, | ||
| 258 | report_id, rep_data, length, 1); | ||
| 539 | } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); | 259 | } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); |
| 540 | 260 | ||
| 541 | kfree(rep_data); | 261 | kfree(rep_data); |
| @@ -543,6 +263,59 @@ static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int | |||
| 543 | return error < 0 ? error : 0; | 263 | return error < 0 ? error : 0; |
| 544 | } | 264 | } |
| 545 | 265 | ||
| 266 | static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, | ||
| 267 | struct wacom_features *features) | ||
| 268 | { | ||
| 269 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
| 270 | int ret; | ||
| 271 | u8 rep_data[2]; | ||
| 272 | |||
| 273 | switch (features->type) { | ||
| 274 | case GRAPHIRE_BT: | ||
| 275 | rep_data[0] = 0x03; | ||
| 276 | rep_data[1] = 0x00; | ||
| 277 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, | ||
| 278 | 3); | ||
| 279 | |||
| 280 | if (ret >= 0) { | ||
| 281 | rep_data[0] = speed == 0 ? 0x05 : 0x06; | ||
| 282 | rep_data[1] = 0x00; | ||
| 283 | |||
| 284 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, | ||
| 285 | rep_data, 2, 3); | ||
| 286 | |||
| 287 | if (ret >= 0) { | ||
| 288 | wacom->wacom_wac.bt_high_speed = speed; | ||
| 289 | return 0; | ||
| 290 | } | ||
| 291 | } | ||
| 292 | |||
| 293 | /* | ||
| 294 | * Note that if the raw queries fail, it's not a hard failure | ||
| 295 | * and it is safe to continue | ||
| 296 | */ | ||
| 297 | hid_warn(hdev, "failed to poke device, command %d, err %d\n", | ||
| 298 | rep_data[0], ret); | ||
| 299 | break; | ||
| 300 | case INTUOS4WL: | ||
| 301 | if (speed == 1) | ||
| 302 | wacom->wacom_wac.bt_features &= ~0x20; | ||
| 303 | else | ||
| 304 | wacom->wacom_wac.bt_features |= 0x20; | ||
| 305 | |||
| 306 | rep_data[0] = 0x03; | ||
| 307 | rep_data[1] = wacom->wacom_wac.bt_features; | ||
| 308 | |||
| 309 | ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, | ||
| 310 | 1); | ||
| 311 | if (ret >= 0) | ||
| 312 | wacom->wacom_wac.bt_high_speed = speed; | ||
| 313 | break; | ||
| 314 | } | ||
| 315 | |||
| 316 | return 0; | ||
| 317 | } | ||
| 318 | |||
| 546 | /* | 319 | /* |
| 547 | * Switch the tablet into its most-capable mode. Wacom tablets are | 320 | * Switch the tablet into its most-capable mode. Wacom tablets are |
| 548 | * typically configured to power-up in a mode which sends mouse-like | 321 | * typically configured to power-up in a mode which sends mouse-like |
| @@ -550,31 +323,34 @@ static int wacom_set_device_mode(struct usb_interface *intf, int report_id, int | |||
| 550 | * from the tablet, it is necessary to switch the tablet out of this | 323 | * from the tablet, it is necessary to switch the tablet out of this |
| 551 | * mode and into one which sends the full range of tablet data. | 324 | * mode and into one which sends the full range of tablet data. |
| 552 | */ | 325 | */ |
| 553 | static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_features *features) | 326 | static int wacom_query_tablet_data(struct hid_device *hdev, |
| 327 | struct wacom_features *features) | ||
| 554 | { | 328 | { |
| 329 | if (hdev->bus == BUS_BLUETOOTH) | ||
| 330 | return wacom_bt_query_tablet_data(hdev, 1, features); | ||
| 331 | |||
| 555 | if (features->device_type == BTN_TOOL_FINGER) { | 332 | if (features->device_type == BTN_TOOL_FINGER) { |
| 556 | if (features->type > TABLETPC) { | 333 | if (features->type > TABLETPC) { |
| 557 | /* MT Tablet PC touch */ | 334 | /* MT Tablet PC touch */ |
| 558 | return wacom_set_device_mode(intf, 3, 4, 4); | 335 | return wacom_set_device_mode(hdev, 3, 4, 4); |
| 559 | } | 336 | } |
| 560 | else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { | 337 | else if (features->type == WACOM_24HDT || features->type == CINTIQ_HYBRID) { |
| 561 | return wacom_set_device_mode(intf, 18, 3, 2); | 338 | return wacom_set_device_mode(hdev, 18, 3, 2); |
| 562 | } | 339 | } |
| 563 | } else if (features->device_type == BTN_TOOL_PEN) { | 340 | } else if (features->device_type == BTN_TOOL_PEN) { |
| 564 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { | 341 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { |
| 565 | return wacom_set_device_mode(intf, 2, 2, 2); | 342 | return wacom_set_device_mode(hdev, 2, 2, 2); |
| 566 | } | 343 | } |
| 567 | } | 344 | } |
| 568 | 345 | ||
| 569 | return 0; | 346 | return 0; |
| 570 | } | 347 | } |
| 571 | 348 | ||
| 572 | static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, | 349 | static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, |
| 573 | struct wacom_features *features) | 350 | struct wacom_features *features) |
| 574 | { | 351 | { |
| 575 | int error = 0; | 352 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 576 | struct usb_host_interface *interface = intf->cur_altsetting; | 353 | struct usb_interface *intf = wacom->intf; |
| 577 | struct hid_descriptor *hid_desc; | ||
| 578 | 354 | ||
| 579 | /* default features */ | 355 | /* default features */ |
| 580 | features->device_type = BTN_TOOL_PEN; | 356 | features->device_type = BTN_TOOL_PEN; |
| @@ -599,66 +375,54 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf, | |||
| 599 | } | 375 | } |
| 600 | 376 | ||
| 601 | /* only devices that support touch need to retrieve the info */ | 377 | /* only devices that support touch need to retrieve the info */ |
| 602 | if (features->type < BAMBOO_PT) { | 378 | if (features->type < BAMBOO_PT) |
| 603 | goto out; | 379 | return; |
| 604 | } | ||
| 605 | |||
| 606 | error = usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc); | ||
| 607 | if (error) { | ||
| 608 | error = usb_get_extra_descriptor(&interface->endpoint[0], | ||
| 609 | HID_DEVICET_REPORT, &hid_desc); | ||
| 610 | if (error) { | ||
| 611 | dev_err(&intf->dev, | ||
| 612 | "can not retrieve extra class descriptor\n"); | ||
| 613 | goto out; | ||
| 614 | } | ||
| 615 | } | ||
| 616 | error = wacom_parse_hid(intf, hid_desc, features); | ||
| 617 | 380 | ||
| 618 | out: | 381 | wacom_parse_hid(hdev, features); |
| 619 | return error; | ||
| 620 | } | 382 | } |
| 621 | 383 | ||
| 622 | struct wacom_usbdev_data { | 384 | struct wacom_hdev_data { |
| 623 | struct list_head list; | 385 | struct list_head list; |
| 624 | struct kref kref; | 386 | struct kref kref; |
| 625 | struct usb_device *dev; | 387 | struct hid_device *dev; |
| 626 | struct wacom_shared shared; | 388 | struct wacom_shared shared; |
| 627 | }; | 389 | }; |
| 628 | 390 | ||
| 629 | static LIST_HEAD(wacom_udev_list); | 391 | static LIST_HEAD(wacom_udev_list); |
| 630 | static DEFINE_MUTEX(wacom_udev_list_lock); | 392 | static DEFINE_MUTEX(wacom_udev_list_lock); |
| 631 | 393 | ||
| 632 | static struct usb_device *wacom_get_sibling(struct usb_device *dev, int vendor, int product) | 394 | static bool wacom_are_sibling(struct hid_device *hdev, |
| 395 | struct hid_device *sibling) | ||
| 633 | { | 396 | { |
| 634 | int port1; | 397 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 635 | struct usb_device *sibling; | 398 | struct wacom_features *features = &wacom->wacom_wac.features; |
| 636 | 399 | int vid = features->oVid; | |
| 637 | if (vendor == 0 && product == 0) | 400 | int pid = features->oPid; |
| 638 | return dev; | 401 | int n1,n2; |
| 639 | 402 | ||
| 640 | if (dev->parent == NULL) | 403 | if (vid == 0 && pid == 0) { |
| 641 | return NULL; | 404 | vid = hdev->vendor; |
| 405 | pid = hdev->product; | ||
| 406 | } | ||
| 642 | 407 | ||
| 643 | usb_hub_for_each_child(dev->parent, port1, sibling) { | 408 | if (vid != sibling->vendor || pid != sibling->product) |
| 644 | struct usb_device_descriptor *d; | 409 | return false; |
| 645 | if (sibling == NULL) | ||
| 646 | continue; | ||
| 647 | 410 | ||
| 648 | d = &sibling->descriptor; | 411 | /* Compare the physical path. */ |
| 649 | if (d->idVendor == vendor && d->idProduct == product) | 412 | n1 = strrchr(hdev->phys, '.') - hdev->phys; |
| 650 | return sibling; | 413 | n2 = strrchr(sibling->phys, '.') - sibling->phys; |
| 651 | } | 414 | if (n1 != n2 || n1 <= 0 || n2 <= 0) |
| 415 | return false; | ||
| 652 | 416 | ||
| 653 | return NULL; | 417 | return !strncmp(hdev->phys, sibling->phys, n1); |
| 654 | } | 418 | } |
| 655 | 419 | ||
| 656 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) | 420 | static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev) |
| 657 | { | 421 | { |
| 658 | struct wacom_usbdev_data *data; | 422 | struct wacom_hdev_data *data; |
| 659 | 423 | ||
| 660 | list_for_each_entry(data, &wacom_udev_list, list) { | 424 | list_for_each_entry(data, &wacom_udev_list, list) { |
| 661 | if (data->dev == dev) { | 425 | if (wacom_are_sibling(hdev, data->dev)) { |
| 662 | kref_get(&data->kref); | 426 | kref_get(&data->kref); |
| 663 | return data; | 427 | return data; |
| 664 | } | 428 | } |
| @@ -667,28 +431,29 @@ static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) | |||
| 667 | return NULL; | 431 | return NULL; |
| 668 | } | 432 | } |
| 669 | 433 | ||
| 670 | static int wacom_add_shared_data(struct wacom_wac *wacom, | 434 | static int wacom_add_shared_data(struct hid_device *hdev) |
| 671 | struct usb_device *dev) | ||
| 672 | { | 435 | { |
| 673 | struct wacom_usbdev_data *data; | 436 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 437 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | ||
| 438 | struct wacom_hdev_data *data; | ||
| 674 | int retval = 0; | 439 | int retval = 0; |
| 675 | 440 | ||
| 676 | mutex_lock(&wacom_udev_list_lock); | 441 | mutex_lock(&wacom_udev_list_lock); |
| 677 | 442 | ||
| 678 | data = wacom_get_usbdev_data(dev); | 443 | data = wacom_get_hdev_data(hdev); |
| 679 | if (!data) { | 444 | if (!data) { |
| 680 | data = kzalloc(sizeof(struct wacom_usbdev_data), GFP_KERNEL); | 445 | data = kzalloc(sizeof(struct wacom_hdev_data), GFP_KERNEL); |
| 681 | if (!data) { | 446 | if (!data) { |
| 682 | retval = -ENOMEM; | 447 | retval = -ENOMEM; |
| 683 | goto out; | 448 | goto out; |
| 684 | } | 449 | } |
| 685 | 450 | ||
| 686 | kref_init(&data->kref); | 451 | kref_init(&data->kref); |
| 687 | data->dev = dev; | 452 | data->dev = hdev; |
| 688 | list_add_tail(&data->list, &wacom_udev_list); | 453 | list_add_tail(&data->list, &wacom_udev_list); |
| 689 | } | 454 | } |
| 690 | 455 | ||
| 691 | wacom->shared = &data->shared; | 456 | wacom_wac->shared = &data->shared; |
| 692 | 457 | ||
| 693 | out: | 458 | out: |
| 694 | mutex_unlock(&wacom_udev_list_lock); | 459 | mutex_unlock(&wacom_udev_list_lock); |
| @@ -697,8 +462,8 @@ out: | |||
| 697 | 462 | ||
| 698 | static void wacom_release_shared_data(struct kref *kref) | 463 | static void wacom_release_shared_data(struct kref *kref) |
| 699 | { | 464 | { |
| 700 | struct wacom_usbdev_data *data = | 465 | struct wacom_hdev_data *data = |
| 701 | container_of(kref, struct wacom_usbdev_data, kref); | 466 | container_of(kref, struct wacom_hdev_data, kref); |
| 702 | 467 | ||
| 703 | mutex_lock(&wacom_udev_list_lock); | 468 | mutex_lock(&wacom_udev_list_lock); |
| 704 | list_del(&data->list); | 469 | list_del(&data->list); |
| @@ -709,10 +474,10 @@ static void wacom_release_shared_data(struct kref *kref) | |||
| 709 | 474 | ||
| 710 | static void wacom_remove_shared_data(struct wacom_wac *wacom) | 475 | static void wacom_remove_shared_data(struct wacom_wac *wacom) |
| 711 | { | 476 | { |
| 712 | struct wacom_usbdev_data *data; | 477 | struct wacom_hdev_data *data; |
| 713 | 478 | ||
| 714 | if (wacom->shared) { | 479 | if (wacom->shared) { |
| 715 | data = container_of(wacom->shared, struct wacom_usbdev_data, shared); | 480 | data = container_of(wacom->shared, struct wacom_hdev_data, shared); |
| 716 | kref_put(&data->kref, wacom_release_shared_data); | 481 | kref_put(&data->kref, wacom_release_shared_data); |
| 717 | wacom->shared = NULL; | 482 | wacom->shared = NULL; |
| 718 | } | 483 | } |
| @@ -755,38 +520,40 @@ static int wacom_led_control(struct wacom *wacom) | |||
| 755 | buf[4] = wacom->led.img_lum; | 520 | buf[4] = wacom->led.img_lum; |
| 756 | } | 521 | } |
| 757 | 522 | ||
| 758 | retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_LED_CONTROL, | 523 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 9, |
| 759 | buf, 9, WAC_CMD_RETRIES); | 524 | WAC_CMD_RETRIES); |
| 760 | kfree(buf); | 525 | kfree(buf); |
| 761 | 526 | ||
| 762 | return retval; | 527 | return retval; |
| 763 | } | 528 | } |
| 764 | 529 | ||
| 765 | static int wacom_led_putimage(struct wacom *wacom, int button_id, const void *img) | 530 | static int wacom_led_putimage(struct wacom *wacom, int button_id, u8 xfer_id, |
| 531 | const unsigned len, const void *img) | ||
| 766 | { | 532 | { |
| 767 | unsigned char *buf; | 533 | unsigned char *buf; |
| 768 | int i, retval; | 534 | int i, retval; |
| 535 | const unsigned chunk_len = len / 4; /* 4 chunks are needed to be sent */ | ||
| 769 | 536 | ||
| 770 | buf = kzalloc(259, GFP_KERNEL); | 537 | buf = kzalloc(chunk_len + 3 , GFP_KERNEL); |
| 771 | if (!buf) | 538 | if (!buf) |
| 772 | return -ENOMEM; | 539 | return -ENOMEM; |
| 773 | 540 | ||
| 774 | /* Send 'start' command */ | 541 | /* Send 'start' command */ |
| 775 | buf[0] = WAC_CMD_ICON_START; | 542 | buf[0] = WAC_CMD_ICON_START; |
| 776 | buf[1] = 1; | 543 | buf[1] = 1; |
| 777 | retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_ICON_START, | 544 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, |
| 778 | buf, 2, WAC_CMD_RETRIES); | 545 | WAC_CMD_RETRIES); |
| 779 | if (retval < 0) | 546 | if (retval < 0) |
| 780 | goto out; | 547 | goto out; |
| 781 | 548 | ||
| 782 | buf[0] = WAC_CMD_ICON_XFER; | 549 | buf[0] = xfer_id; |
| 783 | buf[1] = button_id & 0x07; | 550 | buf[1] = button_id & 0x07; |
| 784 | for (i = 0; i < 4; i++) { | 551 | for (i = 0; i < 4; i++) { |
| 785 | buf[2] = i; | 552 | buf[2] = i; |
| 786 | memcpy(buf + 3, img + i * 256, 256); | 553 | memcpy(buf + 3, img + i * chunk_len, chunk_len); |
| 787 | 554 | ||
| 788 | retval = wacom_set_report(wacom->intf, 0x03, WAC_CMD_ICON_XFER, | 555 | retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, |
| 789 | buf, 259, WAC_CMD_RETRIES); | 556 | buf, chunk_len + 3, WAC_CMD_RETRIES); |
| 790 | if (retval < 0) | 557 | if (retval < 0) |
| 791 | break; | 558 | break; |
| 792 | } | 559 | } |
| @@ -794,8 +561,8 @@ static int wacom_led_putimage(struct wacom *wacom, int button_id, const void *im | |||
| 794 | /* Send 'stop' */ | 561 | /* Send 'stop' */ |
| 795 | buf[0] = WAC_CMD_ICON_START; | 562 | buf[0] = WAC_CMD_ICON_START; |
| 796 | buf[1] = 0; | 563 | buf[1] = 0; |
| 797 | wacom_set_report(wacom->intf, 0x03, WAC_CMD_ICON_START, | 564 | wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, |
| 798 | buf, 2, WAC_CMD_RETRIES); | 565 | WAC_CMD_RETRIES); |
| 799 | 566 | ||
| 800 | out: | 567 | out: |
| 801 | kfree(buf); | 568 | kfree(buf); |
| @@ -805,7 +572,8 @@ out: | |||
| 805 | static ssize_t wacom_led_select_store(struct device *dev, int set_id, | 572 | static ssize_t wacom_led_select_store(struct device *dev, int set_id, |
| 806 | const char *buf, size_t count) | 573 | const char *buf, size_t count) |
| 807 | { | 574 | { |
| 808 | struct wacom *wacom = dev_get_drvdata(dev); | 575 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 576 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
| 809 | unsigned int id; | 577 | unsigned int id; |
| 810 | int err; | 578 | int err; |
| 811 | 579 | ||
| @@ -832,7 +600,8 @@ static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \ | |||
| 832 | static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ | 600 | static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ |
| 833 | struct device_attribute *attr, char *buf) \ | 601 | struct device_attribute *attr, char *buf) \ |
| 834 | { \ | 602 | { \ |
| 835 | struct wacom *wacom = dev_get_drvdata(dev); \ | 603 | struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ |
| 604 | struct wacom *wacom = hid_get_drvdata(hdev); \ | ||
| 836 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ | 605 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ |
| 837 | } \ | 606 | } \ |
| 838 | static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ | 607 | static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ |
| @@ -866,7 +635,8 @@ static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest, | |||
| 866 | static ssize_t wacom_##name##_luminance_store(struct device *dev, \ | 635 | static ssize_t wacom_##name##_luminance_store(struct device *dev, \ |
| 867 | struct device_attribute *attr, const char *buf, size_t count) \ | 636 | struct device_attribute *attr, const char *buf, size_t count) \ |
| 868 | { \ | 637 | { \ |
| 869 | struct wacom *wacom = dev_get_drvdata(dev); \ | 638 | struct hid_device *hdev = container_of(dev, struct hid_device, dev);\ |
| 639 | struct wacom *wacom = hid_get_drvdata(hdev); \ | ||
| 870 | \ | 640 | \ |
| 871 | return wacom_luminance_store(wacom, &wacom->led.field, \ | 641 | return wacom_luminance_store(wacom, &wacom->led.field, \ |
| 872 | buf, count); \ | 642 | buf, count); \ |
| @@ -881,15 +651,26 @@ DEVICE_LUMINANCE_ATTR(buttons, img_lum); | |||
| 881 | static ssize_t wacom_button_image_store(struct device *dev, int button_id, | 651 | static ssize_t wacom_button_image_store(struct device *dev, int button_id, |
| 882 | const char *buf, size_t count) | 652 | const char *buf, size_t count) |
| 883 | { | 653 | { |
| 884 | struct wacom *wacom = dev_get_drvdata(dev); | 654 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 655 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
| 885 | int err; | 656 | int err; |
| 657 | unsigned len; | ||
| 658 | u8 xfer_id; | ||
| 659 | |||
| 660 | if (hdev->bus == BUS_BLUETOOTH) { | ||
| 661 | len = 256; | ||
| 662 | xfer_id = WAC_CMD_ICON_BT_XFER; | ||
| 663 | } else { | ||
| 664 | len = 1024; | ||
| 665 | xfer_id = WAC_CMD_ICON_XFER; | ||
| 666 | } | ||
| 886 | 667 | ||
| 887 | if (count != 1024) | 668 | if (count != len) |
| 888 | return -EINVAL; | 669 | return -EINVAL; |
| 889 | 670 | ||
| 890 | mutex_lock(&wacom->lock); | 671 | mutex_lock(&wacom->lock); |
| 891 | 672 | ||
| 892 | err = wacom_led_putimage(wacom, button_id, buf); | 673 | err = wacom_led_putimage(wacom, button_id, xfer_id, len, buf); |
| 893 | 674 | ||
| 894 | mutex_unlock(&wacom->lock); | 675 | mutex_unlock(&wacom->lock); |
| 895 | 676 | ||
| @@ -965,13 +746,14 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 965 | switch (wacom->wacom_wac.features.type) { | 746 | switch (wacom->wacom_wac.features.type) { |
| 966 | case INTUOS4S: | 747 | case INTUOS4S: |
| 967 | case INTUOS4: | 748 | case INTUOS4: |
| 749 | case INTUOS4WL: | ||
| 968 | case INTUOS4L: | 750 | case INTUOS4L: |
| 969 | wacom->led.select[0] = 0; | 751 | wacom->led.select[0] = 0; |
| 970 | wacom->led.select[1] = 0; | 752 | wacom->led.select[1] = 0; |
| 971 | wacom->led.llv = 10; | 753 | wacom->led.llv = 10; |
| 972 | wacom->led.hlv = 20; | 754 | wacom->led.hlv = 20; |
| 973 | wacom->led.img_lum = 10; | 755 | wacom->led.img_lum = 10; |
| 974 | error = sysfs_create_group(&wacom->intf->dev.kobj, | 756 | error = sysfs_create_group(&wacom->hdev->dev.kobj, |
| 975 | &intuos4_led_attr_group); | 757 | &intuos4_led_attr_group); |
| 976 | break; | 758 | break; |
| 977 | 759 | ||
| @@ -983,7 +765,7 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 983 | wacom->led.hlv = 0; | 765 | wacom->led.hlv = 0; |
| 984 | wacom->led.img_lum = 0; | 766 | wacom->led.img_lum = 0; |
| 985 | 767 | ||
| 986 | error = sysfs_create_group(&wacom->intf->dev.kobj, | 768 | error = sysfs_create_group(&wacom->hdev->dev.kobj, |
| 987 | &cintiq_led_attr_group); | 769 | &cintiq_led_attr_group); |
| 988 | break; | 770 | break; |
| 989 | 771 | ||
| @@ -1000,7 +782,7 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 1000 | wacom->led.hlv = 0; | 782 | wacom->led.hlv = 0; |
| 1001 | wacom->led.img_lum = 0; | 783 | wacom->led.img_lum = 0; |
| 1002 | 784 | ||
| 1003 | error = sysfs_create_group(&wacom->intf->dev.kobj, | 785 | error = sysfs_create_group(&wacom->hdev->dev.kobj, |
| 1004 | &intuos5_led_attr_group); | 786 | &intuos5_led_attr_group); |
| 1005 | } else | 787 | } else |
| 1006 | return 0; | 788 | return 0; |
| @@ -1011,28 +793,35 @@ static int wacom_initialize_leds(struct wacom *wacom) | |||
| 1011 | } | 793 | } |
| 1012 | 794 | ||
| 1013 | if (error) { | 795 | if (error) { |
| 1014 | dev_err(&wacom->intf->dev, | 796 | hid_err(wacom->hdev, |
| 1015 | "cannot create sysfs group err: %d\n", error); | 797 | "cannot create sysfs group err: %d\n", error); |
| 1016 | return error; | 798 | return error; |
| 1017 | } | 799 | } |
| 1018 | wacom_led_control(wacom); | 800 | wacom_led_control(wacom); |
| 801 | wacom->led_initialized = true; | ||
| 1019 | 802 | ||
| 1020 | return 0; | 803 | return 0; |
| 1021 | } | 804 | } |
| 1022 | 805 | ||
| 1023 | static void wacom_destroy_leds(struct wacom *wacom) | 806 | static void wacom_destroy_leds(struct wacom *wacom) |
| 1024 | { | 807 | { |
| 808 | if (!wacom->led_initialized) | ||
| 809 | return; | ||
| 810 | |||
| 811 | wacom->led_initialized = false; | ||
| 812 | |||
| 1025 | switch (wacom->wacom_wac.features.type) { | 813 | switch (wacom->wacom_wac.features.type) { |
| 1026 | case INTUOS4S: | 814 | case INTUOS4S: |
| 1027 | case INTUOS4: | 815 | case INTUOS4: |
| 816 | case INTUOS4WL: | ||
| 1028 | case INTUOS4L: | 817 | case INTUOS4L: |
| 1029 | sysfs_remove_group(&wacom->intf->dev.kobj, | 818 | sysfs_remove_group(&wacom->hdev->dev.kobj, |
| 1030 | &intuos4_led_attr_group); | 819 | &intuos4_led_attr_group); |
| 1031 | break; | 820 | break; |
| 1032 | 821 | ||
| 1033 | case WACOM_24HD: | 822 | case WACOM_24HD: |
| 1034 | case WACOM_21UX2: | 823 | case WACOM_21UX2: |
| 1035 | sysfs_remove_group(&wacom->intf->dev.kobj, | 824 | sysfs_remove_group(&wacom->hdev->dev.kobj, |
| 1036 | &cintiq_led_attr_group); | 825 | &cintiq_led_attr_group); |
| 1037 | break; | 826 | break; |
| 1038 | 827 | ||
| @@ -1043,17 +832,24 @@ static void wacom_destroy_leds(struct wacom *wacom) | |||
| 1043 | case INTUOSPM: | 832 | case INTUOSPM: |
| 1044 | case INTUOSPL: | 833 | case INTUOSPL: |
| 1045 | if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) | 834 | if (wacom->wacom_wac.features.device_type == BTN_TOOL_PEN) |
| 1046 | sysfs_remove_group(&wacom->intf->dev.kobj, | 835 | sysfs_remove_group(&wacom->hdev->dev.kobj, |
| 1047 | &intuos5_led_attr_group); | 836 | &intuos5_led_attr_group); |
| 1048 | break; | 837 | break; |
| 1049 | } | 838 | } |
| 1050 | } | 839 | } |
| 1051 | 840 | ||
| 1052 | static enum power_supply_property wacom_battery_props[] = { | 841 | static enum power_supply_property wacom_battery_props[] = { |
| 842 | POWER_SUPPLY_PROP_STATUS, | ||
| 1053 | POWER_SUPPLY_PROP_SCOPE, | 843 | POWER_SUPPLY_PROP_SCOPE, |
| 1054 | POWER_SUPPLY_PROP_CAPACITY | 844 | POWER_SUPPLY_PROP_CAPACITY |
| 1055 | }; | 845 | }; |
| 1056 | 846 | ||
| 847 | static enum power_supply_property wacom_ac_props[] = { | ||
| 848 | POWER_SUPPLY_PROP_PRESENT, | ||
| 849 | POWER_SUPPLY_PROP_ONLINE, | ||
| 850 | POWER_SUPPLY_PROP_SCOPE, | ||
| 851 | }; | ||
| 852 | |||
| 1057 | static int wacom_battery_get_property(struct power_supply *psy, | 853 | static int wacom_battery_get_property(struct power_supply *psy, |
| 1058 | enum power_supply_property psp, | 854 | enum power_supply_property psp, |
| 1059 | union power_supply_propval *val) | 855 | union power_supply_propval *val) |
| @@ -1067,7 +863,16 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
| 1067 | break; | 863 | break; |
| 1068 | case POWER_SUPPLY_PROP_CAPACITY: | 864 | case POWER_SUPPLY_PROP_CAPACITY: |
| 1069 | val->intval = | 865 | val->intval = |
| 1070 | wacom->wacom_wac.battery_capacity * 100 / 31; | 866 | wacom->wacom_wac.battery_capacity; |
| 867 | break; | ||
| 868 | case POWER_SUPPLY_PROP_STATUS: | ||
| 869 | if (wacom->wacom_wac.bat_charging) | ||
| 870 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | ||
| 871 | else if (wacom->wacom_wac.battery_capacity == 100 && | ||
| 872 | wacom->wacom_wac.ps_connected) | ||
| 873 | val->intval = POWER_SUPPLY_STATUS_FULL; | ||
| 874 | else | ||
| 875 | val->intval = POWER_SUPPLY_STATUS_DISCHARGING; | ||
| 1071 | break; | 876 | break; |
| 1072 | default: | 877 | default: |
| 1073 | ret = -EINVAL; | 878 | ret = -EINVAL; |
| @@ -1077,74 +882,201 @@ static int wacom_battery_get_property(struct power_supply *psy, | |||
| 1077 | return ret; | 882 | return ret; |
| 1078 | } | 883 | } |
| 1079 | 884 | ||
| 885 | static int wacom_ac_get_property(struct power_supply *psy, | ||
| 886 | enum power_supply_property psp, | ||
| 887 | union power_supply_propval *val) | ||
| 888 | { | ||
| 889 | struct wacom *wacom = container_of(psy, struct wacom, ac); | ||
| 890 | int ret = 0; | ||
| 891 | |||
| 892 | switch (psp) { | ||
| 893 | case POWER_SUPPLY_PROP_PRESENT: | ||
| 894 | /* fall through */ | ||
| 895 | case POWER_SUPPLY_PROP_ONLINE: | ||
| 896 | val->intval = wacom->wacom_wac.ps_connected; | ||
| 897 | break; | ||
| 898 | case POWER_SUPPLY_PROP_SCOPE: | ||
| 899 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; | ||
| 900 | break; | ||
| 901 | default: | ||
| 902 | ret = -EINVAL; | ||
| 903 | break; | ||
| 904 | } | ||
| 905 | return ret; | ||
| 906 | } | ||
| 907 | |||
| 1080 | static int wacom_initialize_battery(struct wacom *wacom) | 908 | static int wacom_initialize_battery(struct wacom *wacom) |
| 1081 | { | 909 | { |
| 1082 | int error = 0; | 910 | static atomic_t battery_no = ATOMIC_INIT(0); |
| 911 | int error; | ||
| 912 | unsigned long n; | ||
| 913 | |||
| 914 | if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) { | ||
| 915 | n = atomic_inc_return(&battery_no) - 1; | ||
| 1083 | 916 | ||
| 1084 | if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) { | ||
| 1085 | wacom->battery.properties = wacom_battery_props; | 917 | wacom->battery.properties = wacom_battery_props; |
| 1086 | wacom->battery.num_properties = ARRAY_SIZE(wacom_battery_props); | 918 | wacom->battery.num_properties = ARRAY_SIZE(wacom_battery_props); |
| 1087 | wacom->battery.get_property = wacom_battery_get_property; | 919 | wacom->battery.get_property = wacom_battery_get_property; |
| 1088 | wacom->battery.name = "wacom_battery"; | 920 | sprintf(wacom->wacom_wac.bat_name, "wacom_battery_%ld", n); |
| 921 | wacom->battery.name = wacom->wacom_wac.bat_name; | ||
| 1089 | wacom->battery.type = POWER_SUPPLY_TYPE_BATTERY; | 922 | wacom->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
| 1090 | wacom->battery.use_for_apm = 0; | 923 | wacom->battery.use_for_apm = 0; |
| 1091 | 924 | ||
| 1092 | error = power_supply_register(&wacom->usbdev->dev, | 925 | wacom->ac.properties = wacom_ac_props; |
| 926 | wacom->ac.num_properties = ARRAY_SIZE(wacom_ac_props); | ||
| 927 | wacom->ac.get_property = wacom_ac_get_property; | ||
| 928 | sprintf(wacom->wacom_wac.ac_name, "wacom_ac_%ld", n); | ||
| 929 | wacom->ac.name = wacom->wacom_wac.ac_name; | ||
| 930 | wacom->ac.type = POWER_SUPPLY_TYPE_MAINS; | ||
| 931 | wacom->ac.use_for_apm = 0; | ||
| 932 | |||
| 933 | error = power_supply_register(&wacom->hdev->dev, | ||
| 1093 | &wacom->battery); | 934 | &wacom->battery); |
| 935 | if (error) | ||
| 936 | return error; | ||
| 937 | |||
| 938 | power_supply_powers(&wacom->battery, &wacom->hdev->dev); | ||
| 1094 | 939 | ||
| 1095 | if (!error) | 940 | error = power_supply_register(&wacom->hdev->dev, &wacom->ac); |
| 1096 | power_supply_powers(&wacom->battery, | 941 | if (error) { |
| 1097 | &wacom->usbdev->dev); | 942 | power_supply_unregister(&wacom->battery); |
| 943 | return error; | ||
| 944 | } | ||
| 945 | |||
| 946 | power_supply_powers(&wacom->ac, &wacom->hdev->dev); | ||
| 1098 | } | 947 | } |
| 1099 | 948 | ||
| 1100 | return error; | 949 | return 0; |
| 1101 | } | 950 | } |
| 1102 | 951 | ||
| 1103 | static void wacom_destroy_battery(struct wacom *wacom) | 952 | static void wacom_destroy_battery(struct wacom *wacom) |
| 1104 | { | 953 | { |
| 1105 | if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR && | 954 | if ((wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) && |
| 1106 | wacom->battery.dev) { | 955 | wacom->battery.dev) { |
| 1107 | power_supply_unregister(&wacom->battery); | 956 | power_supply_unregister(&wacom->battery); |
| 1108 | wacom->battery.dev = NULL; | 957 | wacom->battery.dev = NULL; |
| 958 | power_supply_unregister(&wacom->ac); | ||
| 959 | wacom->ac.dev = NULL; | ||
| 1109 | } | 960 | } |
| 1110 | } | 961 | } |
| 1111 | 962 | ||
| 1112 | static int wacom_register_input(struct wacom *wacom) | 963 | static ssize_t wacom_show_speed(struct device *dev, |
| 964 | struct device_attribute | ||
| 965 | *attr, char *buf) | ||
| 966 | { | ||
| 967 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 968 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
| 969 | |||
| 970 | return snprintf(buf, PAGE_SIZE, "%i\n", wacom->wacom_wac.bt_high_speed); | ||
| 971 | } | ||
| 972 | |||
| 973 | static ssize_t wacom_store_speed(struct device *dev, | ||
| 974 | struct device_attribute *attr, | ||
| 975 | const char *buf, size_t count) | ||
| 976 | { | ||
| 977 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | ||
| 978 | struct wacom *wacom = hid_get_drvdata(hdev); | ||
| 979 | u8 new_speed; | ||
| 980 | |||
| 981 | if (kstrtou8(buf, 0, &new_speed)) | ||
| 982 | return -EINVAL; | ||
| 983 | |||
| 984 | if (new_speed != 0 && new_speed != 1) | ||
| 985 | return -EINVAL; | ||
| 986 | |||
| 987 | wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); | ||
| 988 | |||
| 989 | return count; | ||
| 990 | } | ||
| 991 | |||
| 992 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, | ||
| 993 | wacom_show_speed, wacom_store_speed); | ||
| 994 | |||
| 995 | static struct input_dev *wacom_allocate_input(struct wacom *wacom) | ||
| 1113 | { | 996 | { |
| 1114 | struct input_dev *input_dev; | 997 | struct input_dev *input_dev; |
| 1115 | struct usb_interface *intf = wacom->intf; | 998 | struct hid_device *hdev = wacom->hdev; |
| 1116 | struct usb_device *dev = interface_to_usbdev(intf); | ||
| 1117 | struct wacom_wac *wacom_wac = &(wacom->wacom_wac); | 999 | struct wacom_wac *wacom_wac = &(wacom->wacom_wac); |
| 1118 | int error; | ||
| 1119 | 1000 | ||
| 1120 | input_dev = input_allocate_device(); | 1001 | input_dev = input_allocate_device(); |
| 1121 | if (!input_dev) { | 1002 | if (!input_dev) |
| 1122 | error = -ENOMEM; | 1003 | return NULL; |
| 1123 | goto fail1; | ||
| 1124 | } | ||
| 1125 | 1004 | ||
| 1126 | input_dev->name = wacom_wac->name; | 1005 | input_dev->name = wacom_wac->name; |
| 1127 | input_dev->dev.parent = &intf->dev; | 1006 | input_dev->phys = hdev->phys; |
| 1007 | input_dev->dev.parent = &hdev->dev; | ||
| 1128 | input_dev->open = wacom_open; | 1008 | input_dev->open = wacom_open; |
| 1129 | input_dev->close = wacom_close; | 1009 | input_dev->close = wacom_close; |
| 1130 | usb_to_input_id(dev, &input_dev->id); | 1010 | input_dev->uniq = hdev->uniq; |
| 1011 | input_dev->id.bustype = hdev->bus; | ||
| 1012 | input_dev->id.vendor = hdev->vendor; | ||
| 1013 | input_dev->id.product = hdev->product; | ||
| 1014 | input_dev->id.version = hdev->version; | ||
| 1131 | input_set_drvdata(input_dev, wacom); | 1015 | input_set_drvdata(input_dev, wacom); |
| 1132 | 1016 | ||
| 1017 | return input_dev; | ||
| 1018 | } | ||
| 1019 | |||
| 1020 | static void wacom_unregister_inputs(struct wacom *wacom) | ||
| 1021 | { | ||
| 1022 | if (wacom->wacom_wac.input) | ||
| 1023 | input_unregister_device(wacom->wacom_wac.input); | ||
| 1024 | if (wacom->wacom_wac.pad_input) | ||
| 1025 | input_unregister_device(wacom->wacom_wac.pad_input); | ||
| 1026 | wacom->wacom_wac.input = NULL; | ||
| 1027 | wacom->wacom_wac.pad_input = NULL; | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | static int wacom_register_inputs(struct wacom *wacom) | ||
| 1031 | { | ||
| 1032 | struct input_dev *input_dev, *pad_input_dev; | ||
| 1033 | struct wacom_wac *wacom_wac = &(wacom->wacom_wac); | ||
| 1034 | int error; | ||
| 1035 | |||
| 1036 | input_dev = wacom_allocate_input(wacom); | ||
| 1037 | pad_input_dev = wacom_allocate_input(wacom); | ||
| 1038 | if (!input_dev || !pad_input_dev) { | ||
| 1039 | error = -ENOMEM; | ||
| 1040 | goto fail1; | ||
| 1041 | } | ||
| 1042 | |||
| 1133 | wacom_wac->input = input_dev; | 1043 | wacom_wac->input = input_dev; |
| 1044 | wacom_wac->pad_input = pad_input_dev; | ||
| 1045 | wacom_wac->pad_input->name = wacom_wac->pad_name; | ||
| 1046 | |||
| 1134 | error = wacom_setup_input_capabilities(input_dev, wacom_wac); | 1047 | error = wacom_setup_input_capabilities(input_dev, wacom_wac); |
| 1135 | if (error) | 1048 | if (error) |
| 1136 | goto fail1; | 1049 | goto fail2; |
| 1137 | 1050 | ||
| 1138 | error = input_register_device(input_dev); | 1051 | error = input_register_device(input_dev); |
| 1139 | if (error) | 1052 | if (error) |
| 1140 | goto fail2; | 1053 | goto fail2; |
| 1141 | 1054 | ||
| 1055 | error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); | ||
| 1056 | if (error) { | ||
| 1057 | /* no pad in use on this interface */ | ||
| 1058 | input_free_device(pad_input_dev); | ||
| 1059 | wacom_wac->pad_input = NULL; | ||
| 1060 | pad_input_dev = NULL; | ||
| 1061 | } else { | ||
| 1062 | error = input_register_device(pad_input_dev); | ||
| 1063 | if (error) | ||
| 1064 | goto fail3; | ||
| 1065 | } | ||
| 1066 | |||
| 1142 | return 0; | 1067 | return 0; |
| 1143 | 1068 | ||
| 1069 | fail3: | ||
| 1070 | input_unregister_device(input_dev); | ||
| 1071 | input_dev = NULL; | ||
| 1144 | fail2: | 1072 | fail2: |
| 1145 | input_free_device(input_dev); | ||
| 1146 | wacom_wac->input = NULL; | 1073 | wacom_wac->input = NULL; |
| 1074 | wacom_wac->pad_input = NULL; | ||
| 1147 | fail1: | 1075 | fail1: |
| 1076 | if (input_dev) | ||
| 1077 | input_free_device(input_dev); | ||
| 1078 | if (pad_input_dev) | ||
| 1079 | input_free_device(pad_input_dev); | ||
| 1148 | return error; | 1080 | return error; |
| 1149 | } | 1081 | } |
| 1150 | 1082 | ||
| @@ -1153,6 +1085,7 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1153 | struct wacom *wacom = container_of(work, struct wacom, work); | 1085 | struct wacom *wacom = container_of(work, struct wacom, work); |
| 1154 | struct usb_device *usbdev = wacom->usbdev; | 1086 | struct usb_device *usbdev = wacom->usbdev; |
| 1155 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; | 1087 | struct wacom_wac *wacom_wac = &wacom->wacom_wac; |
| 1088 | struct hid_device *hdev1, *hdev2; | ||
| 1156 | struct wacom *wacom1, *wacom2; | 1089 | struct wacom *wacom1, *wacom2; |
| 1157 | struct wacom_wac *wacom_wac1, *wacom_wac2; | 1090 | struct wacom_wac *wacom_wac1, *wacom_wac2; |
| 1158 | int error; | 1091 | int error; |
| @@ -1165,50 +1098,49 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1165 | wacom_destroy_battery(wacom); | 1098 | wacom_destroy_battery(wacom); |
| 1166 | 1099 | ||
| 1167 | /* Stylus interface */ | 1100 | /* Stylus interface */ |
| 1168 | wacom1 = usb_get_intfdata(usbdev->config->interface[1]); | 1101 | hdev1 = usb_get_intfdata(usbdev->config->interface[1]); |
| 1102 | wacom1 = hid_get_drvdata(hdev1); | ||
| 1169 | wacom_wac1 = &(wacom1->wacom_wac); | 1103 | wacom_wac1 = &(wacom1->wacom_wac); |
| 1170 | if (wacom_wac1->input) | 1104 | wacom_unregister_inputs(wacom1); |
| 1171 | input_unregister_device(wacom_wac1->input); | ||
| 1172 | wacom_wac1->input = NULL; | ||
| 1173 | 1105 | ||
| 1174 | /* Touch interface */ | 1106 | /* Touch interface */ |
| 1175 | wacom2 = usb_get_intfdata(usbdev->config->interface[2]); | 1107 | hdev2 = usb_get_intfdata(usbdev->config->interface[2]); |
| 1108 | wacom2 = hid_get_drvdata(hdev2); | ||
| 1176 | wacom_wac2 = &(wacom2->wacom_wac); | 1109 | wacom_wac2 = &(wacom2->wacom_wac); |
| 1177 | if (wacom_wac2->input) | 1110 | wacom_unregister_inputs(wacom2); |
| 1178 | input_unregister_device(wacom_wac2->input); | ||
| 1179 | wacom_wac2->input = NULL; | ||
| 1180 | 1111 | ||
| 1181 | if (wacom_wac->pid == 0) { | 1112 | if (wacom_wac->pid == 0) { |
| 1182 | dev_info(&wacom->intf->dev, "wireless tablet disconnected\n"); | 1113 | hid_info(wacom->hdev, "wireless tablet disconnected\n"); |
| 1114 | wacom_wac1->shared->type = 0; | ||
| 1183 | } else { | 1115 | } else { |
| 1184 | const struct usb_device_id *id = wacom_ids; | 1116 | const struct hid_device_id *id = wacom_ids; |
| 1185 | 1117 | ||
| 1186 | dev_info(&wacom->intf->dev, | 1118 | hid_info(wacom->hdev, "wireless tablet connected with PID %x\n", |
| 1187 | "wireless tablet connected with PID %x\n", | ||
| 1188 | wacom_wac->pid); | 1119 | wacom_wac->pid); |
| 1189 | 1120 | ||
| 1190 | while (id->match_flags) { | 1121 | while (id->bus) { |
| 1191 | if (id->idVendor == USB_VENDOR_ID_WACOM && | 1122 | if (id->vendor == USB_VENDOR_ID_WACOM && |
| 1192 | id->idProduct == wacom_wac->pid) | 1123 | id->product == wacom_wac->pid) |
| 1193 | break; | 1124 | break; |
| 1194 | id++; | 1125 | id++; |
| 1195 | } | 1126 | } |
| 1196 | 1127 | ||
| 1197 | if (!id->match_flags) { | 1128 | if (!id->bus) { |
| 1198 | dev_info(&wacom->intf->dev, | 1129 | hid_info(wacom->hdev, "ignoring unknown PID.\n"); |
| 1199 | "ignoring unknown PID.\n"); | ||
| 1200 | return; | 1130 | return; |
| 1201 | } | 1131 | } |
| 1202 | 1132 | ||
| 1203 | /* Stylus interface */ | 1133 | /* Stylus interface */ |
| 1204 | wacom_wac1->features = | 1134 | wacom_wac1->features = |
| 1205 | *((struct wacom_features *)id->driver_info); | 1135 | *((struct wacom_features *)id->driver_data); |
| 1206 | wacom_wac1->features.device_type = BTN_TOOL_PEN; | 1136 | wacom_wac1->features.device_type = BTN_TOOL_PEN; |
| 1207 | snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", | 1137 | snprintf(wacom_wac1->name, WACOM_NAME_MAX, "%s (WL) Pen", |
| 1208 | wacom_wac1->features.name); | 1138 | wacom_wac1->features.name); |
| 1139 | snprintf(wacom_wac1->pad_name, WACOM_NAME_MAX, "%s (WL) Pad", | ||
| 1140 | wacom_wac1->features.name); | ||
| 1209 | wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max; | 1141 | wacom_wac1->shared->touch_max = wacom_wac1->features.touch_max; |
| 1210 | wacom_wac1->shared->type = wacom_wac1->features.type; | 1142 | wacom_wac1->shared->type = wacom_wac1->features.type; |
| 1211 | error = wacom_register_input(wacom1); | 1143 | error = wacom_register_inputs(wacom1); |
| 1212 | if (error) | 1144 | if (error) |
| 1213 | goto fail; | 1145 | goto fail; |
| 1214 | 1146 | ||
| @@ -1216,7 +1148,7 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1216 | if (wacom_wac1->features.touch_max || | 1148 | if (wacom_wac1->features.touch_max || |
| 1217 | wacom_wac1->features.type == INTUOSHT) { | 1149 | wacom_wac1->features.type == INTUOSHT) { |
| 1218 | wacom_wac2->features = | 1150 | wacom_wac2->features = |
| 1219 | *((struct wacom_features *)id->driver_info); | 1151 | *((struct wacom_features *)id->driver_data); |
| 1220 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | 1152 | wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; |
| 1221 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; | 1153 | wacom_wac2->features.device_type = BTN_TOOL_FINGER; |
| 1222 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; | 1154 | wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; |
| @@ -1226,7 +1158,9 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1226 | else | 1158 | else |
| 1227 | snprintf(wacom_wac2->name, WACOM_NAME_MAX, | 1159 | snprintf(wacom_wac2->name, WACOM_NAME_MAX, |
| 1228 | "%s (WL) Pad",wacom_wac2->features.name); | 1160 | "%s (WL) Pad",wacom_wac2->features.name); |
| 1229 | error = wacom_register_input(wacom2); | 1161 | snprintf(wacom_wac2->pad_name, WACOM_NAME_MAX, |
| 1162 | "%s (WL) Pad", wacom_wac2->features.name); | ||
| 1163 | error = wacom_register_inputs(wacom2); | ||
| 1230 | if (error) | 1164 | if (error) |
| 1231 | goto fail; | 1165 | goto fail; |
| 1232 | 1166 | ||
| @@ -1243,15 +1177,8 @@ static void wacom_wireless_work(struct work_struct *work) | |||
| 1243 | return; | 1177 | return; |
| 1244 | 1178 | ||
| 1245 | fail: | 1179 | fail: |
| 1246 | if (wacom_wac2->input) { | 1180 | wacom_unregister_inputs(wacom1); |
| 1247 | input_unregister_device(wacom_wac2->input); | 1181 | wacom_unregister_inputs(wacom2); |
| 1248 | wacom_wac2->input = NULL; | ||
| 1249 | } | ||
| 1250 | |||
| 1251 | if (wacom_wac1->input) { | ||
| 1252 | input_unregister_device(wacom_wac1->input); | ||
| 1253 | wacom_wac1->input = NULL; | ||
| 1254 | } | ||
| 1255 | return; | 1182 | return; |
| 1256 | } | 1183 | } |
| 1257 | 1184 | ||
| @@ -1282,69 +1209,89 @@ static void wacom_calculate_res(struct wacom_features *features) | |||
| 1282 | features->unitExpo); | 1209 | features->unitExpo); |
| 1283 | } | 1210 | } |
| 1284 | 1211 | ||
| 1285 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) | 1212 | static int wacom_hid_report_len(struct hid_report *report) |
| 1213 | { | ||
| 1214 | /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */ | ||
| 1215 | return ((report->size - 1) >> 3) + 1 + (report->id > 0); | ||
| 1216 | } | ||
| 1217 | |||
| 1218 | static size_t wacom_compute_pktlen(struct hid_device *hdev) | ||
| 1219 | { | ||
| 1220 | struct hid_report_enum *report_enum; | ||
| 1221 | struct hid_report *report; | ||
| 1222 | size_t size = 0; | ||
| 1223 | |||
| 1224 | report_enum = hdev->report_enum + HID_INPUT_REPORT; | ||
| 1225 | |||
| 1226 | list_for_each_entry(report, &report_enum->report_list, list) { | ||
| 1227 | size_t report_size = wacom_hid_report_len(report); | ||
| 1228 | if (report_size > size) | ||
| 1229 | size = report_size; | ||
| 1230 | } | ||
| 1231 | |||
| 1232 | return size; | ||
| 1233 | } | ||
| 1234 | |||
| 1235 | static int wacom_probe(struct hid_device *hdev, | ||
| 1236 | const struct hid_device_id *id) | ||
| 1286 | { | 1237 | { |
| 1238 | struct usb_interface *intf = to_usb_interface(hdev->dev.parent); | ||
| 1287 | struct usb_device *dev = interface_to_usbdev(intf); | 1239 | struct usb_device *dev = interface_to_usbdev(intf); |
| 1288 | struct usb_endpoint_descriptor *endpoint; | ||
| 1289 | struct wacom *wacom; | 1240 | struct wacom *wacom; |
| 1290 | struct wacom_wac *wacom_wac; | 1241 | struct wacom_wac *wacom_wac; |
| 1291 | struct wacom_features *features; | 1242 | struct wacom_features *features; |
| 1292 | int error; | 1243 | int error; |
| 1293 | 1244 | ||
| 1294 | if (!id->driver_info) | 1245 | if (!id->driver_data) |
| 1295 | return -EINVAL; | 1246 | return -EINVAL; |
| 1296 | 1247 | ||
| 1297 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); | 1248 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
| 1298 | if (!wacom) | 1249 | if (!wacom) |
| 1299 | return -ENOMEM; | 1250 | return -ENOMEM; |
| 1300 | 1251 | ||
| 1252 | hid_set_drvdata(hdev, wacom); | ||
| 1253 | wacom->hdev = hdev; | ||
| 1254 | |||
| 1255 | /* ask for the report descriptor to be loaded by HID */ | ||
| 1256 | error = hid_parse(hdev); | ||
| 1257 | if (error) { | ||
| 1258 | hid_err(hdev, "parse failed\n"); | ||
| 1259 | goto fail1; | ||
| 1260 | } | ||
| 1261 | |||
| 1301 | wacom_wac = &wacom->wacom_wac; | 1262 | wacom_wac = &wacom->wacom_wac; |
| 1302 | wacom_wac->features = *((struct wacom_features *)id->driver_info); | 1263 | wacom_wac->features = *((struct wacom_features *)id->driver_data); |
| 1303 | features = &wacom_wac->features; | 1264 | features = &wacom_wac->features; |
| 1265 | features->pktlen = wacom_compute_pktlen(hdev); | ||
| 1304 | if (features->pktlen > WACOM_PKGLEN_MAX) { | 1266 | if (features->pktlen > WACOM_PKGLEN_MAX) { |
| 1305 | error = -EINVAL; | 1267 | error = -EINVAL; |
| 1306 | goto fail1; | 1268 | goto fail1; |
| 1307 | } | 1269 | } |
| 1308 | 1270 | ||
| 1309 | wacom_wac->data = usb_alloc_coherent(dev, WACOM_PKGLEN_MAX, | 1271 | if (features->check_for_hid_type && features->hid_type != hdev->type) { |
| 1310 | GFP_KERNEL, &wacom->data_dma); | 1272 | error = -ENODEV; |
| 1311 | if (!wacom_wac->data) { | ||
| 1312 | error = -ENOMEM; | ||
| 1313 | goto fail1; | 1273 | goto fail1; |
| 1314 | } | 1274 | } |
| 1315 | 1275 | ||
| 1316 | wacom->irq = usb_alloc_urb(0, GFP_KERNEL); | ||
| 1317 | if (!wacom->irq) { | ||
| 1318 | error = -ENOMEM; | ||
| 1319 | goto fail2; | ||
| 1320 | } | ||
| 1321 | |||
| 1322 | wacom->usbdev = dev; | 1276 | wacom->usbdev = dev; |
| 1323 | wacom->intf = intf; | 1277 | wacom->intf = intf; |
| 1324 | mutex_init(&wacom->lock); | 1278 | mutex_init(&wacom->lock); |
| 1325 | INIT_WORK(&wacom->work, wacom_wireless_work); | 1279 | INIT_WORK(&wacom->work, wacom_wireless_work); |
| 1326 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); | ||
| 1327 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); | ||
| 1328 | |||
| 1329 | endpoint = &intf->cur_altsetting->endpoint[0].desc; | ||
| 1330 | 1280 | ||
| 1331 | /* set the default size in case we do not get them from hid */ | 1281 | /* set the default size in case we do not get them from hid */ |
| 1332 | wacom_set_default_phy(features); | 1282 | wacom_set_default_phy(features); |
| 1333 | 1283 | ||
| 1334 | /* Retrieve the physical and logical size for touch devices */ | 1284 | /* Retrieve the physical and logical size for touch devices */ |
| 1335 | error = wacom_retrieve_hid_descriptor(intf, features); | 1285 | wacom_retrieve_hid_descriptor(hdev, features); |
| 1336 | if (error) | ||
| 1337 | goto fail3; | ||
| 1338 | 1286 | ||
| 1339 | /* | 1287 | /* |
| 1340 | * Intuos5 has no useful data about its touch interface in its | 1288 | * Intuos5 has no useful data about its touch interface in its |
| 1341 | * HID descriptor. If this is the touch interface (wMaxPacketSize | 1289 | * HID descriptor. If this is the touch interface (PacketSize |
| 1342 | * of WACOM_PKGLEN_BBTOUCH3), override the table values. | 1290 | * of WACOM_PKGLEN_BBTOUCH3), override the table values. |
| 1343 | */ | 1291 | */ |
| 1344 | if (features->type >= INTUOS5S && features->type <= INTUOSHT) { | 1292 | if (features->type >= INTUOS5S && features->type <= INTUOSHT) { |
| 1345 | if (endpoint->wMaxPacketSize == WACOM_PKGLEN_BBTOUCH3) { | 1293 | if (features->pktlen == WACOM_PKGLEN_BBTOUCH3) { |
| 1346 | features->device_type = BTN_TOOL_FINGER; | 1294 | features->device_type = BTN_TOOL_FINGER; |
| 1347 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; | ||
| 1348 | 1295 | ||
| 1349 | features->x_max = 4096; | 1296 | features->x_max = 4096; |
| 1350 | features->y_max = 4096; | 1297 | features->y_max = 4096; |
| @@ -1353,20 +1300,35 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1353 | } | 1300 | } |
| 1354 | } | 1301 | } |
| 1355 | 1302 | ||
| 1303 | /* | ||
| 1304 | * Same thing for Bamboo 3rd gen. | ||
| 1305 | */ | ||
| 1306 | if ((features->type == BAMBOO_PT) && | ||
| 1307 | (features->pktlen == WACOM_PKGLEN_BBTOUCH3) && | ||
| 1308 | (features->device_type == BTN_TOOL_PEN)) { | ||
| 1309 | features->device_type = BTN_TOOL_FINGER; | ||
| 1310 | |||
| 1311 | features->x_max = 4096; | ||
| 1312 | features->y_max = 4096; | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | if (hdev->bus == BUS_BLUETOOTH) | ||
| 1316 | features->quirks |= WACOM_QUIRK_BATTERY; | ||
| 1317 | |||
| 1356 | wacom_setup_device_quirks(features); | 1318 | wacom_setup_device_quirks(features); |
| 1357 | 1319 | ||
| 1358 | /* set unit to "100th of a mm" for devices not reported by HID */ | 1320 | /* set unit to "100th of a mm" for devices not reported by HID */ |
| 1359 | if (!features->unit) { | 1321 | if (!features->unit) { |
| 1360 | features->unit = 0x11; | 1322 | features->unit = 0x11; |
| 1361 | features->unitExpo = 16 - 3; | 1323 | features->unitExpo = -3; |
| 1362 | } | 1324 | } |
| 1363 | wacom_calculate_res(features); | 1325 | wacom_calculate_res(features); |
| 1364 | 1326 | ||
| 1365 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); | 1327 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); |
| 1328 | snprintf(wacom_wac->pad_name, sizeof(wacom_wac->pad_name), | ||
| 1329 | "%s Pad", features->name); | ||
| 1366 | 1330 | ||
| 1367 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1331 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { |
| 1368 | struct usb_device *other_dev; | ||
| 1369 | |||
| 1370 | /* Append the device type to the name */ | 1332 | /* Append the device type to the name */ |
| 1371 | if (features->device_type != BTN_TOOL_FINGER) | 1333 | if (features->device_type != BTN_TOOL_FINGER) |
| 1372 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); | 1334 | strlcat(wacom_wac->name, " Pen", WACOM_NAME_MAX); |
| @@ -1375,43 +1337,49 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1375 | else | 1337 | else |
| 1376 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); | 1338 | strlcat(wacom_wac->name, " Pad", WACOM_NAME_MAX); |
| 1377 | 1339 | ||
| 1378 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); | 1340 | error = wacom_add_shared_data(hdev); |
| 1379 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) | ||
| 1380 | other_dev = dev; | ||
| 1381 | error = wacom_add_shared_data(wacom_wac, other_dev); | ||
| 1382 | if (error) | 1341 | if (error) |
| 1383 | goto fail3; | 1342 | goto fail1; |
| 1384 | } | 1343 | } |
| 1385 | 1344 | ||
| 1386 | usb_fill_int_urb(wacom->irq, dev, | ||
| 1387 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), | ||
| 1388 | wacom_wac->data, features->pktlen, | ||
| 1389 | wacom_sys_irq, wacom, endpoint->bInterval); | ||
| 1390 | wacom->irq->transfer_dma = wacom->data_dma; | ||
| 1391 | wacom->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
| 1392 | |||
| 1393 | error = wacom_initialize_leds(wacom); | 1345 | error = wacom_initialize_leds(wacom); |
| 1394 | if (error) | 1346 | if (error) |
| 1395 | goto fail4; | 1347 | goto fail2; |
| 1348 | |||
| 1349 | if (!(features->quirks & WACOM_QUIRK_MONITOR) && | ||
| 1350 | (features->quirks & WACOM_QUIRK_BATTERY)) { | ||
| 1351 | error = wacom_initialize_battery(wacom); | ||
| 1352 | if (error) | ||
| 1353 | goto fail3; | ||
| 1354 | } | ||
| 1396 | 1355 | ||
| 1397 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { | 1356 | if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { |
| 1398 | error = wacom_register_input(wacom); | 1357 | error = wacom_register_inputs(wacom); |
| 1399 | if (error) | 1358 | if (error) |
| 1400 | goto fail5; | 1359 | goto fail4; |
| 1401 | } | 1360 | } |
| 1402 | 1361 | ||
| 1403 | /* Note that if query fails it is not a hard failure */ | 1362 | if (hdev->bus == BUS_BLUETOOTH) { |
| 1404 | wacom_query_tablet_data(intf, features); | 1363 | error = device_create_file(&hdev->dev, &dev_attr_speed); |
| 1364 | if (error) | ||
| 1365 | hid_warn(hdev, | ||
| 1366 | "can't create sysfs speed attribute err: %d\n", | ||
| 1367 | error); | ||
| 1368 | } | ||
| 1405 | 1369 | ||
| 1406 | usb_set_intfdata(intf, wacom); | 1370 | /* Note that if query fails it is not a hard failure */ |
| 1371 | wacom_query_tablet_data(hdev, features); | ||
| 1407 | 1372 | ||
| 1408 | if (features->quirks & WACOM_QUIRK_MONITOR) { | 1373 | /* Regular HID work starts now */ |
| 1409 | if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { | 1374 | error = hid_hw_start(hdev, HID_CONNECT_HIDRAW); |
| 1410 | error = -EIO; | 1375 | if (error) { |
| 1411 | goto fail5; | 1376 | hid_err(hdev, "hw start failed\n"); |
| 1412 | } | 1377 | goto fail5; |
| 1413 | } | 1378 | } |
| 1414 | 1379 | ||
| 1380 | if (features->quirks & WACOM_QUIRK_MONITOR) | ||
| 1381 | error = hid_hw_open(hdev); | ||
| 1382 | |||
| 1415 | if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { | 1383 | if (wacom_wac->features.type == INTUOSHT && wacom_wac->features.touch_max) { |
| 1416 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) | 1384 | if (wacom_wac->features.device_type == BTN_TOOL_FINGER) |
| 1417 | wacom_wac->shared->touch_input = wacom_wac->input; | 1385 | wacom_wac->shared->touch_input = wacom_wac->input; |
| @@ -1419,79 +1387,70 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1419 | 1387 | ||
| 1420 | return 0; | 1388 | return 0; |
| 1421 | 1389 | ||
| 1422 | fail5: wacom_destroy_leds(wacom); | 1390 | fail5: if (hdev->bus == BUS_BLUETOOTH) |
| 1423 | fail4: wacom_remove_shared_data(wacom_wac); | 1391 | device_remove_file(&hdev->dev, &dev_attr_speed); |
| 1424 | fail3: usb_free_urb(wacom->irq); | 1392 | wacom_unregister_inputs(wacom); |
| 1425 | fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); | 1393 | fail4: wacom_destroy_battery(wacom); |
| 1394 | fail3: wacom_destroy_leds(wacom); | ||
| 1395 | fail2: wacom_remove_shared_data(wacom_wac); | ||
| 1426 | fail1: kfree(wacom); | 1396 | fail1: kfree(wacom); |
| 1397 | hid_set_drvdata(hdev, NULL); | ||
| 1427 | return error; | 1398 | return error; |
| 1428 | } | 1399 | } |
| 1429 | 1400 | ||
| 1430 | static void wacom_disconnect(struct usb_interface *intf) | 1401 | static void wacom_remove(struct hid_device *hdev) |
| 1431 | { | 1402 | { |
| 1432 | struct wacom *wacom = usb_get_intfdata(intf); | 1403 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1433 | 1404 | ||
| 1434 | usb_set_intfdata(intf, NULL); | 1405 | hid_hw_stop(hdev); |
| 1435 | 1406 | ||
| 1436 | usb_kill_urb(wacom->irq); | ||
| 1437 | cancel_work_sync(&wacom->work); | 1407 | cancel_work_sync(&wacom->work); |
| 1438 | if (wacom->wacom_wac.input) | 1408 | wacom_unregister_inputs(wacom); |
| 1439 | input_unregister_device(wacom->wacom_wac.input); | 1409 | if (hdev->bus == BUS_BLUETOOTH) |
| 1410 | device_remove_file(&hdev->dev, &dev_attr_speed); | ||
| 1440 | wacom_destroy_battery(wacom); | 1411 | wacom_destroy_battery(wacom); |
| 1441 | wacom_destroy_leds(wacom); | 1412 | wacom_destroy_leds(wacom); |
| 1442 | usb_free_urb(wacom->irq); | ||
| 1443 | usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, | ||
| 1444 | wacom->wacom_wac.data, wacom->data_dma); | ||
| 1445 | wacom_remove_shared_data(&wacom->wacom_wac); | 1413 | wacom_remove_shared_data(&wacom->wacom_wac); |
| 1446 | kfree(wacom); | ||
| 1447 | } | ||
| 1448 | |||
| 1449 | static int wacom_suspend(struct usb_interface *intf, pm_message_t message) | ||
| 1450 | { | ||
| 1451 | struct wacom *wacom = usb_get_intfdata(intf); | ||
| 1452 | |||
| 1453 | mutex_lock(&wacom->lock); | ||
| 1454 | usb_kill_urb(wacom->irq); | ||
| 1455 | mutex_unlock(&wacom->lock); | ||
| 1456 | 1414 | ||
| 1457 | return 0; | 1415 | hid_set_drvdata(hdev, NULL); |
| 1416 | kfree(wacom); | ||
| 1458 | } | 1417 | } |
| 1459 | 1418 | ||
| 1460 | static int wacom_resume(struct usb_interface *intf) | 1419 | static int wacom_resume(struct hid_device *hdev) |
| 1461 | { | 1420 | { |
| 1462 | struct wacom *wacom = usb_get_intfdata(intf); | 1421 | struct wacom *wacom = hid_get_drvdata(hdev); |
| 1463 | struct wacom_features *features = &wacom->wacom_wac.features; | 1422 | struct wacom_features *features = &wacom->wacom_wac.features; |
| 1464 | int rv = 0; | ||
| 1465 | 1423 | ||
| 1466 | mutex_lock(&wacom->lock); | 1424 | mutex_lock(&wacom->lock); |
| 1467 | 1425 | ||
| 1468 | /* switch to wacom mode first */ | 1426 | /* switch to wacom mode first */ |
| 1469 | wacom_query_tablet_data(intf, features); | 1427 | wacom_query_tablet_data(hdev, features); |
| 1470 | wacom_led_control(wacom); | 1428 | wacom_led_control(wacom); |
| 1471 | 1429 | ||
| 1472 | if ((wacom->open || (features->quirks & WACOM_QUIRK_MONITOR)) && | ||
| 1473 | usb_submit_urb(wacom->irq, GFP_NOIO) < 0) | ||
| 1474 | rv = -EIO; | ||
| 1475 | |||
| 1476 | mutex_unlock(&wacom->lock); | 1430 | mutex_unlock(&wacom->lock); |
| 1477 | 1431 | ||
| 1478 | return rv; | 1432 | return 0; |
| 1479 | } | 1433 | } |
| 1480 | 1434 | ||
| 1481 | static int wacom_reset_resume(struct usb_interface *intf) | 1435 | static int wacom_reset_resume(struct hid_device *hdev) |
| 1482 | { | 1436 | { |
| 1483 | return wacom_resume(intf); | 1437 | return wacom_resume(hdev); |
| 1484 | } | 1438 | } |
| 1485 | 1439 | ||
| 1486 | static struct usb_driver wacom_driver = { | 1440 | static struct hid_driver wacom_driver = { |
| 1487 | .name = "wacom", | 1441 | .name = "wacom", |
| 1488 | .id_table = wacom_ids, | 1442 | .id_table = wacom_ids, |
| 1489 | .probe = wacom_probe, | 1443 | .probe = wacom_probe, |
| 1490 | .disconnect = wacom_disconnect, | 1444 | .remove = wacom_remove, |
| 1491 | .suspend = wacom_suspend, | 1445 | #ifdef CONFIG_PM |
| 1492 | .resume = wacom_resume, | 1446 | .resume = wacom_resume, |
| 1493 | .reset_resume = wacom_reset_resume, | 1447 | .reset_resume = wacom_reset_resume, |
| 1494 | .supports_autosuspend = 1, | 1448 | #endif |
| 1449 | .raw_event = wacom_raw_event, | ||
| 1495 | }; | 1450 | }; |
| 1451 | module_hid_driver(wacom_driver); | ||
| 1496 | 1452 | ||
| 1497 | module_usb_driver(wacom_driver); | 1453 | MODULE_VERSION(DRIVER_VERSION); |
| 1454 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
| 1455 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
| 1456 | MODULE_LICENSE(DRIVER_LICENSE); | ||
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/hid/wacom_wac.c index 977d05cd9e2e..d4a2d533a444 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/hid/wacom_wac.c | |||
| @@ -25,11 +25,23 @@ | |||
| 25 | #define WACOM_INTUOS_RES 100 | 25 | #define WACOM_INTUOS_RES 100 |
| 26 | #define WACOM_INTUOS3_RES 200 | 26 | #define WACOM_INTUOS3_RES 200 |
| 27 | 27 | ||
| 28 | /* Scale factor relating reported contact size to logical contact area. | 28 | /* |
| 29 | * Scale factor relating reported contact size to logical contact area. | ||
| 29 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo | 30 | * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo |
| 30 | */ | 31 | */ |
| 31 | #define WACOM_CONTACT_AREA_SCALE 2607 | 32 | #define WACOM_CONTACT_AREA_SCALE 2607 |
| 32 | 33 | ||
| 34 | /* | ||
| 35 | * Percent of battery capacity for Graphire. | ||
| 36 | * 8th value means AC online and show 100% capacity. | ||
| 37 | */ | ||
| 38 | static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Percent of battery capacity for Intuos4 WL, AC has a separate bit. | ||
| 42 | */ | ||
| 43 | static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; | ||
| 44 | |||
| 33 | static int wacom_penpartner_irq(struct wacom_wac *wacom) | 45 | static int wacom_penpartner_irq(struct wacom_wac *wacom) |
| 34 | { | 46 | { |
| 35 | unsigned char *data = wacom->data; | 47 | unsigned char *data = wacom->data; |
| @@ -217,17 +229,13 @@ static int wacom_dtus_irq(struct wacom_wac *wacom) | |||
| 217 | "%s: received unknown report #%d", __func__, data[0]); | 229 | "%s: received unknown report #%d", __func__, data[0]); |
| 218 | return 0; | 230 | return 0; |
| 219 | } else if (data[0] == WACOM_REPORT_DTUSPAD) { | 231 | } else if (data[0] == WACOM_REPORT_DTUSPAD) { |
| 232 | input = wacom->pad_input; | ||
| 220 | input_report_key(input, BTN_0, (data[1] & 0x01)); | 233 | input_report_key(input, BTN_0, (data[1] & 0x01)); |
| 221 | input_report_key(input, BTN_1, (data[1] & 0x02)); | 234 | input_report_key(input, BTN_1, (data[1] & 0x02)); |
| 222 | input_report_key(input, BTN_2, (data[1] & 0x04)); | 235 | input_report_key(input, BTN_2, (data[1] & 0x04)); |
| 223 | input_report_key(input, BTN_3, (data[1] & 0x08)); | 236 | input_report_key(input, BTN_3, (data[1] & 0x08)); |
| 224 | input_report_abs(input, ABS_MISC, | 237 | input_report_abs(input, ABS_MISC, |
| 225 | data[1] & 0x0f ? PAD_DEVICE_ID : 0); | 238 | data[1] & 0x0f ? PAD_DEVICE_ID : 0); |
| 226 | /* | ||
| 227 | * Serial number is required when expresskeys are | ||
| 228 | * reported through pen interface. | ||
| 229 | */ | ||
| 230 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | ||
| 231 | return 1; | 239 | return 1; |
| 232 | } else { | 240 | } else { |
| 233 | prox = data[1] & 0x80; | 241 | prox = data[1] & 0x80; |
| @@ -257,7 +265,6 @@ static int wacom_dtus_irq(struct wacom_wac *wacom) | |||
| 257 | wacom->id[0] = 0; | 265 | wacom->id[0] = 0; |
| 258 | input_report_key(input, wacom->tool[0], prox); | 266 | input_report_key(input, wacom->tool[0], prox); |
| 259 | input_report_abs(input, ABS_MISC, wacom->id[0]); | 267 | input_report_abs(input, ABS_MISC, wacom->id[0]); |
| 260 | input_event(input, EV_MSC, MSC_SERIAL, 1); | ||
| 261 | return 1; | 268 | return 1; |
| 262 | } | 269 | } |
| 263 | } | 270 | } |
| @@ -267,11 +274,20 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 267 | struct wacom_features *features = &wacom->features; | 274 | struct wacom_features *features = &wacom->features; |
| 268 | unsigned char *data = wacom->data; | 275 | unsigned char *data = wacom->data; |
| 269 | struct input_dev *input = wacom->input; | 276 | struct input_dev *input = wacom->input; |
| 277 | struct input_dev *pad_input = wacom->pad_input; | ||
| 278 | int battery_capacity, ps_connected; | ||
| 270 | int prox; | 279 | int prox; |
| 271 | int rw = 0; | 280 | int rw = 0; |
| 272 | int retval = 0; | 281 | int retval = 0; |
| 273 | 282 | ||
| 274 | if (data[0] != WACOM_REPORT_PENABLED) { | 283 | if (features->type == GRAPHIRE_BT) { |
| 284 | if (data[0] != WACOM_REPORT_PENABLED_BT) { | ||
| 285 | dev_dbg(input->dev.parent, | ||
| 286 | "%s: received unknown report #%d\n", __func__, | ||
| 287 | data[0]); | ||
| 288 | goto exit; | ||
| 289 | } | ||
| 290 | } else if (data[0] != WACOM_REPORT_PENABLED) { | ||
| 275 | dev_dbg(input->dev.parent, | 291 | dev_dbg(input->dev.parent, |
| 276 | "%s: received unknown report #%d\n", __func__, data[0]); | 292 | "%s: received unknown report #%d\n", __func__, data[0]); |
| 277 | goto exit; | 293 | goto exit; |
| @@ -305,7 +321,12 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 305 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | 321 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 306 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | 322 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
| 307 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { | 323 | if (wacom->tool[0] != BTN_TOOL_MOUSE) { |
| 308 | input_report_abs(input, ABS_PRESSURE, data[6] | ((data[7] & 0x03) << 8)); | 324 | if (features->type == GRAPHIRE_BT) |
| 325 | input_report_abs(input, ABS_PRESSURE, data[6] | | ||
| 326 | (((__u16) (data[1] & 0x08)) << 5)); | ||
| 327 | else | ||
| 328 | input_report_abs(input, ABS_PRESSURE, data[6] | | ||
| 329 | ((data[7] & 0x03) << 8)); | ||
| 309 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); | 330 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
| 310 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); | 331 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 311 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); | 332 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
| @@ -316,6 +337,20 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 316 | features->type == WACOM_MO) { | 337 | features->type == WACOM_MO) { |
| 317 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); | 338 | input_report_abs(input, ABS_DISTANCE, data[6] & 0x3f); |
| 318 | rw = (data[7] & 0x04) - (data[7] & 0x03); | 339 | rw = (data[7] & 0x04) - (data[7] & 0x03); |
| 340 | } else if (features->type == GRAPHIRE_BT) { | ||
| 341 | /* Compute distance between mouse and tablet */ | ||
| 342 | rw = 44 - (data[6] >> 2); | ||
| 343 | rw = clamp_val(rw, 0, 31); | ||
| 344 | input_report_abs(input, ABS_DISTANCE, rw); | ||
| 345 | if (((data[1] >> 5) & 3) == 2) { | ||
| 346 | /* Mouse with wheel */ | ||
| 347 | input_report_key(input, BTN_MIDDLE, | ||
| 348 | data[1] & 0x04); | ||
| 349 | rw = (data[6] & 0x01) ? -1 : | ||
| 350 | (data[6] & 0x02) ? 1 : 0; | ||
| 351 | } else { | ||
| 352 | rw = 0; | ||
| 353 | } | ||
| 319 | } else { | 354 | } else { |
| 320 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); | 355 | input_report_abs(input, ABS_DISTANCE, data[7] & 0x3f); |
| 321 | rw = -(signed char)data[6]; | 356 | rw = -(signed char)data[6]; |
| @@ -327,7 +362,6 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 327 | wacom->id[0] = 0; | 362 | wacom->id[0] = 0; |
| 328 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ | 363 | input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ |
| 329 | input_report_key(input, wacom->tool[0], prox); | 364 | input_report_key(input, wacom->tool[0], prox); |
| 330 | input_event(input, EV_MSC, MSC_SERIAL, 1); | ||
| 331 | input_sync(input); /* sync last event */ | 365 | input_sync(input); /* sync last event */ |
| 332 | } | 366 | } |
| 333 | 367 | ||
| @@ -337,14 +371,13 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 337 | prox = data[7] & 0xf8; | 371 | prox = data[7] & 0xf8; |
| 338 | if (prox || wacom->id[1]) { | 372 | if (prox || wacom->id[1]) { |
| 339 | wacom->id[1] = PAD_DEVICE_ID; | 373 | wacom->id[1] = PAD_DEVICE_ID; |
| 340 | input_report_key(input, BTN_BACK, (data[7] & 0x40)); | 374 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x40)); |
| 341 | input_report_key(input, BTN_FORWARD, (data[7] & 0x80)); | 375 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x80)); |
| 342 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); | 376 | rw = ((data[7] & 0x18) >> 3) - ((data[7] & 0x20) >> 3); |
| 343 | input_report_rel(input, REL_WHEEL, rw); | 377 | input_report_rel(pad_input, REL_WHEEL, rw); |
| 344 | if (!prox) | 378 | if (!prox) |
| 345 | wacom->id[1] = 0; | 379 | wacom->id[1] = 0; |
| 346 | input_report_abs(input, ABS_MISC, wacom->id[1]); | 380 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
| 347 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | ||
| 348 | retval = 1; | 381 | retval = 1; |
| 349 | } | 382 | } |
| 350 | break; | 383 | break; |
| @@ -353,19 +386,43 @@ static int wacom_graphire_irq(struct wacom_wac *wacom) | |||
| 353 | prox = (data[7] & 0xf8) || data[8]; | 386 | prox = (data[7] & 0xf8) || data[8]; |
| 354 | if (prox || wacom->id[1]) { | 387 | if (prox || wacom->id[1]) { |
| 355 | wacom->id[1] = PAD_DEVICE_ID; | 388 | wacom->id[1] = PAD_DEVICE_ID; |
| 356 | input_report_key(input, BTN_BACK, (data[7] & 0x08)); | 389 | input_report_key(pad_input, BTN_BACK, (data[7] & 0x08)); |
| 357 | input_report_key(input, BTN_LEFT, (data[7] & 0x20)); | 390 | input_report_key(pad_input, BTN_LEFT, (data[7] & 0x20)); |
| 358 | input_report_key(input, BTN_FORWARD, (data[7] & 0x10)); | 391 | input_report_key(pad_input, BTN_FORWARD, (data[7] & 0x10)); |
| 359 | input_report_key(input, BTN_RIGHT, (data[7] & 0x40)); | 392 | input_report_key(pad_input, BTN_RIGHT, (data[7] & 0x40)); |
| 360 | input_report_abs(input, ABS_WHEEL, (data[8] & 0x7f)); | 393 | input_report_abs(pad_input, ABS_WHEEL, (data[8] & 0x7f)); |
| 394 | if (!prox) | ||
| 395 | wacom->id[1] = 0; | ||
| 396 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); | ||
| 397 | retval = 1; | ||
| 398 | } | ||
| 399 | break; | ||
| 400 | case GRAPHIRE_BT: | ||
| 401 | prox = data[7] & 0x03; | ||
| 402 | if (prox || wacom->id[1]) { | ||
| 403 | wacom->id[1] = PAD_DEVICE_ID; | ||
| 404 | input_report_key(pad_input, BTN_0, (data[7] & 0x02)); | ||
| 405 | input_report_key(pad_input, BTN_1, (data[7] & 0x01)); | ||
| 361 | if (!prox) | 406 | if (!prox) |
| 362 | wacom->id[1] = 0; | 407 | wacom->id[1] = 0; |
| 363 | input_report_abs(input, ABS_MISC, wacom->id[1]); | 408 | input_report_abs(pad_input, ABS_MISC, wacom->id[1]); |
| 364 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | ||
| 365 | retval = 1; | 409 | retval = 1; |
| 366 | } | 410 | } |
| 367 | break; | 411 | break; |
| 368 | } | 412 | } |
| 413 | |||
| 414 | /* Store current battery capacity and power supply state */ | ||
| 415 | if (features->type == GRAPHIRE_BT) { | ||
| 416 | rw = (data[7] >> 2 & 0x07); | ||
| 417 | battery_capacity = batcap_gr[rw]; | ||
| 418 | ps_connected = rw == 7; | ||
| 419 | if ((wacom->battery_capacity != battery_capacity) || | ||
| 420 | (wacom->ps_connected != ps_connected)) { | ||
| 421 | wacom->battery_capacity = battery_capacity; | ||
| 422 | wacom->ps_connected = ps_connected; | ||
| 423 | wacom_notify_battery(wacom); | ||
| 424 | } | ||
| 425 | } | ||
| 369 | exit: | 426 | exit: |
| 370 | return retval; | 427 | return retval; |
| 371 | } | 428 | } |
| @@ -584,6 +641,7 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
| 584 | 641 | ||
| 585 | /* pad packets. Works as a second tool and is always in prox */ | 642 | /* pad packets. Works as a second tool and is always in prox */ |
| 586 | if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { | 643 | if (data[0] == WACOM_REPORT_INTUOSPAD || data[0] == WACOM_REPORT_INTUOS5PAD) { |
| 644 | input = wacom->pad_input; | ||
| 587 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { | 645 | if (features->type >= INTUOS4S && features->type <= INTUOS4L) { |
| 588 | input_report_key(input, BTN_0, (data[2] & 0x01)); | 646 | input_report_key(input, BTN_0, (data[2] & 0x01)); |
| 589 | input_report_key(input, BTN_1, (data[3] & 0x01)); | 647 | input_report_key(input, BTN_1, (data[3] & 0x01)); |
| @@ -773,7 +831,6 @@ static int wacom_intuos_irq(struct wacom_wac *wacom) | |||
| 773 | input_report_abs(input, ABS_MISC, 0); | 831 | input_report_abs(input, ABS_MISC, 0); |
| 774 | } | 832 | } |
| 775 | } | 833 | } |
| 776 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); | ||
| 777 | return 1; | 834 | return 1; |
| 778 | } | 835 | } |
| 779 | 836 | ||
| @@ -901,6 +958,58 @@ static int int_dist(int x1, int y1, int x2, int y2) | |||
| 901 | return int_sqrt(x*x + y*y); | 958 | return int_sqrt(x*x + y*y); |
| 902 | } | 959 | } |
| 903 | 960 | ||
| 961 | static void wacom_intuos_bt_process_data(struct wacom_wac *wacom, | ||
| 962 | unsigned char *data) | ||
| 963 | { | ||
| 964 | memcpy(wacom->data, data, 10); | ||
| 965 | wacom_intuos_irq(wacom); | ||
| 966 | |||
| 967 | input_sync(wacom->input); | ||
| 968 | if (wacom->pad_input) | ||
| 969 | input_sync(wacom->pad_input); | ||
| 970 | } | ||
| 971 | |||
| 972 | static int wacom_intuos_bt_irq(struct wacom_wac *wacom, size_t len) | ||
| 973 | { | ||
| 974 | unsigned char data[WACOM_PKGLEN_MAX]; | ||
| 975 | int i = 1; | ||
| 976 | unsigned power_raw, battery_capacity, bat_charging, ps_connected; | ||
| 977 | |||
| 978 | memcpy(data, wacom->data, len); | ||
| 979 | |||
| 980 | switch (data[0]) { | ||
| 981 | case 0x04: | ||
| 982 | wacom_intuos_bt_process_data(wacom, data + i); | ||
| 983 | i += 10; | ||
| 984 | /* fall through */ | ||
| 985 | case 0x03: | ||
| 986 | wacom_intuos_bt_process_data(wacom, data + i); | ||
| 987 | i += 10; | ||
| 988 | wacom_intuos_bt_process_data(wacom, data + i); | ||
| 989 | i += 10; | ||
| 990 | power_raw = data[i]; | ||
| 991 | bat_charging = (power_raw & 0x08) ? 1 : 0; | ||
| 992 | ps_connected = (power_raw & 0x10) ? 1 : 0; | ||
| 993 | battery_capacity = batcap_i4[power_raw & 0x07]; | ||
| 994 | if ((wacom->battery_capacity != battery_capacity) || | ||
| 995 | (wacom->bat_charging != bat_charging) || | ||
| 996 | (wacom->ps_connected != ps_connected)) { | ||
| 997 | wacom->battery_capacity = battery_capacity; | ||
| 998 | wacom->bat_charging = bat_charging; | ||
| 999 | wacom->ps_connected = ps_connected; | ||
| 1000 | wacom_notify_battery(wacom); | ||
| 1001 | } | ||
| 1002 | |||
| 1003 | break; | ||
| 1004 | default: | ||
| 1005 | dev_dbg(wacom->input->dev.parent, | ||
| 1006 | "Unknown report: %d,%d size:%zu\n", | ||
| 1007 | data[0], data[1], len); | ||
| 1008 | return 0; | ||
| 1009 | } | ||
| 1010 | return 0; | ||
| 1011 | } | ||
| 1012 | |||
| 904 | static int wacom_24hdt_irq(struct wacom_wac *wacom) | 1013 | static int wacom_24hdt_irq(struct wacom_wac *wacom) |
| 905 | { | 1014 | { |
| 906 | struct input_dev *input = wacom->input; | 1015 | struct input_dev *input = wacom->input; |
| @@ -1093,7 +1202,7 @@ static int wacom_tpc_pen(struct wacom_wac *wacom) | |||
| 1093 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); | 1202 | input_report_key(input, BTN_STYLUS2, data[1] & 0x10); |
| 1094 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); | 1203 | input_report_abs(input, ABS_X, le16_to_cpup((__le16 *)&data[2])); |
| 1095 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); | 1204 | input_report_abs(input, ABS_Y, le16_to_cpup((__le16 *)&data[4])); |
| 1096 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x03) << 8) | data[6]); | 1205 | input_report_abs(input, ABS_PRESSURE, ((data[7] & 0x07) << 8) | data[6]); |
| 1097 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); | 1206 | input_report_key(input, BTN_TOUCH, data[1] & 0x05); |
| 1098 | input_report_key(input, wacom->tool[0], prox); | 1207 | input_report_key(input, wacom->tool[0], prox); |
| 1099 | return 1; | 1208 | return 1; |
| @@ -1143,6 +1252,7 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 1143 | { | 1252 | { |
| 1144 | struct wacom_features *features = &wacom->features; | 1253 | struct wacom_features *features = &wacom->features; |
| 1145 | struct input_dev *input = wacom->input; | 1254 | struct input_dev *input = wacom->input; |
| 1255 | struct input_dev *pad_input = wacom->pad_input; | ||
| 1146 | unsigned char *data = wacom->data; | 1256 | unsigned char *data = wacom->data; |
| 1147 | int i; | 1257 | int i; |
| 1148 | 1258 | ||
| @@ -1177,14 +1287,12 @@ static int wacom_bpt_touch(struct wacom_wac *wacom) | |||
| 1177 | 1287 | ||
| 1178 | input_mt_report_pointer_emulation(input, true); | 1288 | input_mt_report_pointer_emulation(input, true); |
| 1179 | 1289 | ||
| 1180 | input_report_key(input, BTN_LEFT, (data[1] & 0x08) != 0); | 1290 | input_report_key(pad_input, BTN_LEFT, (data[1] & 0x08) != 0); |
| 1181 | input_report_key(input, BTN_FORWARD, (data[1] & 0x04) != 0); | 1291 | input_report_key(pad_input, BTN_FORWARD, (data[1] & 0x04) != 0); |
| 1182 | input_report_key(input, BTN_BACK, (data[1] & 0x02) != 0); | 1292 | input_report_key(pad_input, BTN_BACK, (data[1] & 0x02) != 0); |
| 1183 | input_report_key(input, BTN_RIGHT, (data[1] & 0x01) != 0); | 1293 | input_report_key(pad_input, BTN_RIGHT, (data[1] & 0x01) != 0); |
| 1184 | |||
| 1185 | input_sync(input); | ||
| 1186 | 1294 | ||
| 1187 | return 0; | 1295 | return 1; |
| 1188 | } | 1296 | } |
| 1189 | 1297 | ||
| 1190 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | 1298 | static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) |
| @@ -1232,7 +1340,7 @@ static void wacom_bpt3_touch_msg(struct wacom_wac *wacom, unsigned char *data) | |||
| 1232 | 1340 | ||
| 1233 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) | 1341 | static void wacom_bpt3_button_msg(struct wacom_wac *wacom, unsigned char *data) |
| 1234 | { | 1342 | { |
| 1235 | struct input_dev *input = wacom->input; | 1343 | struct input_dev *input = wacom->pad_input; |
| 1236 | struct wacom_features *features = &wacom->features; | 1344 | struct wacom_features *features = &wacom->features; |
| 1237 | 1345 | ||
| 1238 | if (features->type == INTUOSHT) { | 1346 | if (features->type == INTUOSHT) { |
| @@ -1269,9 +1377,7 @@ static int wacom_bpt3_touch(struct wacom_wac *wacom) | |||
| 1269 | } | 1377 | } |
| 1270 | input_mt_report_pointer_emulation(input, true); | 1378 | input_mt_report_pointer_emulation(input, true); |
| 1271 | 1379 | ||
| 1272 | input_sync(input); | 1380 | return 1; |
| 1273 | |||
| 1274 | return 0; | ||
| 1275 | } | 1381 | } |
| 1276 | 1382 | ||
| 1277 | static int wacom_bpt_pen(struct wacom_wac *wacom) | 1383 | static int wacom_bpt_pen(struct wacom_wac *wacom) |
| @@ -1375,7 +1481,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
| 1375 | 1481 | ||
| 1376 | connected = data[1] & 0x01; | 1482 | connected = data[1] & 0x01; |
| 1377 | if (connected) { | 1483 | if (connected) { |
| 1378 | int pid, battery; | 1484 | int pid, battery, ps_connected; |
| 1379 | 1485 | ||
| 1380 | if ((wacom->shared->type == INTUOSHT) && | 1486 | if ((wacom->shared->type == INTUOSHT) && |
| 1381 | wacom->shared->touch_max) { | 1487 | wacom->shared->touch_max) { |
| @@ -1385,17 +1491,29 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |||
| 1385 | } | 1491 | } |
| 1386 | 1492 | ||
| 1387 | pid = get_unaligned_be16(&data[6]); | 1493 | pid = get_unaligned_be16(&data[6]); |
| 1388 | battery = data[5] & 0x3f; | 1494 | battery = (data[5] & 0x3f) * 100 / 31; |
| 1495 | ps_connected = !!(data[5] & 0x80); | ||
| 1389 | if (wacom->pid != pid) { | 1496 | if (wacom->pid != pid) { |
| 1390 | wacom->pid = pid; | 1497 | wacom->pid = pid; |
| 1391 | wacom_schedule_work(wacom); | 1498 | wacom_schedule_work(wacom); |
| 1392 | } | 1499 | } |
| 1393 | wacom->battery_capacity = battery; | 1500 | |
| 1501 | if (wacom->shared->type && | ||
| 1502 | (battery != wacom->battery_capacity || | ||
| 1503 | ps_connected != wacom->ps_connected)) { | ||
| 1504 | wacom->battery_capacity = battery; | ||
| 1505 | wacom->ps_connected = ps_connected; | ||
| 1506 | wacom->bat_charging = ps_connected && | ||
| 1507 | wacom->battery_capacity < 100; | ||
| 1508 | wacom_notify_battery(wacom); | ||
| 1509 | } | ||
| 1394 | } else if (wacom->pid != 0) { | 1510 | } else if (wacom->pid != 0) { |
| 1395 | /* disconnected while previously connected */ | 1511 | /* disconnected while previously connected */ |
| 1396 | wacom->pid = 0; | 1512 | wacom->pid = 0; |
| 1397 | wacom_schedule_work(wacom); | 1513 | wacom_schedule_work(wacom); |
| 1398 | wacom->battery_capacity = 0; | 1514 | wacom->battery_capacity = 0; |
| 1515 | wacom->bat_charging = 0; | ||
| 1516 | wacom->ps_connected = 0; | ||
| 1399 | } | 1517 | } |
| 1400 | 1518 | ||
| 1401 | return 0; | 1519 | return 0; |
| @@ -1416,6 +1534,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 1416 | 1534 | ||
| 1417 | case WACOM_G4: | 1535 | case WACOM_G4: |
| 1418 | case GRAPHIRE: | 1536 | case GRAPHIRE: |
| 1537 | case GRAPHIRE_BT: | ||
| 1419 | case WACOM_MO: | 1538 | case WACOM_MO: |
| 1420 | sync = wacom_graphire_irq(wacom_wac); | 1539 | sync = wacom_graphire_irq(wacom_wac); |
| 1421 | break; | 1540 | break; |
| @@ -1450,6 +1569,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 1450 | sync = wacom_intuos_irq(wacom_wac); | 1569 | sync = wacom_intuos_irq(wacom_wac); |
| 1451 | break; | 1570 | break; |
| 1452 | 1571 | ||
| 1572 | case INTUOS4WL: | ||
| 1573 | sync = wacom_intuos_bt_irq(wacom_wac, len); | ||
| 1574 | break; | ||
| 1575 | |||
| 1453 | case WACOM_24HDT: | 1576 | case WACOM_24HDT: |
| 1454 | sync = wacom_24hdt_irq(wacom_wac); | 1577 | sync = wacom_24hdt_irq(wacom_wac); |
| 1455 | break; | 1578 | break; |
| @@ -1489,8 +1612,11 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
| 1489 | break; | 1612 | break; |
| 1490 | } | 1613 | } |
| 1491 | 1614 | ||
| 1492 | if (sync) | 1615 | if (sync) { |
| 1493 | input_sync(wacom_wac->input); | 1616 | input_sync(wacom_wac->input); |
| 1617 | if (wacom_wac->pad_input) | ||
| 1618 | input_sync(wacom_wac->pad_input); | ||
| 1619 | } | ||
| 1494 | } | 1620 | } |
| 1495 | 1621 | ||
| 1496 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) | 1622 | static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) |
| @@ -1565,8 +1691,10 @@ void wacom_setup_device_quirks(struct wacom_features *features) | |||
| 1565 | features->quirks |= WACOM_QUIRK_NO_INPUT; | 1691 | features->quirks |= WACOM_QUIRK_NO_INPUT; |
| 1566 | 1692 | ||
| 1567 | /* must be monitor interface if no device_type set */ | 1693 | /* must be monitor interface if no device_type set */ |
| 1568 | if (!features->device_type) | 1694 | if (!features->device_type) { |
| 1569 | features->quirks |= WACOM_QUIRK_MONITOR; | 1695 | features->quirks |= WACOM_QUIRK_MONITOR; |
| 1696 | features->quirks |= WACOM_QUIRK_BATTERY; | ||
| 1697 | } | ||
| 1570 | } | 1698 | } |
| 1571 | } | 1699 | } |
| 1572 | 1700 | ||
| @@ -1615,7 +1743,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1615 | struct wacom_wac *wacom_wac) | 1743 | struct wacom_wac *wacom_wac) |
| 1616 | { | 1744 | { |
| 1617 | struct wacom_features *features = &wacom_wac->features; | 1745 | struct wacom_features *features = &wacom_wac->features; |
| 1618 | int i; | ||
| 1619 | 1746 | ||
| 1620 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 1747 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
| 1621 | 1748 | ||
| @@ -1630,10 +1757,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1630 | /* fall through */ | 1757 | /* fall through */ |
| 1631 | 1758 | ||
| 1632 | case WACOM_G4: | 1759 | case WACOM_G4: |
| 1633 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); | ||
| 1634 | |||
| 1635 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 1636 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 1637 | /* fall through */ | 1760 | /* fall through */ |
| 1638 | 1761 | ||
| 1639 | case GRAPHIRE: | 1762 | case GRAPHIRE: |
| @@ -1652,62 +1775,42 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1652 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1775 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 1653 | break; | 1776 | break; |
| 1654 | 1777 | ||
| 1655 | case WACOM_24HD: | 1778 | case GRAPHIRE_BT: |
| 1656 | __set_bit(BTN_A, input_dev->keybit); | 1779 | __clear_bit(ABS_MISC, input_dev->absbit); |
| 1657 | __set_bit(BTN_B, input_dev->keybit); | 1780 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 1658 | __set_bit(BTN_C, input_dev->keybit); | 1781 | features->distance_max, |
| 1659 | __set_bit(BTN_X, input_dev->keybit); | 1782 | 0, 0); |
| 1660 | __set_bit(BTN_Y, input_dev->keybit); | ||
| 1661 | __set_bit(BTN_Z, input_dev->keybit); | ||
| 1662 | 1783 | ||
| 1663 | for (i = 6; i < 10; i++) | 1784 | input_set_capability(input_dev, EV_REL, REL_WHEEL); |
| 1664 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1665 | 1785 | ||
| 1666 | __set_bit(KEY_PROG1, input_dev->keybit); | 1786 | __set_bit(BTN_LEFT, input_dev->keybit); |
| 1667 | __set_bit(KEY_PROG2, input_dev->keybit); | 1787 | __set_bit(BTN_RIGHT, input_dev->keybit); |
| 1668 | __set_bit(KEY_PROG3, input_dev->keybit); | 1788 | __set_bit(BTN_MIDDLE, input_dev->keybit); |
| 1789 | |||
| 1790 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | ||
| 1791 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | ||
| 1792 | __set_bit(BTN_TOOL_MOUSE, input_dev->keybit); | ||
| 1793 | __set_bit(BTN_STYLUS, input_dev->keybit); | ||
| 1794 | __set_bit(BTN_STYLUS2, input_dev->keybit); | ||
| 1669 | 1795 | ||
| 1796 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | ||
| 1797 | break; | ||
| 1798 | |||
| 1799 | case WACOM_24HD: | ||
| 1670 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1800 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1671 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | 1801 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); |
| 1672 | /* fall through */ | 1802 | /* fall through */ |
| 1673 | 1803 | ||
| 1674 | case DTK: | 1804 | case DTK: |
| 1675 | for (i = 0; i < 6; i++) | ||
| 1676 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1677 | |||
| 1678 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 1805 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 1679 | 1806 | ||
| 1680 | wacom_setup_cintiq(wacom_wac); | 1807 | wacom_setup_cintiq(wacom_wac); |
| 1681 | break; | 1808 | break; |
| 1682 | 1809 | ||
| 1683 | case WACOM_22HD: | 1810 | case WACOM_22HD: |
| 1684 | __set_bit(KEY_PROG1, input_dev->keybit); | ||
| 1685 | __set_bit(KEY_PROG2, input_dev->keybit); | ||
| 1686 | __set_bit(KEY_PROG3, input_dev->keybit); | ||
| 1687 | /* fall through */ | ||
| 1688 | |||
| 1689 | case WACOM_21UX2: | 1811 | case WACOM_21UX2: |
| 1690 | __set_bit(BTN_A, input_dev->keybit); | ||
| 1691 | __set_bit(BTN_B, input_dev->keybit); | ||
| 1692 | __set_bit(BTN_C, input_dev->keybit); | ||
| 1693 | __set_bit(BTN_X, input_dev->keybit); | ||
| 1694 | __set_bit(BTN_Y, input_dev->keybit); | ||
| 1695 | __set_bit(BTN_Z, input_dev->keybit); | ||
| 1696 | __set_bit(BTN_BASE, input_dev->keybit); | ||
| 1697 | __set_bit(BTN_BASE2, input_dev->keybit); | ||
| 1698 | /* fall through */ | ||
| 1699 | |||
| 1700 | case WACOM_BEE: | 1812 | case WACOM_BEE: |
| 1701 | __set_bit(BTN_8, input_dev->keybit); | ||
| 1702 | __set_bit(BTN_9, input_dev->keybit); | ||
| 1703 | /* fall through */ | ||
| 1704 | |||
| 1705 | case CINTIQ: | 1813 | case CINTIQ: |
| 1706 | for (i = 0; i < 8; i++) | ||
| 1707 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1708 | |||
| 1709 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); | ||
| 1710 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | ||
| 1711 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1814 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1712 | 1815 | ||
| 1713 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 1816 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| @@ -1716,9 +1819,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1716 | break; | 1819 | break; |
| 1717 | 1820 | ||
| 1718 | case WACOM_13HD: | 1821 | case WACOM_13HD: |
| 1719 | for (i = 0; i < 9; i++) | ||
| 1720 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1721 | |||
| 1722 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1822 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1723 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 1823 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); |
| 1724 | wacom_setup_cintiq(wacom_wac); | 1824 | wacom_setup_cintiq(wacom_wac); |
| @@ -1726,21 +1826,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1726 | 1826 | ||
| 1727 | case INTUOS3: | 1827 | case INTUOS3: |
| 1728 | case INTUOS3L: | 1828 | case INTUOS3L: |
| 1729 | __set_bit(BTN_4, input_dev->keybit); | ||
| 1730 | __set_bit(BTN_5, input_dev->keybit); | ||
| 1731 | __set_bit(BTN_6, input_dev->keybit); | ||
| 1732 | __set_bit(BTN_7, input_dev->keybit); | ||
| 1733 | |||
| 1734 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | ||
| 1735 | /* fall through */ | ||
| 1736 | |||
| 1737 | case INTUOS3S: | 1829 | case INTUOS3S: |
| 1738 | __set_bit(BTN_0, input_dev->keybit); | ||
| 1739 | __set_bit(BTN_1, input_dev->keybit); | ||
| 1740 | __set_bit(BTN_2, input_dev->keybit); | ||
| 1741 | __set_bit(BTN_3, input_dev->keybit); | ||
| 1742 | |||
| 1743 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); | ||
| 1744 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1830 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1745 | /* fall through */ | 1831 | /* fall through */ |
| 1746 | 1832 | ||
| @@ -1754,20 +1840,11 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1754 | case INTUOS5L: | 1840 | case INTUOS5L: |
| 1755 | case INTUOSPM: | 1841 | case INTUOSPM: |
| 1756 | case INTUOSPL: | 1842 | case INTUOSPL: |
| 1757 | if (features->device_type == BTN_TOOL_PEN) { | ||
| 1758 | __set_bit(BTN_7, input_dev->keybit); | ||
| 1759 | __set_bit(BTN_8, input_dev->keybit); | ||
| 1760 | } | ||
| 1761 | /* fall through */ | ||
| 1762 | |||
| 1763 | case INTUOS5S: | 1843 | case INTUOS5S: |
| 1764 | case INTUOSPS: | 1844 | case INTUOSPS: |
| 1765 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); | 1845 | __set_bit(INPUT_PROP_POINTER, input_dev->propbit); |
| 1766 | 1846 | ||
| 1767 | if (features->device_type == BTN_TOOL_PEN) { | 1847 | if (features->device_type == BTN_TOOL_PEN) { |
| 1768 | for (i = 0; i < 7; i++) | ||
| 1769 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1770 | |||
| 1771 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, | 1848 | input_set_abs_params(input_dev, ABS_DISTANCE, 0, |
| 1772 | features->distance_max, | 1849 | features->distance_max, |
| 1773 | 0, 0); | 1850 | 0, 0); |
| @@ -1787,15 +1864,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1787 | break; | 1864 | break; |
| 1788 | 1865 | ||
| 1789 | case INTUOS4: | 1866 | case INTUOS4: |
| 1867 | case INTUOS4WL: | ||
| 1790 | case INTUOS4L: | 1868 | case INTUOS4L: |
| 1791 | __set_bit(BTN_7, input_dev->keybit); | ||
| 1792 | __set_bit(BTN_8, input_dev->keybit); | ||
| 1793 | /* fall through */ | ||
| 1794 | |||
| 1795 | case INTUOS4S: | 1869 | case INTUOS4S: |
| 1796 | for (i = 0; i < 7; i++) | ||
| 1797 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1798 | |||
| 1799 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 1870 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); |
| 1800 | wacom_setup_intuos(wacom_wac); | 1871 | wacom_setup_intuos(wacom_wac); |
| 1801 | 1872 | ||
| @@ -1839,11 +1910,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1839 | case DTUS: | 1910 | case DTUS: |
| 1840 | case PL: | 1911 | case PL: |
| 1841 | case DTU: | 1912 | case DTU: |
| 1842 | if (features->type == DTUS) { | ||
| 1843 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); | ||
| 1844 | for (i = 0; i < 4; i++) | ||
| 1845 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1846 | } | ||
| 1847 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1913 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
| 1848 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1914 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
| 1849 | __set_bit(BTN_STYLUS, input_dev->keybit); | 1915 | __set_bit(BTN_STYLUS, input_dev->keybit); |
| @@ -1877,11 +1943,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1877 | 1943 | ||
| 1878 | if (features->device_type == BTN_TOOL_FINGER) { | 1944 | if (features->device_type == BTN_TOOL_FINGER) { |
| 1879 | 1945 | ||
| 1880 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 1881 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 1882 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 1883 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 1884 | |||
| 1885 | if (features->touch_max) { | 1946 | if (features->touch_max) { |
| 1886 | /* touch interface */ | 1947 | /* touch interface */ |
| 1887 | unsigned int flags = INPUT_MT_POINTER; | 1948 | unsigned int flags = INPUT_MT_POINTER; |
| @@ -1919,449 +1980,629 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
| 1919 | break; | 1980 | break; |
| 1920 | 1981 | ||
| 1921 | case CINTIQ_HYBRID: | 1982 | case CINTIQ_HYBRID: |
| 1983 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | ||
| 1984 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | ||
| 1985 | |||
| 1986 | wacom_setup_cintiq(wacom_wac); | ||
| 1987 | break; | ||
| 1988 | } | ||
| 1989 | return 0; | ||
| 1990 | } | ||
| 1991 | |||
| 1992 | int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, | ||
| 1993 | struct wacom_wac *wacom_wac) | ||
| 1994 | { | ||
| 1995 | struct wacom_features *features = &wacom_wac->features; | ||
| 1996 | int i; | ||
| 1997 | |||
| 1998 | input_dev->evbit[0] |= BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
| 1999 | |||
| 2000 | /* kept for making legacy xf86-input-wacom working with the wheels */ | ||
| 2001 | __set_bit(ABS_MISC, input_dev->absbit); | ||
| 2002 | |||
| 2003 | /* kept for making legacy xf86-input-wacom accepting the pad */ | ||
| 2004 | input_set_abs_params(input_dev, ABS_X, 0, 1, 0, 0); | ||
| 2005 | input_set_abs_params(input_dev, ABS_Y, 0, 1, 0, 0); | ||
| 2006 | |||
| 2007 | switch (features->type) { | ||
| 2008 | case GRAPHIRE_BT: | ||
| 2009 | __set_bit(BTN_0, input_dev->keybit); | ||
| 1922 | __set_bit(BTN_1, input_dev->keybit); | 2010 | __set_bit(BTN_1, input_dev->keybit); |
| 1923 | __set_bit(BTN_2, input_dev->keybit); | 2011 | break; |
| 1924 | __set_bit(BTN_3, input_dev->keybit); | 2012 | |
| 1925 | __set_bit(BTN_4, input_dev->keybit); | 2013 | case WACOM_MO: |
| 2014 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 2015 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 2016 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 2017 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 2018 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | ||
| 2019 | break; | ||
| 2020 | |||
| 2021 | case WACOM_G4: | ||
| 2022 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 2023 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 2024 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 2025 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 2026 | input_set_capability(input_dev, EV_REL, REL_WHEEL); | ||
| 2027 | break; | ||
| 2028 | |||
| 2029 | case WACOM_24HD: | ||
| 2030 | __set_bit(BTN_A, input_dev->keybit); | ||
| 2031 | __set_bit(BTN_B, input_dev->keybit); | ||
| 2032 | __set_bit(BTN_C, input_dev->keybit); | ||
| 2033 | __set_bit(BTN_X, input_dev->keybit); | ||
| 2034 | __set_bit(BTN_Y, input_dev->keybit); | ||
| 2035 | __set_bit(BTN_Z, input_dev->keybit); | ||
| 2036 | |||
| 2037 | for (i = 0; i < 10; i++) | ||
| 2038 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2039 | |||
| 2040 | __set_bit(KEY_PROG1, input_dev->keybit); | ||
| 2041 | __set_bit(KEY_PROG2, input_dev->keybit); | ||
| 2042 | __set_bit(KEY_PROG3, input_dev->keybit); | ||
| 2043 | |||
| 2044 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | ||
| 2045 | input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); | ||
| 2046 | break; | ||
| 2047 | |||
| 2048 | case DTK: | ||
| 2049 | for (i = 0; i < 6; i++) | ||
| 2050 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2051 | |||
| 2052 | break; | ||
| 2053 | |||
| 2054 | case WACOM_22HD: | ||
| 2055 | __set_bit(KEY_PROG1, input_dev->keybit); | ||
| 2056 | __set_bit(KEY_PROG2, input_dev->keybit); | ||
| 2057 | __set_bit(KEY_PROG3, input_dev->keybit); | ||
| 2058 | /* fall through */ | ||
| 2059 | |||
| 2060 | case WACOM_21UX2: | ||
| 2061 | __set_bit(BTN_A, input_dev->keybit); | ||
| 2062 | __set_bit(BTN_B, input_dev->keybit); | ||
| 2063 | __set_bit(BTN_C, input_dev->keybit); | ||
| 2064 | __set_bit(BTN_X, input_dev->keybit); | ||
| 2065 | __set_bit(BTN_Y, input_dev->keybit); | ||
| 2066 | __set_bit(BTN_Z, input_dev->keybit); | ||
| 2067 | __set_bit(BTN_BASE, input_dev->keybit); | ||
| 2068 | __set_bit(BTN_BASE2, input_dev->keybit); | ||
| 2069 | /* fall through */ | ||
| 2070 | |||
| 2071 | case WACOM_BEE: | ||
| 2072 | __set_bit(BTN_8, input_dev->keybit); | ||
| 2073 | __set_bit(BTN_9, input_dev->keybit); | ||
| 2074 | /* fall through */ | ||
| 2075 | |||
| 2076 | case CINTIQ: | ||
| 2077 | for (i = 0; i < 8; i++) | ||
| 2078 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2079 | |||
| 2080 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); | ||
| 2081 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | ||
| 2082 | break; | ||
| 2083 | |||
| 2084 | case WACOM_13HD: | ||
| 2085 | for (i = 0; i < 9; i++) | ||
| 2086 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1926 | 2087 | ||
| 2088 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | ||
| 2089 | break; | ||
| 2090 | |||
| 2091 | case INTUOS3: | ||
| 2092 | case INTUOS3L: | ||
| 2093 | __set_bit(BTN_4, input_dev->keybit); | ||
| 1927 | __set_bit(BTN_5, input_dev->keybit); | 2094 | __set_bit(BTN_5, input_dev->keybit); |
| 1928 | __set_bit(BTN_6, input_dev->keybit); | 2095 | __set_bit(BTN_6, input_dev->keybit); |
| 1929 | __set_bit(BTN_7, input_dev->keybit); | 2096 | __set_bit(BTN_7, input_dev->keybit); |
| 1930 | __set_bit(BTN_8, input_dev->keybit); | 2097 | |
| 2098 | input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); | ||
| 2099 | /* fall through */ | ||
| 2100 | |||
| 2101 | case INTUOS3S: | ||
| 1931 | __set_bit(BTN_0, input_dev->keybit); | 2102 | __set_bit(BTN_0, input_dev->keybit); |
| 2103 | __set_bit(BTN_1, input_dev->keybit); | ||
| 2104 | __set_bit(BTN_2, input_dev->keybit); | ||
| 2105 | __set_bit(BTN_3, input_dev->keybit); | ||
| 1932 | 2106 | ||
| 1933 | input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); | 2107 | input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); |
| 1934 | __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); | 2108 | break; |
| 2109 | |||
| 2110 | case INTUOS5: | ||
| 2111 | case INTUOS5L: | ||
| 2112 | case INTUOSPM: | ||
| 2113 | case INTUOSPL: | ||
| 2114 | __set_bit(BTN_7, input_dev->keybit); | ||
| 2115 | __set_bit(BTN_8, input_dev->keybit); | ||
| 2116 | /* fall through */ | ||
| 2117 | |||
| 2118 | case INTUOS5S: | ||
| 2119 | case INTUOSPS: | ||
| 2120 | /* touch interface does not have the pad device */ | ||
| 2121 | if (features->device_type != BTN_TOOL_PEN) | ||
| 2122 | return 1; | ||
| 2123 | |||
| 2124 | for (i = 0; i < 7; i++) | ||
| 2125 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2126 | |||
| 2127 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | ||
| 2128 | break; | ||
| 2129 | |||
| 2130 | case INTUOS4WL: | ||
| 2131 | /* | ||
| 2132 | * For Bluetooth devices, the udev rule does not work correctly | ||
| 2133 | * for pads unless we add a stylus capability, which forces | ||
| 2134 | * ID_INPUT_TABLET to be set. | ||
| 2135 | */ | ||
| 2136 | __set_bit(BTN_STYLUS, input_dev->keybit); | ||
| 2137 | /* fall through */ | ||
| 2138 | |||
| 2139 | case INTUOS4: | ||
| 2140 | case INTUOS4L: | ||
| 2141 | __set_bit(BTN_7, input_dev->keybit); | ||
| 2142 | __set_bit(BTN_8, input_dev->keybit); | ||
| 2143 | /* fall through */ | ||
| 2144 | |||
| 2145 | case INTUOS4S: | ||
| 2146 | for (i = 0; i < 7; i++) | ||
| 2147 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2148 | |||
| 2149 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | ||
| 2150 | break; | ||
| 2151 | |||
| 2152 | case CINTIQ_HYBRID: | ||
| 2153 | for (i = 0; i < 9; i++) | ||
| 2154 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 1935 | 2155 | ||
| 1936 | wacom_setup_cintiq(wacom_wac); | ||
| 1937 | break; | 2156 | break; |
| 2157 | |||
| 2158 | case DTUS: | ||
| 2159 | for (i = 0; i < 4; i++) | ||
| 2160 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
| 2161 | break; | ||
| 2162 | |||
| 2163 | case INTUOSHT: | ||
| 2164 | case BAMBOO_PT: | ||
| 2165 | /* pad device is on the touch interface */ | ||
| 2166 | if (features->device_type != BTN_TOOL_FINGER) | ||
| 2167 | return 1; | ||
| 2168 | |||
| 2169 | __clear_bit(ABS_MISC, input_dev->absbit); | ||
| 2170 | |||
| 2171 | __set_bit(BTN_LEFT, input_dev->keybit); | ||
| 2172 | __set_bit(BTN_FORWARD, input_dev->keybit); | ||
| 2173 | __set_bit(BTN_BACK, input_dev->keybit); | ||
| 2174 | __set_bit(BTN_RIGHT, input_dev->keybit); | ||
| 2175 | |||
| 2176 | break; | ||
| 2177 | |||
| 2178 | default: | ||
| 2179 | /* no pad supported */ | ||
| 2180 | return 1; | ||
| 1938 | } | 2181 | } |
| 1939 | return 0; | 2182 | return 0; |
| 1940 | } | 2183 | } |
| 1941 | 2184 | ||
| 1942 | static const struct wacom_features wacom_features_0x00 = | 2185 | static const struct wacom_features wacom_features_0x00 = |
| 1943 | { "Wacom Penpartner", WACOM_PKGLEN_PENPRTN, 5040, 3780, 255, | 2186 | { "Wacom Penpartner", 5040, 3780, 255, 0, |
| 1944 | 0, PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; | 2187 | PENPARTNER, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
| 1945 | static const struct wacom_features wacom_features_0x10 = | 2188 | static const struct wacom_features wacom_features_0x10 = |
| 1946 | { "Wacom Graphire", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, | 2189 | { "Wacom Graphire", 10206, 7422, 511, 63, |
| 1947 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2190 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 2191 | static const struct wacom_features wacom_features_0x81 = | ||
| 2192 | { "Wacom Graphire BT", 16704, 12064, 511, 32, | ||
| 2193 | GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | ||
| 1948 | static const struct wacom_features wacom_features_0x11 = | 2194 | static const struct wacom_features wacom_features_0x11 = |
| 1949 | { "Wacom Graphire2 4x5", WACOM_PKGLEN_GRAPHIRE, 10206, 7422, 511, | 2195 | { "Wacom Graphire2 4x5", 10206, 7422, 511, 63, |
| 1950 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2196 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1951 | static const struct wacom_features wacom_features_0x12 = | 2197 | static const struct wacom_features wacom_features_0x12 = |
| 1952 | { "Wacom Graphire2 5x7", WACOM_PKGLEN_GRAPHIRE, 13918, 10206, 511, | 2198 | { "Wacom Graphire2 5x7", 13918, 10206, 511, 63, |
| 1953 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2199 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1954 | static const struct wacom_features wacom_features_0x13 = | 2200 | static const struct wacom_features wacom_features_0x13 = |
| 1955 | { "Wacom Graphire3", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, | 2201 | { "Wacom Graphire3", 10208, 7424, 511, 63, |
| 1956 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2202 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1957 | static const struct wacom_features wacom_features_0x14 = | 2203 | static const struct wacom_features wacom_features_0x14 = |
| 1958 | { "Wacom Graphire3 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, | 2204 | { "Wacom Graphire3 6x8", 16704, 12064, 511, 63, |
| 1959 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2205 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1960 | static const struct wacom_features wacom_features_0x15 = | 2206 | static const struct wacom_features wacom_features_0x15 = |
| 1961 | { "Wacom Graphire4 4x5", WACOM_PKGLEN_GRAPHIRE, 10208, 7424, 511, | 2207 | { "Wacom Graphire4 4x5", 10208, 7424, 511, 63, |
| 1962 | 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2208 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1963 | static const struct wacom_features wacom_features_0x16 = | 2209 | static const struct wacom_features wacom_features_0x16 = |
| 1964 | { "Wacom Graphire4 6x8", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, | 2210 | { "Wacom Graphire4 6x8", 16704, 12064, 511, 63, |
| 1965 | 63, WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2211 | WACOM_G4, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1966 | static const struct wacom_features wacom_features_0x17 = | 2212 | static const struct wacom_features wacom_features_0x17 = |
| 1967 | { "Wacom BambooFun 4x5", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, | 2213 | { "Wacom BambooFun 4x5", 14760, 9225, 511, 63, |
| 1968 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2214 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1969 | static const struct wacom_features wacom_features_0x18 = | 2215 | static const struct wacom_features wacom_features_0x18 = |
| 1970 | { "Wacom BambooFun 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 511, | 2216 | { "Wacom BambooFun 6x8", 21648, 13530, 511, 63, |
| 1971 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2217 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1972 | static const struct wacom_features wacom_features_0x19 = | 2218 | static const struct wacom_features wacom_features_0x19 = |
| 1973 | { "Wacom Bamboo1 Medium", WACOM_PKGLEN_GRAPHIRE, 16704, 12064, 511, | 2219 | { "Wacom Bamboo1 Medium", 16704, 12064, 511, 63, |
| 1974 | 63, GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; | 2220 | GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; |
| 1975 | static const struct wacom_features wacom_features_0x60 = | 2221 | static const struct wacom_features wacom_features_0x60 = |
| 1976 | { "Wacom Volito", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, | 2222 | { "Wacom Volito", 5104, 3712, 511, 63, |
| 1977 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | 2223 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
| 1978 | static const struct wacom_features wacom_features_0x61 = | 2224 | static const struct wacom_features wacom_features_0x61 = |
| 1979 | { "Wacom PenStation2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 255, | 2225 | { "Wacom PenStation2", 3250, 2320, 255, 63, |
| 1980 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | 2226 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
| 1981 | static const struct wacom_features wacom_features_0x62 = | 2227 | static const struct wacom_features wacom_features_0x62 = |
| 1982 | { "Wacom Volito2 4x5", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, | 2228 | { "Wacom Volito2 4x5", 5104, 3712, 511, 63, |
| 1983 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | 2229 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
| 1984 | static const struct wacom_features wacom_features_0x63 = | 2230 | static const struct wacom_features wacom_features_0x63 = |
| 1985 | { "Wacom Volito2 2x3", WACOM_PKGLEN_GRAPHIRE, 3248, 2320, 511, | 2231 | { "Wacom Volito2 2x3", 3248, 2320, 511, 63, |
| 1986 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | 2232 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
| 1987 | static const struct wacom_features wacom_features_0x64 = | 2233 | static const struct wacom_features wacom_features_0x64 = |
| 1988 | { "Wacom PenPartner2", WACOM_PKGLEN_GRAPHIRE, 3250, 2320, 511, | 2234 | { "Wacom PenPartner2", 3250, 2320, 511, 63, |
| 1989 | 63, GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; | 2235 | GRAPHIRE, WACOM_VOLITO_RES, WACOM_VOLITO_RES }; |
| 1990 | static const struct wacom_features wacom_features_0x65 = | 2236 | static const struct wacom_features wacom_features_0x65 = |
| 1991 | { "Wacom Bamboo", WACOM_PKGLEN_BBFUN, 14760, 9225, 511, | 2237 | { "Wacom Bamboo", 14760, 9225, 511, 63, |
| 1992 | 63, WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2238 | WACOM_MO, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1993 | static const struct wacom_features wacom_features_0x69 = | 2239 | static const struct wacom_features wacom_features_0x69 = |
| 1994 | { "Wacom Bamboo1", WACOM_PKGLEN_GRAPHIRE, 5104, 3712, 511, | 2240 | { "Wacom Bamboo1", 5104, 3712, 511, 63, |
| 1995 | 63, GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; | 2241 | GRAPHIRE, WACOM_PENPRTN_RES, WACOM_PENPRTN_RES }; |
| 1996 | static const struct wacom_features wacom_features_0x6A = | 2242 | static const struct wacom_features wacom_features_0x6A = |
| 1997 | { "Wacom Bamboo1 4x6", WACOM_PKGLEN_GRAPHIRE, 14760, 9225, 1023, | 2243 | { "Wacom Bamboo1 4x6", 14760, 9225, 1023, 63, |
| 1998 | 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2244 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 1999 | static const struct wacom_features wacom_features_0x6B = | 2245 | static const struct wacom_features wacom_features_0x6B = |
| 2000 | { "Wacom Bamboo1 5x8", WACOM_PKGLEN_GRAPHIRE, 21648, 13530, 1023, | 2246 | { "Wacom Bamboo1 5x8", 21648, 13530, 1023, 63, |
| 2001 | 63, GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2247 | GRAPHIRE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2002 | static const struct wacom_features wacom_features_0x20 = | 2248 | static const struct wacom_features wacom_features_0x20 = |
| 2003 | { "Wacom Intuos 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, | 2249 | { "Wacom Intuos 4x5", 12700, 10600, 1023, 31, |
| 2004 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2250 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2005 | static const struct wacom_features wacom_features_0x21 = | 2251 | static const struct wacom_features wacom_features_0x21 = |
| 2006 | { "Wacom Intuos 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 2252 | { "Wacom Intuos 6x8", 20320, 16240, 1023, 31, |
| 2007 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2253 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2008 | static const struct wacom_features wacom_features_0x22 = | 2254 | static const struct wacom_features wacom_features_0x22 = |
| 2009 | { "Wacom Intuos 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, | 2255 | { "Wacom Intuos 9x12", 30480, 24060, 1023, 31, |
| 2010 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2256 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2011 | static const struct wacom_features wacom_features_0x23 = | 2257 | static const struct wacom_features wacom_features_0x23 = |
| 2012 | { "Wacom Intuos 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, | 2258 | { "Wacom Intuos 12x12", 30480, 31680, 1023, 31, |
| 2013 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2259 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2014 | static const struct wacom_features wacom_features_0x24 = | 2260 | static const struct wacom_features wacom_features_0x24 = |
| 2015 | { "Wacom Intuos 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, | 2261 | { "Wacom Intuos 12x18", 45720, 31680, 1023, 31, |
| 2016 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2262 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2017 | static const struct wacom_features wacom_features_0x30 = | 2263 | static const struct wacom_features wacom_features_0x30 = |
| 2018 | { "Wacom PL400", WACOM_PKGLEN_GRAPHIRE, 5408, 4056, 255, | 2264 | { "Wacom PL400", 5408, 4056, 255, 0, |
| 2019 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2265 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2020 | static const struct wacom_features wacom_features_0x31 = | 2266 | static const struct wacom_features wacom_features_0x31 = |
| 2021 | { "Wacom PL500", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 255, | 2267 | { "Wacom PL500", 6144, 4608, 255, 0, |
| 2022 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2268 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2023 | static const struct wacom_features wacom_features_0x32 = | 2269 | static const struct wacom_features wacom_features_0x32 = |
| 2024 | { "Wacom PL600", WACOM_PKGLEN_GRAPHIRE, 6126, 4604, 255, | 2270 | { "Wacom PL600", 6126, 4604, 255, 0, |
| 2025 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2271 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2026 | static const struct wacom_features wacom_features_0x33 = | 2272 | static const struct wacom_features wacom_features_0x33 = |
| 2027 | { "Wacom PL600SX", WACOM_PKGLEN_GRAPHIRE, 6260, 5016, 255, | 2273 | { "Wacom PL600SX", 6260, 5016, 255, 0, |
| 2028 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2274 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2029 | static const struct wacom_features wacom_features_0x34 = | 2275 | static const struct wacom_features wacom_features_0x34 = |
| 2030 | { "Wacom PL550", WACOM_PKGLEN_GRAPHIRE, 6144, 4608, 511, | 2276 | { "Wacom PL550", 6144, 4608, 511, 0, |
| 2031 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2277 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2032 | static const struct wacom_features wacom_features_0x35 = | 2278 | static const struct wacom_features wacom_features_0x35 = |
| 2033 | { "Wacom PL800", WACOM_PKGLEN_GRAPHIRE, 7220, 5780, 511, | 2279 | { "Wacom PL800", 7220, 5780, 511, 0, |
| 2034 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2280 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2035 | static const struct wacom_features wacom_features_0x37 = | 2281 | static const struct wacom_features wacom_features_0x37 = |
| 2036 | { "Wacom PL700", WACOM_PKGLEN_GRAPHIRE, 6758, 5406, 511, | 2282 | { "Wacom PL700", 6758, 5406, 511, 0, |
| 2037 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2283 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2038 | static const struct wacom_features wacom_features_0x38 = | 2284 | static const struct wacom_features wacom_features_0x38 = |
| 2039 | { "Wacom PL510", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, | 2285 | { "Wacom PL510", 6282, 4762, 511, 0, |
| 2040 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2286 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2041 | static const struct wacom_features wacom_features_0x39 = | 2287 | static const struct wacom_features wacom_features_0x39 = |
| 2042 | { "Wacom DTU710", WACOM_PKGLEN_GRAPHIRE, 34080, 27660, 511, | 2288 | { "Wacom DTU710", 34080, 27660, 511, 0, |
| 2043 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2289 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2044 | static const struct wacom_features wacom_features_0xC4 = | 2290 | static const struct wacom_features wacom_features_0xC4 = |
| 2045 | { "Wacom DTF521", WACOM_PKGLEN_GRAPHIRE, 6282, 4762, 511, | 2291 | { "Wacom DTF521", 6282, 4762, 511, 0, |
| 2046 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2292 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2047 | static const struct wacom_features wacom_features_0xC0 = | 2293 | static const struct wacom_features wacom_features_0xC0 = |
| 2048 | { "Wacom DTF720", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, | 2294 | { "Wacom DTF720", 6858, 5506, 511, 0, |
| 2049 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2295 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2050 | static const struct wacom_features wacom_features_0xC2 = | 2296 | static const struct wacom_features wacom_features_0xC2 = |
| 2051 | { "Wacom DTF720a", WACOM_PKGLEN_GRAPHIRE, 6858, 5506, 511, | 2297 | { "Wacom DTF720a", 6858, 5506, 511, 0, |
| 2052 | 0, PL, WACOM_PL_RES, WACOM_PL_RES }; | 2298 | PL, WACOM_PL_RES, WACOM_PL_RES }; |
| 2053 | static const struct wacom_features wacom_features_0x03 = | 2299 | static const struct wacom_features wacom_features_0x03 = |
| 2054 | { "Wacom Cintiq Partner", WACOM_PKGLEN_GRAPHIRE, 20480, 15360, 511, | 2300 | { "Wacom Cintiq Partner", 20480, 15360, 511, 0, |
| 2055 | 0, PTU, WACOM_PL_RES, WACOM_PL_RES }; | 2301 | PTU, WACOM_PL_RES, WACOM_PL_RES }; |
| 2056 | static const struct wacom_features wacom_features_0x41 = | 2302 | static const struct wacom_features wacom_features_0x41 = |
| 2057 | { "Wacom Intuos2 4x5", WACOM_PKGLEN_INTUOS, 12700, 10600, 1023, | 2303 | { "Wacom Intuos2 4x5", 12700, 10600, 1023, 31, |
| 2058 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2304 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2059 | static const struct wacom_features wacom_features_0x42 = | 2305 | static const struct wacom_features wacom_features_0x42 = |
| 2060 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 2306 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 2061 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2307 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2062 | static const struct wacom_features wacom_features_0x43 = | 2308 | static const struct wacom_features wacom_features_0x43 = |
| 2063 | { "Wacom Intuos2 9x12", WACOM_PKGLEN_INTUOS, 30480, 24060, 1023, | 2309 | { "Wacom Intuos2 9x12", 30480, 24060, 1023, 31, |
| 2064 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2310 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2065 | static const struct wacom_features wacom_features_0x44 = | 2311 | static const struct wacom_features wacom_features_0x44 = |
| 2066 | { "Wacom Intuos2 12x12", WACOM_PKGLEN_INTUOS, 30480, 31680, 1023, | 2312 | { "Wacom Intuos2 12x12", 30480, 31680, 1023, 31, |
| 2067 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2313 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2068 | static const struct wacom_features wacom_features_0x45 = | 2314 | static const struct wacom_features wacom_features_0x45 = |
| 2069 | { "Wacom Intuos2 12x18", WACOM_PKGLEN_INTUOS, 45720, 31680, 1023, | 2315 | { "Wacom Intuos2 12x18", 45720, 31680, 1023, 31, |
| 2070 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2316 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2071 | static const struct wacom_features wacom_features_0xB0 = | 2317 | static const struct wacom_features wacom_features_0xB0 = |
| 2072 | { "Wacom Intuos3 4x5", WACOM_PKGLEN_INTUOS, 25400, 20320, 1023, | 2318 | { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63, |
| 2073 | 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2319 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2074 | static const struct wacom_features wacom_features_0xB1 = | 2320 | static const struct wacom_features wacom_features_0xB1 = |
| 2075 | { "Wacom Intuos3 6x8", WACOM_PKGLEN_INTUOS, 40640, 30480, 1023, | 2321 | { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63, |
| 2076 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2322 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2077 | static const struct wacom_features wacom_features_0xB2 = | 2323 | static const struct wacom_features wacom_features_0xB2 = |
| 2078 | { "Wacom Intuos3 9x12", WACOM_PKGLEN_INTUOS, 60960, 45720, 1023, | 2324 | { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63, |
| 2079 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2325 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2080 | static const struct wacom_features wacom_features_0xB3 = | 2326 | static const struct wacom_features wacom_features_0xB3 = |
| 2081 | { "Wacom Intuos3 12x12", WACOM_PKGLEN_INTUOS, 60960, 60960, 1023, | 2327 | { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63, |
| 2082 | 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2328 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2083 | static const struct wacom_features wacom_features_0xB4 = | 2329 | static const struct wacom_features wacom_features_0xB4 = |
| 2084 | { "Wacom Intuos3 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 1023, | 2330 | { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63, |
| 2085 | 63, INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2331 | INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2086 | static const struct wacom_features wacom_features_0xB5 = | 2332 | static const struct wacom_features wacom_features_0xB5 = |
| 2087 | { "Wacom Intuos3 6x11", WACOM_PKGLEN_INTUOS, 54204, 31750, 1023, | 2333 | { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63, |
| 2088 | 63, INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2334 | INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2089 | static const struct wacom_features wacom_features_0xB7 = | 2335 | static const struct wacom_features wacom_features_0xB7 = |
| 2090 | { "Wacom Intuos3 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 1023, | 2336 | { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63, |
| 2091 | 63, INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2337 | INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2092 | static const struct wacom_features wacom_features_0xB8 = | 2338 | static const struct wacom_features wacom_features_0xB8 = |
| 2093 | { "Wacom Intuos4 4x6", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | 2339 | { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63, |
| 2094 | 63, INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2340 | INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2095 | static const struct wacom_features wacom_features_0xB9 = | 2341 | static const struct wacom_features wacom_features_0xB9 = |
| 2096 | { "Wacom Intuos4 6x9", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | 2342 | { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63, |
| 2097 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2343 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2098 | static const struct wacom_features wacom_features_0xBA = | 2344 | static const struct wacom_features wacom_features_0xBA = |
| 2099 | { "Wacom Intuos4 8x13", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, | 2345 | { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63, |
| 2100 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2346 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2101 | static const struct wacom_features wacom_features_0xBB = | 2347 | static const struct wacom_features wacom_features_0xBB = |
| 2102 | { "Wacom Intuos4 12x19", WACOM_PKGLEN_INTUOS, 97536, 60960, 2047, | 2348 | { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63, |
| 2103 | 63, INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2349 | INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2104 | static const struct wacom_features wacom_features_0xBC = | 2350 | static const struct wacom_features wacom_features_0xBC = |
| 2105 | { "Wacom Intuos4 WL", WACOM_PKGLEN_INTUOS, 40640, 25400, 2047, | 2351 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, |
| 2106 | 63, INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2352 | INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2353 | static const struct wacom_features wacom_features_0xBD = | ||
| 2354 | { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, | ||
| 2355 | INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | ||
| 2107 | static const struct wacom_features wacom_features_0x26 = | 2356 | static const struct wacom_features wacom_features_0x26 = |
| 2108 | { "Wacom Intuos5 touch S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | 2357 | { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63, |
| 2109 | 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2358 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; |
| 2110 | .touch_max = 16 }; | ||
| 2111 | static const struct wacom_features wacom_features_0x27 = | 2359 | static const struct wacom_features wacom_features_0x27 = |
| 2112 | { "Wacom Intuos5 touch M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | 2360 | { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63, |
| 2113 | 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2361 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; |
| 2114 | .touch_max = 16 }; | ||
| 2115 | static const struct wacom_features wacom_features_0x28 = | 2362 | static const struct wacom_features wacom_features_0x28 = |
| 2116 | { "Wacom Intuos5 touch L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, | 2363 | { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63, |
| 2117 | 63, INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2364 | INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; |
| 2118 | .touch_max = 16 }; | ||
| 2119 | static const struct wacom_features wacom_features_0x29 = | 2365 | static const struct wacom_features wacom_features_0x29 = |
| 2120 | { "Wacom Intuos5 S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | 2366 | { "Wacom Intuos5 S", 31496, 19685, 2047, 63, |
| 2121 | 63, INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2367 | INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2122 | static const struct wacom_features wacom_features_0x2A = | 2368 | static const struct wacom_features wacom_features_0x2A = |
| 2123 | { "Wacom Intuos5 M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | 2369 | { "Wacom Intuos5 M", 44704, 27940, 2047, 63, |
| 2124 | 63, INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2370 | INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2125 | static const struct wacom_features wacom_features_0x314 = | 2371 | static const struct wacom_features wacom_features_0x314 = |
| 2126 | { "Wacom Intuos Pro S", WACOM_PKGLEN_INTUOS, 31496, 19685, 2047, | 2372 | { "Wacom Intuos Pro S", 31496, 19685, 2047, 63, |
| 2127 | 63, INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2373 | INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, |
| 2128 | .touch_max = 16 }; | 2374 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 2129 | static const struct wacom_features wacom_features_0x315 = | 2375 | static const struct wacom_features wacom_features_0x315 = |
| 2130 | { "Wacom Intuos Pro M", WACOM_PKGLEN_INTUOS, 44704, 27940, 2047, | 2376 | { "Wacom Intuos Pro M", 44704, 27940, 2047, 63, |
| 2131 | 63, INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2377 | INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, |
| 2132 | .touch_max = 16 }; | 2378 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 2133 | static const struct wacom_features wacom_features_0x317 = | 2379 | static const struct wacom_features wacom_features_0x317 = |
| 2134 | { "Wacom Intuos Pro L", WACOM_PKGLEN_INTUOS, 65024, 40640, 2047, | 2380 | { "Wacom Intuos Pro L", 65024, 40640, 2047, 63, |
| 2135 | 63, INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, | 2381 | INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, |
| 2136 | .touch_max = 16 }; | 2382 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 2137 | static const struct wacom_features wacom_features_0xF4 = | 2383 | static const struct wacom_features wacom_features_0xF4 = |
| 2138 | { "Wacom Cintiq 24HD", WACOM_PKGLEN_INTUOS, 104280, 65400, 2047, | 2384 | { "Wacom Cintiq 24HD", 104280, 65400, 2047, 63, |
| 2139 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; | 2385 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; |
| 2140 | static const struct wacom_features wacom_features_0xF8 = | 2386 | static const struct wacom_features wacom_features_0xF8 = |
| 2141 | { "Wacom Cintiq 24HD touch", WACOM_PKGLEN_INTUOS, 104280, 65400, 2047, /* Pen */ | 2387 | { "Wacom Cintiq 24HD touch", 104280, 65400, 2047, 63, /* Pen */ |
| 2142 | 63, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, | 2388 | WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, |
| 2143 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; | 2389 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; |
| 2144 | static const struct wacom_features wacom_features_0xF6 = | 2390 | static const struct wacom_features wacom_features_0xF6 = |
| 2145 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ | 2391 | { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ |
| 2146 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10 }; | 2392 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf8, .touch_max = 10, |
| 2393 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | ||
| 2147 | static const struct wacom_features wacom_features_0x3F = | 2394 | static const struct wacom_features wacom_features_0x3F = |
| 2148 | { "Wacom Cintiq 21UX", WACOM_PKGLEN_INTUOS, 87200, 65600, 1023, | 2395 | { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, |
| 2149 | 63, CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2396 | CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2150 | static const struct wacom_features wacom_features_0xC5 = | 2397 | static const struct wacom_features wacom_features_0xC5 = |
| 2151 | { "Wacom Cintiq 20WSX", WACOM_PKGLEN_INTUOS, 86680, 54180, 1023, | 2398 | { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63, |
| 2152 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2399 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2153 | static const struct wacom_features wacom_features_0xC6 = | 2400 | static const struct wacom_features wacom_features_0xC6 = |
| 2154 | { "Wacom Cintiq 12WX", WACOM_PKGLEN_INTUOS, 53020, 33440, 1023, | 2401 | { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, |
| 2155 | 63, WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; | 2402 | WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; |
| 2156 | static const struct wacom_features wacom_features_0x304 = | 2403 | static const struct wacom_features wacom_features_0x304 = |
| 2157 | { "Wacom Cintiq 13HD", WACOM_PKGLEN_INTUOS, 59352, 33648, 1023, | 2404 | { "Wacom Cintiq 13HD", 59352, 33648, 1023, 63, |
| 2158 | 63, WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; | 2405 | WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; |
| 2159 | static const struct wacom_features wacom_features_0xC7 = | 2406 | static const struct wacom_features wacom_features_0xC7 = |
| 2160 | { "Wacom DTU1931", WACOM_PKGLEN_GRAPHIRE, 37832, 30305, 511, | 2407 | { "Wacom DTU1931", 37832, 30305, 511, 0, |
| 2161 | 0, PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2408 | PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2162 | static const struct wacom_features wacom_features_0xCE = | 2409 | static const struct wacom_features wacom_features_0xCE = |
| 2163 | { "Wacom DTU2231", WACOM_PKGLEN_GRAPHIRE, 47864, 27011, 511, | 2410 | { "Wacom DTU2231", 47864, 27011, 511, 0, |
| 2164 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2411 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 2412 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBMOUSE }; | ||
| 2165 | static const struct wacom_features wacom_features_0xF0 = | 2413 | static const struct wacom_features wacom_features_0xF0 = |
| 2166 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, | 2414 | { "Wacom DTU1631", 34623, 19553, 511, 0, |
| 2167 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2415 | DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2168 | static const struct wacom_features wacom_features_0xFB = | 2416 | static const struct wacom_features wacom_features_0xFB = |
| 2169 | { "Wacom DTU1031", WACOM_PKGLEN_DTUS, 22096, 13960, 511, | 2417 | { "Wacom DTU1031", 22096, 13960, 511, 0, |
| 2170 | 0, DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2418 | DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2171 | static const struct wacom_features wacom_features_0x57 = | 2419 | static const struct wacom_features wacom_features_0x57 = |
| 2172 | { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047, | 2420 | { "Wacom DTK2241", 95640, 54060, 2047, 63, |
| 2173 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; | 2421 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; |
| 2174 | static const struct wacom_features wacom_features_0x59 = /* Pen */ | 2422 | static const struct wacom_features wacom_features_0x59 = /* Pen */ |
| 2175 | { "Wacom DTH2242", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047, | 2423 | { "Wacom DTH2242", 95640, 54060, 2047, 63, |
| 2176 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, | 2424 | DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, |
| 2177 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; | 2425 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; |
| 2178 | static const struct wacom_features wacom_features_0x5D = /* Touch */ | 2426 | static const struct wacom_features wacom_features_0x5D = /* Touch */ |
| 2179 | { "Wacom DTH2242", .type = WACOM_24HDT, | 2427 | { "Wacom DTH2242", .type = WACOM_24HDT, |
| 2180 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10 }; | 2428 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10, |
| 2429 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | ||
| 2181 | static const struct wacom_features wacom_features_0xCC = | 2430 | static const struct wacom_features wacom_features_0xCC = |
| 2182 | { "Wacom Cintiq 21UX2", WACOM_PKGLEN_INTUOS, 87000, 65400, 2047, | 2431 | { "Wacom Cintiq 21UX2", 87000, 65400, 2047, 63, |
| 2183 | 63, WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; | 2432 | WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; |
| 2184 | static const struct wacom_features wacom_features_0xFA = | 2433 | static const struct wacom_features wacom_features_0xFA = |
| 2185 | { "Wacom Cintiq 22HD", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047, | 2434 | { "Wacom Cintiq 22HD", 95640, 54060, 2047, 63, |
| 2186 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; | 2435 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; |
| 2187 | static const struct wacom_features wacom_features_0x5B = | 2436 | static const struct wacom_features wacom_features_0x5B = |
| 2188 | { "Wacom Cintiq 22HDT", WACOM_PKGLEN_INTUOS, 95640, 54060, 2047, | 2437 | { "Wacom Cintiq 22HDT", 95640, 54060, 2047, 63, |
| 2189 | 63, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, | 2438 | WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, |
| 2190 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; | 2439 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; |
| 2191 | static const struct wacom_features wacom_features_0x5E = | 2440 | static const struct wacom_features wacom_features_0x5E = |
| 2192 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, | 2441 | { "Wacom Cintiq 22HDT", .type = WACOM_24HDT, |
| 2193 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10 }; | 2442 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5b, .touch_max = 10, |
| 2443 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | ||
| 2194 | static const struct wacom_features wacom_features_0x90 = | 2444 | static const struct wacom_features wacom_features_0x90 = |
| 2195 | { "Wacom ISDv4 90", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2445 | { "Wacom ISDv4 90", 26202, 16325, 255, 0, |
| 2196 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2446 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2197 | static const struct wacom_features wacom_features_0x93 = | 2447 | static const struct wacom_features wacom_features_0x93 = |
| 2198 | { "Wacom ISDv4 93", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2448 | { "Wacom ISDv4 93", 26202, 16325, 255, 0, |
| 2199 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2449 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2200 | static const struct wacom_features wacom_features_0x97 = | 2450 | static const struct wacom_features wacom_features_0x97 = |
| 2201 | { "Wacom ISDv4 97", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 511, | 2451 | { "Wacom ISDv4 97", 26202, 16325, 511, 0, |
| 2202 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2452 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2203 | static const struct wacom_features wacom_features_0x9A = | 2453 | static const struct wacom_features wacom_features_0x9A = |
| 2204 | { "Wacom ISDv4 9A", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2454 | { "Wacom ISDv4 9A", 26202, 16325, 255, 0, |
| 2205 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2455 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2206 | static const struct wacom_features wacom_features_0x9F = | 2456 | static const struct wacom_features wacom_features_0x9F = |
| 2207 | { "Wacom ISDv4 9F", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2457 | { "Wacom ISDv4 9F", 26202, 16325, 255, 0, |
| 2208 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2458 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2209 | static const struct wacom_features wacom_features_0xE2 = | 2459 | static const struct wacom_features wacom_features_0xE2 = |
| 2210 | { "Wacom ISDv4 E2", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, | 2460 | { "Wacom ISDv4 E2", 26202, 16325, 255, 0, |
| 2211 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2461 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2212 | .touch_max = 2 }; | ||
| 2213 | static const struct wacom_features wacom_features_0xE3 = | 2462 | static const struct wacom_features wacom_features_0xE3 = |
| 2214 | { "Wacom ISDv4 E3", WACOM_PKGLEN_TPC2FG, 26202, 16325, 255, | 2463 | { "Wacom ISDv4 E3", 26202, 16325, 255, 0, |
| 2215 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2464 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2216 | .touch_max = 2 }; | ||
| 2217 | static const struct wacom_features wacom_features_0xE5 = | 2465 | static const struct wacom_features wacom_features_0xE5 = |
| 2218 | { "Wacom ISDv4 E5", WACOM_PKGLEN_MTOUCH, 26202, 16325, 255, | 2466 | { "Wacom ISDv4 E5", 26202, 16325, 255, 0, |
| 2219 | 0, MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2467 | MTSCREEN, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2220 | static const struct wacom_features wacom_features_0xE6 = | 2468 | static const struct wacom_features wacom_features_0xE6 = |
| 2221 | { "Wacom ISDv4 E6", WACOM_PKGLEN_TPC2FG, 27760, 15694, 255, | 2469 | { "Wacom ISDv4 E6", 27760, 15694, 255, 0, |
| 2222 | 0, TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2470 | TABLETPC2FG, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2223 | .touch_max = 2 }; | ||
| 2224 | static const struct wacom_features wacom_features_0xEC = | 2471 | static const struct wacom_features wacom_features_0xEC = |
| 2225 | { "Wacom ISDv4 EC", WACOM_PKGLEN_GRAPHIRE, 25710, 14500, 255, | 2472 | { "Wacom ISDv4 EC", 25710, 14500, 255, 0, |
| 2226 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2473 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2227 | static const struct wacom_features wacom_features_0xED = | 2474 | static const struct wacom_features wacom_features_0xED = |
| 2228 | { "Wacom ISDv4 ED", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2475 | { "Wacom ISDv4 ED", 26202, 16325, 255, 0, |
| 2229 | 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2476 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2230 | static const struct wacom_features wacom_features_0xEF = | 2477 | static const struct wacom_features wacom_features_0xEF = |
| 2231 | { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2478 | { "Wacom ISDv4 EF", 26202, 16325, 255, 0, |
| 2232 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2479 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2233 | static const struct wacom_features wacom_features_0x100 = | 2480 | static const struct wacom_features wacom_features_0x100 = |
| 2234 | { "Wacom ISDv4 100", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2481 | { "Wacom ISDv4 100", 26202, 16325, 255, 0, |
| 2235 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2482 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2236 | static const struct wacom_features wacom_features_0x101 = | 2483 | static const struct wacom_features wacom_features_0x101 = |
| 2237 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2484 | { "Wacom ISDv4 101", 26202, 16325, 255, 0, |
| 2238 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2485 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2239 | static const struct wacom_features wacom_features_0x10D = | 2486 | static const struct wacom_features wacom_features_0x10D = |
| 2240 | { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2487 | { "Wacom ISDv4 10D", 26202, 16325, 255, 0, |
| 2241 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2488 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2242 | static const struct wacom_features wacom_features_0x10E = | 2489 | static const struct wacom_features wacom_features_0x10E = |
| 2243 | { "Wacom ISDv4 10E", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | 2490 | { "Wacom ISDv4 10E", 27760, 15694, 255, 0, |
| 2244 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2491 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2245 | static const struct wacom_features wacom_features_0x10F = | 2492 | static const struct wacom_features wacom_features_0x10F = |
| 2246 | { "Wacom ISDv4 10F", WACOM_PKGLEN_MTTPC, 27760, 15694, 255, | 2493 | { "Wacom ISDv4 10F", 27760, 15694, 255, 0, |
| 2247 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2494 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2248 | static const struct wacom_features wacom_features_0x116 = | 2495 | static const struct wacom_features wacom_features_0x116 = |
| 2249 | { "Wacom ISDv4 116", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2496 | { "Wacom ISDv4 116", 26202, 16325, 255, 0, |
| 2250 | 0, TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2497 | TABLETPCE, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2498 | static const struct wacom_features wacom_features_0x12C = | ||
| 2499 | { "Wacom ISDv4 12C", 27848, 15752, 2047, 0, | ||
| 2500 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
| 2251 | static const struct wacom_features wacom_features_0x4001 = | 2501 | static const struct wacom_features wacom_features_0x4001 = |
| 2252 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | 2502 | { "Wacom ISDv4 4001", 26202, 16325, 255, 0, |
| 2253 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2503 | MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2254 | static const struct wacom_features wacom_features_0x4004 = | 2504 | static const struct wacom_features wacom_features_0x4004 = |
| 2255 | { "Wacom ISDv4 4004", WACOM_PKGLEN_MTTPC, 11060, 6220, 255, | 2505 | { "Wacom ISDv4 4004", 11060, 6220, 255, 0, |
| 2256 | 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2506 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2257 | static const struct wacom_features wacom_features_0x5000 = | 2507 | static const struct wacom_features wacom_features_0x5000 = |
| 2258 | { "Wacom ISDv4 5000", WACOM_PKGLEN_MTTPC, 27848, 15752, 1023, | 2508 | { "Wacom ISDv4 5000", 27848, 15752, 1023, 0, |
| 2259 | 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2509 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2260 | static const struct wacom_features wacom_features_0x5002 = | 2510 | static const struct wacom_features wacom_features_0x5002 = |
| 2261 | { "Wacom ISDv4 5002", WACOM_PKGLEN_MTTPC, 29576, 16724, 1023, | 2511 | { "Wacom ISDv4 5002", 29576, 16724, 1023, 0, |
| 2262 | 0, MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2512 | MTTPC_B, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2263 | static const struct wacom_features wacom_features_0x47 = | 2513 | static const struct wacom_features wacom_features_0x47 = |
| 2264 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 2514 | { "Wacom Intuos2 6x8", 20320, 16240, 1023, 31, |
| 2265 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2515 | INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2266 | static const struct wacom_features wacom_features_0x84 = | 2516 | static const struct wacom_features wacom_features_0x84 = |
| 2267 | { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, | 2517 | { "Wacom Wireless Receiver", 0, 0, 0, 0, |
| 2268 | 0, WIRELESS, 0, 0, .touch_max = 16 }; | 2518 | WIRELESS, 0, 0, .touch_max = 16 }; |
| 2269 | static const struct wacom_features wacom_features_0xD0 = | 2519 | static const struct wacom_features wacom_features_0xD0 = |
| 2270 | { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2520 | { "Wacom Bamboo 2FG", 14720, 9200, 1023, 31, |
| 2271 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2521 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2272 | .touch_max = 2 }; | ||
| 2273 | static const struct wacom_features wacom_features_0xD1 = | 2522 | static const struct wacom_features wacom_features_0xD1 = |
| 2274 | { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2523 | { "Wacom Bamboo 2FG 4x5", 14720, 9200, 1023, 31, |
| 2275 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2524 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2276 | .touch_max = 2 }; | ||
| 2277 | static const struct wacom_features wacom_features_0xD2 = | 2525 | static const struct wacom_features wacom_features_0xD2 = |
| 2278 | { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2526 | { "Wacom Bamboo Craft", 14720, 9200, 1023, 31, |
| 2279 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2527 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2280 | .touch_max = 2 }; | ||
| 2281 | static const struct wacom_features wacom_features_0xD3 = | 2528 | static const struct wacom_features wacom_features_0xD3 = |
| 2282 | { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, | 2529 | { "Wacom Bamboo 2FG 6x8", 21648, 13700, 1023, 31, |
| 2283 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2530 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2284 | .touch_max = 2 }; | ||
| 2285 | static const struct wacom_features wacom_features_0xD4 = | 2531 | static const struct wacom_features wacom_features_0xD4 = |
| 2286 | { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2532 | { "Wacom Bamboo Pen", 14720, 9200, 1023, 31, |
| 2287 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2533 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2288 | static const struct wacom_features wacom_features_0xD5 = | 2534 | static const struct wacom_features wacom_features_0xD5 = |
| 2289 | { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, | 2535 | { "Wacom Bamboo Pen 6x8", 21648, 13700, 1023, 31, |
| 2290 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2536 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2291 | static const struct wacom_features wacom_features_0xD6 = | 2537 | static const struct wacom_features wacom_features_0xD6 = |
| 2292 | { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2538 | { "Wacom BambooPT 2FG 4x5", 14720, 9200, 1023, 31, |
| 2293 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2539 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2294 | .touch_max = 2 }; | ||
| 2295 | static const struct wacom_features wacom_features_0xD7 = | 2540 | static const struct wacom_features wacom_features_0xD7 = |
| 2296 | { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2541 | { "Wacom BambooPT 2FG Small", 14720, 9200, 1023, 31, |
| 2297 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2542 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2298 | .touch_max = 2 }; | ||
| 2299 | static const struct wacom_features wacom_features_0xD8 = | 2543 | static const struct wacom_features wacom_features_0xD8 = |
| 2300 | { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, | 2544 | { "Wacom Bamboo Comic 2FG", 21648, 13700, 1023, 31, |
| 2301 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2545 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2302 | .touch_max = 2 }; | ||
| 2303 | static const struct wacom_features wacom_features_0xDA = | 2546 | static const struct wacom_features wacom_features_0xDA = |
| 2304 | { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, | 2547 | { "Wacom Bamboo 2FG 4x5 SE", 14720, 9200, 1023, 31, |
| 2305 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2548 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2306 | .touch_max = 2 }; | ||
| 2307 | static const struct wacom_features wacom_features_0xDB = | 2549 | static const struct wacom_features wacom_features_0xDB = |
| 2308 | { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13700, 1023, | 2550 | { "Wacom Bamboo 2FG 6x8 SE", 21648, 13700, 1023, 31, |
| 2309 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2551 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 2 }; |
| 2310 | .touch_max = 2 }; | ||
| 2311 | static const struct wacom_features wacom_features_0xDD = | 2552 | static const struct wacom_features wacom_features_0xDD = |
| 2312 | { "Wacom Bamboo Connect", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | 2553 | { "Wacom Bamboo Connect", 14720, 9200, 1023, 31, |
| 2313 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2554 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2314 | static const struct wacom_features wacom_features_0xDE = | 2555 | static const struct wacom_features wacom_features_0xDE = |
| 2315 | { "Wacom Bamboo 16FG 4x5", WACOM_PKGLEN_BBPEN, 14720, 9200, 1023, | 2556 | { "Wacom Bamboo 16FG 4x5", 14720, 9200, 1023, 31, |
| 2316 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2557 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
| 2317 | .touch_max = 16 }; | ||
| 2318 | static const struct wacom_features wacom_features_0xDF = | 2558 | static const struct wacom_features wacom_features_0xDF = |
| 2319 | { "Wacom Bamboo 16FG 6x8", WACOM_PKGLEN_BBPEN, 21648, 13700, 1023, | 2559 | { "Wacom Bamboo 16FG 6x8", 21648, 13700, 1023, 31, |
| 2320 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2560 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16 }; |
| 2321 | .touch_max = 16 }; | ||
| 2322 | static const struct wacom_features wacom_features_0x300 = | 2561 | static const struct wacom_features wacom_features_0x300 = |
| 2323 | { "Wacom Bamboo One S", WACOM_PKGLEN_BBPEN, 14720, 9225, 1023, | 2562 | { "Wacom Bamboo One S", 14720, 9225, 1023, 31, |
| 2324 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2563 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2325 | static const struct wacom_features wacom_features_0x301 = | 2564 | static const struct wacom_features wacom_features_0x301 = |
| 2326 | { "Wacom Bamboo One M", WACOM_PKGLEN_BBPEN, 21648, 13530, 1023, | 2565 | { "Wacom Bamboo One M", 21648, 13530, 1023, 31, |
| 2327 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2566 | BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2328 | static const struct wacom_features wacom_features_0x302 = | 2567 | static const struct wacom_features wacom_features_0x302 = |
| 2329 | { "Wacom Intuos PT S", WACOM_PKGLEN_BBPEN, 15200, 9500, 1023, | 2568 | { "Wacom Intuos PT S", 15200, 9500, 1023, 31, |
| 2330 | 31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2569 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 2331 | .touch_max = 16 }; | 2570 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 2332 | static const struct wacom_features wacom_features_0x303 = | 2571 | static const struct wacom_features wacom_features_0x303 = |
| 2333 | { "Wacom Intuos PT M", WACOM_PKGLEN_BBPEN, 21600, 13500, 1023, | 2572 | { "Wacom Intuos PT M", 21600, 13500, 1023, 31, |
| 2334 | 31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, | 2573 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, .touch_max = 16, |
| 2335 | .touch_max = 16 }; | 2574 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; |
| 2336 | static const struct wacom_features wacom_features_0x30E = | 2575 | static const struct wacom_features wacom_features_0x30E = |
| 2337 | { "Wacom Intuos S", WACOM_PKGLEN_BBPEN, 15200, 9500, 1023, | 2576 | { "Wacom Intuos S", 15200, 9500, 1023, 31, |
| 2338 | 31, INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2577 | INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, |
| 2578 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | ||
| 2339 | static const struct wacom_features wacom_features_0x6004 = | 2579 | static const struct wacom_features wacom_features_0x6004 = |
| 2340 | { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, | 2580 | { "ISD-V4", 12800, 8000, 255, 0, |
| 2341 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2581 | TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
| 2342 | static const struct wacom_features wacom_features_0x0307 = | 2582 | static const struct wacom_features wacom_features_0x307 = |
| 2343 | { "Wacom ISDv5 307", WACOM_PKGLEN_INTUOS, 59352, 33648, 2047, | 2583 | { "Wacom ISDv5 307", 59352, 33648, 2047, 63, |
| 2344 | 63, CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, | 2584 | CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, |
| 2345 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; | 2585 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; |
| 2346 | static const struct wacom_features wacom_features_0x0309 = | 2586 | static const struct wacom_features wacom_features_0x309 = |
| 2347 | { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ | 2587 | { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ |
| 2348 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10 }; | 2588 | .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10, |
| 2589 | .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; | ||
| 2349 | 2590 | ||
| 2350 | #define USB_DEVICE_WACOM(prod) \ | 2591 | #define USB_DEVICE_WACOM(prod) \ |
| 2351 | USB_DEVICE(USB_VENDOR_ID_WACOM, prod), \ | 2592 | HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 2352 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | 2593 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 2353 | 2594 | ||
| 2354 | #define USB_DEVICE_DETAILED(prod, class, sub, proto) \ | 2595 | #define BT_DEVICE_WACOM(prod) \ |
| 2355 | USB_DEVICE_AND_INTERFACE_INFO(USB_VENDOR_ID_WACOM, prod, class, \ | 2596 | HID_DEVICE(BUS_BLUETOOTH, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ |
| 2356 | sub, proto), \ | 2597 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 2357 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | ||
| 2358 | 2598 | ||
| 2359 | #define USB_DEVICE_LENOVO(prod) \ | 2599 | #define USB_DEVICE_LENOVO(prod) \ |
| 2360 | USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ | 2600 | HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, prod), \ |
| 2361 | .driver_info = (kernel_ulong_t)&wacom_features_##prod | 2601 | .driver_data = (kernel_ulong_t)&wacom_features_##prod |
| 2362 | 2602 | ||
| 2363 | const struct usb_device_id wacom_ids[] = { | 2603 | const struct hid_device_id wacom_ids[] = { |
| 2364 | { USB_DEVICE_WACOM(0x00) }, | 2604 | { USB_DEVICE_WACOM(0x00) }, |
| 2605 | { USB_DEVICE_WACOM(0x03) }, | ||
| 2365 | { USB_DEVICE_WACOM(0x10) }, | 2606 | { USB_DEVICE_WACOM(0x10) }, |
| 2366 | { USB_DEVICE_WACOM(0x11) }, | 2607 | { USB_DEVICE_WACOM(0x11) }, |
| 2367 | { USB_DEVICE_WACOM(0x12) }, | 2608 | { USB_DEVICE_WACOM(0x12) }, |
| @@ -2372,20 +2613,16 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2372 | { USB_DEVICE_WACOM(0x17) }, | 2613 | { USB_DEVICE_WACOM(0x17) }, |
| 2373 | { USB_DEVICE_WACOM(0x18) }, | 2614 | { USB_DEVICE_WACOM(0x18) }, |
| 2374 | { USB_DEVICE_WACOM(0x19) }, | 2615 | { USB_DEVICE_WACOM(0x19) }, |
| 2375 | { USB_DEVICE_WACOM(0x60) }, | ||
| 2376 | { USB_DEVICE_WACOM(0x61) }, | ||
| 2377 | { USB_DEVICE_WACOM(0x62) }, | ||
| 2378 | { USB_DEVICE_WACOM(0x63) }, | ||
| 2379 | { USB_DEVICE_WACOM(0x64) }, | ||
| 2380 | { USB_DEVICE_WACOM(0x65) }, | ||
| 2381 | { USB_DEVICE_WACOM(0x69) }, | ||
| 2382 | { USB_DEVICE_WACOM(0x6A) }, | ||
| 2383 | { USB_DEVICE_WACOM(0x6B) }, | ||
| 2384 | { USB_DEVICE_WACOM(0x20) }, | 2616 | { USB_DEVICE_WACOM(0x20) }, |
| 2385 | { USB_DEVICE_WACOM(0x21) }, | 2617 | { USB_DEVICE_WACOM(0x21) }, |
| 2386 | { USB_DEVICE_WACOM(0x22) }, | 2618 | { USB_DEVICE_WACOM(0x22) }, |
| 2387 | { USB_DEVICE_WACOM(0x23) }, | 2619 | { USB_DEVICE_WACOM(0x23) }, |
| 2388 | { USB_DEVICE_WACOM(0x24) }, | 2620 | { USB_DEVICE_WACOM(0x24) }, |
| 2621 | { USB_DEVICE_WACOM(0x26) }, | ||
| 2622 | { USB_DEVICE_WACOM(0x27) }, | ||
| 2623 | { USB_DEVICE_WACOM(0x28) }, | ||
| 2624 | { USB_DEVICE_WACOM(0x29) }, | ||
| 2625 | { USB_DEVICE_WACOM(0x2A) }, | ||
| 2389 | { USB_DEVICE_WACOM(0x30) }, | 2626 | { USB_DEVICE_WACOM(0x30) }, |
| 2390 | { USB_DEVICE_WACOM(0x31) }, | 2627 | { USB_DEVICE_WACOM(0x31) }, |
| 2391 | { USB_DEVICE_WACOM(0x32) }, | 2628 | { USB_DEVICE_WACOM(0x32) }, |
| @@ -2395,20 +2632,34 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2395 | { USB_DEVICE_WACOM(0x37) }, | 2632 | { USB_DEVICE_WACOM(0x37) }, |
| 2396 | { USB_DEVICE_WACOM(0x38) }, | 2633 | { USB_DEVICE_WACOM(0x38) }, |
| 2397 | { USB_DEVICE_WACOM(0x39) }, | 2634 | { USB_DEVICE_WACOM(0x39) }, |
| 2398 | { USB_DEVICE_WACOM(0xC4) }, | 2635 | { USB_DEVICE_WACOM(0x3F) }, |
| 2399 | { USB_DEVICE_WACOM(0xC0) }, | ||
| 2400 | { USB_DEVICE_WACOM(0xC2) }, | ||
| 2401 | { USB_DEVICE_WACOM(0x03) }, | ||
| 2402 | { USB_DEVICE_WACOM(0x41) }, | 2636 | { USB_DEVICE_WACOM(0x41) }, |
| 2403 | { USB_DEVICE_WACOM(0x42) }, | 2637 | { USB_DEVICE_WACOM(0x42) }, |
| 2404 | { USB_DEVICE_WACOM(0x43) }, | 2638 | { USB_DEVICE_WACOM(0x43) }, |
| 2405 | { USB_DEVICE_WACOM(0x44) }, | 2639 | { USB_DEVICE_WACOM(0x44) }, |
| 2406 | { USB_DEVICE_WACOM(0x45) }, | 2640 | { USB_DEVICE_WACOM(0x45) }, |
| 2641 | { USB_DEVICE_WACOM(0x47) }, | ||
| 2407 | { USB_DEVICE_WACOM(0x57) }, | 2642 | { USB_DEVICE_WACOM(0x57) }, |
| 2408 | { USB_DEVICE_WACOM(0x59) }, | 2643 | { USB_DEVICE_WACOM(0x59) }, |
| 2409 | { USB_DEVICE_DETAILED(0x5D, USB_CLASS_HID, 0, 0) }, | ||
| 2410 | { USB_DEVICE_WACOM(0x5B) }, | 2644 | { USB_DEVICE_WACOM(0x5B) }, |
| 2411 | { USB_DEVICE_DETAILED(0x5E, USB_CLASS_HID, 0, 0) }, | 2645 | { USB_DEVICE_WACOM(0x5D) }, |
| 2646 | { USB_DEVICE_WACOM(0x5E) }, | ||
| 2647 | { USB_DEVICE_WACOM(0x60) }, | ||
| 2648 | { USB_DEVICE_WACOM(0x61) }, | ||
| 2649 | { USB_DEVICE_WACOM(0x62) }, | ||
| 2650 | { USB_DEVICE_WACOM(0x63) }, | ||
| 2651 | { USB_DEVICE_WACOM(0x64) }, | ||
| 2652 | { USB_DEVICE_WACOM(0x65) }, | ||
| 2653 | { USB_DEVICE_WACOM(0x69) }, | ||
| 2654 | { USB_DEVICE_WACOM(0x6A) }, | ||
| 2655 | { USB_DEVICE_WACOM(0x6B) }, | ||
| 2656 | { BT_DEVICE_WACOM(0x81) }, | ||
| 2657 | { USB_DEVICE_WACOM(0x84) }, | ||
| 2658 | { USB_DEVICE_WACOM(0x90) }, | ||
| 2659 | { USB_DEVICE_WACOM(0x93) }, | ||
| 2660 | { USB_DEVICE_WACOM(0x97) }, | ||
| 2661 | { USB_DEVICE_WACOM(0x9A) }, | ||
| 2662 | { USB_DEVICE_WACOM(0x9F) }, | ||
| 2412 | { USB_DEVICE_WACOM(0xB0) }, | 2663 | { USB_DEVICE_WACOM(0xB0) }, |
| 2413 | { USB_DEVICE_WACOM(0xB1) }, | 2664 | { USB_DEVICE_WACOM(0xB1) }, |
| 2414 | { USB_DEVICE_WACOM(0xB2) }, | 2665 | { USB_DEVICE_WACOM(0xB2) }, |
| @@ -2421,23 +2672,15 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2421 | { USB_DEVICE_WACOM(0xBA) }, | 2672 | { USB_DEVICE_WACOM(0xBA) }, |
| 2422 | { USB_DEVICE_WACOM(0xBB) }, | 2673 | { USB_DEVICE_WACOM(0xBB) }, |
| 2423 | { USB_DEVICE_WACOM(0xBC) }, | 2674 | { USB_DEVICE_WACOM(0xBC) }, |
| 2424 | { USB_DEVICE_WACOM(0x26) }, | 2675 | { BT_DEVICE_WACOM(0xBD) }, |
| 2425 | { USB_DEVICE_WACOM(0x27) }, | 2676 | { USB_DEVICE_WACOM(0xC0) }, |
| 2426 | { USB_DEVICE_WACOM(0x28) }, | 2677 | { USB_DEVICE_WACOM(0xC2) }, |
| 2427 | { USB_DEVICE_WACOM(0x29) }, | 2678 | { USB_DEVICE_WACOM(0xC4) }, |
| 2428 | { USB_DEVICE_WACOM(0x2A) }, | ||
| 2429 | { USB_DEVICE_WACOM(0x3F) }, | ||
| 2430 | { USB_DEVICE_WACOM(0xC5) }, | 2679 | { USB_DEVICE_WACOM(0xC5) }, |
| 2431 | { USB_DEVICE_WACOM(0xC6) }, | 2680 | { USB_DEVICE_WACOM(0xC6) }, |
| 2432 | { USB_DEVICE_WACOM(0xC7) }, | 2681 | { USB_DEVICE_WACOM(0xC7) }, |
| 2433 | /* | 2682 | { USB_DEVICE_WACOM(0xCC) }, |
| 2434 | * DTU-2231 has two interfaces on the same configuration, | 2683 | { USB_DEVICE_WACOM(0xCE) }, |
| 2435 | * only one is used. | ||
| 2436 | */ | ||
| 2437 | { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID, | ||
| 2438 | USB_INTERFACE_SUBCLASS_BOOT, | ||
| 2439 | USB_INTERFACE_PROTOCOL_MOUSE) }, | ||
| 2440 | { USB_DEVICE_WACOM(0x84) }, | ||
| 2441 | { USB_DEVICE_WACOM(0xD0) }, | 2684 | { USB_DEVICE_WACOM(0xD0) }, |
| 2442 | { USB_DEVICE_WACOM(0xD1) }, | 2685 | { USB_DEVICE_WACOM(0xD1) }, |
| 2443 | { USB_DEVICE_WACOM(0xD2) }, | 2686 | { USB_DEVICE_WACOM(0xD2) }, |
| @@ -2452,13 +2695,6 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2452 | { USB_DEVICE_WACOM(0xDD) }, | 2695 | { USB_DEVICE_WACOM(0xDD) }, |
| 2453 | { USB_DEVICE_WACOM(0xDE) }, | 2696 | { USB_DEVICE_WACOM(0xDE) }, |
| 2454 | { USB_DEVICE_WACOM(0xDF) }, | 2697 | { USB_DEVICE_WACOM(0xDF) }, |
| 2455 | { USB_DEVICE_WACOM(0xF0) }, | ||
| 2456 | { USB_DEVICE_WACOM(0xCC) }, | ||
| 2457 | { USB_DEVICE_WACOM(0x90) }, | ||
| 2458 | { USB_DEVICE_WACOM(0x93) }, | ||
| 2459 | { USB_DEVICE_WACOM(0x97) }, | ||
| 2460 | { USB_DEVICE_WACOM(0x9A) }, | ||
| 2461 | { USB_DEVICE_WACOM(0x9F) }, | ||
| 2462 | { USB_DEVICE_WACOM(0xE2) }, | 2698 | { USB_DEVICE_WACOM(0xE2) }, |
| 2463 | { USB_DEVICE_WACOM(0xE3) }, | 2699 | { USB_DEVICE_WACOM(0xE3) }, |
| 2464 | { USB_DEVICE_WACOM(0xE5) }, | 2700 | { USB_DEVICE_WACOM(0xE5) }, |
| @@ -2466,34 +2702,34 @@ const struct usb_device_id wacom_ids[] = { | |||
| 2466 | { USB_DEVICE_WACOM(0xEC) }, | 2702 | { USB_DEVICE_WACOM(0xEC) }, |
| 2467 | { USB_DEVICE_WACOM(0xED) }, | 2703 | { USB_DEVICE_WACOM(0xED) }, |
| 2468 | { USB_DEVICE_WACOM(0xEF) }, | 2704 | { USB_DEVICE_WACOM(0xEF) }, |
| 2705 | { USB_DEVICE_WACOM(0xF0) }, | ||
| 2706 | { USB_DEVICE_WACOM(0xF4) }, | ||
| 2707 | { USB_DEVICE_WACOM(0xF6) }, | ||
| 2708 | { USB_DEVICE_WACOM(0xF8) }, | ||
| 2709 | { USB_DEVICE_WACOM(0xFA) }, | ||
| 2710 | { USB_DEVICE_WACOM(0xFB) }, | ||
| 2469 | { USB_DEVICE_WACOM(0x100) }, | 2711 | { USB_DEVICE_WACOM(0x100) }, |
| 2470 | { USB_DEVICE_WACOM(0x101) }, | 2712 | { USB_DEVICE_WACOM(0x101) }, |
| 2471 | { USB_DEVICE_WACOM(0x10D) }, | 2713 | { USB_DEVICE_WACOM(0x10D) }, |
| 2472 | { USB_DEVICE_WACOM(0x10E) }, | 2714 | { USB_DEVICE_WACOM(0x10E) }, |
| 2473 | { USB_DEVICE_WACOM(0x10F) }, | 2715 | { USB_DEVICE_WACOM(0x10F) }, |
| 2474 | { USB_DEVICE_WACOM(0x116) }, | 2716 | { USB_DEVICE_WACOM(0x116) }, |
| 2717 | { USB_DEVICE_WACOM(0x12C) }, | ||
| 2475 | { USB_DEVICE_WACOM(0x300) }, | 2718 | { USB_DEVICE_WACOM(0x300) }, |
| 2476 | { USB_DEVICE_WACOM(0x301) }, | 2719 | { USB_DEVICE_WACOM(0x301) }, |
| 2477 | { USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) }, | 2720 | { USB_DEVICE_WACOM(0x302) }, |
| 2478 | { USB_DEVICE_DETAILED(0x303, USB_CLASS_HID, 0, 0) }, | 2721 | { USB_DEVICE_WACOM(0x303) }, |
| 2479 | { USB_DEVICE_DETAILED(0x30E, USB_CLASS_HID, 0, 0) }, | ||
| 2480 | { USB_DEVICE_WACOM(0x304) }, | 2722 | { USB_DEVICE_WACOM(0x304) }, |
| 2481 | { USB_DEVICE_DETAILED(0x314, USB_CLASS_HID, 0, 0) }, | 2723 | { USB_DEVICE_WACOM(0x307) }, |
| 2482 | { USB_DEVICE_DETAILED(0x315, USB_CLASS_HID, 0, 0) }, | 2724 | { USB_DEVICE_WACOM(0x309) }, |
| 2483 | { USB_DEVICE_DETAILED(0x317, USB_CLASS_HID, 0, 0) }, | 2725 | { USB_DEVICE_WACOM(0x30E) }, |
| 2726 | { USB_DEVICE_WACOM(0x314) }, | ||
| 2727 | { USB_DEVICE_WACOM(0x315) }, | ||
| 2728 | { USB_DEVICE_WACOM(0x317) }, | ||
| 2484 | { USB_DEVICE_WACOM(0x4001) }, | 2729 | { USB_DEVICE_WACOM(0x4001) }, |
| 2485 | { USB_DEVICE_WACOM(0x4004) }, | 2730 | { USB_DEVICE_WACOM(0x4004) }, |
| 2486 | { USB_DEVICE_WACOM(0x5000) }, | 2731 | { USB_DEVICE_WACOM(0x5000) }, |
| 2487 | { USB_DEVICE_WACOM(0x5002) }, | 2732 | { USB_DEVICE_WACOM(0x5002) }, |
| 2488 | { USB_DEVICE_WACOM(0x47) }, | ||
| 2489 | { USB_DEVICE_WACOM(0xF4) }, | ||
| 2490 | { USB_DEVICE_WACOM(0xF8) }, | ||
| 2491 | { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, | ||
| 2492 | { USB_DEVICE_WACOM(0xFA) }, | ||
| 2493 | { USB_DEVICE_WACOM(0xFB) }, | ||
| 2494 | { USB_DEVICE_WACOM(0x0307) }, | ||
| 2495 | { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) }, | ||
| 2496 | { USB_DEVICE_LENOVO(0x6004) }, | ||
| 2497 | { } | 2733 | { } |
| 2498 | }; | 2734 | }; |
| 2499 | MODULE_DEVICE_TABLE(usb, wacom_ids); | 2735 | MODULE_DEVICE_TABLE(hid, wacom_ids); |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/hid/wacom_wac.h index b2c9a9c1b551..339ab5d81a2d 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/hid/wacom_wac.h | |||
| @@ -46,6 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | /* wacom data packet report IDs */ | 47 | /* wacom data packet report IDs */ |
| 48 | #define WACOM_REPORT_PENABLED 2 | 48 | #define WACOM_REPORT_PENABLED 2 |
| 49 | #define WACOM_REPORT_PENABLED_BT 3 | ||
| 49 | #define WACOM_REPORT_INTUOSREAD 5 | 50 | #define WACOM_REPORT_INTUOSREAD 5 |
| 50 | #define WACOM_REPORT_INTUOSWRITE 6 | 51 | #define WACOM_REPORT_INTUOSWRITE 6 |
| 51 | #define WACOM_REPORT_INTUOSPAD 12 | 52 | #define WACOM_REPORT_INTUOSPAD 12 |
| @@ -68,10 +69,12 @@ | |||
| 68 | #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 | 69 | #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 |
| 69 | #define WACOM_QUIRK_NO_INPUT 0x0004 | 70 | #define WACOM_QUIRK_NO_INPUT 0x0004 |
| 70 | #define WACOM_QUIRK_MONITOR 0x0008 | 71 | #define WACOM_QUIRK_MONITOR 0x0008 |
| 72 | #define WACOM_QUIRK_BATTERY 0x0010 | ||
| 71 | 73 | ||
| 72 | enum { | 74 | enum { |
| 73 | PENPARTNER = 0, | 75 | PENPARTNER = 0, |
| 74 | GRAPHIRE, | 76 | GRAPHIRE, |
| 77 | GRAPHIRE_BT, | ||
| 75 | WACOM_G4, | 78 | WACOM_G4, |
| 76 | PTU, | 79 | PTU, |
| 77 | PL, | 80 | PL, |
| @@ -83,6 +86,7 @@ enum { | |||
| 83 | INTUOS3L, | 86 | INTUOS3L, |
| 84 | INTUOS4S, | 87 | INTUOS4S, |
| 85 | INTUOS4, | 88 | INTUOS4, |
| 89 | INTUOS4WL, | ||
| 86 | INTUOS4L, | 90 | INTUOS4L, |
| 87 | INTUOS5S, | 91 | INTUOS5S, |
| 88 | INTUOS5, | 92 | INTUOS5, |
| @@ -114,7 +118,6 @@ enum { | |||
| 114 | 118 | ||
| 115 | struct wacom_features { | 119 | struct wacom_features { |
| 116 | const char *name; | 120 | const char *name; |
| 117 | int pktlen; | ||
| 118 | int x_max; | 121 | int x_max; |
| 119 | int y_max; | 122 | int y_max; |
| 120 | int pressure_max; | 123 | int pressure_max; |
| @@ -127,8 +130,8 @@ struct wacom_features { | |||
| 127 | int device_type; | 130 | int device_type; |
| 128 | int x_phy; | 131 | int x_phy; |
| 129 | int y_phy; | 132 | int y_phy; |
| 130 | unsigned char unit; | 133 | unsigned unit; |
| 131 | unsigned char unitExpo; | 134 | int unitExpo; |
| 132 | int x_fuzz; | 135 | int x_fuzz; |
| 133 | int y_fuzz; | 136 | int y_fuzz; |
| 134 | int pressure_fuzz; | 137 | int pressure_fuzz; |
| @@ -137,6 +140,9 @@ struct wacom_features { | |||
| 137 | unsigned touch_max; | 140 | unsigned touch_max; |
| 138 | int oVid; | 141 | int oVid; |
| 139 | int oPid; | 142 | int oPid; |
| 143 | int pktlen; | ||
| 144 | bool check_for_hid_type; | ||
| 145 | int hid_type; | ||
| 140 | }; | 146 | }; |
| 141 | 147 | ||
| 142 | struct wacom_shared { | 148 | struct wacom_shared { |
| @@ -150,16 +156,24 @@ struct wacom_shared { | |||
| 150 | 156 | ||
| 151 | struct wacom_wac { | 157 | struct wacom_wac { |
| 152 | char name[WACOM_NAME_MAX]; | 158 | char name[WACOM_NAME_MAX]; |
| 153 | unsigned char *data; | 159 | char pad_name[WACOM_NAME_MAX]; |
| 160 | char bat_name[WACOM_NAME_MAX]; | ||
| 161 | char ac_name[WACOM_NAME_MAX]; | ||
| 162 | unsigned char data[WACOM_PKGLEN_MAX]; | ||
| 154 | int tool[2]; | 163 | int tool[2]; |
| 155 | int id[2]; | 164 | int id[2]; |
| 156 | __u32 serial[2]; | 165 | __u32 serial[2]; |
| 157 | struct wacom_features features; | 166 | struct wacom_features features; |
| 158 | struct wacom_shared *shared; | 167 | struct wacom_shared *shared; |
| 159 | struct input_dev *input; | 168 | struct input_dev *input; |
| 169 | struct input_dev *pad_input; | ||
| 160 | int pid; | 170 | int pid; |
| 161 | int battery_capacity; | 171 | int battery_capacity; |
| 162 | int num_contacts_left; | 172 | int num_contacts_left; |
| 173 | int bat_charging; | ||
| 174 | int ps_connected; | ||
| 175 | u8 bt_features; | ||
| 176 | u8 bt_high_speed; | ||
| 163 | }; | 177 | }; |
| 164 | 178 | ||
| 165 | #endif | 179 | #endif |
diff --git a/drivers/input/tablet/Kconfig b/drivers/input/tablet/Kconfig index a5121b09c63f..623bb9e0d5a4 100644 --- a/drivers/input/tablet/Kconfig +++ b/drivers/input/tablet/Kconfig | |||
| @@ -73,22 +73,6 @@ config TABLET_USB_KBTAB | |||
| 73 | To compile this driver as a module, choose M here: the | 73 | To compile this driver as a module, choose M here: the |
| 74 | module will be called kbtab. | 74 | module will be called kbtab. |
| 75 | 75 | ||
| 76 | config TABLET_USB_WACOM | ||
| 77 | tristate "Wacom Intuos/Graphire tablet support (USB)" | ||
| 78 | depends on USB_ARCH_HAS_HCD | ||
| 79 | select POWER_SUPPLY | ||
| 80 | select USB | ||
| 81 | select NEW_LEDS | ||
| 82 | select LEDS_CLASS | ||
| 83 | help | ||
| 84 | Say Y here if you want to use the USB version of the Wacom Intuos | ||
| 85 | or Graphire tablet. Make sure to say Y to "Mouse support" | ||
| 86 | (CONFIG_INPUT_MOUSEDEV) and/or "Event interface support" | ||
| 87 | (CONFIG_INPUT_EVDEV) as well. | ||
| 88 | |||
| 89 | To compile this driver as a module, choose M here: the | ||
| 90 | module will be called wacom. | ||
| 91 | |||
| 92 | config TABLET_SERIAL_WACOM4 | 76 | config TABLET_SERIAL_WACOM4 |
| 93 | tristate "Wacom protocol 4 serial tablet support" | 77 | tristate "Wacom protocol 4 serial tablet support" |
| 94 | select SERIO | 78 | select SERIO |
diff --git a/drivers/input/tablet/Makefile b/drivers/input/tablet/Makefile index 4d9339fb3b63..2e130101cf3c 100644 --- a/drivers/input/tablet/Makefile +++ b/drivers/input/tablet/Makefile | |||
| @@ -2,13 +2,10 @@ | |||
| 2 | # Makefile for the tablet drivers | 2 | # Makefile for the tablet drivers |
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | # Multipart objects. | ||
| 6 | wacom-objs := wacom_wac.o wacom_sys.o | ||
| 7 | 5 | ||
| 8 | obj-$(CONFIG_TABLET_USB_ACECAD) += acecad.o | 6 | obj-$(CONFIG_TABLET_USB_ACECAD) += acecad.o |
| 9 | obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o | 7 | obj-$(CONFIG_TABLET_USB_AIPTEK) += aiptek.o |
| 10 | obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o | 8 | obj-$(CONFIG_TABLET_USB_GTCO) += gtco.o |
| 11 | obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o | 9 | obj-$(CONFIG_TABLET_USB_HANWANG) += hanwang.o |
| 12 | obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o | 10 | obj-$(CONFIG_TABLET_USB_KBTAB) += kbtab.o |
| 13 | obj-$(CONFIG_TABLET_USB_WACOM) += wacom.o | ||
| 14 | obj-$(CONFIG_TABLET_SERIAL_WACOM4) += wacom_serial4.o | 11 | obj-$(CONFIG_TABLET_SERIAL_WACOM4) += wacom_serial4.o |
diff --git a/include/linux/hid.h b/include/linux/hid.h index 77632cf159c0..07fa80671db0 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -311,6 +311,11 @@ struct hid_item { | |||
| 311 | #define HID_GROUP_RMI 0x0100 | 311 | #define HID_GROUP_RMI 0x0100 |
| 312 | 312 | ||
| 313 | /* | 313 | /* |
| 314 | * Vendor specific HID device groups | ||
| 315 | */ | ||
| 316 | #define HID_GROUP_WACOM 0x0101 | ||
| 317 | |||
| 318 | /* | ||
| 314 | * This is the global environment of the parser. This information is | 319 | * This is the global environment of the parser. This information is |
| 315 | * persistent for main-items. The global environment can be saved and | 320 | * persistent for main-items. The global environment can be saved and |
| 316 | * restored with PUSH/POP statements. | 321 | * restored with PUSH/POP statements. |
