blob: 60c75dcbbdb87109061e1d3f12d5e9710fdfe944 [file] [log] [blame]
Bastien Noceraca2dcd42009-05-11 17:18:12 +02001/*
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
Bastien Noceraca2dcd42009-05-11 17:18:12 +02008 * 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>
Przemo Firszt78761ff2011-11-05 11:28:22 +000011 * Copyright (c) 2011 Przemysław Firszt <przemo@firszt.eu>
Bastien Noceraca2dcd42009-05-11 17:18:12 +020012 */
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
Joe Perches4291ee32010-12-09 19:29:03 -080021#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
22
Bastien Noceraca2dcd42009-05-11 17:18:12 +020023#include <linux/device.h>
24#include <linux/hid.h>
25#include <linux/module.h>
Przemo Firsztd13f5452012-05-10 19:23:52 +010026#include <linux/leds.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090027#include <linux/slab.h>
Przemo Firszt59d23342010-03-15 19:16:23 +000028#include <linux/power_supply.h>
Bastien Noceraca2dcd42009-05-11 17:18:12 +020029
30#include "hid-ids.h"
31
Przemo Firszt6245bde2012-02-28 17:19:05 +000032#define PAD_DEVICE_ID 0x0F
33
Przemo Firsztd13f5452012-05-10 19:23:52 +010034#define WAC_CMD_LED_CONTROL 0x20
Przemo Firszte3c399e2012-07-31 18:27:56 +010035#define WAC_CMD_ICON_START_STOP 0x21
36#define WAC_CMD_ICON_TRANSFER 0x26
Przemo Firsztd13f5452012-05-10 19:23:52 +010037
Bastien Noceraca2dcd42009-05-11 17:18:12 +020038struct wacom_data {
39 __u16 tool;
Przemo Firszt6245bde2012-02-28 17:19:05 +000040 __u16 butstate;
Przemo Firszt7e503a32012-03-14 19:55:04 +000041 __u8 whlstate;
Przemo Firszt78761ff2011-11-05 11:28:22 +000042 __u8 features;
Przemo Firszt24709002012-02-24 13:52:32 +000043 __u32 id;
44 __u32 serial;
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +000045 unsigned char high_speed;
Przemo Firszte31e3832012-03-22 18:54:07 +000046 __u8 battery_capacity;
47 __u8 power_raw;
48 __u8 ps_connected;
Przemo Firszt9d157622013-06-29 10:57:13 +010049 __u8 bat_charging;
Przemo Firszt59d23342010-03-15 19:16:23 +000050 struct power_supply battery;
51 struct power_supply ac;
Przemo Firsztd13f5452012-05-10 19:23:52 +010052 __u8 led_selector;
53 struct led_classdev *leds[4];
Bastien Noceraca2dcd42009-05-11 17:18:12 +020054};
55
Przemo Firszte31e3832012-03-22 18:54:07 +000056/*percent of battery capacity for Graphire
57 8th value means AC online and show 100% capacity */
58static unsigned short batcap_gr[8] = { 1, 15, 25, 35, 50, 70, 100, 100 };
Przemo Firszt4202f1d2012-03-22 18:54:08 +000059/*percent of battery capacity for Intuos4 WL, AC has a separate bit*/
60static unsigned short batcap_i4[8] = { 1, 15, 30, 45, 60, 70, 85, 100 };
Przemo Firszt59d23342010-03-15 19:16:23 +000061
62static enum power_supply_property wacom_battery_props[] = {
63 POWER_SUPPLY_PROP_PRESENT,
Jeremy Fitzhardinge73db8812011-12-07 11:29:46 -080064 POWER_SUPPLY_PROP_CAPACITY,
65 POWER_SUPPLY_PROP_SCOPE,
Przemo Firszt9d157622013-06-29 10:57:13 +010066 POWER_SUPPLY_PROP_STATUS,
Przemo Firszt59d23342010-03-15 19:16:23 +000067};
68
69static enum power_supply_property wacom_ac_props[] = {
70 POWER_SUPPLY_PROP_PRESENT,
Jeremy Fitzhardinge73db8812011-12-07 11:29:46 -080071 POWER_SUPPLY_PROP_ONLINE,
72 POWER_SUPPLY_PROP_SCOPE,
Przemo Firszt59d23342010-03-15 19:16:23 +000073};
74
Przemo Firszte3c399e2012-07-31 18:27:56 +010075static 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
119static 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 = hdev->hid_output_raw_report(hdev, rep_data, 2,
132 HID_FEATURE_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 = hdev->hid_output_raw_report(hdev, rep_data, 67,
147 HID_FEATURE_REPORT);
148 }
149
150 rep_data[0] = WAC_CMD_ICON_START_STOP;
151 rep_data[1] = 0;
152
153 ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
154 HID_FEATURE_REPORT);
155
156err:
157 return;
158}
159
Przemo Firsztd13f5452012-05-10 19:23:52 +0100160static 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;
Przemo Firszt530a76c2012-07-31 18:27:55 +0100182 buf[2] = value >> 2;
183 buf[3] = value;
Przemo Firszte3c399e2012-07-31 18:27:56 +0100184 /* use fixed brightness for OLEDs */
185 buf[4] = 0x08;
Przemo Firsztd13f5452012-05-10 19:23:52 +0100186 hdev->hid_output_raw_report(hdev, buf, 9, HID_FEATURE_REPORT);
187 kfree(buf);
188 }
189
190 return;
191}
192
193static enum led_brightness wacom_leds_get_brightness(struct led_classdev *led_dev)
194{
195 struct wacom_data *wdata;
196 struct device *dev = led_dev->dev->parent;
197 int value = 0;
198 int i;
199
200 wdata = hid_get_drvdata(container_of(dev, struct hid_device, dev));
201
202 for (i = 0; i < 4; ++i) {
203 if (wdata->leds[i] == led_dev) {
204 value = wdata->leds[i]->brightness;
205 break;
206 }
207 }
208
209 return value;
210}
211
212
213static int wacom_initialize_leds(struct hid_device *hdev)
214{
215 struct wacom_data *wdata = hid_get_drvdata(hdev);
216 struct led_classdev *led;
217 struct device *dev = &hdev->dev;
218 size_t namesz = strlen(dev_name(dev)) + 12;
219 char *name;
220 int i, ret;
221
222 wdata->led_selector = 0;
223
224 for (i = 0; i < 4; i++) {
225 led = kzalloc(sizeof(struct led_classdev) + namesz, GFP_KERNEL);
226 if (!led) {
227 hid_warn(hdev,
228 "can't allocate memory for LED selector\n");
229 ret = -ENOMEM;
230 goto err;
231 }
232
233 name = (void *)&led[1];
234 snprintf(name, namesz, "%s:selector:%d", dev_name(dev), i);
235 led->name = name;
236 led->brightness = 0;
237 led->max_brightness = 127;
238 led->brightness_get = wacom_leds_get_brightness;
239 led->brightness_set = wacom_leds_set_brightness;
240
241 wdata->leds[i] = led;
242
243 ret = led_classdev_register(dev, wdata->leds[i]);
244
245 if (ret) {
246 wdata->leds[i] = NULL;
247 kfree(led);
248 hid_warn(hdev, "can't register LED\n");
249 goto err;
250 }
251 }
252
253err:
254 return ret;
255}
256
257static void wacom_destroy_leds(struct hid_device *hdev)
258{
259 struct wacom_data *wdata = hid_get_drvdata(hdev);
260 struct led_classdev *led;
261 int i;
262
263 for (i = 0; i < 4; ++i) {
264 if (wdata->leds[i]) {
265 led = wdata->leds[i];
266 wdata->leds[i] = NULL;
267 led_classdev_unregister(led);
268 kfree(led);
269 }
270 }
271
272}
273
Przemo Firszt59d23342010-03-15 19:16:23 +0000274static int wacom_battery_get_property(struct power_supply *psy,
275 enum power_supply_property psp,
276 union power_supply_propval *val)
277{
278 struct wacom_data *wdata = container_of(psy,
279 struct wacom_data, battery);
Przemo Firszt59d23342010-03-15 19:16:23 +0000280 int ret = 0;
281
282 switch (psp) {
283 case POWER_SUPPLY_PROP_PRESENT:
284 val->intval = 1;
285 break;
Jeremy Fitzhardinge73db8812011-12-07 11:29:46 -0800286 case POWER_SUPPLY_PROP_SCOPE:
287 val->intval = POWER_SUPPLY_SCOPE_DEVICE;
288 break;
Przemo Firszt59d23342010-03-15 19:16:23 +0000289 case POWER_SUPPLY_PROP_CAPACITY:
Przemo Firszte31e3832012-03-22 18:54:07 +0000290 val->intval = wdata->battery_capacity;
Przemo Firszt59d23342010-03-15 19:16:23 +0000291 break;
Przemo Firszt9d157622013-06-29 10:57:13 +0100292 case POWER_SUPPLY_PROP_STATUS:
293 if (wdata->bat_charging)
294 val->intval = POWER_SUPPLY_STATUS_CHARGING;
295 else
296 if (wdata->battery_capacity == 100 && wdata->ps_connected)
297 val->intval = POWER_SUPPLY_STATUS_FULL;
298 else
299 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
300 break;
Przemo Firszt59d23342010-03-15 19:16:23 +0000301 default:
302 ret = -EINVAL;
303 break;
304 }
305 return ret;
306}
307
308static int wacom_ac_get_property(struct power_supply *psy,
309 enum power_supply_property psp,
310 union power_supply_propval *val)
311{
312 struct wacom_data *wdata = container_of(psy, struct wacom_data, ac);
Przemo Firszt59d23342010-03-15 19:16:23 +0000313 int ret = 0;
314
315 switch (psp) {
316 case POWER_SUPPLY_PROP_PRESENT:
317 /* fall through */
318 case POWER_SUPPLY_PROP_ONLINE:
Przemo Firszte31e3832012-03-22 18:54:07 +0000319 val->intval = wdata->ps_connected;
Przemo Firszt59d23342010-03-15 19:16:23 +0000320 break;
Jeremy Fitzhardinge73db8812011-12-07 11:29:46 -0800321 case POWER_SUPPLY_PROP_SCOPE:
322 val->intval = POWER_SUPPLY_SCOPE_DEVICE;
323 break;
Przemo Firszt59d23342010-03-15 19:16:23 +0000324 default:
325 ret = -EINVAL;
326 break;
327 }
328 return ret;
329}
Przemo Firszt59d23342010-03-15 19:16:23 +0000330
Przemo Firsztbe4925b2012-05-15 19:32:26 +0100331static void wacom_set_features(struct hid_device *hdev, u8 speed)
Przemo Firszt78761ff2011-11-05 11:28:22 +0000332{
Przemo Firsztbe4925b2012-05-15 19:32:26 +0100333 struct wacom_data *wdata = hid_get_drvdata(hdev);
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100334 int limit, ret;
Przemo Firszt78761ff2011-11-05 11:28:22 +0000335 __u8 rep_data[2];
336
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100337 switch (hdev->product) {
338 case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
339 rep_data[0] = 0x03 ; rep_data[1] = 0x00;
Przemo Firszt06c7c312010-03-22 09:55:04 +0100340 limit = 3;
341 do {
342 ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
343 HID_FEATURE_REPORT);
344 } while (ret < 0 && limit-- > 0);
345
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000346 if (ret >= 0) {
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100347 if (speed == 0)
348 rep_data[0] = 0x05;
349 else
350 rep_data[0] = 0x06;
351
352 rep_data[1] = 0x00;
353 limit = 3;
354 do {
355 ret = hdev->hid_output_raw_report(hdev,
356 rep_data, 2, HID_FEATURE_REPORT);
357 } while (ret < 0 && limit-- > 0);
358
359 if (ret >= 0) {
360 wdata->high_speed = speed;
361 return;
362 }
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000363 }
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100364
365 /*
366 * Note that if the raw queries fail, it's not a hard failure
367 * and it is safe to continue
368 */
369 hid_warn(hdev, "failed to poke device, command %d, err %d\n",
370 rep_data[0], ret);
371 break;
372 case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
373 if (speed == 1)
374 wdata->features &= ~0x20;
375 else
376 wdata->features |= 0x20;
377
378 rep_data[0] = 0x03;
379 rep_data[1] = wdata->features;
380
381 ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
382 HID_FEATURE_REPORT);
383 if (ret >= 0)
384 wdata->high_speed = speed;
385 break;
Przemo Firszt06c7c312010-03-22 09:55:04 +0100386 }
387
Przemo Firszt06c7c312010-03-22 09:55:04 +0100388 return;
389}
390
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000391static ssize_t wacom_show_speed(struct device *dev,
392 struct device_attribute
393 *attr, char *buf)
394{
395 struct wacom_data *wdata = dev_get_drvdata(dev);
396
397 return snprintf(buf, PAGE_SIZE, "%i\n", wdata->high_speed);
398}
399
400static ssize_t wacom_store_speed(struct device *dev,
401 struct device_attribute *attr,
402 const char *buf, size_t count)
403{
404 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
405 int new_speed;
406
407 if (sscanf(buf, "%1d", &new_speed ) != 1)
408 return -EINVAL;
409
410 if (new_speed == 0 || new_speed == 1) {
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100411 wacom_set_features(hdev, new_speed);
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000412 return strnlen(buf, PAGE_SIZE);
413 } else
414 return -EINVAL;
415}
416
Jiri Kosinaedd21262010-11-18 16:28:43 +0100417static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP,
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000418 wacom_show_speed, wacom_store_speed);
419
Przemo Firszte3c399e2012-07-31 18:27:56 +0100420#define WACOM_STORE(OLED_ID) \
421static ssize_t wacom_oled##OLED_ID##_store(struct device *dev, \
422 struct device_attribute *attr, \
423 const char *buf, size_t count) \
424{ \
425 struct hid_device *hdev = container_of(dev, struct hid_device, \
426 dev); \
427 \
428 if (count != 256) \
429 return -EINVAL; \
430 \
431 wacom_set_image(hdev, buf, OLED_ID); \
432 \
433 return count; \
434} \
435 \
436static DEVICE_ATTR(oled##OLED_ID##_img, S_IWUSR | S_IWGRP, NULL, \
437 wacom_oled##OLED_ID##_store)
438
439WACOM_STORE(0);
440WACOM_STORE(1);
441WACOM_STORE(2);
442WACOM_STORE(3);
443WACOM_STORE(4);
444WACOM_STORE(5);
445WACOM_STORE(6);
446WACOM_STORE(7);
447
Przemo Firsztf6b7efc2011-11-05 11:28:21 +0000448static int wacom_gr_parse_report(struct hid_device *hdev,
449 struct wacom_data *wdata,
450 struct input_dev *input, unsigned char *data)
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200451{
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200452 int tool, x, y, rw;
453
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200454 tool = 0;
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200455 /* Get X & Y positions */
456 x = le16_to_cpu(*(__le16 *) &data[2]);
457 y = le16_to_cpu(*(__le16 *) &data[4]);
458
459 /* Get current tool identifier */
460 if (data[1] & 0x90) { /* If pen is in the in/active area */
461 switch ((data[1] >> 5) & 3) {
462 case 0: /* Pen */
463 tool = BTN_TOOL_PEN;
464 break;
465
466 case 1: /* Rubber */
467 tool = BTN_TOOL_RUBBER;
468 break;
469
470 case 2: /* Mouse with wheel */
471 case 3: /* Mouse without wheel */
472 tool = BTN_TOOL_MOUSE;
473 break;
474 }
475
476 /* Reset tool if out of active tablet area */
477 if (!(data[1] & 0x10))
478 tool = 0;
479 }
480
481 /* If tool changed, notify input subsystem */
482 if (wdata->tool != tool) {
483 if (wdata->tool) {
484 /* Completely reset old tool state */
485 if (wdata->tool == BTN_TOOL_MOUSE) {
486 input_report_key(input, BTN_LEFT, 0);
487 input_report_key(input, BTN_RIGHT, 0);
488 input_report_key(input, BTN_MIDDLE, 0);
489 input_report_abs(input, ABS_DISTANCE,
Daniel Mack987a6c02010-08-02 20:15:17 -0700490 input_abs_get_max(input, ABS_DISTANCE));
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200491 } else {
492 input_report_key(input, BTN_TOUCH, 0);
493 input_report_key(input, BTN_STYLUS, 0);
494 input_report_key(input, BTN_STYLUS2, 0);
495 input_report_abs(input, ABS_PRESSURE, 0);
496 }
497 input_report_key(input, wdata->tool, 0);
498 input_sync(input);
499 }
500 wdata->tool = tool;
501 if (tool)
502 input_report_key(input, tool, 1);
503 }
504
505 if (tool) {
506 input_report_abs(input, ABS_X, x);
507 input_report_abs(input, ABS_Y, y);
508
509 switch ((data[1] >> 5) & 3) {
510 case 2: /* Mouse with wheel */
511 input_report_key(input, BTN_MIDDLE, data[1] & 0x04);
512 rw = (data[6] & 0x01) ? -1 :
513 (data[6] & 0x02) ? 1 : 0;
514 input_report_rel(input, REL_WHEEL, rw);
515 /* fall through */
516
517 case 3: /* Mouse without wheel */
518 input_report_key(input, BTN_LEFT, data[1] & 0x01);
519 input_report_key(input, BTN_RIGHT, data[1] & 0x02);
520 /* Compute distance between mouse and tablet */
521 rw = 44 - (data[6] >> 2);
522 if (rw < 0)
523 rw = 0;
524 else if (rw > 31)
525 rw = 31;
526 input_report_abs(input, ABS_DISTANCE, rw);
527 break;
528
529 default:
530 input_report_abs(input, ABS_PRESSURE,
531 data[6] | (((__u16) (data[1] & 0x08)) << 5));
532 input_report_key(input, BTN_TOUCH, data[1] & 0x01);
533 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
534 input_report_key(input, BTN_STYLUS2, (tool == BTN_TOOL_PEN) && data[1] & 0x04);
535 break;
536 }
537
538 input_sync(input);
539 }
540
541 /* Report the state of the two buttons at the top of the tablet
542 * as two extra fingerpad keys (buttons 4 & 5). */
543 rw = data[7] & 0x03;
544 if (rw != wdata->butstate) {
545 wdata->butstate = rw;
546 input_report_key(input, BTN_0, rw & 0x02);
547 input_report_key(input, BTN_1, rw & 0x01);
Przemo Firszt0e253fd2010-01-09 15:20:03 +0100548 input_report_key(input, BTN_TOOL_FINGER, 0xf0);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200549 input_event(input, EV_MSC, MSC_SERIAL, 0xf0);
550 input_sync(input);
551 }
552
Przemo Firszte31e3832012-03-22 18:54:07 +0000553 /* Store current battery capacity and power supply state*/
Przemo Firszt59d23342010-03-15 19:16:23 +0000554 rw = (data[7] >> 2 & 0x07);
Przemo Firszte31e3832012-03-22 18:54:07 +0000555 if (rw != wdata->power_raw) {
556 wdata->power_raw = rw;
557 wdata->battery_capacity = batcap_gr[rw];
558 if (rw == 7)
559 wdata->ps_connected = 1;
560 else
561 wdata->ps_connected = 0;
562 }
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200563 return 1;
564}
Przemo Firszt78761ff2011-11-05 11:28:22 +0000565
Przemo Firszt6245bde2012-02-28 17:19:05 +0000566static void wacom_i4_parse_button_report(struct wacom_data *wdata,
567 struct input_dev *input, unsigned char *data)
568{
569 __u16 new_butstate;
Przemo Firszt7e503a32012-03-14 19:55:04 +0000570 __u8 new_whlstate;
571 __u8 sync = 0;
572
573 new_whlstate = data[1];
574 if (new_whlstate != wdata->whlstate) {
575 wdata->whlstate = new_whlstate;
576 if (new_whlstate & 0x80) {
577 input_report_key(input, BTN_TOUCH, 1);
578 input_report_abs(input, ABS_WHEEL, (new_whlstate & 0x7f));
579 input_report_key(input, BTN_TOOL_FINGER, 1);
580 } else {
581 input_report_key(input, BTN_TOUCH, 0);
582 input_report_abs(input, ABS_WHEEL, 0);
583 input_report_key(input, BTN_TOOL_FINGER, 0);
584 }
585 sync = 1;
586 }
Przemo Firszt6245bde2012-02-28 17:19:05 +0000587
588 new_butstate = (data[3] << 1) | (data[2] & 0x01);
589 if (new_butstate != wdata->butstate) {
590 wdata->butstate = new_butstate;
591 input_report_key(input, BTN_0, new_butstate & 0x001);
592 input_report_key(input, BTN_1, new_butstate & 0x002);
593 input_report_key(input, BTN_2, new_butstate & 0x004);
594 input_report_key(input, BTN_3, new_butstate & 0x008);
595 input_report_key(input, BTN_4, new_butstate & 0x010);
596 input_report_key(input, BTN_5, new_butstate & 0x020);
597 input_report_key(input, BTN_6, new_butstate & 0x040);
598 input_report_key(input, BTN_7, new_butstate & 0x080);
599 input_report_key(input, BTN_8, new_butstate & 0x100);
600 input_report_key(input, BTN_TOOL_FINGER, 1);
Przemo Firszt7e503a32012-03-14 19:55:04 +0000601 sync = 1;
602 }
603
604 if (sync) {
Przemo Firszt6245bde2012-02-28 17:19:05 +0000605 input_report_abs(input, ABS_MISC, PAD_DEVICE_ID);
606 input_event(input, EV_MSC, MSC_SERIAL, 0xffffffff);
607 input_sync(input);
608 }
609}
610
Przemo Firszt78761ff2011-11-05 11:28:22 +0000611static void wacom_i4_parse_pen_report(struct wacom_data *wdata,
612 struct input_dev *input, unsigned char *data)
613{
614 __u16 x, y, pressure;
Przemo Firszte0829e92012-02-28 17:19:04 +0000615 __u8 distance;
Przemo Firsztc653dab2012-05-04 18:00:10 +0100616 __u8 tilt_x, tilt_y;
Przemo Firszt78761ff2011-11-05 11:28:22 +0000617
618 switch (data[1]) {
619 case 0x80: /* Out of proximity report */
Przemo Firszt78761ff2011-11-05 11:28:22 +0000620 input_report_key(input, BTN_TOUCH, 0);
621 input_report_abs(input, ABS_PRESSURE, 0);
Przemo Firszt693f45b2012-03-09 13:20:51 +0000622 input_report_key(input, BTN_STYLUS, 0);
623 input_report_key(input, BTN_STYLUS2, 0);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000624 input_report_key(input, wdata->tool, 0);
Przemo Firszt24709002012-02-24 13:52:32 +0000625 input_report_abs(input, ABS_MISC, 0);
626 input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
Przemo Firszt32db7372012-02-19 20:20:29 +0000627 wdata->tool = 0;
Przemo Firszt78761ff2011-11-05 11:28:22 +0000628 input_sync(input);
629 break;
630 case 0xC2: /* Tool report */
Przemo Firszt24709002012-02-24 13:52:32 +0000631 wdata->id = ((data[2] << 4) | (data[3] >> 4) |
Przemo Firszt78761ff2011-11-05 11:28:22 +0000632 ((data[7] & 0x0f) << 20) |
Przemo Firszt24709002012-02-24 13:52:32 +0000633 ((data[8] & 0xf0) << 12));
634 wdata->serial = ((data[3] & 0x0f) << 28) +
635 (data[4] << 20) + (data[5] << 12) +
636 (data[6] << 4) + (data[7] >> 4);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000637
Przemo Firszt24709002012-02-24 13:52:32 +0000638 switch (wdata->id) {
639 case 0x100802:
Przemo Firszt78761ff2011-11-05 11:28:22 +0000640 wdata->tool = BTN_TOOL_PEN;
641 break;
Przemo Firszt24709002012-02-24 13:52:32 +0000642 case 0x10080A:
Przemo Firszt78761ff2011-11-05 11:28:22 +0000643 wdata->tool = BTN_TOOL_RUBBER;
644 break;
645 }
646 break;
647 default: /* Position/pressure report */
648 x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1);
649 y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01);
650 pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5)
651 | (data[1] & 0x01);
Przemo Firszte0829e92012-02-28 17:19:04 +0000652 distance = (data[9] >> 2) & 0x3f;
Przemo Firsztc653dab2012-05-04 18:00:10 +0100653 tilt_x = ((data[7] << 1) & 0x7e) | (data[8] >> 7);
654 tilt_y = data[8] & 0x7f;
Przemo Firszt78761ff2011-11-05 11:28:22 +0000655
656 input_report_key(input, BTN_TOUCH, pressure > 1);
657
658 input_report_key(input, BTN_STYLUS, data[1] & 0x02);
659 input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
660 input_report_key(input, wdata->tool, 1);
661 input_report_abs(input, ABS_X, x);
662 input_report_abs(input, ABS_Y, y);
663 input_report_abs(input, ABS_PRESSURE, pressure);
Przemo Firszte0829e92012-02-28 17:19:04 +0000664 input_report_abs(input, ABS_DISTANCE, distance);
Przemo Firsztc653dab2012-05-04 18:00:10 +0100665 input_report_abs(input, ABS_TILT_X, tilt_x);
666 input_report_abs(input, ABS_TILT_Y, tilt_y);
Przemo Firszt24709002012-02-24 13:52:32 +0000667 input_report_abs(input, ABS_MISC, wdata->id);
668 input_event(input, EV_MSC, MSC_SERIAL, wdata->serial);
669 input_report_key(input, wdata->tool, 1);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000670 input_sync(input);
671 break;
672 }
673
674 return;
675}
676
677static void wacom_i4_parse_report(struct hid_device *hdev,
678 struct wacom_data *wdata,
679 struct input_dev *input, unsigned char *data)
680{
681 switch (data[0]) {
682 case 0x00: /* Empty report */
683 break;
684 case 0x02: /* Pen report */
685 wacom_i4_parse_pen_report(wdata, input, data);
686 break;
687 case 0x03: /* Features Report */
688 wdata->features = data[2];
689 break;
690 case 0x0C: /* Button report */
Przemo Firszt6245bde2012-02-28 17:19:05 +0000691 wacom_i4_parse_button_report(wdata, input, data);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000692 break;
693 default:
694 hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]);
695 break;
696 }
697}
698
Przemo Firsztf6b7efc2011-11-05 11:28:21 +0000699static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
700 u8 *raw_data, int size)
701{
702 struct wacom_data *wdata = hid_get_drvdata(hdev);
703 struct hid_input *hidinput;
704 struct input_dev *input;
705 unsigned char *data = (unsigned char *) raw_data;
Przemo Firszt78761ff2011-11-05 11:28:22 +0000706 int i;
Przemo Firszt4202f1d2012-03-22 18:54:08 +0000707 __u8 power_raw;
Przemo Firsztf6b7efc2011-11-05 11:28:21 +0000708
709 if (!(hdev->claimed & HID_CLAIMED_INPUT))
710 return 0;
711
712 hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
713 input = hidinput->input;
714
Przemo Firszt78761ff2011-11-05 11:28:22 +0000715 switch (hdev->product) {
716 case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
Przemo Firszt163a6ae2012-05-15 19:32:25 +0100717 if (data[0] == 0x03) {
718 return wacom_gr_parse_report(hdev, wdata, input, data);
719 } else {
720 hid_err(hdev, "Unknown report: %d,%d size:%d\n",
721 data[0], data[1], size);
722 return 0;
723 }
Przemo Firszt78761ff2011-11-05 11:28:22 +0000724 break;
725 case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
726 i = 1;
727
728 switch (data[0]) {
729 case 0x04:
730 wacom_i4_parse_report(hdev, wdata, input, data + i);
731 i += 10;
732 /* fall through */
733 case 0x03:
734 wacom_i4_parse_report(hdev, wdata, input, data + i);
735 i += 10;
736 wacom_i4_parse_report(hdev, wdata, input, data + i);
Przemo Firszt4202f1d2012-03-22 18:54:08 +0000737 power_raw = data[i+10];
738 if (power_raw != wdata->power_raw) {
739 wdata->power_raw = power_raw;
740 wdata->battery_capacity = batcap_i4[power_raw & 0x07];
Przemo Firszt9d157622013-06-29 10:57:13 +0100741 wdata->bat_charging = (power_raw & 0x08) ? 1 : 0;
742 wdata->ps_connected = (power_raw & 0x10) ? 1 : 0;
Przemo Firszt4202f1d2012-03-22 18:54:08 +0000743 }
744
Przemo Firszt78761ff2011-11-05 11:28:22 +0000745 break;
746 default:
747 hid_err(hdev, "Unknown report: %d,%d size:%d\n",
748 data[0], data[1], size);
749 return 0;
750 }
751 }
752 return 1;
Przemo Firsztf6b7efc2011-11-05 11:28:21 +0000753}
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200754
David Herrmann3797ef62011-10-08 23:20:17 +0200755static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
756 struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
757 int *max)
758{
759 struct input_dev *input = hi->input;
760
Jiri Kosinaf6f12422011-10-25 09:58:12 +0200761 __set_bit(INPUT_PROP_POINTER, input->propbit);
762
David Herrmann3797ef62011-10-08 23:20:17 +0200763 /* Basics */
764 input->evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_REL);
765
766 __set_bit(REL_WHEEL, input->relbit);
767
768 __set_bit(BTN_TOOL_PEN, input->keybit);
769 __set_bit(BTN_TOUCH, input->keybit);
770 __set_bit(BTN_STYLUS, input->keybit);
771 __set_bit(BTN_STYLUS2, input->keybit);
772 __set_bit(BTN_LEFT, input->keybit);
773 __set_bit(BTN_RIGHT, input->keybit);
774 __set_bit(BTN_MIDDLE, input->keybit);
775
776 /* Pad */
Przemo Firszt9a911da2012-03-14 19:55:03 +0000777 input_set_capability(input, EV_MSC, MSC_SERIAL);
David Herrmann3797ef62011-10-08 23:20:17 +0200778
779 __set_bit(BTN_0, input->keybit);
780 __set_bit(BTN_1, input->keybit);
781 __set_bit(BTN_TOOL_FINGER, input->keybit);
782
783 /* Distance, rubber and mouse */
784 __set_bit(BTN_TOOL_RUBBER, input->keybit);
785 __set_bit(BTN_TOOL_MOUSE, input->keybit);
786
Przemo Firszt78761ff2011-11-05 11:28:22 +0000787 switch (hdev->product) {
788 case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
789 input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
790 input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
791 input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
792 input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
793 break;
794 case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
Przemo Firszt7e503a32012-03-14 19:55:04 +0000795 __set_bit(ABS_WHEEL, input->absbit);
Przemo Firszt2c653e62012-02-24 13:47:48 +0000796 __set_bit(ABS_MISC, input->absbit);
Przemo Firszt6245bde2012-02-28 17:19:05 +0000797 __set_bit(BTN_2, input->keybit);
798 __set_bit(BTN_3, input->keybit);
799 __set_bit(BTN_4, input->keybit);
800 __set_bit(BTN_5, input->keybit);
801 __set_bit(BTN_6, input->keybit);
802 __set_bit(BTN_7, input->keybit);
803 __set_bit(BTN_8, input->keybit);
Przemo Firszt7e503a32012-03-14 19:55:04 +0000804 input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000805 input_set_abs_params(input, ABS_X, 0, 40640, 4, 0);
806 input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0);
807 input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0);
Przemo Firszte0829e92012-02-28 17:19:04 +0000808 input_set_abs_params(input, ABS_DISTANCE, 0, 63, 0, 0);
Przemo Firsztc653dab2012-05-04 18:00:10 +0100809 input_set_abs_params(input, ABS_TILT_X, 0, 127, 0, 0);
810 input_set_abs_params(input, ABS_TILT_Y, 0, 127, 0, 0);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000811 break;
812 }
David Herrmann3797ef62011-10-08 23:20:17 +0200813
814 return 0;
815}
816
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200817static int wacom_probe(struct hid_device *hdev,
818 const struct hid_device_id *id)
819{
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200820 struct wacom_data *wdata;
821 int ret;
822
823 wdata = kzalloc(sizeof(*wdata), GFP_KERNEL);
824 if (wdata == NULL) {
Joe Perches4291ee32010-12-09 19:29:03 -0800825 hid_err(hdev, "can't alloc wacom descriptor\n");
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200826 return -ENOMEM;
827 }
828
829 hid_set_drvdata(hdev, wdata);
830
Bastien Nocera46a709b2010-01-20 12:00:53 +0000831 /* Parse the HID report now */
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200832 ret = hid_parse(hdev);
833 if (ret) {
Joe Perches4291ee32010-12-09 19:29:03 -0800834 hid_err(hdev, "parse failed\n");
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200835 goto err_free;
836 }
837
838 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
839 if (ret) {
Joe Perches4291ee32010-12-09 19:29:03 -0800840 hid_err(hdev, "hw start failed\n");
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200841 goto err_free;
842 }
843
Przemo Firszt20a3ce7e2010-03-18 14:34:34 +0000844 ret = device_create_file(&hdev->dev, &dev_attr_speed);
845 if (ret)
Joe Perches4291ee32010-12-09 19:29:03 -0800846 hid_warn(hdev,
847 "can't create sysfs speed attribute err: %d\n", ret);
Jiri Kosina342f31e2010-02-03 15:52:31 +0100848
Przemo Firszte3c399e2012-07-31 18:27:56 +0100849#define OLED_INIT(OLED_ID) \
850 do { \
851 ret = device_create_file(&hdev->dev, \
852 &dev_attr_oled##OLED_ID##_img); \
853 if (ret) \
854 hid_warn(hdev, \
855 "can't create sysfs oled attribute, err: %d\n", ret);\
856 } while (0)
857
858OLED_INIT(0);
859OLED_INIT(1);
860OLED_INIT(2);
861OLED_INIT(3);
862OLED_INIT(4);
863OLED_INIT(5);
864OLED_INIT(6);
865OLED_INIT(7);
866
Przemo Firsztd70a2ff2012-05-15 19:32:28 +0100867 wdata->features = 0;
868 wacom_set_features(hdev, 1);
869
870 if (hdev->product == USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) {
Przemo Firszta72c5dd2012-02-17 17:47:10 +0000871 sprintf(hdev->name, "%s", "Wacom Intuos4 WL");
Przemo Firsztd13f5452012-05-10 19:23:52 +0100872 ret = wacom_initialize_leds(hdev);
Axel Lin8908dd82012-09-17 16:53:54 +0800873 if (ret)
Przemo Firsztd13f5452012-05-10 19:23:52 +0100874 hid_warn(hdev,
875 "can't create led attribute, err: %d\n", ret);
Przemo Firszt78761ff2011-11-05 11:28:22 +0000876 }
Bastien Nocera46a709b2010-01-20 12:00:53 +0000877
Przemo Firszt59d23342010-03-15 19:16:23 +0000878 wdata->battery.properties = wacom_battery_props;
879 wdata->battery.num_properties = ARRAY_SIZE(wacom_battery_props);
880 wdata->battery.get_property = wacom_battery_get_property;
881 wdata->battery.name = "wacom_battery";
882 wdata->battery.type = POWER_SUPPLY_TYPE_BATTERY;
883 wdata->battery.use_for_apm = 0;
Bastien Nocera46a709b2010-01-20 12:00:53 +0000884
Jeremy Fitzhardinge35b4c012011-12-09 09:35:00 -0800885
Przemo Firszt59d23342010-03-15 19:16:23 +0000886 ret = power_supply_register(&hdev->dev, &wdata->battery);
887 if (ret) {
Axel Lin8908dd82012-09-17 16:53:54 +0800888 hid_err(hdev, "can't create sysfs battery attribute, err: %d\n",
889 ret);
David Herrmanndde58cf2011-09-05 18:45:28 +0200890 goto err_battery;
Przemo Firszt59d23342010-03-15 19:16:23 +0000891 }
892
Przemo Firsztd7cb3db2012-02-05 22:35:24 +0000893 power_supply_powers(&wdata->battery, &hdev->dev);
894
Przemo Firszt59d23342010-03-15 19:16:23 +0000895 wdata->ac.properties = wacom_ac_props;
896 wdata->ac.num_properties = ARRAY_SIZE(wacom_ac_props);
897 wdata->ac.get_property = wacom_ac_get_property;
898 wdata->ac.name = "wacom_ac";
899 wdata->ac.type = POWER_SUPPLY_TYPE_MAINS;
900 wdata->ac.use_for_apm = 0;
901
902 ret = power_supply_register(&hdev->dev, &wdata->ac);
903 if (ret) {
Axel Lin8908dd82012-09-17 16:53:54 +0800904 hid_err(hdev,
905 "can't create ac battery attribute, err: %d\n", ret);
David Herrmanndde58cf2011-09-05 18:45:28 +0200906 goto err_ac;
Przemo Firszt59d23342010-03-15 19:16:23 +0000907 }
Przemo Firsztd7cb3db2012-02-05 22:35:24 +0000908
909 power_supply_powers(&wdata->ac, &hdev->dev);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200910 return 0;
Daniel Mack987a6c02010-08-02 20:15:17 -0700911
David Herrmanndde58cf2011-09-05 18:45:28 +0200912err_ac:
913 power_supply_unregister(&wdata->battery);
914err_battery:
Axel Lin8908dd82012-09-17 16:53:54 +0800915 wacom_destroy_leds(hdev);
916 device_remove_file(&hdev->dev, &dev_attr_oled0_img);
917 device_remove_file(&hdev->dev, &dev_attr_oled1_img);
918 device_remove_file(&hdev->dev, &dev_attr_oled2_img);
919 device_remove_file(&hdev->dev, &dev_attr_oled3_img);
920 device_remove_file(&hdev->dev, &dev_attr_oled4_img);
921 device_remove_file(&hdev->dev, &dev_attr_oled5_img);
922 device_remove_file(&hdev->dev, &dev_attr_oled6_img);
923 device_remove_file(&hdev->dev, &dev_attr_oled7_img);
David Herrmanndde58cf2011-09-05 18:45:28 +0200924 device_remove_file(&hdev->dev, &dev_attr_speed);
925 hid_hw_stop(hdev);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200926err_free:
927 kfree(wdata);
928 return ret;
929}
930
931static void wacom_remove(struct hid_device *hdev)
932{
Przemo Firszt59d23342010-03-15 19:16:23 +0000933 struct wacom_data *wdata = hid_get_drvdata(hdev);
Przemo Firsztd13f5452012-05-10 19:23:52 +0100934
935 wacom_destroy_leds(hdev);
Przemo Firszte3c399e2012-07-31 18:27:56 +0100936 device_remove_file(&hdev->dev, &dev_attr_oled0_img);
937 device_remove_file(&hdev->dev, &dev_attr_oled1_img);
938 device_remove_file(&hdev->dev, &dev_attr_oled2_img);
939 device_remove_file(&hdev->dev, &dev_attr_oled3_img);
940 device_remove_file(&hdev->dev, &dev_attr_oled4_img);
941 device_remove_file(&hdev->dev, &dev_attr_oled5_img);
942 device_remove_file(&hdev->dev, &dev_attr_oled6_img);
943 device_remove_file(&hdev->dev, &dev_attr_oled7_img);
David Herrmann90866172011-09-05 18:45:29 +0200944 device_remove_file(&hdev->dev, &dev_attr_speed);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200945 hid_hw_stop(hdev);
Przemo Firszt59d23342010-03-15 19:16:23 +0000946
Przemo Firszt59d23342010-03-15 19:16:23 +0000947 power_supply_unregister(&wdata->battery);
948 power_supply_unregister(&wdata->ac);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200949 kfree(hid_get_drvdata(hdev));
950}
951
952static const struct hid_device_id wacom_devices[] = {
953 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
Przemo Firszt78761ff2011-11-05 11:28:22 +0000954 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
Jiri Kosinad5e0a062010-07-20 17:48:48 +0200955
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200956 { }
957};
958MODULE_DEVICE_TABLE(hid, wacom_devices);
959
960static struct hid_driver wacom_driver = {
961 .name = "wacom",
962 .id_table = wacom_devices,
963 .probe = wacom_probe,
964 .remove = wacom_remove,
965 .raw_event = wacom_raw_event,
David Herrmann3797ef62011-10-08 23:20:17 +0200966 .input_mapped = wacom_input_mapped,
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200967};
H Hartley Sweetenf4254582012-12-17 15:28:26 -0700968module_hid_driver(wacom_driver);
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200969
Przemo Firszt1fa2f722012-03-28 22:13:37 +0100970MODULE_DESCRIPTION("Driver for Wacom Graphire Bluetooth and Wacom Intuos4 WL");
Bastien Noceraca2dcd42009-05-11 17:18:12 +0200971MODULE_LICENSE("GPL");