Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

Pull HID updates from Jiri Kosina:
"to receive patches queued for 4.3 merge window in HID tree. Highlights:

- a lot of improvements (regarding supported features and devices) to
Wacom driver, from Aaron Skomra and Jason Gerecke
- a lot of functional fixes and support for large I2C transfer to
cp2112 driver, from Ellen Wang
- HW support improvements to RMI driver, from Andrew Duggan
- quite some small fixes and device ID additions all over the place"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (44 commits)
HID: wacom: wacom_setup_numbered_buttons is local to wacom_wac
HID: wacom: Add support for Express Key Remote.
HID: wacom: Set button bits based on a new numbered_buttons
HID: quirks: add QUIRK_NOGET for an other TPV touchscreen
HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error
HID: i2c-hid: Only disable irq wake if it was successfully enabled during suspend
HID: wacom: Use tablet-provided touch height/width values for INTUOSHT
HID: gembird: add new driver to fix Gembird JPD-DualForce 2
HID: lenovo: Hide middle-button press until release
HID: lenovo: Add missing return-value check
HID: lenovo: Use constants for axes names
HID: wacom: Simplify 'wacom_pl_irq'
HID: wacom: Do not repeatedly attempt to set device mode on error
HID: wacom: Do not repeatedly attempt to set device mode on error
HID: wacom: Remove WACOM_QUIRK_NO_INPUT
HID: wacom: Replace WACOM_QUIRK_MONITOR with WACOM_DEVICETYPE_WL_MONITOR
HID: wacom: Use calculated pkglen for wireless touch interface
HID: sony: Fix DS4 controller reporting rate issues
HID: chicony: Add support for Acer Aspire Switch 12
HID: hid-lg: Add USBID for Logitech G29 Wheel
...

