diff options
Diffstat (limited to 'drivers/input/tablet')
| -rw-r--r-- | drivers/input/tablet/wacom_sys.c | 51 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.c | 91 | ||||
| -rw-r--r-- | drivers/input/tablet/wacom_wac.h | 5 |
3 files changed, 142 insertions, 5 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 9edf9806cff9..858ad446de91 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
| @@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
| 391 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 391 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | if (features->type == MTSCREEN) | 394 | if (features->type == MTSCREEN || features->type == WACOM_24HDT) |
| 395 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 395 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
| 396 | 396 | ||
| 397 | if (features->type == BAMBOO_PT) { | 397 | if (features->type == BAMBOO_PT) { |
| @@ -402,6 +402,14 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
| 402 | features->x_max = | 402 | features->x_max = |
| 403 | get_unaligned_le16(&report[i + 8]); | 403 | get_unaligned_le16(&report[i + 8]); |
| 404 | i += 15; | 404 | i += 15; |
| 405 | } else if (features->type == WACOM_24HDT) { | ||
| 406 | features->x_max = | ||
| 407 | get_unaligned_le16(&report[i + 3]); | ||
| 408 | features->x_phy = | ||
| 409 | get_unaligned_le16(&report[i + 8]); | ||
| 410 | features->unit = report[i - 1]; | ||
| 411 | features->unitExpo = report[i - 3]; | ||
| 412 | i += 12; | ||
| 405 | } else { | 413 | } else { |
| 406 | features->x_max = | 414 | features->x_max = |
| 407 | get_unaligned_le16(&report[i + 3]); | 415 | get_unaligned_le16(&report[i + 3]); |
| @@ -434,6 +442,12 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
| 434 | features->y_phy = | 442 | features->y_phy = |
| 435 | get_unaligned_le16(&report[i + 6]); | 443 | get_unaligned_le16(&report[i + 6]); |
| 436 | i += 7; | 444 | i += 7; |
| 445 | } else if (type == WACOM_24HDT) { | ||
| 446 | features->y_max = | ||
| 447 | get_unaligned_le16(&report[i + 3]); | ||
| 448 | features->y_phy = | ||
| 449 | get_unaligned_le16(&report[i - 2]); | ||
| 450 | i += 7; | ||
| 437 | } else if (type == BAMBOO_PT) { | 451 | } else if (type == BAMBOO_PT) { |
| 438 | features->y_phy = | 452 | features->y_phy = |
| 439 | get_unaligned_le16(&report[i + 3]); | 453 | get_unaligned_le16(&report[i + 3]); |
| @@ -541,6 +555,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat | |||
| 541 | /* MT Tablet PC touch */ | 555 | /* MT Tablet PC touch */ |
| 542 | return wacom_set_device_mode(intf, 3, 4, 4); | 556 | return wacom_set_device_mode(intf, 3, 4, 4); |
| 543 | } | 557 | } |
| 558 | else if (features->type == WACOM_24HDT) { | ||
| 559 | return wacom_set_device_mode(intf, 18, 3, 2); | ||
| 560 | } | ||
| 544 | } else if (features->device_type == BTN_TOOL_PEN) { | 561 | } else if (features->device_type == BTN_TOOL_PEN) { |
| 545 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { | 562 | if (features->type <= BAMBOO_PT && features->type != WIRELESS) { |
| 546 | return wacom_set_device_mode(intf, 2, 2, 2); | 563 | return wacom_set_device_mode(intf, 2, 2, 2); |
| @@ -613,6 +630,30 @@ struct wacom_usbdev_data { | |||
| 613 | static LIST_HEAD(wacom_udev_list); | 630 | static LIST_HEAD(wacom_udev_list); |
| 614 | static DEFINE_MUTEX(wacom_udev_list_lock); | 631 | static DEFINE_MUTEX(wacom_udev_list_lock); |
| 615 | 632 | ||
| 633 | static struct usb_device *wacom_get_sibling(struct usb_device *dev, int vendor, int product) | ||
| 634 | { | ||
| 635 | int port1; | ||
| 636 | struct usb_device *sibling; | ||
| 637 | |||
| 638 | if (vendor == 0 && product == 0) | ||
| 639 | return dev; | ||
| 640 | |||
| 641 | if (dev->parent == NULL) | ||
| 642 | return NULL; | ||
| 643 | |||
| 644 | usb_hub_for_each_child(dev->parent, port1, sibling) { | ||
| 645 | struct usb_device_descriptor *d; | ||
| 646 | if (sibling == NULL) | ||
| 647 | continue; | ||
| 648 | |||
| 649 | d = &sibling->descriptor; | ||
| 650 | if (d->idVendor == vendor && d->idProduct == product) | ||
| 651 | return sibling; | ||
| 652 | } | ||
| 653 | |||
| 654 | return NULL; | ||
| 655 | } | ||
| 656 | |||
| 616 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) | 657 | static struct wacom_usbdev_data *wacom_get_usbdev_data(struct usb_device *dev) |
| 617 | { | 658 | { |
| 618 | struct wacom_usbdev_data *data; | 659 | struct wacom_usbdev_data *data; |
| @@ -1257,13 +1298,19 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 1257 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); | 1298 | strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); |
| 1258 | 1299 | ||
| 1259 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { | 1300 | if (features->quirks & WACOM_QUIRK_MULTI_INPUT) { |
| 1301 | struct usb_device *other_dev; | ||
| 1302 | |||
| 1260 | /* Append the device type to the name */ | 1303 | /* Append the device type to the name */ |
| 1261 | strlcat(wacom_wac->name, | 1304 | strlcat(wacom_wac->name, |
| 1262 | features->device_type == BTN_TOOL_PEN ? | 1305 | features->device_type == BTN_TOOL_PEN ? |
| 1263 | " Pen" : " Finger", | 1306 | " Pen" : " Finger", |
| 1264 | sizeof(wacom_wac->name)); | 1307 | sizeof(wacom_wac->name)); |
| 1265 | 1308 | ||
| 1266 | error = wacom_add_shared_data(wacom_wac, dev); | 1309 | |
| 1310 | other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); | ||
| 1311 | if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) | ||
| 1312 | other_dev = dev; | ||
| 1313 | error = wacom_add_shared_data(wacom_wac, other_dev); | ||
| 1267 | if (error) | 1314 | if (error) |
| 1268 | goto fail3; | 1315 | goto fail3; |
| 1269 | } | 1316 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c3468c8dbd89..0a67031ffc13 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
| @@ -806,6 +806,70 @@ static int find_slot_from_contactid(struct wacom_wac *wacom, int contactid) | |||
| 806 | return -1; | 806 | return -1; |
| 807 | } | 807 | } |
| 808 | 808 | ||
| 809 | static int int_dist(int x1, int y1, int x2, int y2) | ||
| 810 | { | ||
| 811 | int x = x2 - x1; | ||
| 812 | int y = y2 - y1; | ||
| 813 | |||
| 814 | return int_sqrt(x*x + y*y); | ||
| 815 | } | ||
| 816 | |||
| 817 | static int wacom_24hdt_irq(struct wacom_wac *wacom) | ||
| 818 | { | ||
| 819 | struct input_dev *input = wacom->input; | ||
| 820 | char *data = wacom->data; | ||
| 821 | int i; | ||
| 822 | int current_num_contacts = data[61]; | ||
| 823 | int contacts_to_send = 0; | ||
| 824 | |||
| 825 | /* | ||
| 826 | * First packet resets the counter since only the first | ||
| 827 | * packet in series will have non-zero current_num_contacts. | ||
| 828 | */ | ||
| 829 | if (current_num_contacts) | ||
| 830 | wacom->num_contacts_left = current_num_contacts; | ||
| 831 | |||
| 832 | /* There are at most 4 contacts per packet */ | ||
| 833 | contacts_to_send = min(4, wacom->num_contacts_left); | ||
| 834 | |||
| 835 | for (i = 0; i < contacts_to_send; i++) { | ||
| 836 | int offset = (WACOM_BYTES_PER_24HDT_PACKET * i) + 1; | ||
| 837 | bool touch = data[offset] & 0x1 && !wacom->shared->stylus_in_proximity; | ||
| 838 | int id = data[offset + 1]; | ||
| 839 | int slot = find_slot_from_contactid(wacom, id); | ||
| 840 | |||
| 841 | if (slot < 0) | ||
| 842 | continue; | ||
| 843 | input_mt_slot(input, slot); | ||
| 844 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | ||
| 845 | |||
| 846 | if (touch) { | ||
| 847 | int t_x = le16_to_cpup((__le16 *)&data[offset + 2]); | ||
| 848 | int c_x = le16_to_cpup((__le16 *)&data[offset + 4]); | ||
| 849 | int t_y = le16_to_cpup((__le16 *)&data[offset + 6]); | ||
| 850 | int c_y = le16_to_cpup((__le16 *)&data[offset + 8]); | ||
| 851 | int w = le16_to_cpup((__le16 *)&data[offset + 10]); | ||
| 852 | int h = le16_to_cpup((__le16 *)&data[offset + 12]); | ||
| 853 | |||
| 854 | input_report_abs(input, ABS_MT_POSITION_X, t_x); | ||
| 855 | input_report_abs(input, ABS_MT_POSITION_Y, t_y); | ||
| 856 | input_report_abs(input, ABS_MT_TOUCH_MAJOR, min(w,h)); | ||
| 857 | input_report_abs(input, ABS_MT_WIDTH_MAJOR, min(w, h) + int_dist(t_x, t_y, c_x, c_y)); | ||
| 858 | input_report_abs(input, ABS_MT_WIDTH_MINOR, min(w, h)); | ||
| 859 | input_report_abs(input, ABS_MT_ORIENTATION, w > h); | ||
| 860 | } | ||
| 861 | wacom->slots[slot] = touch ? id : -1; | ||
