diff options
author | Ping Cheng <pinglinux@gmail.com> | 2014-01-20 23:18:04 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2014-01-20 23:36:57 -0500 |
commit | 497ab1f290a26fa9414c5c316515f1e2ddba0803 (patch) | |
tree | ca82bc46cc8da06167edabd50a8d911592a9398a | |
parent | 713481620b60cb311486cac3c38b1185dec31f5d (diff) |
Input: wacom - add support for DTU-1031
Signed-off-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | drivers/input/tablet/wacom_wac.c | 72 | ||||
-rw-r--r-- | drivers/input/tablet/wacom_wac.h | 6 |
2 files changed, 76 insertions, 2 deletions
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 0bcc7a634214..05f371df6c40 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -210,6 +210,62 @@ static int wacom_dtu_irq(struct wacom_wac *wacom) | |||
210 | return 1; | 210 | return 1; |
211 | } | 211 | } |
212 | 212 | ||
213 | static int wacom_dtus_irq(struct wacom_wac *wacom) | ||
214 | { | ||
215 | char *data = wacom->data; | ||
216 | struct input_dev *input = wacom->input; | ||
217 | unsigned short prox, pressure = 0; | ||
218 | |||
219 | if (data[0] != WACOM_REPORT_DTUS && data[0] != WACOM_REPORT_DTUSPAD) { | ||
220 | dev_dbg(input->dev.parent, | ||
221 | "%s: received unknown report #%d", __func__, data[0]); | ||
222 | return 0; | ||
223 | } else if (data[0] == WACOM_REPORT_DTUSPAD) { | ||
224 | input_report_key(input, BTN_0, (data[1] & 0x01)); | ||
225 | input_report_key(input, BTN_1, (data[1] & 0x02)); | ||
226 | input_report_key(input, BTN_2, (data[1] & 0x04)); | ||
227 | input_report_key(input, BTN_3, (data[1] & 0x08)); | ||
228 | input_report_abs(input, ABS_MISC, | ||
229 | data[1] & 0x0f ? PAD_DEVICE_ID : 0); | ||
230 | /* | ||
231 | * Serial number is required when expresskeys are | ||
232 | * reported through pen interface. | ||
233 | */ | ||
234 | input_event(input, EV_MSC, MSC_SERIAL, 0xf0); | ||
235 | return 1; | ||
236 | } else { | ||
237 | prox = data[1] & 0x80; | ||
238 | if (prox) { | ||
239 | switch ((data[1] >> 3) & 3) { | ||
240 | case 1: /* Rubber */ | ||
241 | wacom->tool[0] = BTN_TOOL_RUBBER; | ||
242 | wacom->id[0] = ERASER_DEVICE_ID; | ||
243 | break; | ||
244 | |||
245 | case 2: /* Pen */ | ||
246 | wacom->tool[0] = BTN_TOOL_PEN; | ||
247 | wacom->id[0] = STYLUS_DEVICE_ID; | ||
248 | break; | ||
249 | } | ||
250 | } | ||
251 | |||
252 | input_report_key(input, BTN_STYLUS, data[1] & 0x20); | ||
253 | input_report_key(input, BTN_STYLUS2, data[1] & 0x40); | ||
254 | input_report_abs(input, ABS_X, get_unaligned_be16(&data[3])); | ||
255 | input_report_abs(input, ABS_Y, get_unaligned_be16(&data[5])); | ||
256 | pressure = ((data[1] & 0x03) << 8) | (data[2] & 0xff); | ||
257 | input_report_abs(input, ABS_PRESSURE, pressure); | ||
258 | input_report_key(input, BTN_TOUCH, pressure > 10); | ||
259 | |||
260 | if (!prox) /* out-prox */ | ||
261 | wacom->id[0] = 0; | ||
262 | input_report_key(input, wacom->tool[0], prox); | ||
263 | input_report_abs(input, ABS_MISC, wacom->id[0]); | ||
264 | input_event(input, EV_MSC, MSC_SERIAL, 1); | ||
265 | return 1; | ||
266 | } | ||
267 | } | ||
268 | |||
213 | static int wacom_graphire_irq(struct wacom_wac *wacom) | 269 | static int wacom_graphire_irq(struct wacom_wac *wacom) |
214 | { | 270 | { |
215 | struct wacom_features *features = &wacom->features; | 271 | struct wacom_features *features = &wacom->features; |
@@ -1371,6 +1427,10 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
1371 | sync = wacom_dtu_irq(wacom_wac); | 1427 | sync = wacom_dtu_irq(wacom_wac); |
1372 | break; | 1428 | break; |
1373 | 1429 | ||
1430 | case DTUS: | ||
1431 | sync = wacom_dtus_irq(wacom_wac); | ||
1432 | break; | ||
1433 | |||
1374 | case INTUOS: | 1434 | case INTUOS: |
1375 | case INTUOS3S: | 1435 | case INTUOS3S: |
1376 | case INTUOS3: | 1436 | case INTUOS3: |
@@ -1562,7 +1622,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1562 | 1622 | ||
1563 | wacom_abs_set_axis(input_dev, wacom_wac); | 1623 | wacom_abs_set_axis(input_dev, wacom_wac); |
1564 | 1624 | ||
1565 | switch (wacom_wac->features.type) { | 1625 | switch (features->type) { |
1566 | case WACOM_MO: | 1626 | case WACOM_MO: |
1567 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); | 1627 | input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); |
1568 | /* fall through */ | 1628 | /* fall through */ |
@@ -1773,8 +1833,14 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1773 | 1833 | ||
1774 | /* fall through */ | 1834 | /* fall through */ |
1775 | 1835 | ||
1836 | case DTUS: | ||
1776 | case PL: | 1837 | case PL: |
1777 | case DTU: | 1838 | case DTU: |
1839 | if (features->type == DTUS) { | ||
1840 | input_set_capability(input_dev, EV_MSC, MSC_SERIAL); | ||
1841 | for (i = 0; i < 3; i++) | ||
1842 | __set_bit(BTN_0 + i, input_dev->keybit); | ||
1843 | } | ||
1778 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); | 1844 | __set_bit(BTN_TOOL_PEN, input_dev->keybit); |
1779 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); | 1845 | __set_bit(BTN_TOOL_RUBBER, input_dev->keybit); |
1780 | __set_bit(BTN_STYLUS, input_dev->keybit); | 1846 | __set_bit(BTN_STYLUS, input_dev->keybit); |
@@ -2096,6 +2162,9 @@ static const struct wacom_features wacom_features_0xCE = | |||
2096 | static const struct wacom_features wacom_features_0xF0 = | 2162 | static const struct wacom_features wacom_features_0xF0 = |
2097 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, | 2163 | { "Wacom DTU1631", WACOM_PKGLEN_GRAPHIRE, 34623, 19553, 511, |
2098 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2164 | 0, DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2165 | static const struct wacom_features wacom_features_0xFB = | ||
2166 | { "Wacom DTU1031", WACOM_PKGLEN_DTUS, 22096, 13960, 511, | ||
2167 | 0, DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2099 | static const struct wacom_features wacom_features_0x57 = | 2168 | static const struct wacom_features wacom_features_0x57 = |
2100 | { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, | 2169 | { "Wacom DTK2241", WACOM_PKGLEN_INTUOS, 95840, 54260, 2047, |
2101 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES}; | 2170 | 63, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES}; |
@@ -2402,6 +2471,7 @@ const struct usb_device_id wacom_ids[] = { | |||
2402 | { USB_DEVICE_WACOM(0xF8) }, | 2471 | { USB_DEVICE_WACOM(0xF8) }, |
2403 | { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, | 2472 | { USB_DEVICE_DETAILED(0xF6, USB_CLASS_HID, 0, 0) }, |
2404 | { USB_DEVICE_WACOM(0xFA) }, | 2473 | { USB_DEVICE_WACOM(0xFA) }, |
2474 | { USB_DEVICE_WACOM(0xFB) }, | ||
2405 | { USB_DEVICE_WACOM(0x0307) }, | 2475 | { USB_DEVICE_WACOM(0x0307) }, |
2406 | { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) }, | 2476 | { USB_DEVICE_DETAILED(0x0309, USB_CLASS_HID, 0, 0) }, |
2407 | { USB_DEVICE_LENOVO(0x6004) }, | 2477 | { USB_DEVICE_LENOVO(0x6004) }, |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 3600cf705fb1..f69c0ebe7fa9 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -12,7 +12,7 @@ | |||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | 13 | ||
14 | /* maximum packet length for USB devices */ | 14 | /* maximum packet length for USB devices */ |
15 | #define WACOM_PKGLEN_MAX 64 | 15 | #define WACOM_PKGLEN_MAX 68 |
16 | 16 | ||
17 | #define WACOM_NAME_MAX 64 | 17 | #define WACOM_NAME_MAX 64 |
18 | 18 | ||
@@ -29,6 +29,7 @@ | |||
29 | #define WACOM_PKGLEN_WIRELESS 32 | 29 | #define WACOM_PKGLEN_WIRELESS 32 |
30 | #define WACOM_PKGLEN_MTOUCH 62 | 30 | #define WACOM_PKGLEN_MTOUCH 62 |
31 | #define WACOM_PKGLEN_MTTPC 40 | 31 | #define WACOM_PKGLEN_MTTPC 40 |
32 | #define WACOM_PKGLEN_DTUS 68 | ||
32 | 33 | ||
33 | /* wacom data size per MT contact */ | 34 | /* wacom data size per MT contact */ |
34 | #define WACOM_BYTES_PER_MT_PACKET 11 | 35 | #define WACOM_BYTES_PER_MT_PACKET 11 |
@@ -47,11 +48,13 @@ | |||
47 | #define WACOM_REPORT_INTUOSWRITE 6 | 48 | #define WACOM_REPORT_INTUOSWRITE 6 |
48 | #define WACOM_REPORT_INTUOSPAD 12 | 49 | #define WACOM_REPORT_INTUOSPAD 12 |
49 | #define WACOM_REPORT_INTUOS5PAD 3 | 50 | #define WACOM_REPORT_INTUOS5PAD 3 |
51 | #define WACOM_REPORT_DTUSPAD 21 | ||
50 | #define WACOM_REPORT_TPC1FG 6 | 52 | #define WACOM_REPORT_TPC1FG 6 |
51 | #define WACOM_REPORT_TPC2FG 13 | 53 | #define WACOM_REPORT_TPC2FG 13 |
52 | #define WACOM_REPORT_TPCMT 13 | 54 | #define WACOM_REPORT_TPCMT 13 |
53 | #define WACOM_REPORT_TPCHID 15 | 55 | #define WACOM_REPORT_TPCHID 15 |
54 | #define WACOM_REPORT_TPCST 16 | 56 | #define WACOM_REPORT_TPCST 16 |
57 | #define WACOM_REPORT_DTUS 17 | ||
55 | #define WACOM_REPORT_TPC1FGE 18 | 58 | #define WACOM_REPORT_TPC1FGE 18 |
56 | #define WACOM_REPORT_24HDT 1 | 59 | #define WACOM_REPORT_24HDT 1 |
57 | #define WACOM_REPORT_WL 128 | 60 | #define WACOM_REPORT_WL 128 |
@@ -70,6 +73,7 @@ enum { | |||
70 | PTU, | 73 | PTU, |
71 | PL, | 74 | PL, |
72 | DTU, | 75 | DTU, |
76 | DTUS, | ||
73 | INTUOS, | 77 | INTUOS, |
74 | INTUOS3S, | 78 | INTUOS3S, |
75 | INTUOS3, | 79 | INTUOS3, |