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 | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 366 | |
| 367 | switch (data[1]) { |
| 368 | case 0x80: /* Out of proximity report */ |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 369 | input_report_key(input, BTN_TOUCH, 0); |
| 370 | input_report_abs(input, ABS_PRESSURE, 0); |
Przemo Firszt | 693f45b | 2012-03-09 13:20:51 +0000 | [diff] [blame] | 371 | input_report_key(input, BTN_STYLUS, 0); |
| 372 | input_report_key(input, BTN_STYLUS2, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 373 | input_report_key(input, wdata->tool, 0); |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 374 | input_report_abs(input, ABS_MISC, 0); |
| 375 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); |
Przemo Firszt | 32db737 | 2012-02-19 20:20:29 +0000 | [diff] [blame] | 376 | wdata->tool = 0; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 377 | input_sync(input); |
| 378 | break; |
| 379 | case 0xC2: /* Tool report */ |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 380 | wdata->id = ((data[2] << 4) | (data[3] >> 4) | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 381 | ((data[7] & 0x0f) << 20) | |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 382 | ((data[8] & 0xf0) << 12)); |
| 383 | wdata->serial = ((data[3] & 0x0f) << 28) + |
| 384 | (data[4] << 20) + (data[5] << 12) + |
| 385 | (data[6] << 4) + (data[7] >> 4); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 386 | |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 387 | switch (wdata->id) { |
| 388 | case 0x100802: |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 389 | wdata->tool = BTN_TOOL_PEN; |
| 390 | break; |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 391 | case 0x10080A: |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 392 | wdata->tool = BTN_TOOL_RUBBER; |
| 393 | break; |
| 394 | } |
| 395 | break; |
| 396 | default: /* Position/pressure report */ |
| 397 | x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1); |
| 398 | y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01); |
| 399 | pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5) |
| 400 | | (data[1] & 0x01); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 401 | distance = (data[9] >> 2) & 0x3f; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 402 | |
| 403 | input_report_key(input, BTN_TOUCH, pressure > 1); |
| 404 | |
| 405 | input_report_key(input, BTN_STYLUS, data[1] & 0x02); |
| 406 | input_report_key(input, BTN_STYLUS2, data[1] & 0x04); |
| 407 | input_report_key(input, wdata->tool, 1); |
| 408 | input_report_abs(input, ABS_X, x); |
| 409 | input_report_abs(input, ABS_Y, y); |
| 410 | input_report_abs(input, ABS_PRESSURE, pressure); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 411 | input_report_abs(input, ABS_DISTANCE, distance); |
Przemo Firszt | 2470900 | 2012-02-24 13:52:32 +0000 | [diff] [blame] | 412 | input_report_abs(input, ABS_MISC, wdata->id); |
| 413 | input_event(input, EV_MSC, MSC_SERIAL, wdata->serial); |
| 414 | input_report_key(input, wdata->tool, 1); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 415 | input_sync(input); |
| 416 | break; |
| 417 | } |
| 418 | |
| 419 | return; |
| 420 | } |
| 421 | |
| 422 | static void wacom_i4_parse_report(struct hid_device *hdev, |
| 423 | struct wacom_data *wdata, |
| 424 | struct input_dev *input, unsigned char *data) |
| 425 | { |
| 426 | switch (data[0]) { |
| 427 | case 0x00: /* Empty report */ |
| 428 | break; |
| 429 | case 0x02: /* Pen report */ |
| 430 | wacom_i4_parse_pen_report(wdata, input, data); |
| 431 | break; |
| 432 | case 0x03: /* Features Report */ |
| 433 | wdata->features = data[2]; |
| 434 | break; |
| 435 | case 0x0C: /* Button report */ |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 436 | wacom_i4_parse_button_report(wdata, input, data); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 437 | break; |
| 438 | default: |
| 439 | hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]); |
| 440 | break; |
| 441 | } |
| 442 | } |
| 443 | |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 444 | static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, |
| 445 | u8 *raw_data, int size) |
| 446 | { |
| 447 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
| 448 | struct hid_input *hidinput; |
| 449 | struct input_dev *input; |
| 450 | unsigned char *data = (unsigned char *) raw_data; |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 451 | int i; |
Przemo Firszt | 4202f1d | 2012-03-22 18:54:08 +0000 | [diff] [blame] | 452 | __u8 power_raw; |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 453 | |
| 454 | if (!(hdev->claimed & HID_CLAIMED_INPUT)) |
| 455 | return 0; |
| 456 | |
| 457 | hidinput = list_entry(hdev->inputs.next, struct hid_input, list); |
| 458 | input = hidinput->input; |
| 459 | |
| 460 | /* Check if this is a tablet report */ |
| 461 | if (data[0] != 0x03) |
| 462 | return 0; |
| 463 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 464 | switch (hdev->product) { |
| 465 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 466 | return wacom_gr_parse_report(hdev, wdata, input, data); |
| 467 | break; |
| 468 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
| 469 | i = 1; |
| 470 | |
| 471 | switch (data[0]) { |
| 472 | case 0x04: |
| 473 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
| 474 | i += 10; |
| 475 | /* fall through */ |
| 476 | case 0x03: |
| 477 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
| 478 | i += 10; |
| 479 | wacom_i4_parse_report(hdev, wdata, input, data + i); |
Przemo Firszt | 4202f1d | 2012-03-22 18:54:08 +0000 | [diff] [blame] | 480 | power_raw = data[i+10]; |
| 481 | if (power_raw != wdata->power_raw) { |
| 482 | wdata->power_raw = power_raw; |
| 483 | wdata->battery_capacity = batcap_i4[power_raw & 0x07]; |
| 484 | wdata->ps_connected = power_raw & 0x08; |
| 485 | } |
| 486 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 487 | break; |
| 488 | default: |
| 489 | hid_err(hdev, "Unknown report: %d,%d size:%d\n", |
| 490 | data[0], data[1], size); |
| 491 | return 0; |
| 492 | } |
| 493 | } |
| 494 | return 1; |
Przemo Firszt | f6b7efc | 2011-11-05 11:28:21 +0000 | [diff] [blame] | 495 | } |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 496 | |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 497 | static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi, |
| 498 | struct hid_field *field, struct hid_usage *usage, unsigned long **bit, |
| 499 | int *max) |
| 500 | { |
| 501 | struct input_dev *input = hi->input; |
| 502 | |
Jiri Kosina | f6f1242 | 2011-10-25 09:58:12 +0200 | [diff] [blame] | 503 | __set_bit(INPUT_PROP_POINTER, input->propbit); |
| 504 | |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 505 | /* Basics */ |
| 506 | input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL); |
| 507 | |
| 508 | __set_bit(REL_WHEEL, input->relbit); |
| 509 | |
| 510 | __set_bit(BTN_TOOL_PEN, input->keybit); |
| 511 | __set_bit(BTN_TOUCH, input->keybit); |
| 512 | __set_bit(BTN_STYLUS, input->keybit); |
| 513 | __set_bit(BTN_STYLUS2, input->keybit); |
| 514 | __set_bit(BTN_LEFT, input->keybit); |
| 515 | __set_bit(BTN_RIGHT, input->keybit); |
| 516 | __set_bit(BTN_MIDDLE, input->keybit); |
| 517 | |
| 518 | /* Pad */ |
Przemo Firszt | 9a911da | 2012-03-14 19:55:03 +0000 | [diff] [blame] | 519 | input_set_capability(input, EV_MSC, MSC_SERIAL); |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 520 | |
| 521 | __set_bit(BTN_0, input->keybit); |
| 522 | __set_bit(BTN_1, input->keybit); |
| 523 | __set_bit(BTN_TOOL_FINGER, input->keybit); |
| 524 | |
| 525 | /* Distance, rubber and mouse */ |
| 526 | __set_bit(BTN_TOOL_RUBBER, input->keybit); |
| 527 | __set_bit(BTN_TOOL_MOUSE, input->keybit); |
| 528 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 529 | switch (hdev->product) { |
| 530 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 531 | input_set_abs_params(input, ABS_X, 0, 16704, 4, 0); |
| 532 | input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0); |
| 533 | input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0); |
| 534 | input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0); |
| 535 | break; |
| 536 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 537 | __set_bit(ABS_WHEEL, input->absbit); |
Przemo Firszt | 2c653e6 | 2012-02-24 13:47:48 +0000 | [diff] [blame] | 538 | __set_bit(ABS_MISC, input->absbit); |
Przemo Firszt | 6245bde | 2012-02-28 17:19:05 +0000 | [diff] [blame] | 539 | __set_bit(BTN_2, input->keybit); |
| 540 | __set_bit(BTN_3, input->keybit); |
| 541 | __set_bit(BTN_4, input->keybit); |
| 542 | __set_bit(BTN_5, input->keybit); |
| 543 | __set_bit(BTN_6, input->keybit); |
| 544 | __set_bit(BTN_7, input->keybit); |
| 545 | __set_bit(BTN_8, input->keybit); |
Przemo Firszt | 7e503a3 | 2012-03-14 19:55:04 +0000 | [diff] [blame] | 546 | input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 547 | input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); |
| 548 | input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); |
| 549 | input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); |
Przemo Firszt | e0829e9 | 2012-02-28 17:19:04 +0000 | [diff] [blame] | 550 | input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 551 | break; |
| 552 | } |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 553 | |
| 554 | return 0; |
| 555 | } |
| 556 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 557 | static int wacom_probe(struct hid_device *hdev, |
| 558 | const struct hid_device_id *id) |
| 559 | { |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 560 | struct wacom_data *wdata; |
| 561 | int ret; |
| 562 | |
| 563 | wdata = kzalloc(sizeof(*wdata), GFP_KERNEL); |
| 564 | if (wdata == NULL) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 565 | hid_err(hdev, "can't alloc wacom descriptor\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 566 | return -ENOMEM; |
| 567 | } |
| 568 | |
| 569 | hid_set_drvdata(hdev, wdata); |
| 570 | |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 571 | /* Parse the HID report now */ |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 572 | ret = hid_parse(hdev); |
| 573 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 574 | hid_err(hdev, "parse failed\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 575 | goto err_free; |
| 576 | } |
| 577 | |
| 578 | ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); |
| 579 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 580 | hid_err(hdev, "hw start failed\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 581 | goto err_free; |
| 582 | } |
| 583 | |
Przemo Firszt | 20a3ce7e | 2010-03-18 14:34:34 +0000 | [diff] [blame] | 584 | ret = device_create_file(&hdev->dev, &dev_attr_speed); |
| 585 | if (ret) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 586 | hid_warn(hdev, |
| 587 | "can't create sysfs speed attribute err: %d\n", ret); |
Jiri Kosina | 342f31e | 2010-02-03 15:52:31 +0100 | [diff] [blame] | 588 | |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 589 | switch (hdev->product) { |
| 590 | case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH: |
| 591 | /* Set Wacom mode 2 with high reporting speed */ |
| 592 | wacom_poke(hdev, 1); |
| 593 | break; |
| 594 | case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH: |
Przemo Firszt | a72c5dd | 2012-02-17 17:47:10 +0000 | [diff] [blame] | 595 | sprintf(hdev->name, "%s", "Wacom Intuos4 WL"); |
Przemo Firszt | 78761ff | 2011-11-05 11:28:22 +0000 | [diff] [blame] | 596 | wdata->features = 0; |
| 597 | wacom_set_features(hdev); |
| 598 | break; |
| 599 | } |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 600 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 601 | wdata->battery.properties = wacom_battery_props; |
| 602 | wdata->battery.num_properties = ARRAY_SIZE(wacom_battery_props); |
| 603 | wdata->battery.get_property = wacom_battery_get_property; |
| 604 | wdata->battery.name = "wacom_battery"; |
| 605 | wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY; |
| 606 | wdata->battery.use_for_apm = 0; |
Bastien Nocera | 46a709b | 2010-01-20 12:00:53 +0000 | [diff] [blame] | 607 | |
Jeremy Fitzhardinge | 35b4c01 | 2011-12-09 09:35:00 -0800 | [diff] [blame] | 608 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 609 | ret = power_supply_register(&hdev->dev, &wdata->battery); |
| 610 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 611 | hid_warn(hdev, "can't create sysfs battery attribute, err: %d\n", |
| 612 | ret); |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 613 | goto err_battery; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 614 | } |
| 615 | |
Przemo Firszt | d7cb3dbd10 | 2012-02-05 22:35:24 +0000 | [diff] [blame] | 616 | power_supply_powers(&wdata->battery, &hdev->dev); |
| 617 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 618 | wdata->ac.properties = wacom_ac_props; |
| 619 | wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props); |
| 620 | wdata->ac.get_property = wacom_ac_get_property; |
| 621 | wdata->ac.name = "wacom_ac"; |
| 622 | wdata->ac.type = POWER_SUPPLY_TYPE_MAINS; |
| 623 | wdata->ac.use_for_apm = 0; |
| 624 | |
| 625 | ret = power_supply_register(&hdev->dev, &wdata->ac); |
| 626 | if (ret) { |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 627 | hid_warn(hdev, |
| 628 | "can't create ac battery attribute, err: %d\n", ret); |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 629 | goto err_ac; |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 630 | } |
Przemo Firszt | d7cb3dbd10 | 2012-02-05 22:35:24 +0000 | [diff] [blame] | 631 | |
| 632 | power_supply_powers(&wdata->ac, &hdev->dev); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 633 | return 0; |
Daniel Mack | 987a6c0 | 2010-08-02 20:15:17 -0700 | [diff] [blame] | 634 | |
David Herrmann | dde58cf | 2011-09-05 18:45:28 +0200 | [diff] [blame] | 635 | err_ac: |
| 636 | power_supply_unregister(&wdata->battery); |
| 637 | err_battery: |
| 638 | device_remove_file(&hdev->dev, &dev_attr_speed); |
| 639 | hid_hw_stop(hdev); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 640 | err_free: |
| 641 | kfree(wdata); |
| 642 | return ret; |
| 643 | } |
| 644 | |
| 645 | static void wacom_remove(struct hid_device *hdev) |
| 646 | { |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 647 | struct wacom_data *wdata = hid_get_drvdata(hdev); |
David Herrmann | 9086617 | 2011-09-05 18:45:29 +0200 | [diff] [blame] | 648 | device_remove_file(&hdev->dev, &dev_attr_speed); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 649 | hid_hw_stop(hdev); |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 650 | |
Przemo Firszt | 59d2334 | 2010-03-15 19:16:23 +0000 | [diff] [blame] | 651 | power_supply_unregister(&wdata->battery); |
| 652 | power_supply_unregister(&wdata->ac); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 653 | kfree(hid_get_drvdata(hdev)); |
| 654 | } |
| 655 | |
| 656 | static const struct hid_device_id wacom_devices[] = { |
| 657 | { 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] | 658 | { 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] | 659 | |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 660 | { } |
| 661 | }; |
| 662 | MODULE_DEVICE_TABLE(hid, wacom_devices); |
| 663 | |
| 664 | static struct hid_driver wacom_driver = { |
| 665 | .name = "wacom", |
| 666 | .id_table = wacom_devices, |
| 667 | .probe = wacom_probe, |
| 668 | .remove = wacom_remove, |
| 669 | .raw_event = wacom_raw_event, |
David Herrmann | 3797ef6 | 2011-10-08 23:20:17 +0200 | [diff] [blame] | 670 | .input_mapped = wacom_input_mapped, |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 671 | }; |
| 672 | |
Peter Huewe | a24f423 | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 673 | static int __init wacom_init(void) |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 674 | { |
| 675 | int ret; |
| 676 | |
| 677 | ret = hid_register_driver(&wacom_driver); |
| 678 | if (ret) |
Joe Perches | 4291ee3 | 2010-12-09 19:29:03 -0800 | [diff] [blame] | 679 | pr_err("can't register wacom driver\n"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 680 | return ret; |
| 681 | } |
| 682 | |
Peter Huewe | a24f423 | 2009-07-02 19:08:38 +0200 | [diff] [blame] | 683 | static void __exit wacom_exit(void) |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 684 | { |
| 685 | hid_unregister_driver(&wacom_driver); |
| 686 | } |
| 687 | |
| 688 | module_init(wacom_init); |
| 689 | module_exit(wacom_exit); |
Przemo Firszt | 1fa2f72 | 2012-03-28 22:13:37 +0100 | [diff] [blame^] | 690 | MODULE_DESCRIPTION("Driver for Wacom Graphire Bluetooth and Wacom Intuos4 WL"); |
Bastien Nocera | ca2dcd4 | 2009-05-11 17:18:12 +0200 | [diff] [blame] | 691 | MODULE_LICENSE("GPL"); |