diff options
| -rw-r--r-- | drivers/hid/hid-core.c | 1 | ||||
| -rw-r--r-- | drivers/hid/hid-ids.h | 1 | ||||
| -rw-r--r-- | drivers/hid/hid-waltop.c | 189 | ||||
| -rw-r--r-- | drivers/hid/usbhid/hid-quirks.c | 1 |
4 files changed, 192 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 990fe19330e6..59f32a70ec59 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
| @@ -1578,6 +1578,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 1578 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, | 1578 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_PID_0038) }, |
| 1579 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, | 1579 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
| 1580 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, | 1580 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
| 1581 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, | ||
| 1581 | { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) }, | 1582 | { HID_USB_DEVICE(USB_VENDOR_ID_XAT, USB_DEVICE_ID_XAT_CSR) }, |
| 1582 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) }, | 1583 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_SPX) }, |
| 1583 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) }, | 1584 | { HID_USB_DEVICE(USB_VENDOR_ID_XIROKU, USB_DEVICE_ID_XIROKU_MPX) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 3eb00902ca40..9f5b1cd91489 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
| @@ -737,6 +737,7 @@ | |||
| 737 | #define USB_DEVICE_ID_WALTOP_PID_0038 0x0038 | 737 | #define USB_DEVICE_ID_WALTOP_PID_0038 0x0038 |
| 738 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501 | 738 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH 0x0501 |
| 739 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500 | 739 | #define USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH 0x0500 |
| 740 | #define USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET 0x0502 | ||
| 740 | 741 | ||
| 741 | #define USB_VENDOR_ID_WISEGROUP 0x0925 | 742 | #define USB_VENDOR_ID_WISEGROUP 0x0925 |
| 742 | #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 | 743 | #define USB_DEVICE_ID_SMARTJOY_PLUS 0x0005 |
diff --git a/drivers/hid/hid-waltop.c b/drivers/hid/hid-waltop.c index 2cfd95c4467b..9a48438090a9 100644 --- a/drivers/hid/hid-waltop.c +++ b/drivers/hid/hid-waltop.c | |||
| @@ -502,6 +502,142 @@ static __u8 media_tablet_14_1_inch_rdesc_fixed[] = { | |||
| 502 | 0xC0 /* End Collection */ | 502 | 0xC0 /* End Collection */ |
| 503 | }; | 503 | }; |
| 504 | 504 | ||
| 505 | /* | ||
| 506 | * See Sirius Battery Free Tablet description, device and HID report descriptors | ||
| 507 | * at | ||
| 508 | * http://sf.net/apps/mediawiki/digimend/?title=Waltop_Sirius_Battery_Free_Tablet | ||
| 509 | */ | ||
| 510 | |||
| 511 | /* Size of the original report descriptor of Sirius Battery Free Tablet */ | ||
| 512 | #define SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE 335 | ||
| 513 | |||
| 514 | /* Fixed Sirius Battery Free Tablet descriptor */ | ||
| 515 | static __u8 sirius_battery_free_tablet_rdesc_fixed[] = { | ||
| 516 | 0x05, 0x0D, /* Usage Page (Digitizer), */ | ||
| 517 | 0x09, 0x02, /* Usage (Pen), */ | ||
| 518 | 0xA1, 0x01, /* Collection (Application), */ | ||
| 519 | 0x85, 0x10, /* Report ID (16), */ | ||
| 520 | 0x09, 0x20, /* Usage (Stylus), */ | ||
| 521 | 0xA0, /* Collection (Physical), */ | ||
| 522 | 0x95, 0x01, /* Report Count (1), */ | ||
| 523 | 0x15, 0x01, /* Logical Minimum (1), */ | ||
| 524 | 0x25, 0x03, /* Logical Maximum (3), */ | ||
| 525 | 0x75, 0x02, /* Report Size (2), */ | ||
| 526 | 0x09, 0x42, /* Usage (Tip Switch), */ | ||
| 527 | 0x09, 0x44, /* Usage (Barrel Switch), */ | ||
| 528 | 0x09, 0x46, /* Usage (Tablet Pick), */ | ||
| 529 | 0x80, /* Input, */ | ||
| 530 | 0x14, /* Logical Minimum (0), */ | ||
| 531 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
| 532 | 0x75, 0x01, /* Report Size (1), */ | ||
| 533 | 0x09, 0x3C, /* Usage (Invert), */ | ||
| 534 | 0x81, 0x02, /* Input (Variable), */ | ||
| 535 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 536 | 0x09, 0x32, /* Usage (In Range), */ | ||
| 537 | 0x81, 0x02, /* Input (Variable), */ | ||
| 538 | 0x95, 0x03, /* Report Count (3), */ | ||
| 539 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 540 | 0xA4, /* Push, */ | ||
| 541 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
| 542 | 0x55, 0xFD, /* Unit Exponent (-3), */ | ||
| 543 | 0x65, 0x13, /* Unit (Inch), */ | ||
| 544 | 0x34, /* Physical Minimum (0), */ | ||
| 545 | 0x14, /* Logical Minimum (0), */ | ||
| 546 | 0x75, 0x10, /* Report Size (16), */ | ||
| 547 | 0x95, 0x01, /* Report Count (1), */ | ||
| 548 | 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ | ||
| 549 | 0x26, 0x20, 0x4E, /* Logical Maximum (20000), */ | ||
| 550 | 0x09, 0x30, /* Usage (X), */ | ||
| 551 | 0x81, 0x02, /* Input (Variable), */ | ||
| 552 | 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ | ||
| 553 | 0x26, 0xE0, 0x2E, /* Logical Maximum (12000), */ | ||
| 554 | 0x09, 0x31, /* Usage (Y), */ | ||
| 555 | 0x81, 0x02, /* Input (Variable), */ | ||
| 556 | 0xB4, /* Pop, */ | ||
| 557 | 0x75, 0x10, /* Report Size (16), */ | ||
| 558 | 0x95, 0x01, /* Report Count (1), */ | ||
| 559 | 0x14, /* Logical Minimum (0), */ | ||
| 560 | 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ | ||
| 561 | 0x09, 0x30, /* Usage (Tip Pressure), */ | ||
| 562 | 0x81, 0x02, /* Input (Variable), */ | ||
| 563 | 0xA4, /* Push, */ | ||
| 564 | 0x55, 0xFE, /* Unit Exponent (-2), */ | ||
| 565 | 0x65, 0x12, /* Unit (Radians), */ | ||
| 566 | 0x35, 0x97, /* Physical Minimum (-105), */ | ||
| 567 | 0x45, 0x69, /* Physical Maximum (105), */ | ||
| 568 | 0x15, 0x97, /* Logical Minimum (-105), */ | ||
| 569 | 0x25, 0x69, /* Logical Maximum (105), */ | ||
| 570 | 0x75, 0x08, /* Report Size (8), */ | ||
| 571 | 0x95, 0x02, /* Report Count (2), */ | ||
| 572 | 0x09, 0x3D, /* Usage (X Tilt), */ | ||
| 573 | 0x09, 0x3E, /* Usage (Y Tilt), */ | ||
| 574 | 0x81, 0x02, /* Input (Variable), */ | ||
| 575 | 0xB4, /* Pop, */ | ||
| 576 | 0xC0, /* End Collection, */ | ||
| 577 | 0xC0, /* End Collection, */ | ||
| 578 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
| 579 | 0x09, 0x02, /* Usage (Mouse), */ | ||
| 580 | 0xA1, 0x01, /* Collection (Application), */ | ||
| 581 | 0x85, 0x01, /* Report ID (1), */ | ||
| 582 | 0x09, 0x01, /* Usage (Pointer), */ | ||
| 583 | 0xA0, /* Collection (Physical), */ | ||
| 584 | 0x75, 0x08, /* Report Size (8), */ | ||
| 585 | 0x95, 0x03, /* Report Count (3), */ | ||
| 586 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 587 | 0x09, 0x38, /* Usage (Wheel), */ | ||
| 588 | 0x15, 0xFF, /* Logical Minimum (-1), */ | ||
| 589 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
| 590 | 0x75, 0x08, /* Report Size (8), */ | ||
| 591 | 0x95, 0x01, /* Report Count (1), */ | ||
| 592 | 0x81, 0x06, /* Input (Variable, Relative), */ | ||
| 593 | 0x75, 0x08, /* Report Size (8), */ | ||
| 594 | 0x95, 0x03, /* Report Count (3), */ | ||
| 595 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 596 | 0xC0, /* End Collection, */ | ||
| 597 | 0xC0, /* End Collection, */ | ||
| 598 | 0x05, 0x01, /* Usage Page (Desktop), */ | ||
| 599 | 0x09, 0x06, /* Usage (Keyboard), */ | ||
| 600 | 0xA1, 0x01, /* Collection (Application), */ | ||
| 601 | 0x85, 0x0D, /* Report ID (13), */ | ||
| 602 | 0x05, 0x07, /* Usage Page (Keyboard), */ | ||
| 603 | 0x19, 0xE0, /* Usage Minimum (KB Leftcontrol), */ | ||
| 604 | 0x29, 0xE7, /* Usage Maximum (KB Right GUI), */ | ||
| 605 | 0x14, /* Logical Minimum (0), */ | ||
| 606 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
| 607 | 0x75, 0x01, /* Report Size (1), */ | ||
| 608 | 0x95, 0x08, /* Report Count (8), */ | ||
| 609 | 0x81, 0x02, /* Input (Variable), */ | ||
| 610 | 0x75, 0x08, /* Report Size (8), */ | ||
| 611 | 0x95, 0x01, /* Report Count (1), */ | ||
| 612 | 0x81, 0x01, /* Input (Constant), */ | ||
| 613 | 0x18, /* Usage Minimum (None), */ | ||
| 614 | 0x29, 0x65, /* Usage Maximum (KB Application), */ | ||
| 615 | 0x14, /* Logical Minimum (0), */ | ||
| 616 | 0x25, 0x65, /* Logical Maximum (101), */ | ||
| 617 | 0x75, 0x08, /* Report Size (8), */ | ||
| 618 | 0x95, 0x05, /* Report Count (5), */ | ||
| 619 | 0x80, /* Input, */ | ||
| 620 | 0xC0, /* End Collection, */ | ||
| 621 | 0x05, 0x0C, /* Usage Page (Consumer), */ | ||
| 622 | 0x09, 0x01, /* Usage (Consumer Control), */ | ||
| 623 | 0xA1, 0x01, /* Collection (Application), */ | ||
| 624 | 0x85, 0x0C, /* Report ID (12), */ | ||
| 625 | 0x09, 0xE9, /* Usage (Volume Inc), */ | ||
| 626 | 0x09, 0xEA, /* Usage (Volume Dec), */ | ||
| 627 | 0x14, /* Logical Minimum (0), */ | ||
| 628 | 0x25, 0x01, /* Logical Maximum (1), */ | ||
| 629 | 0x75, 0x01, /* Report Size (1), */ | ||
| 630 | 0x95, 0x02, /* Report Count (2), */ | ||
| 631 | 0x81, 0x02, /* Input (Variable), */ | ||
| 632 | 0x75, 0x06, /* Report Size (6), */ | ||
| 633 | 0x95, 0x01, /* Report Count (1), */ | ||
| 634 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 635 | 0x75, 0x10, /* Report Size (16), */ | ||
| 636 | 0x95, 0x03, /* Report Count (3), */ | ||
| 637 | 0x81, 0x03, /* Input (Constant, Variable), */ | ||
| 638 | 0xC0 /* End Collection */ | ||
| 639 | }; | ||
| 640 | |||
| 505 | struct waltop_state { | 641 | struct waltop_state { |
| 506 | u8 pressure0; | 642 | u8 pressure0; |
| 507 | u8 pressure1; | 643 | u8 pressure1; |
| @@ -583,6 +719,12 @@ static __u8 *waltop_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
| 583 | *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed); | 719 | *rsize = sizeof(media_tablet_14_1_inch_rdesc_fixed); |
| 584 | } | 720 | } |
| 585 | break; | 721 | break; |
| 722 | case USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET: | ||
| 723 | if (*rsize == SIRIUS_BATTERY_FREE_TABLET_RDESC_ORIG_SIZE) { | ||
| 724 | rdesc = sirius_battery_free_tablet_rdesc_fixed; | ||
| 725 | *rsize = sizeof(sirius_battery_free_tablet_rdesc_fixed); | ||
| 726 | } | ||
| 727 | break; | ||
| 586 | } | 728 | } |
| 587 | return rdesc; | 729 | return rdesc; |
| 588 | } | 730 | } |
| @@ -614,6 +756,51 @@ static int waltop_raw_event(struct hid_device *hdev, struct hid_report *report, | |||
| 614 | } | 756 | } |
| 615 | } | 757 | } |
| 616 | 758 | ||
| 759 | /* If this is a pen input report of Sirius Battery Free Tablet */ | ||
| 760 | if (hdev->product == USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET && | ||
| 761 | report->type == HID_INPUT_REPORT && | ||
| 762 | report->id == 16 && | ||
| 763 | size == 10) { | ||
| 764 | /* | ||
| 765 | * The tablet reports tilt as roughly sin(a)*21 (18 means 60 | ||
| 766 | * degrees). | ||
| 767 | * | ||
| 768 | * This array stores angles as radians * 100, corresponding to | ||
| 769 | * reported values up to 60 degrees, as expected by userspace. | ||
| 770 | */ | ||
| 771 | static const s8 tilt_to_radians[] = { | ||
| 772 | 0, 5, 10, 14, 19, 24, 29, 34, 40, 45, | ||
| 773 | 50, 56, 62, 68, 74, 81, 88, 96, 105 | ||
| 774 | }; | ||
| 775 | |||
| 776 | s8 tilt_x = (s8)data[8]; | ||
| 777 | s8 tilt_y = (s8)data[9]; | ||
| 778 | s8 sign_x = tilt_x >= 0 ? 1 : -1; | ||
| 779 | s8 sign_y = tilt_y >= 0 ? 1 : -1; | ||
| 780 | |||
| 781 | tilt_x *= sign_x; | ||
| 782 | tilt_y *= sign_y; | ||
| 783 | |||
| 784 | /* | ||
| 785 | * Reverse the Y Tilt direction to match the HID standard and | ||
| 786 | * userspace expectations. See HID Usage Tables v1.12 16.3.2 | ||
| 787 | * Tilt Orientation. | ||
| 788 | */ | ||
| 789 | sign_y *= -1; | ||
| 790 | |||
| 791 | /* | ||
| 792 | * This effectively clamps reported tilt to 60 degrees - the | ||
| 793 | * range expected by userspace | ||
| 794 | */ | ||
| 795 | if (tilt_x > ARRAY_SIZE(tilt_to_radians) - 1) | ||
| 796 | tilt_x = ARRAY_SIZE(tilt_to_radians) - 1; | ||
| 797 | if (tilt_y > ARRAY_SIZE(tilt_to_radians) - 1) | ||
| 798 | tilt_y = ARRAY_SIZE(tilt_to_radians) - 1; | ||
| 799 | |||
| 800 | data[8] = tilt_to_radians[tilt_x] * sign_x; | ||
| 801 | data[9] = tilt_to_radians[tilt_y] * sign_y; | ||
| 802 | } | ||
| 803 | |||
| 617 | return 0; | 804 | return 0; |
| 618 | } | 805 | } |
| 619 | 806 | ||
| @@ -638,6 +825,8 @@ static const struct hid_device_id waltop_devices[] = { | |||
| 638 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, | 825 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) }, |
| 639 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, | 826 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, |
| 640 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, | 827 | USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH) }, |
| 828 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, | ||
| 829 | USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET) }, | ||
| 641 | { } | 830 | { } |
| 642 | }; | 831 | }; |
| 643 | MODULE_DEVICE_TABLE(hid, waltop_devices); | 832 | MODULE_DEVICE_TABLE(hid, waltop_devices); |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 782c63955f29..0597ee604f6e 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
| @@ -88,6 +88,7 @@ static const struct hid_blacklist { | |||
| 88 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, | 88 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, |
| 89 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, | 89 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, |
| 90 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, | 90 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, |
| 91 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET, HID_QUIRK_MULTI_INPUT }, | ||
| 91 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 92 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
| 92 | 93 | ||
| 93 | { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 94 | { USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