+1145 -309
+19
Documentation/ABI/testing/sysfs-driver-wacom
··· 77 77 The format is also scrambled, like in the USB mode, and it can 78 78 be summarized by converting 76543210 into GECA6420. 79 79 HGFEDCBA HFDB7531 80 + 81 + What: /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/wacom_remote/unpair_remote 82 + Date: July 2015 83 + Contact: linux-input@vger.kernel.org 84 + Description: 85 + Writing the character sequence '*' followed by a newline to 86 + this file will delete all of the current pairings on the 87 + device. Other character sequences are reserved. This file is 88 + write only. 89 + 90 + What: /sys/bus/hid/devices/<bus>:<vid>:<pid>.<n>/wacom_remote/<serial_number>/remote_mode 91 + Date: July 2015 92 + Contact: linux-input@vger.kernel.org 93 + Description: 94 + Reading from this file reports the mode status of the 95 + remote as indicated by the LED lights on the device. If no 96 + reports have been received from the paired device, reading 97 + from this file will report '-1'. The mode is read-only 98 + and cannot be set through the driver.
+7
drivers/hid/Kconfig
··· 251 251 ---help--- 252 252 Support for Ezkey BTC 8193 keyboard. 253 253 254 + config HID_GEMBIRD 255 + tristate "Gembird Joypad" 256 + depends on HID 257 + ---help--- 258 + Support for Gembird JPD-DualForce 2. 259 + 254 260 config HID_HOLTEK 255 261 tristate "Holtek HID devices" 256 262 depends on USB_HID ··· 486 480 - Atmel panels 487 481 - Cando dual touch panels 488 482 - Chunghwa panels 483 + - CJTouch panels 489 484 - CVTouch panels 490 485 - Cypress TrueTouch panels 491 486 - Elan Microelectronics touch panels
+1
drivers/hid/Makefile
··· 36 36 obj-$(CONFIG_HID_ELECOM) += hid-elecom.o 37 37 obj-$(CONFIG_HID_ELO) += hid-elo.o 38 38 obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 39 + obj-$(CONFIG_HID_GEMBIRD) += hid-gembird.o 39 40 obj-$(CONFIG_HID_GT683R) += hid-gt683r.o 40 41 obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 41 42 obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
+26
drivers/hid/hid-chicony.c
··· 20 20 #include <linux/input.h> 21 21 #include <linux/hid.h> 22 22 #include <linux/module.h> 23 + #include <linux/usb.h> 23 24 24 25 #include "hid-ids.h" 25 26 ··· 58 57 return 1; 59 58 } 60 59 60 + static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc, 61 + unsigned int *rsize) 62 + { 63 + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); 64 + 65 + if (intf->cur_altsetting->desc.bInterfaceNumber == 1) { 66 + /* Change usage maximum and logical maximum from 0x7fff to 67 + * 0x2fff, so they don't exceed HID_MAX_USAGES */ 68 + switch (hdev->product) { 69 + case USB_DEVICE_ID_CHICONY_ACER_SWITCH12: 70 + if (*rsize >= 128 && rdesc[64] == 0xff && rdesc[65] == 0x7f 71 + && rdesc[69] == 0xff && rdesc[70] == 0x7f) { 72 + hid_info(hdev, "Fixing up report descriptor\n"); 73 + rdesc[65] = rdesc[70] = 0x2f; 74 + } 75 + break; 76 + } 77 + 78 + } 79 + return rdesc; 80 + } 81 + 82 + 61 83 static const struct hid_device_id ch_devices[] = { 62 84 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 63 85 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, 64 86 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, 87 + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, 65 88 { } 66 89 }; 67 90 MODULE_DEVICE_TABLE(hid, ch_devices); ··· 93 68 static struct hid_driver ch_driver = { 94 69 .name = "chicony", 95 70 .id_table = ch_devices, 71 + .report_fixup = ch_switch12_report_fixup, 96 72 .input_mapping = ch_input_mapping, 97 73 }; 98 74 module_hid_driver(ch_driver);
+26 -3
drivers/hid/hid-core.c
··· 427 427 { 428 428 __u32 data; 429 429 unsigned n; 430 + __u32 count; 430 431 431 432 data = item_udata(item); 432 433 ··· 490 489 491 490 if (item->size <= 2) 492 491 data = (parser->global.usage_page << 16) + data; 492 + 493 + count = data - parser->local.usage_minimum; 494 + if (count + parser->local.usage_index >= HID_MAX_USAGES) { 495 + /* 496 + * We do not warn if the name is not set, we are 497 + * actually pre-scanning the device. 498 + */ 499 + if (dev_name(&parser->device->dev)) 500 + hid_warn(parser->device, 501 + "ignoring exceeding usage max\n"); 502 + data = HID_MAX_USAGES - parser->local.usage_index + 503 + parser->local.usage_minimum - 1; 504 + if (data <= 0) { 505 + hid_err(parser->device, 506 + "no more usage index available\n"); 507 + return -1; 508 + } 509 + } 493 510 494 511 for (n = parser->local.usage_minimum; n <= data; n++) 495 512 if (hid_add_usage(parser, n)) { ··· 724 705 hid->group = HID_GROUP_SENSOR_HUB; 725 706 726 707 if (hid->vendor == USB_VENDOR_ID_MICROSOFT && 727 - (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || 728 - hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP || 708 + (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 || 709 + hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP || 710 + hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 || 729 711 hid->product == USB_DEVICE_ID_MS_POWER_COVER) && 730 712 hid->group == HID_GROUP_MULTITOUCH) 731 713 hid->group = HID_GROUP_GENERIC; ··· 1827 1807 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) }, 1828 1808 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) }, 1829 1809 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) }, 1810 + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) }, 1830 1811 { HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) }, 1831 1812 { HID_USB_DEVICE(USB_VENDOR_ID_CYGNAL, USB_DEVICE_ID_CYGNAL_CP2112) }, 1832 1813 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, ··· 1844 1823 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1845 1824 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1846 1825 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1826 + { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, 1847 1827 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 1848 1828 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) }, 1849 1829 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, ··· 1927 1905 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, 1928 1906 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 1929 1907 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) }, 1908 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) }, 1909 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) }, 1930 1910 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) }, 1931 - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) }, 1932 1911 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) }, 1933 1912 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1934 1913 { HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
+80 -27
drivers/hid/hid-cp2112.c
··· 156 156 wait_queue_head_t wait; 157 157 u8 read_data[61]; 158 158 u8 read_length; 159 + u8 hwversion; 159 160 int xfer_status; 160 161 atomic_t read_avail; 161 162 atomic_t xfer_avail; ··· 447 446 return data_length + 3; 448 447 } 449 448 449 + static int cp2112_i2c_write_read_req(void *buf, u8 slave_address, 450 + u8 *addr, int addr_length, 451 + int read_length) 452 + { 453 + struct cp2112_write_read_req_report *report = buf; 454 + 455 + if (read_length < 1 || read_length > 512 || 456 + addr_length > sizeof(report->target_address)) 457 + return -EINVAL; 458 + 459 + report->report = CP2112_DATA_WRITE_READ_REQUEST; 460 + report->slave_address = slave_address << 1; 461 + report->length = cpu_to_be16(read_length); 462 + report->target_address_length = addr_length; 463 + memcpy(report->target_address, addr, addr_length); 464 + return addr_length + 5; 465 + } 466 + 450 467 static int cp2112_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, 451 468 int num) 452 469 { ··· 472 453 struct hid_device *hdev = dev->hdev; 473 454 u8 buf[64]; 474 455 ssize_t count; 456 + ssize_t read_length = 0; 457 + u8 *read_buf = NULL; 475 458 unsigned int retries; 476 459 int ret; 477 460 478 461 hid_dbg(hdev, "I2C %d messages\n", num); 479 462 480 - if (num != 1) { 463 + if (num == 1) { 464 + if (msgs->flags & I2C_M_RD) { 465 + hid_dbg(hdev, "I2C read %#04x len %d\n", 466 + msgs->addr, msgs->len); 467 + read_length = msgs->len; 468 + read_buf = msgs->buf; 469 + count = cp2112_read_req(buf, msgs->addr, msgs->len); 470 + } else { 471 + hid_dbg(hdev, "I2C write %#04x len %d\n", 472 + msgs->addr, msgs->len); 473 + count = cp2112_i2c_write_req(buf, msgs->addr, 474 + msgs->buf, msgs->len); 475 + } 476 + if (count < 0) 477 + return count; 478 + } else if (dev->hwversion > 1 && /* no repeated start in rev 1 */ 479 + num == 2 && 480 + msgs[0].addr == msgs[1].addr && 481 + !(msgs[0].flags & I2C_M_RD) && (msgs[1].flags & I2C_M_RD)) { 482 + hid_dbg(hdev, "I2C write-read %#04x wlen %d rlen %d\n", 483 + msgs[0].addr, msgs[0].len, msgs[1].len); 484 + read_length = msgs[1].len; 485 + read_buf = msgs[1].buf; 486 + count = cp2112_i2c_write_read_req(buf, msgs[0].addr, 487 + msgs[0].buf, msgs[0].len, msgs[1].len); 488 + if (count < 0) 489 + return count; 490 + } else { 481 491 hid_err(hdev, 482 492 "Multi-message I2C transactions not supported\n"); 483 493 return -EOPNOTSUPP; 484 494 } 485 - 486 - if (msgs->flags & I2C_M_RD) 487 - count = cp2112_read_req(buf, msgs->addr, msgs->len); 488 - else 489 - count = cp2112_i2c_write_req(buf, msgs->addr, msgs->buf, 490 - msgs->len); 491 - 492 - if (count < 0) 493 - return count; 494 495 495 496 ret = hid_hw_power(hdev, PM_HINT_FULLON); 496 497 if (ret < 0) { ··· 547 508 goto power_normal; 548 509 } 549 510 550 - if (!(msgs->flags & I2C_M_RD)) 551 - goto finish; 552 - 553 - ret = cp2112_read(dev, msgs->buf, msgs->len); 554 - if (ret < 0) 555 - goto power_normal; 556 - if (ret != msgs->len) { 557 - hid_warn(hdev, "short read: %d < %d\n", ret, msgs->len); 558 - ret = -EIO; 559 - goto power_normal; 511 + for (count = 0; count < read_length;) { 512 + ret = cp2112_read(dev, read_buf + count, read_length - count); 513 + if (ret < 0) 514 + goto power_normal; 515 + if (ret == 0) { 516 + hid_err(hdev, "read returned 0\n"); 517 + ret = -EIO; 518 + goto power_normal; 519 + } 520 + count += ret; 521 + if (count > read_length) { 522 + /* 523 + * The hardware returned too much data. 524 + * This is mostly harmless because cp2112_read() 525 + * has a limit check so didn't overrun our 526 + * buffer. Nevertheless, we return an error 527 + * because something is seriously wrong and 528 + * it shouldn't go unnoticed. 529 + */ 530 + hid_err(hdev, "long read: %d > %zd\n", 531 + ret, read_length - count + ret); 532 + ret = -EIO; 533 + goto power_normal; 534 + } 560 535 } 561 536 562 - finish: 563 537 /* return the number of transferred messages */ 564 - ret = 1; 538 + ret = num; 565 539 566 540 power_normal: 567 541 hid_hw_power(hdev, PM_HINT_NORMAL); ··· 589 537 struct cp2112_device *dev = (struct cp2112_device *)adap->algo_data; 590 538 struct hid_device *hdev = dev->hdev; 591 539 u8 buf[64]; 592 - __be16 word; 540 + __le16 word; 593 541 ssize_t count; 594 542 size_t read_length = 0; 595 543 unsigned int retries; ··· 606 554 if (I2C_SMBUS_READ == read_write) 607 555 count = cp2112_read_req(buf, addr, read_length); 608 556 else 609 - count = cp2112_write_req(buf, addr, data->byte, NULL, 557 + count = cp2112_write_req(buf, addr, command, NULL, 610 558 0); 611 559 break; 612 560 case I2C_SMBUS_BYTE_DATA: ··· 621 569 break; 622 570 case I2C_SMBUS_WORD_DATA: 623 571 read_length = 2; 624 - word = cpu_to_be16(data->word); 572 + word = cpu_to_le16(data->word); 625 573 626 574 if (I2C_SMBUS_READ == read_write) 627 575 count = cp2112_write_read_req(buf, addr, read_length, ··· 634 582 size = I2C_SMBUS_WORD_DATA; 635 583 read_write = I2C_SMBUS_READ; 636 584 read_length = 2; 637 - word = cpu_to_be16(data->word); 585 + word = cpu_to_le16(data->word); 638 586 639 587 count = cp2112_write_read_req(buf, addr, read_length, command, 640 588 (u8 *)&word, 2); ··· 727 675 data->byte = buf[0]; 728 676 break; 729 677 case I2C_SMBUS_WORD_DATA: 730 - data->word = be16_to_cpup((__be16 *)buf); 678 + data->word = le16_to_cpup((__le16 *)buf); 731 679 break; 732 680 case I2C_SMBUS_BLOCK_DATA: 733 681 if (read_length > I2C_SMBUS_BLOCK_MAX) { ··· 1082 1030 dev->adap.dev.parent = &hdev->dev; 1083 1031 snprintf(dev->adap.name, sizeof(dev->adap.name), 1084 1032 "CP2112 SMBus Bridge on hiddev%d", hdev->minor); 1033 + dev->hwversion = buf[2]; 1085 1034 init_waitqueue_head(&dev->wait); 1086 1035 1087 1036 hid_device_io_start(hdev);
+116
drivers/hid/hid-gembird.c
··· 1 + /* 2 + * HID driver for Gembird Joypad, "PC Game Controller" 3 + * 4 + * Copyright (c) 2015 Red Hat, Inc 5 + * Copyright (c) 2015 Benjamin Tissoires 6 + */ 7 + 8 + /* 9 + * This program is free software; you can redistribute it and/or modify it 10 + * under the terms of the GNU General Public License as published by the Free 11 + * Software Foundation; either version 2 of the License, or (at your option) 12 + * any later version. 13 + */ 14 + 15 + #include <linux/device.h> 16 + #include <linux/hid.h> 17 + #include <linux/module.h> 18 + 19 + #include "hid-ids.h" 20 + 21 + #define GEMBIRD_START_FAULTY_RDESC 8 22 + 23 + static const __u8 gembird_jpd_faulty_rdesc[] = { 24 + 0x75, 0x08, /* Report Size (8) */ 25 + 0x95, 0x05, /* Report Count (5) */ 26 + 0x15, 0x00, /* Logical Minimum (0) */ 27 + 0x26, 0xff, 0x00, /* Logical Maximum (255) */ 28 + 0x35, 0x00, /* Physical Minimum (0) */ 29 + 0x46, 0xff, 0x00, /* Physical Maximum (255) */ 30 + 0x09, 0x30, /* Usage (X) */ 31 + 0x09, 0x31, /* Usage (Y) */ 32 + 0x09, 0x32, /* Usage (Z) */ 33 + 0x09, 0x32, /* Usage (Z) */ 34 + 0x09, 0x35, /* Usage (Rz) */ 35 + 0x81, 0x02, /* Input (Data,Var,Abs) */ 36 + }; 37 + 38 + /* 39 + * we fix the report descriptor by: 40 + * - marking the first Z axis as constant (so it is ignored by HID) 41 + * - assign the original second Z to Rx 42 + * - assign the original Rz to Ry 43 + */ 44 + static const __u8 gembird_jpd_fixed_rdesc[] = { 45 + 0x75, 0x08, /* Report Size (8) */ 46 + 0x95, 0x02, /* Report Count (2) */ 47 + 0x15, 0x00, /* Logical Minimum (0) */ 48 + 0x26, 0xff, 0x00, /* Logical Maximum (255) */ 49 + 0x35, 0x00, /* Physical Minimum (0) */ 50 + 0x46, 0xff, 0x00, /* Physical Maximum (255) */ 51 + 0x09, 0x30, /* Usage (X) */ 52 + 0x09, 0x31, /* Usage (Y) */ 53 + 0x81, 0x02, /* Input (Data,Var,Abs) */ 54 + 0x95, 0x01, /* Report Count (1) */ 55 + 0x09, 0x32, /* Usage (Z) */ 56 + 0x81, 0x01, /* Input (Cnst,Arr,Abs) */ 57 + 0x95, 0x02, /* Report Count (2) */ 58 + 0x09, 0x33, /* Usage (Rx) */ 59 + 0x09, 0x34, /* Usage (Ry) */ 60 + 0x81, 0x02, /* Input (Data,Var,Abs) */ 61 + }; 62 + 63 + static __u8 *gembird_report_fixup(struct hid_device *hdev, __u8 *rdesc, 64 + unsigned int *rsize) 65 + { 66 + __u8 *new_rdesc; 67 + /* delta_size is > 0 */ 68 + size_t delta_size = sizeof(gembird_jpd_fixed_rdesc) - 69 + sizeof(gembird_jpd_faulty_rdesc); 70 + size_t new_size = *rsize + delta_size; 71 + 72 + if (*rsize >= 31 && !memcmp(&rdesc[GEMBIRD_START_FAULTY_RDESC], 73 + gembird_jpd_faulty_rdesc, 74 + sizeof(gembird_jpd_faulty_rdesc))) { 75 + new_rdesc = devm_kzalloc(&hdev->dev, new_size, GFP_KERNEL); 76 + if (new_rdesc == NULL) 77 + return rdesc; 78 + 79 + dev_info(&hdev->dev, 80 + "fixing Gembird JPD-DualForce 2 report descriptor.\n"); 81 + 82 + /* start by copying the end of the rdesc */ 83 + memcpy(new_rdesc + delta_size, rdesc, *rsize); 84 + 85 + /* add the correct beginning */ 86 + memcpy(new_rdesc, rdesc, GEMBIRD_START_FAULTY_RDESC); 87 + 88 + /* replace the faulty part with the fixed one */ 89 + memcpy(new_rdesc + GEMBIRD_START_FAULTY_RDESC, 90 + gembird_jpd_fixed_rdesc, 91 + sizeof(gembird_jpd_fixed_rdesc)); 92 + 93 + *rsize = new_size; 94 + rdesc = new_rdesc; 95 + } 96 + 97 + return rdesc; 98 + } 99 + 100 + static const struct hid_device_id gembird_devices[] = { 101 + { HID_USB_DEVICE(USB_VENDOR_ID_GEMBIRD, 102 + USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2) }, 103 + { } 104 + }; 105 + MODULE_DEVICE_TABLE(hid, gembird_devices); 106 + 107 + static struct hid_driver gembird_driver = { 108 + .name = "gembird", 109 + .id_table = gembird_devices, 110 + .report_fixup = gembird_report_fixup, 111 + }; 112 + module_hid_driver(gembird_driver); 113 + 114 + MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); 115 + MODULE_DESCRIPTION("HID Gembird joypad driver"); 116 + MODULE_LICENSE("GPL");
+17 -3
drivers/hid/hid-ids.h
··· 233 233 #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053 234 234 #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 235 235 #define USB_DEVICE_ID_CHICONY_AK1D 0x1125 236 + #define USB_DEVICE_ID_CHICONY_ACER_SWITCH12 0x1421 236 237 237 238 #define USB_VENDOR_ID_CHUNGHWAT 0x2247 238 239 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH 0x0001 239 240 240 241 #define USB_VENDOR_ID_CIDC 0x1677 242 + 243 + #define USB_VENDOR_ID_CJTOUCH 0x24b8 244 + #define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020 245 + #define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040 0x0040 241 246 242 247 #define USB_VENDOR_ID_CMEDIA 0x0d8c 243 248 #define USB_DEVICE_ID_CM109 0x000e ··· 362 357 #define USB_VENDOR_ID_GAMERON 0x0810 363 358 #define USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR 0x0001 364 359 #define USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR 0x0002 360 + 361 + #define USB_VENDOR_ID_GEMBIRD 0x11ff 362 + #define USB_DEVICE_ID_GEMBIRD_JPD_DUALFORCE2 0x3331 365 363 366 364 #define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 367 365 #define USB_DEVICE_ID_GENERAL_TOUCH_WIN7_TWOFINGERS 0x0003 ··· 508 500 #define USB_VENDOR_ID_IRTOUCHSYSTEMS 0x6615 509 501 #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB 0x0070 510 502 503 + #define USB_VENDOR_ID_ITE 0x048d 504 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386 505 + 511 506 #define USB_VENDOR_ID_JABRA 0x0b0e 512 507 #define USB_DEVICE_ID_JABRA_SPEAK_410 0x0412 513 508 #define USB_DEVICE_ID_JABRA_SPEAK_510 0x0420 ··· 613 602 #define USB_DEVICE_ID_LOGITECH_DUAL_ACTION 0xc216 614 603 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2 0xc218 615 604 #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2 0xc219 605 + #define USB_DEVICE_ID_LOGITECH_G29_WHEEL 0xc24f 616 606 #define USB_DEVICE_ID_LOGITECH_WINGMAN_F3D 0xc283 617 607 #define USB_DEVICE_ID_LOGITECH_FORCE3D_PRO 0xc286 618 608 #define USB_DEVICE_ID_LOGITECH_FLIGHT_SYSTEM_G940 0xc287 ··· 678 666 #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 679 667 #define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 680 668 #define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9 681 - #define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc 682 - #define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd 669 + #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 0x07dc 670 + #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd 671 + #define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07de 683 672 #define USB_DEVICE_ID_MS_POWER_COVER 0x07da 684 673 685 674 #define USB_VENDOR_ID_MOJO 0x8282 ··· 938 925 #define USB_DEVICE_ID_TOUCHPACK_RTS 0x1688 939 926 940 927 #define USB_VENDOR_ID_TPV 0x25aa 941 - #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN 0x8883 928 + #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882 929 + #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 942 930 943 931 #define USB_VENDOR_ID_TURBOX 0x062a 944 932 #define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
+4 -1
drivers/hid/hid-input.c
··· 1166 1166 1167 1167 input_event(input, usage->type, usage->code, value); 1168 1168 1169 - if ((field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->type == EV_KEY)) 1169 + if ((field->flags & HID_MAIN_ITEM_RELATIVE) && 1170 + usage->type == EV_KEY && value) { 1171 + input_sync(input); 1170 1172 input_event(input, usage->type, usage->code, 0); 1173 + } 1171 1174 } 1172 1175 1173 1176 void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
+56 -3
drivers/hid/hid-lenovo.c
··· 37 37 }; 38 38 39 39 struct lenovo_drvdata_cptkbd { 40 + u8 middlebutton_state; /* 0:Up, 1:Down (undecided), 2:Scrolling */ 40 41 bool fn_lock; 41 42 int sensitivity; 42 43 }; ··· 147 146 148 147 switch (usage->hid & HID_USAGE) { 149 148 case 0x0000: 150 - hid_map_usage(hi, usage, bit, max, EV_REL, 0x06); 149 + hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); 151 150 return 1; 152 151 case 0x0001: 153 - hid_map_usage(hi, usage, bit, max, EV_REL, 0x08); 152 + hid_map_usage(hi, usage, bit, max, EV_REL, REL_WHEEL); 154 153 return 1; 155 154 default: 156 155 return -1; ··· 208 207 struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 209 208 210 209 ret = lenovo_send_cmd_cptkbd(hdev, 0x05, cptkbd_data->fn_lock); 211 - ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); 212 210 if (ret) 213 211 hid_err(hdev, "Fn-lock setting failed: %d\n", ret); 212 + 213 + ret = lenovo_send_cmd_cptkbd(hdev, 0x02, cptkbd_data->sensitivity); 214 + if (ret) 215 + hid_err(hdev, "Sensitivity setting failed: %d\n", ret); 214 216 } 215 217 216 218 static ssize_t attr_fn_lock_show_cptkbd(struct device *dev, ··· 315 311 } 316 312 317 313 return 0; 314 + } 315 + 316 + static int lenovo_event_cptkbd(struct hid_device *hdev, 317 + struct hid_field *field, struct hid_usage *usage, __s32 value) 318 + { 319 + struct lenovo_drvdata_cptkbd *cptkbd_data = hid_get_drvdata(hdev); 320 + 321 + /* "wheel" scroll events */ 322 + if (usage->type == EV_REL && (usage->code == REL_WHEEL || 323 + usage->code == REL_HWHEEL)) { 324 + /* Scroll events disable middle-click event */ 325 + cptkbd_data->middlebutton_state = 2; 326 + return 0; 327 + } 328 + 329 + /* Middle click events */ 330 + if (usage->type == EV_KEY && usage->code == BTN_MIDDLE) { 331 + if (value == 1) { 332 + cptkbd_data->middlebutton_state = 1; 333 + } else if (value == 0) { 334 + if (cptkbd_data->middlebutton_state == 1) { 335 + /* No scrolling inbetween, send middle-click */ 336 + input_event(field->hidinput->input, 337 + EV_KEY, BTN_MIDDLE, 1); 338 + input_sync(field->hidinput->input); 339 + input_event(field->hidinput->input, 340 + EV_KEY, BTN_MIDDLE, 0); 341 + input_sync(field->hidinput->input); 342 + } 343 + cptkbd_data->middlebutton_state = 0; 344 + } 345 + return 1; 346 + } 347 + 348 + return 0; 349 + } 350 + 351 + static int lenovo_event(struct hid_device *hdev, struct hid_field *field, 352 + struct hid_usage *usage, __s32 value) 353 + { 354 + switch (hdev->product) { 355 + case USB_DEVICE_ID_LENOVO_CUSBKBD: 356 + case USB_DEVICE_ID_LENOVO_CBTKBD: 357 + return lenovo_event_cptkbd(hdev, field, usage, value); 358 + default: 359 + return 0; 360 + } 318 361 } 319 362 320 363 static int lenovo_features_set_tpkbd(struct hid_device *hdev) ··· 756 705 hid_warn(hdev, "Failed to switch middle button: %d\n", ret); 757 706 758 707 /* Set keyboard settings to known state */ 708 + cptkbd_data->middlebutton_state = 0; 759 709 cptkbd_data->fn_lock = true; 760 710 cptkbd_data->sensitivity = 0x05; 761 711 lenovo_features_set_cptkbd(hdev); ··· 884 832 .probe = lenovo_probe, 885 833 .remove = lenovo_remove, 886 834 .raw_event = lenovo_raw_event, 835 + .event = lenovo_event, 887 836 .report_fixup = lenovo_report_fixup, 888 837 }; 889 838 module_hid_driver(lenovo_driver);
+2
drivers/hid/hid-lg.c
··· 776 776 .driver_data = LG_FF }, 777 777 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RUMBLEPAD2_2), 778 778 .driver_data = LG_FF }, 779 + { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_G29_WHEEL), 780 + .driver_data = LG_FF4 }, 779 781 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_WINGMAN_F3D), 780 782 .driver_data = LG_FF }, 781 783 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_FORCE3D_PRO),
+4 -2
drivers/hid/hid-microsoft.c
··· 276 276 .driver_data = MS_NOGET }, 277 277 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), 278 278 .driver_data = MS_DUPLICATE_USAGES }, 279 - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3), 279 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3), 280 280 .driver_data = MS_HIDINPUT }, 281 - { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP), 281 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP), 282 + .driver_data = MS_HIDINPUT }, 283 + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3), 282 284 .driver_data = MS_HIDINPUT }, 283 285 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), 284 286 .driver_data = MS_HIDINPUT },
+8
drivers/hid/hid-multitouch.c
··· 1145 1145 MT_USB_DEVICE(USB_VENDOR_ID_CHUNGHWAT, 1146 1146 USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH) }, 1147 1147 1148 + /* CJTouch panels */ 1149 + { .driver_data = MT_CLS_NSMU, 1150 + MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, 1151 + USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020) }, 1152 + { .driver_data = MT_CLS_NSMU, 1153 + MT_USB_DEVICE(USB_VENDOR_ID_CJTOUCH, 1154 + USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040) }, 1155 + 1148 1156 /* CVTouch panels */ 1149 1157 { .driver_data = MT_CLS_NSMU, 1150 1158 MT_USB_DEVICE(USB_VENDOR_ID_CVTOUCH,
+1 -2
drivers/hid/hid-picolcd_backlight.c
··· 94 94 struct backlight_device *bdev = data->backlight; 95 95 96 96 data->backlight = NULL; 97 - if (bdev) 98 - backlight_device_unregister(bdev); 97 + backlight_device_unregister(bdev); 99 98 } 100 99 101 100 int picolcd_resume_backlight(struct picolcd_data *data)
+1 -2
drivers/hid/hid-picolcd_cir.c
··· 145 145 struct rc_dev *rdev = data->rc_dev; 146 146 147 147 data->rc_dev = NULL; 148 - if (rdev) 149 - rc_unregister_device(rdev); 148 + rc_unregister_device(rdev); 150 149 } 151 150
+1 -2
drivers/hid/hid-picolcd_lcd.c
··· 92 92 struct lcd_device *ldev = data->lcd; 93 93 94 94 data->lcd = NULL; 95 - if (ldev) 96 - lcd_device_unregister(ldev); 95 + lcd_device_unregister(ldev); 97 96 } 98 97 99 98 int picolcd_resume_lcd(struct picolcd_data *data)
+147 -16
drivers/hid/hid-rmi.c
··· 33 33 #define RMI_READ_DATA_PENDING 1 34 34 #define RMI_STARTED 2 35 35 36 + #define RMI_SLEEP_NORMAL 0x0 37 + #define RMI_SLEEP_DEEP_SLEEP 0x1 38 + 36 39 /* device flags */ 37 40 #define RMI_DEVICE BIT(0) 38 41 #define RMI_DEVICE_HAS_PHYS_BUTTONS BIT(1) 42 + 43 + /* 44 + * retrieve the ctrl registers 45 + * the ctrl register has a size of 20 but a fw bug split it into 16 + 4, 46 + * and there is no way to know if the first 20 bytes are here or not. 47 + * We use only the first 12 bytes, so get only them. 48 + */ 49 + #define RMI_F11_CTRL_REG_COUNT 12 39 50 40 51 enum rmi_mode_type { 41 52 RMI_MODE_OFF = 0, ··· 124 113 unsigned int max_y; 125 114 unsigned int x_size_mm; 126 115 unsigned int y_size_mm; 116 + bool read_f11_ctrl_regs; 117 + u8 f11_ctrl_regs[RMI_F11_CTRL_REG_COUNT]; 127 118 128 119 unsigned int gpio_led_count; 129 120 unsigned int button_count; ··· 139 126 140 127 unsigned long device_flags; 141 128 unsigned long firmware_id; 129 + 130 + u8 f01_ctrl0; 131 + u8 interrupt_enable_mask; 132 + bool restore_interrupt_mask; 142 133 }; 143 134 144 135 #define RMI_PAGE(addr) (((addr) >> 8) & 0xff) ··· 363 346 } 364 347 } 365 348 349 + static int rmi_reset_attn_mode(struct hid_device *hdev) 350 + { 351 + struct rmi_data *data = hid_get_drvdata(hdev); 352 + int ret; 353 + 354 + ret = rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); 355 + if (ret) 356 + return ret; 357 + 358 + if (data->restore_interrupt_mask) { 359 + ret = rmi_write(hdev, data->f01.control_base_addr + 1, 360 + &data->interrupt_enable_mask); 361 + if (ret) { 362 + hid_err(hdev, "can not write F01 control register\n"); 363 + return ret; 364 + } 365 + } 366 + 367 + return 0; 368 + } 369 + 366 370 static void rmi_reset_work(struct work_struct *work) 367 371 { 368 372 struct rmi_data *hdata = container_of(work, struct rmi_data, 369 373 reset_work); 370 374 371 375 /* switch the device to RMI if we receive a generic mouse report */ 372 - rmi_set_mode(hdata->hdev, RMI_MODE_ATTN_REPORTS); 376 + rmi_reset_attn_mode(hdata->hdev); 373 377 } 374 378 375 379 static inline int rmi_schedule_reset(struct hid_device *hdev) ··· 570 532 } 571 533 572 534 #ifdef CONFIG_PM 535 + static int rmi_set_sleep_mode(struct hid_device *hdev, int sleep_mode) 536 + { 537 + struct rmi_data *data = hid_get_drvdata(hdev); 538 + int ret; 539 + u8 f01_ctrl0; 540 + 541 + f01_ctrl0 = (data->f01_ctrl0 & ~0x3) | sleep_mode; 542 + 543 + ret = rmi_write(hdev, data->f01.control_base_addr, 544 + &f01_ctrl0); 545 + if (ret) { 546 + hid_err(hdev, "can not write sleep mode\n"); 547 + return ret; 548 + } 549 + 550 + return 0; 551 + } 552 + 553 + static int rmi_suspend(struct hid_device *hdev, pm_message_t message) 554 + { 555 + struct rmi_data *data = hid_get_drvdata(hdev); 556 + int ret; 557 + u8 buf[RMI_F11_CTRL_REG_COUNT]; 558 + 559 + ret = rmi_read_block(hdev, data->f11.control_base_addr, buf, 560 + RMI_F11_CTRL_REG_COUNT); 561 + if (ret) 562 + hid_warn(hdev, "can not read F11 control registers\n"); 563 + else 564 + memcpy(data->f11_ctrl_regs, buf, RMI_F11_CTRL_REG_COUNT); 565 + 566 + 567 + if (!device_may_wakeup(hdev->dev.parent)) 568 + return rmi_set_sleep_mode(hdev, RMI_SLEEP_DEEP_SLEEP); 569 + 570 + return 0; 571 + } 572 + 573 573 static int rmi_post_reset(struct hid_device *hdev) 574 574 { 575 - return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); 575 + struct rmi_data *data = hid_get_drvdata(hdev); 576 + int ret; 577 + 578 + ret = rmi_reset_attn_mode(hdev); 579 + if (ret) { 580 + hid_err(hdev, "can not set rmi mode\n"); 581 + return ret; 582 + } 583 + 584 + if (data->read_f11_ctrl_regs) { 585 + ret = rmi_write_block(hdev, data->f11.control_base_addr, 586 + data->f11_ctrl_regs, RMI_F11_CTRL_REG_COUNT); 587 + if (ret) 588 + hid_warn(hdev, 589 + "can not write F11 control registers after reset\n"); 590 + } 591 + 592 + if (!device_may_wakeup(hdev->dev.parent)) { 593 + ret = rmi_set_sleep_mode(hdev, RMI_SLEEP_NORMAL); 594 + if (ret) { 595 + hid_err(hdev, "can not write sleep mode\n"); 596 + return ret; 597 + } 598 + } 599 + 600 + return ret; 576 601 } 577 602 578 603 static int rmi_post_resume(struct hid_device *hdev) 579 604 { 580 - return rmi_set_mode(hdev, RMI_MODE_ATTN_REPORTS); 605 + return rmi_reset_attn_mode(hdev); 581 606 } 582 607 #endif /* CONFIG_PM */ 583 608 ··· 696 595 f->interrupt_count = pdt_entry->interrupt_source_count; 697 596 f->irq_mask = rmi_gen_mask(f->interrupt_base, 698 597 f->interrupt_count); 598 + data->interrupt_enable_mask |= f->irq_mask; 699 599 } 700 600 } 701 601 ··· 832 730 833 731 data->firmware_id = info[1] << 8 | info[0]; 834 732 data->firmware_id += info[2] * 65536; 733 + } 734 + 735 + ret = rmi_read_block(hdev, data->f01.control_base_addr, info, 736 + 2); 737 + 738 + if (ret) { 739 + hid_err(hdev, "can not read f01 ctrl registers\n"); 740 + return ret; 741 + } 742 + 743 + data->f01_ctrl0 = info[0]; 744 + 745 + if (!info[1]) { 746 + /* 747 + * Do to a firmware bug in some touchpads the F01 interrupt 748 + * enable control register will be cleared on reset. 749 + * This will stop the touchpad from reporting data, so 750 + * if F01 CTRL1 is 0 then we need to explicitly enable 751 + * interrupts for the functions we want data for. 752 + */ 753 + data->restore_interrupt_mask = true; 754 + 755 + ret = rmi_write(hdev, data->f01.control_base_addr + 1, 756 + &data->interrupt_enable_mask); 757 + if (ret) { 758 + hid_err(hdev, "can not write to control reg 1: %d.\n", 759 + ret); 760 + return ret; 761 + } 835 762 } 836 763 837 764 return 0; ··· 1035 904 if (has_data40) 1036 905 data->f11.report_size += data->max_fingers * 2; 1037 906 1038 - /* 1039 - * retrieve the ctrl registers 1040 - * the ctrl register has a size of 20 but a fw bug split it into 16 + 4, 1041 - * and there is no way to know if the first 20 bytes are here or not. 1042 - * We use only the first 12 bytes, so get only them. 1043 - */ 1044 - ret = rmi_read_block(hdev, data->f11.control_base_addr, buf, 12); 907 + ret = rmi_read_block(hdev, data->f11.control_base_addr, 908 + data->f11_ctrl_regs, RMI_F11_CTRL_REG_COUNT); 1045 909 if (ret) { 1046 910 hid_err(hdev, "can not read ctrl block of size 11: %d.\n", ret); 1047 911 return ret; 1048 912 } 1049 913 1050 - data->max_x = buf[6] | (buf[7] << 8); 1051 - data->max_y = buf[8] | (buf[9] << 8); 914 + /* data->f11_ctrl_regs now contains valid register data */ 915 + data->read_f11_ctrl_regs = true; 916 + 917 + data->max_x = data->f11_ctrl_regs[6] | (data->f11_ctrl_regs[7] << 8); 918 + data->max_y = data->f11_ctrl_regs[8] | (data->f11_ctrl_regs[9] << 8); 1052 919 1053 920 if (has_dribble) { 1054 - buf[0] = buf[0] & ~BIT(6); 1055 - ret = rmi_write(hdev, data->f11.control_base_addr, buf); 921 + data->f11_ctrl_regs[0] = data->f11_ctrl_regs[0] & ~BIT(6); 922 + ret = rmi_write(hdev, data->f11.control_base_addr, 923 + data->f11_ctrl_regs); 1056 924 if (ret) { 1057 925 hid_err(hdev, "can not write to control reg 0: %d.\n", 1058 926 ret); ··· 1060 930 } 1061 931 1062 932 if (has_palm_detect) { 1063 - buf[11] = buf[11] & ~BIT(0); 933 + data->f11_ctrl_regs[11] = data->f11_ctrl_regs[11] & ~BIT(0); 1064 934 ret = rmi_write(hdev, data->f11.control_base_addr + 11, 1065 - &buf[11]); 935 + &data->f11_ctrl_regs[11]); 1066 936 if (ret) { 1067 937 hid_err(hdev, "can not write to control reg 11: %d.\n", 1068 938 ret); ··· 1403 1273 .input_mapping = rmi_input_mapping, 1404 1274 .input_configured = rmi_input_configured, 1405 1275 #ifdef CONFIG_PM 1276 + .suspend = rmi_suspend, 1406 1277 .resume = rmi_post_resume, 1407 1278 .reset_resume = rmi_post_reset, 1408 1279 #endif
+3
drivers/hid/hid-sensor-hub.c
··· 774 774 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_TEXAS_INSTRUMENTS, 775 775 USB_DEVICE_ID_TEXAS_INSTRUMENTS_LENOVO_YOGA), 776 776 .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, 777 + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, USB_VENDOR_ID_ITE, 778 + USB_DEVICE_ID_ITE_LENOVO_YOGA), 779 + .driver_data = HID_SENSOR_HUB_ENUM_QUIRK}, 777 780 { HID_DEVICE(HID_BUS_ANY, HID_GROUP_SENSOR_HUB, HID_ANY_ID, 778 781 HID_ANY_ID) }, 779 782 { }
+20 -2
drivers/hid/hid-sony.c
··· 296 296 0x09, 0x01, /* Usage (Pointer), */ 297 297 0x81, 0x02, /* Input (Variable), */ 298 298 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 299 - 0x95, 0x20, /* Report Count (26), */ 299 + 0x95, 0x01, /* Report Count (1), */ 300 + 0x81, 0x02, /* Input (Variable), */ 301 + 0x05, 0x01, /* Usage Page (Desktop), */ 302 + 0x95, 0x01, /* Report Count (1), */ 303 + 0x09, 0x01, /* Usage (Pointer), */ 304 + 0x81, 0x02, /* Input (Variable), */ 305 + 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 306 + 0x95, 0x1E, /* Report Count (24), */ 300 307 0x81, 0x02, /* Input (Variable), */ 301 308 0x75, 0x08, /* Report Size (8), */ 302 309 0x95, 0x30, /* Report Count (48), */ ··· 1277 1270 * has to be BYTE_SWAPPED before passing up to joystick interface 1278 1271 */ 1279 1272 if ((sc->quirks & SIXAXIS_CONTROLLER) && rd[0] == 0x01 && size == 49) { 1273 + /* 1274 + * When connected via Bluetooth the Sixaxis occasionally sends 1275 + * a report with the second byte 0xff and the rest zeroed. 1276 + * 1277 + * This report does not reflect the actual state of the 1278 + * controller must be ignored to avoid generating false input 1279 + * events. 1280 + */ 1281 + if (rd[1] == 0xff) 1282 + return -EINVAL; 1283 + 1280 1284 swap(rd[41], rd[42]); 1281 1285 swap(rd[43], rd[44]); 1282 1286 swap(rd[45], rd[46]); ··· 1854 1836 } else { 1855 1837 memset(buf, 0, DS4_REPORT_0x11_SIZE); 1856 1838 buf[0] = 0x11; 1857 - buf[1] = 0xB0; 1839 + buf[1] = 0x80; 1858 1840 buf[3] = 0x0F; 1859 1841 offset = 6; 1860 1842 }
+22 -6
drivers/hid/i2c-hid/i2c-hid.c
··· 149 149 int irq; 150 150 151 151 struct i2c_hid_platform_data pdata; 152 + 153 + bool irq_wake_enabled; 152 154 }; 153 155 154 156 static int __i2c_hid_command(struct i2c_client *client, ··· 1093 1091 struct i2c_hid *ihid = i2c_get_clientdata(client); 1094 1092 struct hid_device *hid = ihid->hid; 1095 1093 int ret = 0; 1096 - 1097 - disable_irq(ihid->irq); 1098 - if (device_may_wakeup(&client->dev)) 1099 - enable_irq_wake(ihid->irq); 1094 + int wake_status; 1100 1095 1101 1096 if (hid->driver && hid->driver->suspend) 1102 1097 ret = hid->driver->suspend(hid, PMSG_SUSPEND); 1098 + 1099 + disable_irq(ihid->irq); 1100 + if (device_may_wakeup(&client->dev)) { 1101 + wake_status = enable_irq_wake(ihid->irq); 1102 + if (!wake_status) 1103 + ihid->irq_wake_enabled = true; 1104 + else 1105 + hid_warn(hid, "Failed to enable irq wake: %d\n", 1106 + wake_status); 1107 + } 1103 1108 1104 1109 /* Save some power */ 1105 1110 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); ··· 1120 1111 struct i2c_client *client = to_i2c_client(dev); 1121 1112 struct i2c_hid *ihid = i2c_get_clientdata(client); 1122 1113 struct hid_device *hid = ihid->hid; 1114 + int wake_status; 1123 1115 1124 1116 enable_irq(ihid->irq); 1125 1117 ret = i2c_hid_hwreset(client); 1126 1118 if (ret) 1127 1119 return ret; 1128 1120 1129 - if (device_may_wakeup(&client->dev)) 1130 - disable_irq_wake(ihid->irq); 1121 + if (device_may_wakeup(&client->dev) && ihid->irq_wake_enabled) { 1122 + wake_status = disable_irq_wake(ihid->irq); 1123 + if (!wake_status) 1124 + ihid->irq_wake_enabled = false; 1125 + else 1126 + hid_warn(hid, "Failed to disable irq wake: %d\n", 1127 + wake_status); 1128 + } 1131 1129 1132 1130 if (hid->driver && hid->driver->reset_resume) { 1133 1131 ret = hid->driver->reset_resume(hid);
+3 -2
drivers/hid/usbhid/hid-core.c
··· 164 164 if (time_after(jiffies, usbhid->stop_retry)) { 165 165 166 166 /* Retries failed, so do a port reset unless we lack bandwidth*/ 167 - if (test_bit(HID_NO_BANDWIDTH, &usbhid->iofl) 167 + if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl) 168 168 && !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) { 169 169 170 170 schedule_work(&usbhid->reset_work); ··· 710 710 * Wait 50 msec for the queue to empty before allowing events 711 711 * to go through hid. 712 712 */ 713 - msleep(50); 713 + if (res == 0 && !(hid->quirks & HID_QUIRK_ALWAYS_POLL)) 714 + msleep(50); 714 715 clear_bit(HID_RESUME_RUNNING, &usbhid->iofl); 715 716 } 716 717 done:
+4 -2
drivers/hid/usbhid/hid-quirks.c
··· 90 90 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2, HID_QUIRK_NO_INIT_REPORTS }, 91 91 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2, HID_QUIRK_NO_INIT_REPORTS }, 92 92 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2, HID_QUIRK_NO_INIT_REPORTS }, 93 + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, HID_QUIRK_NO_INIT_REPORTS }, 94 + { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS }, 93 95 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS }, 94 - { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS }, 95 96 { USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS }, 96 97 { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, 97 98 { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, ··· 118 117 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, 119 118 { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET }, 120 119 { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, 121 - { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET }, 120 + { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882, HID_QUIRK_NOGET }, 121 + { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883, HID_QUIRK_NOGET }, 122 122 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 123 123 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, 124 124 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT },
+6 -1
drivers/hid/wacom.h
··· 113 113 struct mutex lock; 114 114 struct work_struct work; 115 115 struct wacom_led { 116 - u8 select[2]; /* status led selector (0..3) */ 116 + u8 select[5]; /* status led selector (0..3) */ 117 117 u8 llv; /* status led brightness no button (1..127) */ 118 118 u8 hlv; /* status led brightness button pressed (1..127) */ 119 119 u8 img_lum; /* OLED matrix display brightness */ ··· 123 123 struct power_supply *ac; 124 124 struct power_supply_desc battery_desc; 125 125 struct power_supply_desc ac_desc; 126 + struct kobject *remote_dir; 127 + struct attribute_group remote_group[5]; 126 128 }; 127 129 128 130 static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) ··· 149 147 struct hid_usage *usage, __s32 value); 150 148 void wacom_wac_report(struct hid_device *hdev, struct hid_report *report); 151 149 void wacom_battery_work(struct work_struct *work); 150 + int wacom_remote_create_attr_group(struct wacom *wacom, __u32 serial, 151 + int index); 152 + void wacom_remote_destroy_attr_group(struct wacom *wacom, __u32 serial); 152 153 #endif
+228 -57
drivers/hid/wacom_sys.c
··· 23 23 #define WAC_CMD_ICON_XFER 0x23 24 24 #define WAC_CMD_ICON_BT_XFER 0x26 25 25 #define WAC_CMD_RETRIES 10 26 + #define WAC_CMD_DELETE_PAIRING 0x20 27 + #define WAC_CMD_UNPAIR_ALL 0xFF 28 + #define WAC_REMOTE_SERIAL_MAX_STRLEN 9 26 29 27 30 #define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP) 28 31 #define DEV_ATTR_WO_PERM (S_IWUSR | S_IWGRP) 32 + #define DEV_ATTR_RO_PERM (S_IRUSR | S_IRGRP) 29 33 30 34 static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf, 31 35 size_t size, unsigned int retries) ··· 339 335 if (error >= 0) 340 336 error = wacom_get_report(hdev, HID_FEATURE_REPORT, 341 337 rep_data, length, 1); 342 - } while ((error < 0 || rep_data[1] != mode) && limit++ < WAC_MSG_RETRIES); 338 + } while (error >= 0 && rep_data[1] != mode && limit++ < WAC_MSG_RETRIES); 343 339 344 340 kfree(rep_data); 345 341 ··· 457 453 * interface number. 458 454 */ 459 455 if (features->type == WIRELESS) { 460 - if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { 456 + if (intf->cur_altsetting->desc.bInterfaceNumber == 0) 457 + features->device_type = WACOM_DEVICETYPE_WL_MONITOR; 458 + else 461 459 features->device_type = WACOM_DEVICETYPE_NONE; 462 - } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { 463 - features->device_type |= WACOM_DEVICETYPE_TOUCH; 464 - features->pktlen = WACOM_PKGLEN_BBTOUCH3; 465 - } 460 + return; 466 461 } 467 462 468 463 wacom_parse_hid(hdev, features); ··· 1123 1120 static DEVICE_ATTR(speed, DEV_ATTR_RW_PERM, 1124 1121 wacom_show_speed, wacom_store_speed); 1125 1122 1123 + 1124 + static ssize_t wacom_show_remote_mode(struct kobject *kobj, 1125 + struct kobj_attribute *kattr, 1126 + char *buf, int index) 1127 + { 1128 + struct device *dev = container_of(kobj->parent, struct device, kobj); 1129 + struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1130 + struct wacom *wacom = hid_get_drvdata(hdev); 1131 + u8 mode; 1132 + 1133 + mode = wacom->led.select[index]; 1134 + if (mode >= 0 && mode < 3) 1135 + return snprintf(buf, PAGE_SIZE, "%d\n", mode); 1136 + else 1137 + return snprintf(buf, PAGE_SIZE, "%d\n", -1); 1138 + } 1139 + 1140 + #define DEVICE_EKR_ATTR_GROUP(SET_ID) \ 1141 + static ssize_t wacom_show_remote##SET_ID##_mode(struct kobject *kobj, \ 1142 + struct kobj_attribute *kattr, char *buf) \ 1143 + { \ 1144 + return wacom_show_remote_mode(kobj, kattr, buf, SET_ID); \ 1145 + } \ 1146 + static struct kobj_attribute remote##SET_ID##_mode_attr = { \ 1147 + .attr = {.name = "remote_mode", \ 1148 + .mode = DEV_ATTR_RO_PERM}, \ 1149 + .show = wacom_show_remote##SET_ID##_mode, \ 1150 + }; \ 1151 + static struct attribute *remote##SET_ID##_serial_attrs[] = { \ 1152 + &remote##SET_ID##_mode_attr.attr, \ 1153 + NULL \ 1154 + }; \ 1155 + static struct attribute_group remote##SET_ID##_serial_group = { \ 1156 + .name = NULL, \ 1157 + .attrs = remote##SET_ID##_serial_attrs, \ 1158 + } 1159 + 1160 + DEVICE_EKR_ATTR_GROUP(0); 1161 + DEVICE_EKR_ATTR_GROUP(1); 1162 + DEVICE_EKR_ATTR_GROUP(2); 1163 + DEVICE_EKR_ATTR_GROUP(3); 1164 + DEVICE_EKR_ATTR_GROUP(4); 1165 + 1166 + int wacom_remote_create_attr_group(struct wacom *wacom, __u32 serial, int index) 1167 + { 1168 + int error = 0; 1169 + char *buf; 1170 + struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1171 + 1172 + wacom_wac->serial[index] = serial; 1173 + 1174 + buf = kzalloc(WAC_REMOTE_SERIAL_MAX_STRLEN, GFP_KERNEL); 1175 + if (!buf) 1176 + return -ENOMEM; 1177 + snprintf(buf, WAC_REMOTE_SERIAL_MAX_STRLEN, "%d", serial); 1178 + wacom->remote_group[index].name = buf; 1179 + 1180 + error = sysfs_create_group(wacom->remote_dir, 1181 + &wacom->remote_group[index]); 1182 + if (error) { 1183 + hid_err(wacom->hdev, 1184 + "cannot create sysfs group err: %d\n", error); 1185 + kobject_put(wacom->remote_dir); 1186 + return error; 1187 + } 1188 + 1189 + return 0; 1190 + } 1191 + 1192 + void wacom_remote_destroy_attr_group(struct wacom *wacom, __u32 serial) 1193 + { 1194 + struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1195 + int i; 1196 + 1197 + if (!serial) 1198 + return; 1199 + 1200 + for (i = 0; i < WACOM_MAX_REMOTES; i++) { 1201 + if (wacom_wac->serial[i] == serial) { 1202 + wacom_wac->serial[i] = 0; 1203 + wacom->led.select[i] = WACOM_STATUS_UNKNOWN; 1204 + if (wacom->remote_group[i].name) { 1205 + sysfs_remove_group(wacom->remote_dir, 1206 + &wacom->remote_group[i]); 1207 + kfree(wacom->remote_group[i].name); 1208 + wacom->remote_group[i].name = NULL; 1209 + } 1210 + } 1211 + } 1212 + } 1213 + 1214 + static int wacom_cmd_unpair_remote(struct wacom *wacom, unsigned char selector) 1215 + { 1216 + const size_t buf_size = 2; 1217 + unsigned char *buf; 1218 + int retval; 1219 + 1220 + buf = kzalloc(buf_size, GFP_KERNEL); 1221 + if (!buf) 1222 + return -ENOMEM; 1223 + 1224 + buf[0] = WAC_CMD_DELETE_PAIRING; 1225 + buf[1] = selector; 1226 + 1227 + retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf, 1228 + buf_size, WAC_CMD_RETRIES); 1229 + kfree(buf); 1230 + 1231 + return retval; 1232 + } 1233 + 1234 + static ssize_t wacom_store_unpair_remote(struct kobject *kobj, 1235 + struct kobj_attribute *attr, 1236 + const char *buf, size_t count) 1237 + { 1238 + unsigned char selector = 0; 1239 + struct device *dev = container_of(kobj->parent, struct device, kobj); 1240 + struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1241 + struct wacom *wacom = hid_get_drvdata(hdev); 1242 + int err; 1243 + 1244 + if (!strncmp(buf, "*\n", 2)) { 1245 + selector = WAC_CMD_UNPAIR_ALL; 1246 + } else { 1247 + hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n", 1248 + buf); 1249 + return -1; 1250 + } 1251 + 1252 + mutex_lock(&wacom->lock); 1253 + 1254 + err = wacom_cmd_unpair_remote(wacom, selector); 1255 + mutex_unlock(&wacom->lock); 1256 + 1257 + return err < 0 ? err : count; 1258 + } 1259 + 1260 + static struct kobj_attribute unpair_remote_attr = { 1261 + .attr = {.name = "unpair_remote", .mode = 0200}, 1262 + .store = wacom_store_unpair_remote, 1263 + }; 1264 + 1265 + static const struct attribute *remote_unpair_attrs[] = { 1266 + &unpair_remote_attr.attr, 1267 + NULL 1268 + }; 1269 + 1270 + static int wacom_initialize_remote(struct wacom *wacom) 1271 + { 1272 + int error = 0; 1273 + struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1274 + int i; 1275 + 1276 + if (wacom->wacom_wac.features.type != REMOTE) 1277 + return 0; 1278 + 1279 + wacom->remote_group[0] = remote0_serial_group; 1280 + wacom->remote_group[1] = remote1_serial_group; 1281 + wacom->remote_group[2] = remote2_serial_group; 1282 + wacom->remote_group[3] = remote3_serial_group; 1283 + wacom->remote_group[4] = remote4_serial_group; 1284 + 1285 + wacom->remote_dir = kobject_create_and_add("wacom_remote", 1286 + &wacom->hdev->dev.kobj); 1287 + if (!wacom->remote_dir) 1288 + return -ENOMEM; 1289 + 1290 + error = sysfs_create_files(wacom->remote_dir, remote_unpair_attrs); 1291 + 1292 + if (error) { 1293 + hid_err(wacom->hdev, 1294 + "cannot create sysfs group err: %d\n", error); 1295 + return error; 1296 + } 1297 + 1298 + for (i = 0; i < WACOM_MAX_REMOTES; i++) { 1299 + wacom->led.select[i] = WACOM_STATUS_UNKNOWN; 1300 + wacom_wac->serial[i] = 0; 1301 + } 1302 + 1303 + return 0; 1304 + } 1305 + 1126 1306 static struct input_dev *wacom_allocate_input(struct wacom *wacom) 1127 1307 { 1128 1308 struct input_dev *input_dev; ··· 1316 1130 if (!input_dev) 1317 1131 return NULL; 1318 1132 1319 - input_dev->name = wacom_wac->pen_name; 1133 + input_dev->name = wacom_wac->features.name; 1320 1134 input_dev->phys = hdev->phys; 1321 1135 input_dev->dev.parent = &hdev->dev; 1322 1136 input_dev->open = wacom_open; ··· 1329 1143 input_set_drvdata(input_dev, wacom); 1330 1144 1331 1145 return input_dev; 1332 - } 1333 - 1334 - static void wacom_free_inputs(struct wacom *wacom) 1335 - { 1336 - struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1337 - 1338 - if (wacom_wac->pen_input) 1339 - input_free_device(wacom_wac->pen_input); 1340 - if (wacom_wac->touch_input) 1341 - input_free_device(wacom_wac->touch_input); 1342 - if (wacom_wac->pad_input) 1343 - input_free_device(wacom_wac->pad_input); 1344 - wacom_wac->pen_input = NULL; 1345 - wacom_wac->touch_input = NULL; 1346 - wacom_wac->pad_input = NULL; 1347 - } 1348 - 1349 - static int wacom_allocate_inputs(struct wacom *wacom) 1350 - { 1351 - struct input_dev *pen_input_dev, *touch_input_dev, *pad_input_dev; 1352 - struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1353 - 1354 - pen_input_dev = wacom_allocate_input(wacom); 1355 - touch_input_dev = wacom_allocate_input(wacom); 1356 - pad_input_dev = wacom_allocate_input(wacom); 1357 - if (!pen_input_dev || !touch_input_dev || !pad_input_dev) { 1358 - wacom_free_inputs(wacom); 1359 - return -ENOMEM; 1360 - } 1361 - 1362 - wacom_wac->pen_input = pen_input_dev; 1363 - wacom_wac->touch_input = touch_input_dev; 1364 - wacom_wac->touch_input->name = wacom_wac->touch_name; 1365 - wacom_wac->pad_input = pad_input_dev; 1366 - wacom_wac->pad_input->name = wacom_wac->pad_name; 1367 - 1368 - return 0; 1369 1146 } 1370 1147 1371 1148 static void wacom_clean_inputs(struct wacom *wacom) ··· 1351 1202 else 1352 1203 input_free_device(wacom->wacom_wac.pad_input); 1353 1204 } 1205 + if (wacom->remote_dir) 1206 + kobject_put(wacom->remote_dir); 1354 1207 wacom->wacom_wac.pen_input = NULL; 1355 1208 wacom->wacom_wac.touch_input = NULL; 1356 1209 wacom->wacom_wac.pad_input = NULL; 1357 1210 wacom_destroy_leds(wacom); 1211 + } 1212 + 1213 + static int wacom_allocate_inputs(struct wacom *wacom) 1214 + { 1215 + struct wacom_wac *wacom_wac = &(wacom->wacom_wac); 1216 + 1217 + wacom_wac->pen_input = wacom_allocate_input(wacom); 1218 + wacom_wac->touch_input = wacom_allocate_input(wacom); 1219 + wacom_wac->pad_input = wacom_allocate_input(wacom); 1220 + if (!wacom_wac->pen_input || !wacom_wac->touch_input || !wacom_wac->pad_input) { 1221 + wacom_clean_inputs(wacom); 1222 + return -ENOMEM; 1223 + } 1224 + 1225 + wacom_wac->pen_input->name = wacom_wac->pen_name; 1226 + wacom_wac->touch_input->name = wacom_wac->touch_name; 1227 + wacom_wac->pad_input->name = wacom_wac->pad_name; 1228 + 1229 + return 0; 1358 1230 } 1359 1231 1360 1232 static int wacom_register_inputs(struct wacom *wacom) ··· 1432 1262 error = wacom_initialize_leds(wacom); 1433 1263 if (error) 1434 1264 goto fail_leds; 1265 + 1266 + error = wacom_initialize_remote(wacom); 1267 + if (error) 1268 + goto fail_remote; 1435 1269 } 1436 1270 1437 1271 return 0; 1438 1272 1273 + fail_remote: 1274 + wacom_destroy_leds(wacom); 1439 1275 fail_leds: 1440 1276 input_unregister_device(pad_input_dev); 1441 1277 pad_input_dev = NULL; ··· 1732 1556 mutex_init(&wacom->lock); 1733 1557 INIT_WORK(&wacom->work, wacom_wireless_work); 1734 1558 1735 - if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { 1736 - error = wacom_allocate_inputs(wacom); 1737 - if (error) 1738 - goto fail_allocate_inputs; 1739 - } 1559 + error = wacom_allocate_inputs(wacom); 1560 + if (error) 1561 + goto fail_allocate_inputs; 1740 1562 1741 1563 /* 1742 1564 * Bamboo Pad has a generic hid handling for the Pen, and we switch it ··· 1780 1606 if (error) 1781 1607 goto fail_shared_data; 1782 1608 1783 - if (!(features->quirks & WACOM_QUIRK_MONITOR) && 1609 + if (!(features->device_type & WACOM_DEVICETYPE_WL_MONITOR) && 1784 1610 (features->quirks & WACOM_QUIRK_BATTERY)) { 1785 1611 error = wacom_initialize_battery(wacom); 1786 1612 if (error) 1787 1613 goto fail_battery; 1788 1614 } 1789 1615 1790 - if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { 1791 - error = wacom_register_inputs(wacom); 1792 - if (error) 1793 - goto fail_register_inputs; 1794 - } 1616 + error = wacom_register_inputs(wacom); 1617 + if (error) 1618 + goto fail_register_inputs; 1795 1619 1796 1620 if (hdev->bus == BUS_BLUETOOTH) { 1797 1621 error = device_create_file(&hdev->dev, &dev_attr_speed); ··· 1812 1640 /* Note that if query fails it is not a hard failure */ 1813 1641 wacom_query_tablet_data(hdev, features); 1814 1642 1815 - if (features->quirks & WACOM_QUIRK_MONITOR) 1643 + if (features->device_type & WACOM_DEVICETYPE_WL_MONITOR) 1816 1644 error = hid_hw_open(hdev); 1817 1645 1818 1646 if (wacom_wac->features.type == INTUOSHT && ··· 1886 1714 .id_table = wacom_ids, 1887 1715 .probe = wacom_probe, 1888 1716 .remove = wacom_remove, 1889 - .event = wacom_wac_event, 1890 1717 .report = wacom_wac_report, 1891 1718 #ifdef CONFIG_PM 1892 1719 .resume = wacom_resume,
+331 -175
drivers/hid/wacom_wac.c
··· 125 125 126 126 prox = data[1] & 0x40; 127 127 128 - if (prox) { 129 - wacom->id[0] = ERASER_DEVICE_ID; 130 - pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 131 - if (features->pressure_max > 255) 132 - pressure = (pressure << 1) | ((data[4] >> 6) & 1); 133 - pressure += (features->pressure_max + 1) / 2; 134 - 135 - /* 136 - * if going from out of proximity into proximity select between the eraser 137 - * and the pen based on the state of the stylus2 button, choose eraser if 138 - * pressed else choose pen. if not a proximity change from out to in, send 139 - * an out of proximity for previous tool then a in for new tool. 140 - */ 141 - if (!wacom->tool[0]) { 142 - /* Eraser bit set for DTF */ 143 - if (data[1] & 0x10) 144 - wacom->tool[1] = BTN_TOOL_RUBBER; 145 - else 146 - /* Going into proximity select tool */ 147 - wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; 148 - } else { 149 - /* was entered with stylus2 pressed */ 150 - if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { 151 - /* report out proximity for previous tool */ 152 - input_report_key(input, wacom->tool[1], 0); 153 - input_sync(input); 154 - wacom->tool[1] = BTN_TOOL_PEN; 155 - return 0; 156 - } 128 + if (!wacom->id[0]) { 129 + if ((data[0] & 0x10) || (data[4] & 0x20)) { 130 + wacom->tool[0] = BTN_TOOL_RUBBER; 131 + wacom->id[0] = ERASER_DEVICE_ID; 157 132 } 158 - if (wacom->tool[1] != BTN_TOOL_RUBBER) { 159 - /* Unknown tool selected default to pen tool */ 160 - wacom->tool[1] = BTN_TOOL_PEN; 133 + else { 134 + wacom->tool[0] = BTN_TOOL_PEN; 161 135 wacom->id[0] = STYLUS_DEVICE_ID; 162 136 } 163 - input_report_key(input, wacom->tool[1], prox); /* report in proximity for tool */ 164 - input_report_abs(input, ABS_MISC, wacom->id[0]); /* report tool id */ 165 - input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 166 - input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 167 - input_report_abs(input, ABS_PRESSURE, pressure); 168 - 169 - input_report_key(input, BTN_TOUCH, data[4] & 0x08); 170 - input_report_key(input, BTN_STYLUS, data[4] & 0x10); 171 - /* Only allow the stylus2 button to be reported for the pen tool. */ 172 - input_report_key(input, BTN_STYLUS2, (wacom->tool[1] == BTN_TOOL_PEN) && (data[4] & 0x20)); 173 - } else { 174 - /* report proximity-out of a (valid) tool */ 175 - if (wacom->tool[1] != BTN_TOOL_RUBBER) { 176 - /* Unknown tool selected default to pen tool */ 177 - wacom->tool[1] = BTN_TOOL_PEN; 178 - } 179 - input_report_key(input, wacom->tool[1], prox); 180 137 } 181 138 182 - wacom->tool[0] = prox; /* Save proximity state */ 139 + /* If the eraser is in prox, STYLUS2 is always set. If we 140 + * mis-detected the type and notice that STYLUS2 isn't set 141 + * then force the eraser out of prox and let the pen in. 142 + */ 143 + if (wacom->tool[0] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { 144 + input_report_key(input, BTN_TOOL_RUBBER, 0); 145 + input_report_abs(input, ABS_MISC, 0); 146 + input_sync(input); 147 + wacom->tool[0] = BTN_TOOL_PEN; 148 + wacom->id[0] = STYLUS_DEVICE_ID; 149 + } 150 + 151 + pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); 152 + if (features->pressure_max > 255) 153 + pressure = (pressure << 1) | ((data[4] >> 6) & 1); 154 + pressure += (features->pressure_max + 1) / 2; 155 + 156 + input_report_abs(input, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); 157 + input_report_abs(input, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); 158 + input_report_abs(input, ABS_PRESSURE, pressure); 159 + 160 + input_report_key(input, BTN_TOUCH, data[4] & 0x08); 161 + input_report_key(input, BTN_STYLUS, data[4] & 0x10); 162 + /* Only allow the stylus2 button to be reported for the pen tool. */ 163 + input_report_key(input, BTN_STYLUS2, (wacom->tool[0] == BTN_TOOL_PEN) && (data[4] & 0x20)); 164 + 165 + if (!prox) 166 + wacom->id[0] = 0; 167 + input_report_key(input, wacom->tool[0], prox); 168 + input_report_abs(input, ABS_MISC, wacom->id[0]); 183 169 return 1; 184 170 } 185 171 ··· 626 640 /* but reschedule a read of the current tool */ 627 641 wacom_intuos_schedule_prox_event(wacom); 628 642 return 1; 643 + } 644 + 645 + return 0; 646 + } 647 + 648 + static int wacom_remote_irq(struct wacom_wac *wacom_wac, size_t len) 649 + { 650 + unsigned char *data = wacom_wac->data; 651 + struct input_dev *input = wacom_wac->pad_input; 652 + struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); 653 + struct wacom_features *features = &wacom_wac->features; 654 + int bat_charging, bat_percent, touch_ring_mode; 655 + __u32 serial; 656 + int i; 657 + 658 + if (data[0] != WACOM_REPORT_REMOTE) { 659 + dev_dbg(input->dev.parent, 660 + "%s: received unknown report #%d", __func__, data[0]); 661 + return 0; 662 + } 663 + 664 + serial = data[3] + (data[4] << 8) + (data[5] << 16); 665 + wacom_wac->id[0] = PAD_DEVICE_ID; 666 + 667 + input_report_key(input, BTN_0, (data[9] & 0x01)); 668 + input_report_key(input, BTN_1, (data[9] & 0x02)); 669 + input_report_key(input, BTN_2, (data[9] & 0x04)); 670 + input_report_key(input, BTN_3, (data[9] & 0x08)); 671 + input_report_key(input, BTN_4, (data[9] & 0x10)); 672 + input_report_key(input, BTN_5, (data[9] & 0x20)); 673 + input_report_key(input, BTN_6, (data[9] & 0x40)); 674 + input_report_key(input, BTN_7, (data[9] & 0x80)); 675 + 676 + input_report_key(input, BTN_8, (data[10] & 0x01)); 677 + input_report_key(input, BTN_9, (data[10] & 0x02)); 678 + input_report_key(input, BTN_A, (data[10] & 0x04)); 679 + input_report_key(input, BTN_B, (data[10] & 0x08)); 680 + input_report_key(input, BTN_C, (data[10] & 0x10)); 681 + input_report_key(input, BTN_X, (data[10] & 0x20)); 682 + input_report_key(input, BTN_Y, (data[10] & 0x40)); 683 + input_report_key(input, BTN_Z, (data[10] & 0x80)); 684 + 685 + input_report_key(input, BTN_BASE, (data[11] & 0x01)); 686 + input_report_key(input, BTN_BASE2, (data[11] & 0x02)); 687 + 688 + if (data[12] & 0x80) 689 + input_report_abs(input, ABS_WHEEL, (data[12] & 0x7f)); 690 + else 691 + input_report_abs(input, ABS_WHEEL, 0); 692 + 693 + bat_percent = data[7] & 0x7f; 694 + bat_charging = !!(data[7] & 0x80); 695 + 696 + if (data[9] | data[10] | (data[11] & 0x03) | data[12]) 697 + input_report_abs(input, ABS_MISC, PAD_DEVICE_ID); 698 + else 699 + input_report_abs(input, ABS_MISC, 0); 700 + 701 + input_event(input, EV_MSC, MSC_SERIAL, serial); 702 + 703 + /*Which mode select (LED light) is currently on?*/ 704 + touch_ring_mode = (data[11] & 0xC0) >> 6; 705 + 706 + for (i = 0; i < WACOM_MAX_REMOTES; i++) { 707 + if (wacom_wac->serial[i] == serial) 708 + wacom->led.select[i] = touch_ring_mode; 709 + } 710 + 711 + if (!wacom->battery && 712 + !(features->quirks & WACOM_QUIRK_BATTERY)) { 713 + features->quirks |= WACOM_QUIRK_BATTERY; 714 + INIT_WORK(&wacom->work, wacom_battery_work); 715 + wacom_schedule_work(wacom_wac); 716 + } 717 + 718 + wacom_notify_battery(wacom_wac, bat_percent, bat_charging, 1, 719 + bat_charging); 720 + 721 + return 1; 722 + } 723 + 724 + static int wacom_remote_status_irq(struct wacom_wac *wacom_wac, size_t len) 725 + { 726 + struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); 727 + unsigned char *data = wacom_wac->data; 728 + int i; 729 + 730 + if (data[0] != WACOM_REPORT_DEVICE_LIST) 731 + return 0; 732 + 733 + for (i = 0; i < WACOM_MAX_REMOTES; i++) { 734 + int j = i * 6; 735 + int serial = (data[j+6] << 16) + (data[j+5] << 8) + data[j+4]; 736 + bool connected = data[j+2]; 737 + 738 + if (connected) { 739 + int k; 740 + 741 + if (wacom_wac->serial[i] == serial) 742 + continue; 743 + 744 + if (wacom_wac->serial[i]) { 745 + wacom_remote_destroy_attr_group(wacom, 746 + wacom_wac->serial[i]); 747 + } 748 + 749 + /* A remote can pair more than once with an EKR, 750 + * check to make sure this serial isn't already paired. 751 + */ 752 + for (k = 0; k < WACOM_MAX_REMOTES; k++) { 753 + if (wacom_wac->serial[k] == serial) 754 + break; 755 + } 756 + 757 + if (k < WACOM_MAX_REMOTES) { 758 + wacom_wac->serial[i] = serial; 759 + continue; 760 + } 761 + wacom_remote_create_attr_group(wacom, serial, i); 762 + 763 + } else if (wacom_wac->serial[i]) { 764 + wacom_remote_destroy_attr_group(wacom, 765 + wacom_wac->serial[i]); 766 + } 629 767 } 630 768 631 769 return 0; ··· 1547 1437 return 0; 1548 1438 } 1549 1439 1440 + static void wacom_wac_pen_pre_report(struct hid_device *hdev, 1441 + struct hid_report *report) 1442 + { 1443 + return; 1444 + } 1445 + 1550 1446 static void wacom_wac_pen_report(struct hid_device *hdev, 1551 1447 struct hid_report *report) 1552 1448 { ··· 1607 1491 wacom_map_usage(input, usage, field, EV_ABS, 1608 1492 ABS_MT_POSITION_Y, 4); 1609 1493 break; 1494 + case HID_DG_WIDTH: 1495 + case HID_DG_HEIGHT: 1496 + features->last_slot_field = usage->hid; 1497 + wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MAJOR, 0); 1498 + wacom_map_usage(input, usage, field, EV_ABS, ABS_MT_TOUCH_MINOR, 0); 1499 + input_set_abs_params(input, ABS_MT_ORIENTATION, 0, 1, 0, 0); 1500 + break; 1610 1501 case HID_DG_CONTACTID: 1611 1502 features->last_slot_field = usage->hid; 1612 1503 break; ··· 1627 1504 features->last_slot_field = usage->hid; 1628 1505 wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0); 1629 1506 break; 1507 + case HID_DG_CONTACTCOUNT: 1508 + wacom_wac->hid_data.cc_index = field->index; 1509 + wacom_wac->hid_data.cc_value_index = usage->usage_index; 1510 + break; 1630 1511 } 1631 1512 } 1632 1513 ··· 1641 1514 bool mt = wacom_wac->features.touch_max > 1; 1642 1515 bool prox = hid_data->tipswitch && 1643 1516 !wacom_wac->shared->stylus_in_proximity; 1517 + 1518 + wacom_wac->hid_data.num_received++; 1519 + if (wacom_wac->hid_data.num_received > wacom_wac->hid_data.num_expected) 1520 + return; 1644 1521 1645 1522 if (mt) { 1646 1523 int slot; ··· 1662 1531 hid_data->x); 1663 1532 input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y, 1664 1533 hid_data->y); 1534 + 1535 + if (test_bit(ABS_MT_TOUCH_MAJOR, input->absbit)) { 1536 + input_report_abs(input, ABS_MT_TOUCH_MAJOR, max(hid_data->width, hid_data->height)); 1537 + input_report_abs(input, ABS_MT_TOUCH_MINOR, min(hid_data->width, hid_data->height)); 1538 + if (hid_data->width != hid_data->height) 1539 + input_report_abs(input, ABS_MT_ORIENTATION, hid_data->width <= hid_data->height ? 0 : 1); 1540 + } 1665 1541 } 1666 1542 } 1667 1543 ··· 1684 1546 break; 1685 1547 case HID_GD_Y: 1686 1548 wacom_wac->hid_data.y = value; 1549 + break; 1550 + case HID_DG_WIDTH: 1551 + wacom_wac->hid_data.width = value; 1552 + break; 1553 + case HID_DG_HEIGHT: 1554 + wacom_wac->hid_data.height = value; 1687 1555 break; 1688 1556 case HID_DG_CONTACTID: 1689 1557 wacom_wac->hid_data.id = value; ··· 1708 1564 return 0; 1709 1565 } 1710 1566 1567 + static void wacom_wac_finger_pre_report(struct hid_device *hdev, 1568 + struct hid_report *report) 1569 + { 1570 + struct wacom *wacom = hid_get_drvdata(hdev); 1571 + struct wacom_wac *wacom_wac = &wacom->wacom_wac; 1572 + struct hid_data* hid_data = &wacom_wac->hid_data; 1573 + 1574 + if (hid_data->cc_index >= 0) { 1575 + struct hid_field *field = report->field[hid_data->cc_index]; 1576 + int value = field->value[hid_data->cc_value_index]; 1577 + if (value) 1578 + hid_data->num_expected = value; 1579 + } 1580 + else { 1581 + hid_data->num_expected = wacom_wac->features.touch_max; 1582 + } 1583 + } 1584 + 1711 1585 static void wacom_wac_finger_report(struct hid_device *hdev, 1712 1586 struct hid_report *report) 1713 1587 { ··· 1734 1572 struct input_dev *input = wacom_wac->touch_input; 1735 1573 unsigned touch_max = wacom_wac->features.touch_max; 1736 1574 1575 + /* If more packets of data are expected, give us a chance to 1576 + * process them rather than immediately syncing a partial 1577 + * update. 1578 + */ 1579 + if (wacom_wac->hid_data.num_received < wacom_wac->hid_data.num_expected) 1580 + return; 1581 + 1737 1582 if (touch_max > 1) 1738 1583 input_mt_sync_frame(input); 1739 1584 1740 1585 input_sync(input); 1586 + wacom_wac->hid_data.num_received = 0; 1741 1587 1742 1588 /* keep touch state for pen event */ 1743 1589 wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(wacom_wac); ··· 1785 1615 return 0; 1786 1616 } 1787 1617 1618 + static void wacom_report_events(struct hid_device *hdev, struct hid_report *report) 1619 + { 1620 + int r; 1621 + 1622 + for (r = 0; r < report->maxfield; r++) { 1623 + struct hid_field *field; 1624 + unsigned count, n; 1625 + 1626 + field = report->field[r]; 1627 + count = field->report_count; 1628 + 1629 + if (!(HID_MAIN_ITEM_VARIABLE & field->flags)) 1630 + continue; 1631 + 1632 + for (n = 0; n < count; n++) 1633 + wacom_wac_event(hdev, field, &field->usage[n], field->value[n]); 1634 + } 1635 + } 1636 + 1788 1637 void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) 1789 1638 { 1790 1639 struct wacom *wacom = hid_get_drvdata(hdev); ··· 1812 1623 1813 1624 if (wacom_wac->features.type != HID_GENERIC) 1814 1625 return; 1626 + 1627 + if (WACOM_PEN_FIELD(field)) 1628 + wacom_wac_pen_pre_report(hdev, report); 1629 + 1630 + if (WACOM_FINGER_FIELD(field)) 1631 + wacom_wac_finger_pre_report(hdev, report); 1632 + 1633 + wacom_report_events(hdev, report); 1815 1634 1816 1635 if (WACOM_PEN_FIELD(field)) 1817 1636 return wacom_wac_pen_report(hdev, report); ··· 1896 1699 int y = (data[3] << 4) | (data[4] & 0x0f); 1897 1700 int width, height; 1898 1701 1899 - if (features->type >= INTUOSPS && features->type <= INTUOSPL) { 1702 + if (features->type >= INTUOSPS && features->type <= INTUOSHT) { 1900 1703 width = data[5] * 100; 1901 1704 height = data[6] * 100; 1902 1705 } else { ··· 2315 2118 sync = wacom_wireless_irq(wacom_wac, len); 2316 2119 break; 2317 2120 2121 + case REMOTE: 2122 + if (wacom_wac->data[0] == WACOM_REPORT_DEVICE_LIST) 2123 + sync = wacom_remote_status_irq(wacom_wac, len); 2124 + else 2125 + sync = wacom_remote_irq(wacom_wac, len); 2126 + break; 2127 + 2318 2128 default: 2319 2129 sync = false; 2320 2130 break; ··· 2427 2223 * 0, whose HID descriptor has an application usage of 0xFF0D 2428 2224 * (i.e., WACOM_VENDORDEFINED_PEN). We route pen packets back 2429 2225 * out through the HID_GENERIC device created for interface 1, 2430 - * so rewrite this one to be of type BTN_TOOL_FINGER. 2226 + * so rewrite this one to be of type WACOM_DEVICETYPE_TOUCH. 2431 2227 */ 2432 2228 if (features->type == BAMBOO_PAD) 2433 - features->device_type |= WACOM_DEVICETYPE_TOUCH; 2229 + features->device_type = WACOM_DEVICETYPE_TOUCH; 2230 + 2231 + if (features->type == REMOTE) 2232 + features->device_type = WACOM_DEVICETYPE_PAD; 2434 2233 2435 2234 if (wacom->hdev->bus == BUS_BLUETOOTH) 2436 2235 features->quirks |= WACOM_QUIRK_BATTERY; ··· 2449 2242 } 2450 2243 2451 2244 if (features->type == WIRELESS) { 2452 - 2453 - /* monitor never has input and pen/touch have delayed create */ 2454 - features->quirks |= WACOM_QUIRK_NO_INPUT; 2455 - 2456 - /* must be monitor interface if no device_type set */ 2457 - if (features->device_type == WACOM_DEVICETYPE_NONE) { 2458 - features->quirks |= WACOM_QUIRK_MONITOR; 2245 + if (features->device_type == WACOM_DEVICETYPE_WL_MONITOR) { 2459 2246 features->quirks |= WACOM_QUIRK_BATTERY; 2460 2247 } 2461 2248 } ··· 2714 2513 return 0; 2715 2514 } 2716 2515 2516 + static void wacom_setup_numbered_buttons(struct input_dev *input_dev, 2517 + int button_count) 2518 + { 2519 + int i; 2520 + 2521 + for (i = 0; i < button_count && i < 10; i++) 2522 + __set_bit(BTN_0 + i, input_dev->keybit); 2523 + for (i = 10; i < button_count && i < 16; i++) 2524 + __set_bit(BTN_A + (i-10), input_dev->keybit); 2525 + for (i = 16; i < button_count && i < 18; i++) 2526 + __set_bit(BTN_BASE + (i-16), input_dev->keybit); 2527 + } 2528 + 2717 2529 int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, 2718 2530 struct wacom_wac *wacom_wac) 2719 2531 { 2720 2532 struct wacom_features *features = &wacom_wac->features; 2721 - int i; 2722 2533 2723 2534 if (!(features->device_type & WACOM_DEVICETYPE_PAD)) 2724 2535 return -ENODEV; ··· 2747 2534 /* kept for making udev and libwacom accepting the pad */ 2748 2535 __set_bit(BTN_STYLUS, input_dev->keybit); 2749 2536 2537 + wacom_setup_numbered_buttons(input_dev, features->numbered_buttons); 2538 + 2750 2539 switch (features->type) { 2540 + 2541 + case CINTIQ_HYBRID: 2542 + case DTK: 2543 + case DTUS: 2751 2544 case GRAPHIRE_BT: 2752 - __set_bit(BTN_0, input_dev->keybit); 2753 - __set_bit(BTN_1, input_dev->keybit); 2754 2545 break; 2755 2546 2756 2547 case WACOM_MO: ··· 2772 2555 break; 2773 2556 2774 2557 case WACOM_24HD: 2775 - __set_bit(BTN_A, input_dev->keybit); 2776 - __set_bit(BTN_B, input_dev->keybit); 2777 - __set_bit(BTN_C, input_dev->keybit); 2778 - __set_bit(BTN_X, input_dev->keybit); 2779 - __set_bit(BTN_Y, input_dev->keybit); 2780 - __set_bit(BTN_Z, input_dev->keybit); 2781 - 2782 - for (i = 0; i < 10; i++) 2783 - __set_bit(BTN_0 + i, input_dev->keybit); 2784 - 2785 2558 __set_bit(KEY_PROG1, input_dev->keybit); 2786 2559 __set_bit(KEY_PROG2, input_dev->keybit); 2787 2560 __set_bit(KEY_PROG3, input_dev->keybit); ··· 2793 2586 __set_bit(INPUT_PROP_ACCELEROMETER, input_dev->propbit); 2794 2587 break; 2795 2588 2796 - case DTK: 2797 - for (i = 0; i < 6; i++) 2798 - __set_bit(BTN_0 + i, input_dev->keybit); 2799 - 2800 - break; 2801 - 2802 2589 case WACOM_22HD: 2803 2590 __set_bit(KEY_PROG1, input_dev->keybit); 2804 2591 __set_bit(KEY_PROG2, input_dev->keybit); ··· 2800 2599 /* fall through */ 2801 2600 2802 2601 case WACOM_21UX2: 2803 - __set_bit(BTN_A, input_dev->keybit); 2804 - __set_bit(BTN_B, input_dev->keybit); 2805 - __set_bit(BTN_C, input_dev->keybit); 2806 - __set_bit(BTN_X, input_dev->keybit); 2807 - __set_bit(BTN_Y, input_dev->keybit); 2808 - __set_bit(BTN_Z, input_dev->keybit); 2809 - __set_bit(BTN_BASE, input_dev->keybit); 2810 - __set_bit(BTN_BASE2, input_dev->keybit); 2811 - /* fall through */ 2812 - 2813 2602 case WACOM_BEE: 2814 - __set_bit(BTN_8, input_dev->keybit); 2815 - __set_bit(BTN_9, input_dev->keybit); 2816 - /* fall through */ 2817 - 2818 2603 case CINTIQ: 2819 - for (i = 0; i < 8; i++) 2820 - __set_bit(BTN_0 + i, input_dev->keybit); 2821 - 2822 2604 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); 2823 2605 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); 2824 2606 break; 2825 2607 2826 2608 case WACOM_13HD: 2827 - for (i = 0; i < 9; i++) 2828 - __set_bit(BTN_0 + i, input_dev->keybit); 2829 - 2830 2609 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 2831 2610 break; 2832 2611 2833 2612 case INTUOS3: 2834 2613 case INTUOS3L: 2835 - __set_bit(BTN_4, input_dev->keybit); 2836 - __set_bit(BTN_5, input_dev->keybit); 2837 - __set_bit(BTN_6, input_dev->keybit); 2838 - __set_bit(BTN_7, input_dev->keybit); 2839 - 2840 2614 input_set_abs_params(input_dev, ABS_RY, 0, 4096, 0, 0); 2841 2615 /* fall through */ 2842 2616 2843 2617 case INTUOS3S: 2844 - __set_bit(BTN_0, input_dev->keybit); 2845 - __set_bit(BTN_1, input_dev->keybit); 2846 - __set_bit(BTN_2, input_dev->keybit); 2847 - __set_bit(BTN_3, input_dev->keybit); 2848 - 2849 2618 input_set_abs_params(input_dev, ABS_RX, 0, 4096, 0, 0); 2850 2619 break; 2851 2620 ··· 2823 2652 case INTUOS5L: 2824 2653 case INTUOSPM: 2825 2654 case INTUOSPL: 2826 - __set_bit(BTN_7, input_dev->keybit); 2827 - __set_bit(BTN_8, input_dev->keybit); 2828 - /* fall through */ 2829 - 2830 2655 case INTUOS5S: 2831 2656 case INTUOSPS: 2832 - for (i = 0; i < 7; i++) 2833 - __set_bit(BTN_0 + i, input_dev->keybit); 2834 - 2835 2657 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 2836 2658 break; 2837 2659 ··· 2839 2675 2840 2676 case INTUOS4: 2841 2677 case INTUOS4L: 2842 - __set_bit(BTN_7, input_dev->keybit); 2843 - __set_bit(BTN_8, input_dev->keybit); 2844 - /* fall through */ 2845 - 2846 2678 case INTUOS4S: 2847 - for (i = 0; i < 7; i++) 2848 - __set_bit(BTN_0 + i, input_dev->keybit); 2849 - 2850 2679 input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 2851 - break; 2852 - 2853 - case CINTIQ_HYBRID: 2854 - for (i = 0; i < 9; i++) 2855 - __set_bit(BTN_0 + i, input_dev->keybit); 2856 - 2857 - break; 2858 - 2859 - case DTUS: 2860 - for (i = 0; i < 4; i++) 2861 - __set_bit(BTN_0 + i, input_dev->keybit); 2862 2680 break; 2863 2681 2864 2682 case INTUOSHT: ··· 2852 2706 __set_bit(BTN_BACK, input_dev->keybit); 2853 2707 __set_bit(BTN_RIGHT, input_dev->keybit); 2854 2708 2709 + break; 2710 + 2711 + case REMOTE: 2712 + input_set_capability(input_dev, EV_MSC, MSC_SERIAL); 2713 + input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0); 2855 2714 break; 2856 2715 2857 2716 default: ··· 2874 2723 GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; 2875 2724 static const struct wacom_features wacom_features_0x81 = 2876 2725 { "Wacom Graphire BT", 16704, 12064, 511, 32, 2877 - GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; 2726 + GRAPHIRE_BT, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES, 2 }; 2878 2727 static const struct wacom_features wacom_features_0x11 = 2879 2728 { "Wacom Graphire2 4x5", 10206, 7422, 511, 63, 2880 2729 GRAPHIRE, WACOM_GRAPHIRE_RES, WACOM_GRAPHIRE_RES }; ··· 3000 2849 INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3001 2850 static const struct wacom_features wacom_features_0xB0 = 3002 2851 { "Wacom Intuos3 4x5", 25400, 20320, 1023, 63, 3003 - INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2852 + INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; 3004 2853 static const struct wacom_features wacom_features_0xB1 = 3005 2854 { "Wacom Intuos3 6x8", 40640, 30480, 1023, 63, 3006 - INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2855 + INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3007 2856 static const struct wacom_features wacom_features_0xB2 = 3008 2857 { "Wacom Intuos3 9x12", 60960, 45720, 1023, 63, 3009 - INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2858 + INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3010 2859 static const struct wacom_features wacom_features_0xB3 = 3011 2860 { "Wacom Intuos3 12x12", 60960, 60960, 1023, 63, 3012 - INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2861 + INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3013 2862 static const struct wacom_features wacom_features_0xB4 = 3014 2863 { "Wacom Intuos3 12x19", 97536, 60960, 1023, 63, 3015 - INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2864 + INTUOS3L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3016 2865 static const struct wacom_features wacom_features_0xB5 = 3017 2866 { "Wacom Intuos3 6x11", 54204, 31750, 1023, 63, 3018 - INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2867 + INTUOS3, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3019 2868 static const struct wacom_features wacom_features_0xB7 = 3020 2869 { "Wacom Intuos3 4x6", 31496, 19685, 1023, 63, 3021 - INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2870 + INTUOS3S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 4 }; 3022 2871 static const struct wacom_features wacom_features_0xB8 = 3023 2872 { "Wacom Intuos4 4x6", 31496, 19685, 2047, 63, 3024 - INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2873 + INTUOS4S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; 3025 2874 static const struct wacom_features wacom_features_0xB9 = 3026 2875 { "Wacom Intuos4 6x9", 44704, 27940, 2047, 63, 3027 - INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2876 + INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3028 2877 static const struct wacom_features wacom_features_0xBA = 3029 2878 { "Wacom Intuos4 8x13", 65024, 40640, 2047, 63, 3030 - INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2879 + INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3031 2880 static const struct wacom_features wacom_features_0xBB = 3032 2881 { "Wacom Intuos4 12x19", 97536, 60960, 2047, 63, 3033 - INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2882 + INTUOS4L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3034 2883 static const struct wacom_features wacom_features_0xBC = 3035 2884 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, 3036 - INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2885 + INTUOS4, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3037 2886 static const struct wacom_features wacom_features_0xBD = 3038 2887 { "Wacom Intuos4 WL", 40640, 25400, 2047, 63, 3039 - INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2888 + INTUOS4WL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3040 2889 static const struct wacom_features wacom_features_0x26 = 3041 2890 { "Wacom Intuos5 touch S", 31496, 19685, 2047, 63, 3042 - INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; 2891 + INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16 }; 3043 2892 static const struct wacom_features wacom_features_0x27 = 3044 2893 { "Wacom Intuos5 touch M", 44704, 27940, 2047, 63, 3045 - INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; 2894 + INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; 3046 2895 static const struct wacom_features wacom_features_0x28 = 3047 2896 { "Wacom Intuos5 touch L", 65024, 40640, 2047, 63, 3048 - INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16 }; 2897 + INTUOS5L, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16 }; 3049 2898 static const struct wacom_features wacom_features_0x29 = 3050 2899 { "Wacom Intuos5 S", 31496, 19685, 2047, 63, 3051 - INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2900 + INTUOS5S, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7 }; 3052 2901 static const struct wacom_features wacom_features_0x2A = 3053 2902 { "Wacom Intuos5 M", 44704, 27940, 2047, 63, 3054 - INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2903 + INTUOS5, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9 }; 3055 2904 static const struct wacom_features wacom_features_0x314 = 3056 2905 { "Wacom Intuos Pro S", 31496, 19685, 2047, 63, 3057 - INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, 2906 + INTUOSPS, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7, .touch_max = 16, 3058 2907 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3059 2908 static const struct wacom_features wacom_features_0x315 = 3060 2909 { "Wacom Intuos Pro M", 44704, 27940, 2047, 63, 3061 - INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, 2910 + INTUOSPM, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, 3062 2911 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3063 2912 static const struct wacom_features wacom_features_0x317 = 3064 2913 { "Wacom Intuos Pro L", 65024, 40640, 2047, 63, 3065 - INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, 2914 + INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, .touch_max = 16, 3066 2915 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3067 2916 static const struct wacom_features wacom_features_0xF4 = 3068 2917 { "Wacom Cintiq 24HD", 104080, 65200, 2047, 63, 3069 - WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2918 + WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, 3070 2919 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3071 2920 static const struct wacom_features wacom_features_0xF8 = 3072 2921 { "Wacom Cintiq 24HD touch", 104080, 65200, 2047, 63, /* Pen */ 3073 - WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2922 + WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 16, 3074 2923 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3075 2924 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; 3076 2925 static const struct wacom_features wacom_features_0xF6 = ··· 3079 2928 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3080 2929 static const struct wacom_features wacom_features_0x32A = 3081 2930 { "Wacom Cintiq 27QHD", 119740, 67520, 2047, 63, 3082 - WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2931 + WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, 3083 2932 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3084 2933 static const struct wacom_features wacom_features_0x32B = 3085 2934 { "Wacom Cintiq 27QHD touch", 119740, 67520, 2047, 63, 3086 - WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2935 + WACOM_27QHD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 0, 3087 2936 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3088 2937 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32C }; 3089 2938 static const struct wacom_features wacom_features_0x32C = ··· 3091 2940 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x32B, .touch_max = 10 }; 3092 2941 static const struct wacom_features wacom_features_0x3F = 3093 2942 { "Wacom Cintiq 21UX", 87200, 65600, 1023, 63, 3094 - CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2943 + CINTIQ, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 8 }; 3095 2944 static const struct wacom_features wacom_features_0xC5 = 3096 2945 { "Wacom Cintiq 20WSX", 86680, 54180, 1023, 63, 3097 - WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2946 + WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; 3098 2947 static const struct wacom_features wacom_features_0xC6 = 3099 2948 { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, 3100 - WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; 2949 + WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 10 }; 3101 2950 static const struct wacom_features wacom_features_0x304 = 3102 2951 { "Wacom Cintiq 13HD", 59152, 33448, 1023, 63, 3103 - WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2952 + WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, 3104 2953 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3105 2954 static const struct wacom_features wacom_features_0x333 = 3106 2955 { "Wacom Cintiq 13HD touch", 59152, 33448, 2047, 63, 3107 - WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2956 + WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, 3108 2957 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3109 2958 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x335 }; 3110 2959 static const struct wacom_features wacom_features_0x335 = ··· 3123 2972 DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3124 2973 static const struct wacom_features wacom_features_0xFB = 3125 2974 { "Wacom DTU1031", 21896, 13760, 511, 0, 3126 - DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 2975 + DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4, 3127 2976 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; 3128 2977 static const struct wacom_features wacom_features_0x32F = 3129 2978 { "Wacom DTU1031X", 22472, 12728, 511, 0, 3130 - DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 2979 + DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 0, 3131 2980 WACOM_DTU_OFFSET, WACOM_DTU_OFFSET }; 3132 2981 static const struct wacom_features wacom_features_0x336 = 3133 2982 { "Wacom DTU1141", 23472, 13203, 1023, 0, 3134 - DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2983 + DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 }; 3135 2984 static const struct wacom_features wacom_features_0x57 = 3136 2985 { "Wacom DTK2241", 95640, 54060, 2047, 63, 3137 - DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2986 + DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, 3138 2987 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3139 2988 static const struct wacom_features wacom_features_0x59 = /* Pen */ 3140 2989 { "Wacom DTH2242", 95640, 54060, 2047, 63, 3141 - DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2990 + DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 6, 3142 2991 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3143 2992 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; 3144 2993 static const struct wacom_features wacom_features_0x5D = /* Touch */ ··· 3147 2996 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3148 2997 static const struct wacom_features wacom_features_0xCC = 3149 2998 { "Wacom Cintiq 21UX2", 86800, 65200, 2047, 63, 3150 - WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 2999 + WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, 3151 3000 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3152 3001 static const struct wacom_features wacom_features_0xFA = 3153 3002 { "Wacom Cintiq 22HD", 95440, 53860, 2047, 63, 3154 - WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 3003 + WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, 3155 3004 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET }; 3156 3005 static const struct wacom_features wacom_features_0x5B = 3157 3006 { "Wacom Cintiq 22HDT", 95440, 53860, 2047, 63, 3158 - WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 3007 + WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 18, 3159 3008 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3160 3009 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; 3161 3010 static const struct wacom_features wacom_features_0x5E = ··· 3302 3151 TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 3303 3152 static const struct wacom_features wacom_features_0x307 = 3304 3153 { "Wacom ISDv5 307", 59152, 33448, 2047, 63, 3305 - CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 3154 + CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, 3306 3155 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3307 3156 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; 3308 3157 static const struct wacom_features wacom_features_0x309 = ··· 3311 3160 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3312 3161 static const struct wacom_features wacom_features_0x30A = 3313 3162 { "Wacom ISDv5 30A", 59152, 33448, 2047, 63, 3314 - CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 3163 + CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 9, 3315 3164 WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET, 3316 3165 .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C }; 3317 3166 static const struct wacom_features wacom_features_0x30C = ··· 3328 3177 { "Wacom Intuos P M", 21600, 13500, 1023, 31, 3329 3178 INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 3330 3179 .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; 3180 + static const struct wacom_features wacom_features_0x331 = 3181 + { "Wacom Express Key Remote", 0, 0, 0, 0, 3182 + REMOTE, 0, 0, 18, .check_for_hid_type = true, 3183 + .hid_type = HID_TYPE_USBNONE }; 3331 3184 3332 3185 static const struct wacom_features wacom_features_HID_ANY_ID = 3333 3186 { "Wacom HID", .type = HID_GENERIC }; ··· 3487 3332 { USB_DEVICE_WACOM(0x32B) }, 3488 3333 { USB_DEVICE_WACOM(0x32C) }, 3489 3334 { USB_DEVICE_WACOM(0x32F) }, 3335 + { USB_DEVICE_WACOM(0x331) }, 3490 3336 { USB_DEVICE_WACOM(0x333) }, 3491 3337 { USB_DEVICE_WACOM(0x335) }, 3492 3338 { USB_DEVICE_WACOM(0x336) },
+12 -3
drivers/hid/wacom_wac.h
··· 16 16 #define WACOM_PKGLEN_MAX 192 17 17 18 18 #define WACOM_NAME_MAX 64 19 + #define WACOM_MAX_REMOTES 5 20 + #define WACOM_STATUS_UNKNOWN 255 19 21 20 22 /* packet length for individual models */ 21 23 #define WACOM_PKGLEN_BBFUN 9 ··· 67 65 #define WACOM_REPORT_USB 192 68 66 #define WACOM_REPORT_BPAD_PEN 3 69 67 #define WACOM_REPORT_BPAD_TOUCH 16 68 + #define WACOM_REPORT_DEVICE_LIST 16 69 + #define WACOM_REPORT_REMOTE 17 70 70 71 71 /* device quirks */ 72 72 #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001 73 - #define WACOM_QUIRK_NO_INPUT 0x0002 74 - #define WACOM_QUIRK_MONITOR 0x0004 75 73 #define WACOM_QUIRK_BATTERY 0x0008 76 74 77 75 /* device types */ ··· 79 77 #define WACOM_DEVICETYPE_PEN 0x0001 80 78 #define WACOM_DEVICETYPE_TOUCH 0x0002 81 79 #define WACOM_DEVICETYPE_PAD 0x0004 80 + #define WACOM_DEVICETYPE_WL_MONITOR 0x0008 82 81 83 82 #define WACOM_VENDORDEFINED_PEN 0xff0d0001 84 83 ··· 133 130 WACOM_24HDT, 134 131 WACOM_27QHDT, 135 132 BAMBOO_PAD, 133 + REMOTE, 136 134 TABLETPC, /* add new TPC below */ 137 135 TABLETPCE, 138 136 TABLETPC2FG, ··· 153 149 int type; 154 150 int x_resolution; 155 151 int y_resolution; 152 + int numbered_buttons; 156 153 int x_min; 157 154 int y_min; 158 155 int device_type; ··· 198 193 int width; 199 194 int height; 200 195 int id; 196 + int cc_index; 197 + int cc_value_index; 198 + int num_expected; 199 + int num_received; 201 200 }; 202 201 203 202 struct wacom_wac { ··· 213 204 unsigned char data[WACOM_PKGLEN_MAX]; 214 205 int tool[2]; 215 206 int id[2]; 216 - __u32 serial[2]; 207 + __u32 serial[5]; 217 208 bool reporting_data; 218 209 struct wacom_features features; 219 210 struct wacom_shared *shared;