Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 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) 2007 Paul Walmsley |
| 9 | * Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com> |
| 10 | * Copyright (c) 2006 Andrew Zabolotny <zap@homelink.ru> |
| 11 | * Copyright (c) 2009 Bastien Nocera <hadess@hadess.net> |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 12 | * Copyright (c) 2011 Przemysław Firszt <przemo@firszt.eu> |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | /* |
| 16 | * This program is free software; you can redistribute it and/or modify it |
| 17 | * under the terms of the GNU General Public License as published by the Free |
| 18 | * Software Foundation; either version 2 of the License, or (at your option) |
| 19 | * any later version. |
| 20 | */ |
| 21 | |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
| 23 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 24 | #include <linux/device.h> |
| 25 | #include <linux/hid.h> |
| 26 | #include <linux/module.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 28 | #include <linux/power_supply.h> |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 29 | |
| 30 | #include "hid-ids.h" |
| 31 | |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 32 | #define PAD_DEVICE_ID 0x0F |
| 33 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 34 | struct wacom_data { |
| 35 | __u16 tool; |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 36 | __u16 butstate; |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 37 | __u8 whlstate; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 38 | __u8 features; |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 39 | __u32 id; |
| 40 | __u32 serial; |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 41 | unsigned char high_speed; |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 42 | __u8 battery_capacity; |
| 43 | __u8 power_raw; |
| 44 | __u8 ps_connected; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 45 | struct power_supply battery; |
| 46 | struct power_supply ac; |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 47 | }; |
| 48 | |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 49 | /*percent of battery capacity for Graphire |
| 50 | 8th value means AC online and show 100% capacity */ |
| 51 | static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 }; |
Przemo Firszt | 4202f1d | 2012-03-22 18:54:08 +0000 | [diff] [blame] | 52 | /*percent of battery capacity for Intuos4 WL, AC has a separate bit*/ |
| 53 | static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 }; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 54 | |
| 55 | static enum power_supply_property wacom_battery_props[] = { |
| 56 | POWER_SUPPLY_PROP_PRESENT, |
Jeremy Fitzhardinge | 73db881 | 2011-12-07 11:29:46 -0800 | [diff] [blame] | 57 | POWER_SUPPLY_PROP_CAPACITY, |
| 58 | POWER_SUPPLY_PROP_SCOPE, |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 59 | }; |
| 60 | |
| 61 | static enum power_supply_property wacom_ac_props[] = { |
| 62 | POWER_SUPPLY_PROP_PRESENT, |
Jeremy Fitzhardinge | 73db881 | 2011-12-07 11:29:46 -0800 | [diff] [blame] | 63 | POWER_SUPPLY_PROP_ONLINE, |
| 64 | POWER_SUPPLY_PROP_SCOPE, |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | static int wacom_battery_get_property(struct power_supply *psy, |
| 68 | enum power_supply_property psp, |
| 69 | union power_supply_propval *val) |
| 70 | { |
| 71 | struct wacom_data *wdata = container_of(psy, |
| 72 | struct wacom_data, battery); |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 73 | int ret = 0; |
| 74 | |
| 75 | switch (psp) { |
| 76 | case POWER_SUPPLY_PROP_PRESENT: |
| 77 | val->intval = 1; |
| 78 | break; |
Jeremy Fitzhardinge | 73db881 | 2011-12-07 11:29:46 -0800 | [diff] [blame] | 79 | case POWER_SUPPLY_PROP_SCOPE: |
| 80 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; |
| 81 | break; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 82 | case POWER_SUPPLY_PROP_CAPACITY: |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 83 | val->intval = wdata->battery_capacity; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 84 | break; |
| 85 | default: |
| 86 | ret = -EINVAL; |
| 87 | break; |
| 88 | } |
| 89 | return ret; |
| 90 | } |
| 91 | |
| 92 | static int wacom_ac_get_property(struct power_supply *psy, |
| 93 | enum power_supply_property psp, |
| 94 | union power_supply_propval *val) |
| 95 | { |
| 96 | struct wacom_data *wdata = container_of(psy, struct wacom_data, ac); |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 97 | int ret = 0; |
| 98 | |
| 99 | switch (psp) { |
| 100 | case POWER_SUPPLY_PROP_PRESENT: |
| 101 | /* fall through */ |
| 102 | case POWER_SUPPLY_PROP_ONLINE: |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 103 | val->intval = wdata->ps_connected; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 104 | break; |
Jeremy Fitzhardinge | 73db881 | 2011-12-07 11:29:46 -0800 | [diff] [blame] | 105 | case POWER_SUPPLY_PROP_SCOPE: |
| 106 | val->intval = POWER_SUPPLY_SCOPE_DEVICE; |
| 107 | break; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 108 | default: |
| 109 | ret = -EINVAL; |
| 110 | break; |
| 111 | } |
| 112 | return ret; |
| 113 | } |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 114 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 115 | static void wacom_set_features(struct hid_device *hdev) |
| 116 | { |
| 117 | int ret; |
| 118 | __u8 rep_data[2]; |
| 119 | |
| 120 | /*set high speed, tablet mode*/ |
| 121 | rep_data[0] = 0x03; |
| 122 | rep_data[1] = 0x20; |
| 123 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, |
| 124 | HID_FEATURE_REPORT); |
| 125 | return; |
| 126 | } |
| 127 | |
Przemo Firszt | 06c7c31 | 2010-03-22 09:55:04 +0100 | [diff] [blame] | 128 | static void wacom_poke(struct hid_device *hdev, u8 speed) |
| 129 | { |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 130 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
Przemo Firszt | 06c7c31 | 2010-03-22 09:55:04 +0100 | [diff] [blame] | 131 | int limit, ret; |
| 132 | char rep_data[2]; |
| 133 | |
| 134 | rep_data[0] = 0x03 ; rep_data[1] = 0x00; |
| 135 | limit = 3; |
| 136 | do { |
| 137 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, |
| 138 | HID_FEATURE_REPORT); |
| 139 | } while (ret < 0 && limit-- > 0); |
| 140 | |
| 141 | if (ret >= 0) { |
| 142 | if (speed == 0) |
| 143 | rep_data[0] = 0x05; |
| 144 | else |
| 145 | rep_data[0] = 0x06; |
| 146 | |
| 147 | rep_data[1] = 0x00; |
| 148 | limit = 3; |
| 149 | do { |
| 150 | ret = hdev->hid_output_raw_report(hdev, rep_data, 2, |
| 151 | HID_FEATURE_REPORT); |
| 152 | } while (ret < 0 && limit-- > 0); |
| 153 | |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 154 | if (ret >= 0) { |
| 155 | wdata->high_speed = speed; |
Przemo Firszt | 06c7c31 | 2010-03-22 09:55:04 +0100 | [diff] [blame] | 156 | return; |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 157 | } |
Przemo Firszt | 06c7c31 | 2010-03-22 09:55:04 +0100 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | /* |
| 161 | * Note that if the raw queries fail, it's not a hard failure and it |
| 162 | * is safe to continue |
| 163 | */ |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 164 | hid_warn(hdev, "failed to poke device, command %d, err %d\n", |
| 165 | rep_data[0], ret); |
Przemo Firszt | 06c7c31 | 2010-03-22 09:55:04 +0100 | [diff] [blame] | 166 | return; |
| 167 | } |
| 168 | |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 169 | static ssize_t wacom_show_speed(struct device *dev, |
| 170 | struct device_attribute |
| 171 | *attr, char *buf) |
| 172 | { |
| 173 | struct wacom_data *wdata = dev_get_drvdata(dev); |
| 174 | |
| 175 | return snprintf(buf, PAGE_SIZE, "%i\n", wdata->high_speed); |
| 176 | } |
| 177 | |
| 178 | static ssize_t wacom_store_speed(struct device *dev, |
| 179 | struct device_attribute *attr, |
| 180 | const char *buf, size_t count) |
| 181 | { |
| 182 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
| 183 | int new_speed; |
| 184 | |
| 185 | if (sscanf(buf, "%1d", &new_speed ) != 1) |
| 186 | return -EINVAL; |
| 187 | |
| 188 | if (new_speed == 0 || new_speed == 1) { |
| 189 | wacom_poke(hdev, new_speed); |
| 190 | return strnlen(buf, PAGE_SIZE); |
| 191 | } else |
| 192 | return -EINVAL; |
| 193 | } |
| 194 | |
Jiri Kosina | edd2126 | 2010-11-18 16:28:43 +0100 | [diff] [blame] | 195 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 196 | wacom_show_speed, wacom_store_speed); |
| 197 | |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 198 | static int wacom_gr_parse_report(struct hid_device *hdev, |
| 199 | struct wacom_data *wdata, |
| 200 | struct input_dev *input, unsigned char *data) |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 201 | { |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 202 | int tool, x, y, rw; |
| 203 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 204 | tool = 0; |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 205 | /* Get X & Y positions */ |
| 206 | x = le16_to_cpu(*(__le16 *) &data[2]); |
| 207 | y = le16_to_cpu(*(__le16 *) &data[4]); |
| 208 | |
| 209 | /* Get current tool identifier */ |
| 210 | if (data[1] & 0x90) { /* If pen is in the in/active area */ |
| 211 | switch ((data[1] >> 5) & 3) { |
| 212 | case 0: /* Pen */ |
| 213 | tool = BTN_TOOL_PEN; |
| 214 | break; |
| 215 | |
| 216 | case 1: /* Rubber */ |
| 217 | tool = BTN_TOOL_RUBBER; |
| 218 | break; |
| 219 | |
| 220 | case 2: /* Mouse with wheel */ |
| 221 | case 3: /* Mouse without wheel */ |
| 222 | tool = BTN_TOOL_MOUSE; |
| 223 | break; |
| 224 | } |
| 225 | |
| 226 | /* Reset tool if out of active tablet area */ |
| 227 | if (!(data[1] & 0x10)) |
| 228 | tool = 0; |
| 229 | } |
| 230 | |
| 231 | /* If tool changed, notify input subsystem */ |
| 232 | if (wdata->tool != tool) { |
| 233 | if (wdata->tool) { |
| 234 | /* Completely reset old tool state */ |
| 235 | if (wdata->tool == BTN_TOOL_MOUSE) { |
| 236 | input_report_key(input, BTN_LEFT, 0); |
| 237 | input_report_key(input, BTN_RIGHT, 0); |
| 238 | input_report_key(input, BTN_MIDDLE, 0); |
| 239 | input_report_abs(input, ABS_DISTANCE, |
Daniel Mack | 987a6c0 | 2010-08-02 20:15:17 -0700 | [diff] [blame] | 240 | input_abs_get_max(input, ABS_DISTANCE)); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 241 | } else { |
| 242 | input_report_key(input, BTN_TOUCH, 0); |
| 243 | input_report_key(input, BTN_STYLUS, 0); |
| 244 | input_report_key(input, BTN_STYLUS2, 0); |
| 245 | input_report_abs(input, ABS_PRESSURE, 0); |
| 246 | } |
| 247 | input_report_key(input, wdata->tool, 0); |
| 248 | input_sync(input); |
| 249 | } |
| 250 | wdata->tool = tool; |
| 251 | if (tool) |
| 252 | input_report_key(input, tool, 1); |
| 253 | } |
| 254 | |
| 255 | if (tool) { |
| 256 | input_report_abs(input, ABS_X, x); |
| 257 | input_report_abs(input, ABS_Y, y); |
| 258 | |
| 259 | switch ((data[1] >> 5) & 3) { |
| 260 | case 2: /* Mouse with wheel */ |
| 261 | input_report_key(input, BTN_MIDDLE, data[1] & 0x04); |
| 262 | rw = (data[6] & 0x01) ? -1 : |
| 263 | (data[6] & 0x02) ? 1 : 0; |
| 264 | input_report_rel(input, REL_WHEEL, rw); |
| 265 | /* fall through */ |
| 266 | |
| 267 | case 3: /* Mouse without wheel */ |
| 268 | input_report_key(input, BTN_LEFT, data[1] & 0x01); |
| 269 | input_report_key(input, BTN_RIGHT, data[1] & 0x02); |
| 270 | /* Compute distance between mouse and tablet */ |
| 271 | rw = 44 - (data[6] >> 2); |
| 272 | if (rw < 0) |
| 273 | rw = 0; |
| 274 | else if (rw > 31) |
| 275 | rw = 31; |
| 276 | input_report_abs(input, ABS_DISTANCE, rw); |
| 277 | break; |
| 278 | |
| 279 | default: |
| 280 | input_report_abs(input, ABS_PRESSURE, |
| 281 | data[6] | (((__u16) (data[1] & 0x08)) << 5)); |
| 282 | input_report_key(input, BTN_TOUCH, data[1] & 0x01); |
| 283 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 284 | input_report_key(input, BTN_STYLUS2, (tool == BTN_TOOL_PEN) && data[1] & 0x04); |
| 285 | break; |
| 286 | } |
| 287 | |
| 288 | input_sync(input); |
| 289 | } |
| 290 | |
| 291 | /* Report the state of the two buttons at the top of the tablet |
| 292 | * as two extra fingerpad keys (buttons 4 & 5). */ |
| 293 | rw = data[7] & 0x03; |
| 294 | if (rw != wdata->butstate) { |
| 295 | wdata->butstate = rw; |
| 296 | input_report_key(input, BTN_0, rw & 0x02); |
| 297 | input_report_key(input, BTN_1, rw & 0x01); |
Przemo Firszt | 0e253fd | 2010-01-09 15:20:03 +0100 | [diff] [blame] | 298 | input_report_key(input, BTN_TOOL_FINGER, 0xf0); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 299 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); |
| 300 | input_sync(input); |
| 301 | } |
| 302 | |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 303 | /* Store current battery capacity and power supply state*/ |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 304 | rw = (data[7] >> 2 & 0x07); |
Przemo Firszt | e31e383 | 2012-03-22 18:54:07 +0000 | [diff] [blame] | 305 | if (rw != wdata->power_raw) { |
| 306 | wdata->power_raw = rw; |
| 307 | wdata->battery_capacity = batcap_gr[rw]; |
| 308 | if (rw == 7) |
| 309 | wdata->ps_connected = 1; |
| 310 | else |
| 311 | wdata->ps_connected = 0; |
| 312 | } |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 313 | return 1; |
| 314 | } |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 315 | |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 316 | static void wacom_i4_parse_button_report(struct wacom_data *wdata, |
| 317 | struct input_dev *input, unsigned char *data) |
| 318 | { |
| 319 | __u16 new_butstate; |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 320 | __u8 new_whlstate; |
| 321 | __u8 sync = 0; |
| 322 | |
| 323 | new_whlstate = data[1]; |
| 324 | if (new_whlstate != wdata->whlstate) { |
| 325 | wdata->whlstate = new_whlstate; |
| 326 | if (new_whlstate & 0x80) { |
| 327 | input_report_key(input, BTN_TOUCH, 1); |
| 328 | input_report_abs(input, ABS_WHEEL, (new_whlstate & 0x7f)); |
| 329 | input_report_key(input, BTN_TOOL_FINGER, 1); |
| 330 | } else { |
| 331 | input_report_key(input, BTN_TOUCH, 0); |
| 332 | input_report_abs(input, ABS_WHEEL, 0); |
| 333 | input_report_key(input, BTN_TOOL_FINGER, 0); |
| 334 | } |
| 335 | sync = 1; |
| 336 | } |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 337 | |
| 338 | new_butstate = (data[3] << 1) | (data[2] & 0x01); |
| 339 | if (new_butstate != wdata->butstate) { |
| 340 | wdata->butstate = new_butstate; |
| 341 | input_report_key(input, BTN_0, new_butstate & 0x001); |
| 342 | input_report_key(input, BTN_1, new_butstate & 0x002); |
| 343 | input_report_key(input, BTN_2, new_butstate & 0x004); |
| 344 | input_report_key(input, BTN_3, new_butstate & 0x008); |
| 345 | input_report_key(input, BTN_4, new_butstate & 0x010); |
| 346 | input_report_key(input, BTN_5, new_butstate & 0x020); |
| 347 | input_report_key(input, BTN_6, new_butstate & 0x040); |
| 348 | input_report_key(input, BTN_7, new_butstate & 0x080); |
| 349 | input_report_key(input, BTN_8, new_butstate & 0x100); |
| 350 | input_report_key(input, BTN_TOOL_FINGER, 1); |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 351 | sync = 1; |
| 352 | } |
| 353 | |
| 354 | if (sync) { |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 355 | input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); |
| 356 | input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff); |
| 357 | input_sync(input); |
| 358 | } |
| 359 | } |
| 360 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 361 | static void wacom_i4_parse_pen_report(struct wacom_data *wdata, |
| 362 | struct input_dev *input, unsigned char *data) |
| 363 | { |
| 364 | __u16 x, y, pressure; |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 365 | __u8 distance; |
Przemo Firszt | c653dab | 2012-05-04 18:00:10 +0100 | [diff] [blame^] | 366 | __u8 tilt_x, tilt_y; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 367 | |
| 368 | switch (data[1]) { |
| 369 | case 0x80: /* Out of proximity report */ |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 370 | input_report_key(input, BTN_TOUCH, 0); |
| 371 | input_report_abs(input, ABS_PRESSURE, 0); |
Przemo Firszt | 693f45b | 2012-03-09 13:20:51 +0000 | [diff] [blame] | 372 | input_report_key(input, BTN_STYLUS, 0); |
| 373 | input_report_key(input, BTN_STYLUS2, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 374 | input_report_key(input, wdata->tool, 0); |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 375 | input_report_abs(input, ABS_MISC, 0); |
| 376 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); |
Przemo Firszt | 32db737 | 2012-02-19 20:20:29 +0000 | [diff] [blame] | 377 | wdata->tool = 0; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 378 | input_sync(input); |
| 379 | break; |
| 380 | case 0xC2: /* Tool report */ |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 381 | wdata->id = ((data[2] << 4) | (data[3] >> 4) | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 382 | ((data[7] & 0x0f) << 20) | |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 383 | ((data[8] & 0xf0) << 12)); |
| 384 | wdata->serial = ((data[3] & 0x0f) << 28) + |
| 385 | (data[4] << 20) + (data[5] << 12) + |
| 386 | (data[6] << 4) + (data[7] >> 4); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 387 | |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 388 | switch (wdata->id) { |
| 389 | case 0x100802: |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 390 | wdata->tool = BTN_TOOL_PEN; |
| 391 | break; |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 392 | case 0x10080A: |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 393 | wdata->tool = BTN_TOOL_RUBBER; |
| 394 | break; |
| 395 | } |
| 396 | break; |
| 397 | default: /* Position/pressure report */ |
| 398 | x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1); |
| 399 | y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01); |
| 400 | pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5) |
| 401 | | (data[1] & 0x01); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 402 | distance = (data[9] >> 2) & 0x3f; |
Przemo Firszt | c653dab | 2012-05-04 18:00:10 +0100 | [diff] [blame^] | 403 | tilt_x = ((data[7] << 1) & 0x7e) | (data[8] >> 7); |
| 404 | tilt_y = data[8] & 0x7f; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 405 | |
| 406 | input_report_key(input, BTN_TOUCH, pressure > 1); |
| 407 | |
| 408 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 409 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
| 410 | input_report_key(input, wdata->tool, 1); |
| 411 | input_report_abs(input, ABS_X, x); |
| 412 | input_report_abs(input, ABS_Y, y); |
| 413 | input_report_abs(input, ABS_PRESSURE, pressure); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 414 | input_report_abs(input, ABS_DISTANCE, distance); |
Przemo Firszt | c653dab | 2012-05-04 18:00:10 +0100 | [diff] [blame^] | 415 | input_report_abs(input, ABS_TILT_X, tilt_x); |
| 416 | input_report_abs(input, ABS_TILT_Y, tilt_y); |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 417 | input_report_abs(input, ABS_MISC, wdata->id); |
| 418 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); |
| 419 | input_report_key(input, wdata->tool, 1); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 420 | input_sync(input); |
| 421 | break; |
| 422 | } |
| 423 | |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | static void wacom_i4_parse_report(struct hid_device *hdev, |
| 428 | struct wacom_data *wdata, |
| 429 | struct input_dev *input, unsigned char *data) |
| 430 | { |
| 431 | switch (data[0]) { |
| 432 | case 0x00: /* Empty report */ |
| 433 | break; |
| 434 | case 0x02: /* Pen report */ |
| 435 | wacom_i4_parse_pen_report(wdata, input, data); |
| 436 | break; |
| 437 | case 0x03: /* Features Report */ |
| 438 | wdata->features = data[2]; |
| 439 | break; |
| 440 | case 0x0C: /* Button report */ |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 441 | wacom_i4_parse_button_report(wdata, input, data); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 442 | break; |
| 443 | default: |
| 444 | hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]); |
| 445 | break; |
| 446 | } |
| 447 | } |
| 448 | |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 449 | static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, |
| 450 | u8 *raw_data, int size) |
| 451 | { |
| 452 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
| 453 | struct hid_input *hidinput; |
| 454 | struct input_dev *input; |
| 455 | unsigned char *data = (unsigned char *) raw_data; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 456 | int i; |
Przemo Firszt | 4202f1d | 2012-03-22 18:54:08 +0000 | [diff] [blame] | 457 | __u8 power_raw; |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 458 | |
| 459 | if (!(hdev->claimed & HID_CLAIMED_INPUT)) |
| 460 | return 0; |
| 461 | |
| 462 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
| 463 | input = hidinput->input; |
| 464 | |
| 465 | /* Check if this is a tablet report */ |
| 466 | if (data[0] != 0x03) |
| 467 | return 0; |
| 468 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 469 | switch (hdev->product) { |
| 470 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 471 | return wacom_gr_parse_report(hdev, wdata, input, data); |
| 472 | break; |
| 473 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
| 474 | i = 1; |
| 475 | |
| 476 | switch (data[0]) { |
| 477 | case 0x04: |
| 478 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
| 479 | i += 10; |
| 480 | /* fall through */ |
| 481 | case 0x03: |
| 482 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
| 483 | i += 10; |
| 484 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
Przemo Firszt | 4202f1d | 2012-03-22 18:54:08 +0000 | [diff] [blame] | 485 | power_raw = data[i+10]; |
| 486 | if (power_raw != wdata->power_raw) { |
| 487 | wdata->power_raw = power_raw; |
| 488 | wdata->battery_capacity = batcap_i4[power_raw & 0x07]; |
| 489 | wdata->ps_connected = power_raw & 0x08; |
| 490 | } |
| 491 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 492 | break; |
| 493 | default: |
| 494 | hid_err(hdev, "Unknown report: %d,%d size:%d\n", |
| 495 | data[0], data[1], size); |
| 496 | return 0; |
| 497 | } |
| 498 | } |
| 499 | return 1; |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 500 | } |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 501 | |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 502 | static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 503 | struct hid_field *field, struct hid_usage *usage, unsigned long **bit, |
| 504 | int *max) |
| 505 | { |
| 506 | struct input_dev *input = hi->input; |
| 507 | |
Jiri Kosina | f6f1242 | 2011-10-25 09:58:12 +0200 | [diff] [blame] | 508 | __set_bit(INPUT_PROP_POINTER, input->propbit); |
| 509 | |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 510 | /* Basics */ |
| 511 | input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL); |
| 512 | |
| 513 | __set_bit(REL_WHEEL, input->relbit); |
| 514 | |
| 515 | __set_bit(BTN_TOOL_PEN, input->keybit); |
| 516 | __set_bit(BTN_TOUCH, input->keybit); |
| 517 | __set_bit(BTN_STYLUS, input->keybit); |
| 518 | __set_bit(BTN_STYLUS2, input->keybit); |
| 519 | __set_bit(BTN_LEFT, input->keybit); |
| 520 | __set_bit(BTN_RIGHT, input->keybit); |
| 521 | __set_bit(BTN_MIDDLE, input->keybit); |
| 522 | |
| 523 | /* Pad */ |
Przemo Firszt | 9a911da | 2012-03-14 19:55:03 +0000 | [diff] [blame] | 524 | input_set_capability(input, EV_MSC, MSC_SERIAL); |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 525 | |
| 526 | __set_bit(BTN_0, input->keybit); |
| 527 | __set_bit(BTN_1, input->keybit); |
| 528 | __set_bit(BTN_TOOL_FINGER, input->keybit); |
| 529 | |
| 530 | /* Distance, rubber and mouse */ |
| 531 | __set_bit(BTN_TOOL_RUBBER, input->keybit); |
| 532 | __set_bit(BTN_TOOL_MOUSE, input->keybit); |
| 533 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 534 | switch (hdev->product) { |
| 535 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 536 | input_set_abs_params(input, ABS_X, 0, 16704, 4, 0); |
| 537 | input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0); |
| 538 | input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0); |
| 539 | input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0); |
| 540 | break; |
| 541 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 542 | __set_bit(ABS_WHEEL, input->absbit); |
Przemo Firszt | 2c653e6 | 2012-02-24 13:47:48 +0000 | [diff] [blame] | 543 | __set_bit(ABS_MISC, input->absbit); |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 544 | __set_bit(BTN_2, input->keybit); |
| 545 | __set_bit(BTN_3, input->keybit); |
| 546 | __set_bit(BTN_4, input->keybit); |
| 547 | __set_bit(BTN_5, input->keybit); |
| 548 | __set_bit(BTN_6, input->keybit); |
| 549 | __set_bit(BTN_7, input->keybit); |
| 550 | __set_bit(BTN_8, input->keybit); |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 551 | input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 552 | input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); |
| 553 | input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); |
| 554 | input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 555 | input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0); |
Przemo Firszt | c653dab | 2012-05-04 18:00:10 +0100 | [diff] [blame^] | 556 | input_set_abs_params(input, ABS_TILT_X, 0, 127, 0, 0); |
| 557 | input_set_abs_params(input, ABS_TILT_Y, 0, 127, 0, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 558 | break; |
| 559 | } |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 560 | |
| 561 | return 0; |
| 562 | } |
| 563 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 564 | static int wacom_probe(struct hid_device *hdev, |
| 565 | const struct hid_device_id *id) |
| 566 | { |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 567 | struct wacom_data *wdata; |
| 568 | int ret; |
| 569 | |
| 570 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); |
| 571 | if (wdata == NULL) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 572 | hid_err(hdev, "can't alloc wacom descriptor\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 573 | return -ENOMEM; |
| 574 | } |
| 575 | |
| 576 | hid_set_drvdata(hdev, wdata); |
| 577 | |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 578 | /* Parse the HID report now */ |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 579 | ret = hid_parse(hdev); |
| 580 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 581 | hid_err(hdev, "parse failed\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 582 | goto err_free; |
| 583 | } |
| 584 | |
| 585 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
| 586 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 587 | hid_err(hdev, "hw start failed\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 588 | goto err_free; |
| 589 | } |
| 590 | |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 591 | ret = device_create_file(&hdev->dev, &dev_attr_speed); |
| 592 | if (ret) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 593 | hid_warn(hdev, |
| 594 | "can't create sysfs speed attribute err: %d\n", ret); |
Jiri Kosina | 342f31e | 2010-02-03 15:52:31 +0100 | [diff] [blame] | 595 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 596 | switch (hdev->product) { |
| 597 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 598 | /* Set Wacom mode 2 with high reporting speed */ |
| 599 | wacom_poke(hdev, 1); |
| 600 | break; |
| 601 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
Przemo Firszt | a72c5dd | 2012-02-17 17:47:10 +0000 | [diff] [blame] | 602 | sprintf(hdev->name, "%s", "Wacom Intuos4 WL"); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 603 | wdata->features = 0; |
| 604 | wacom_set_features(hdev); |
| 605 | break; |
| 606 | } |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 607 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 608 | wdata->battery.properties = wacom_battery_props; |
| 609 | wdata->battery.num_properties = ARRAY_SIZE(wacom_battery_props); |
| 610 | wdata->battery.get_property = wacom_battery_get_property; |
| 611 | wdata->battery.name = "wacom_battery"; |
| 612 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
| 613 | wdata->battery.use_for_apm = 0; |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 614 | |
Jeremy Fitzhardinge | 35b4c01 | 2011-12-09 09:35:00 -0800 | [diff] [blame] | 615 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 616 | ret = power_supply_register(&hdev->dev, &wdata->battery); |
| 617 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 618 | hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", |
| 619 | ret); |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 620 | goto err_battery; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 621 | } |
| 622 | |
Przemo Firszt | d7cb3db | 2012-02-05 22:35:24 +0000 | [diff] [blame] | 623 | power_supply_powers(&wdata->battery, &hdev->dev); |
| 624 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 625 | wdata->ac.properties = wacom_ac_props; |
| 626 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); |
| 627 | wdata->ac.get_property = wacom_ac_get_property; |
| 628 | wdata->ac.name = "wacom_ac"; |
| 629 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; |
| 630 | wdata->ac.use_for_apm = 0; |
| 631 | |
| 632 | ret = power_supply_register(&hdev->dev, &wdata->ac); |
| 633 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 634 | hid_warn(hdev, |
| 635 | "can't create ac battery attribute, err: %d\n", ret); |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 636 | goto err_ac; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 637 | } |
Przemo Firszt | d7cb3db | 2012-02-05 22:35:24 +0000 | [diff] [blame] | 638 | |
| 639 | power_supply_powers(&wdata->ac, &hdev->dev); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 640 | return 0; |
Daniel Mack | 987a6c0 | 2010-08-02 20:15:17 -0700 | [diff] [blame] | 641 | |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 642 | err_ac: |
| 643 | power_supply_unregister(&wdata->battery); |
| 644 | err_battery: |
| 645 | device_remove_file(&hdev->dev, &dev_attr_speed); |
| 646 | hid_hw_stop(hdev); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 647 | err_free: |
| 648 | kfree(wdata); |
| 649 | return ret; |
| 650 | } |
| 651 | |
| 652 | static void wacom_remove(struct hid_device *hdev) |
| 653 | { |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 654 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
David Herrmann | 9086617 | 2011-09-05 18:45:29 +0200 | [diff] [blame] | 655 | device_remove_file(&hdev->dev, &dev_attr_speed); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 656 | hid_hw_stop(hdev); |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 657 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 658 | power_supply_unregister(&wdata->battery); |
| 659 | power_supply_unregister(&wdata->ac); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 660 | kfree(hid_get_drvdata(hdev)); |
| 661 | } |
| 662 | |
| 663 | static const struct hid_device_id wacom_devices[] = { |
| 664 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) }, |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 665 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) }, |
Jiri Kosina | d5e0a06 | 2010-07-20 17:48:48 +0200 | [diff] [blame] | 666 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 667 | { } |
| 668 | }; |
| 669 | MODULE_DEVICE_TABLE(hid, wacom_devices); |
| 670 | |
| 671 | static struct hid_driver wacom_driver = { |
| 672 | .name = "wacom", |
| 673 | .id_table = wacom_devices, |
| 674 | .probe = wacom_probe, |
| 675 | .remove = wacom_remove, |
| 676 | .raw_event = wacom_raw_event, |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 677 | .input_mapped = wacom_input_mapped, |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 678 | }; |
| 679 | |
Peter Huewe | a24f423b | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 680 | static int __init wacom_init(void) |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 681 | { |
| 682 | int ret; |
| 683 | |
| 684 | ret = hid_register_driver(&wacom_driver); |
| 685 | if (ret) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 686 | pr_err("can't register wacom driver\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 687 | return ret; |
| 688 | } |
| 689 | |
Peter Huewe | a24f423b | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 690 | static void __exit wacom_exit(void) |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 691 | { |
| 692 | hid_unregister_driver(&wacom_driver); |
| 693 | } |
| 694 | |
| 695 | module_init(wacom_init); |
| 696 | module_exit(wacom_exit); |
Przemo Firszt | 1fa2f72 | 2012-03-28 22:13:37 +0100 | [diff] [blame] | 697 | MODULE_DESCRIPTION("Driver for Wacom Graphire Bluetooth and Wacom Intuos4 WL"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 698 | MODULE_LICENSE("GPL"); |