.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * HID driver for Kye/Genius devices not fully compliant with HID standard |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | */ |
---|
8 | 9 | |
---|
9 | 10 | /* |
---|
10 | | - * This program is free software; you can redistribute it and/or modify it |
---|
11 | | - * under the terms of the GNU General Public License as published by the Free |
---|
12 | | - * Software Foundation; either version 2 of the License, or (at your option) |
---|
13 | | - * any later version. |
---|
14 | 11 | */ |
---|
15 | 12 | |
---|
16 | 13 | #include <linux/device.h> |
---|
.. | .. |
---|
483 | 480 | 0xC0 /* End Collection */ |
---|
484 | 481 | }; |
---|
485 | 482 | |
---|
| 483 | +/* Original EasyPen M406XE report descriptor size */ |
---|
| 484 | +#define EASYPEN_M406XE_RDESC_ORIG_SIZE 476 |
---|
| 485 | + |
---|
| 486 | +/* Fixed EasyPen M406XE report descriptor */ |
---|
| 487 | +static __u8 easypen_m406xe_rdesc_fixed[] = { |
---|
| 488 | + 0x05, 0x01, /* Usage Page (Desktop), */ |
---|
| 489 | + 0x09, 0x01, /* Usage (01h), */ |
---|
| 490 | + 0xA1, 0x01, /* Collection (Application), */ |
---|
| 491 | + 0x85, 0x05, /* Report ID (5), */ |
---|
| 492 | + 0x09, 0x01, /* Usage (01h), */ |
---|
| 493 | + 0x15, 0x80, /* Logical Minimum (-128), */ |
---|
| 494 | + 0x25, 0x7F, /* Logical Maximum (127), */ |
---|
| 495 | + 0x75, 0x08, /* Report Size (8), */ |
---|
| 496 | + 0x95, 0x07, /* Report Count (7), */ |
---|
| 497 | + 0xB1, 0x02, /* Feature (Variable), */ |
---|
| 498 | + 0xC0, /* End Collection, */ |
---|
| 499 | + 0x05, 0x0D, /* Usage Page (Digitizer), */ |
---|
| 500 | + 0x09, 0x02, /* Usage (Pen), */ |
---|
| 501 | + 0xA1, 0x01, /* Collection (Application), */ |
---|
| 502 | + 0x85, 0x10, /* Report ID (16), */ |
---|
| 503 | + 0x09, 0x20, /* Usage (Stylus), */ |
---|
| 504 | + 0xA0, /* Collection (Physical), */ |
---|
| 505 | + 0x14, /* Logical Minimum (0), */ |
---|
| 506 | + 0x25, 0x01, /* Logical Maximum (1), */ |
---|
| 507 | + 0x75, 0x01, /* Report Size (1), */ |
---|
| 508 | + 0x09, 0x42, /* Usage (Tip Switch), */ |
---|
| 509 | + 0x09, 0x44, /* Usage (Barrel Switch), */ |
---|
| 510 | + 0x09, 0x46, /* Usage (Tablet Pick), */ |
---|
| 511 | + 0x95, 0x03, /* Report Count (3), */ |
---|
| 512 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 513 | + 0x95, 0x04, /* Report Count (4), */ |
---|
| 514 | + 0x81, 0x03, /* Input (Constant, Variable), */ |
---|
| 515 | + 0x09, 0x32, /* Usage (In Range), */ |
---|
| 516 | + 0x95, 0x01, /* Report Count (1), */ |
---|
| 517 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 518 | + 0x75, 0x10, /* Report Size (16), */ |
---|
| 519 | + 0x95, 0x01, /* Report Count (1), */ |
---|
| 520 | + 0xA4, /* Push, */ |
---|
| 521 | + 0x05, 0x01, /* Usage Page (Desktop), */ |
---|
| 522 | + 0x55, 0xFD, /* Unit Exponent (-3), */ |
---|
| 523 | + 0x65, 0x13, /* Unit (Inch), */ |
---|
| 524 | + 0x34, /* Physical Minimum (0), */ |
---|
| 525 | + 0x09, 0x30, /* Usage (X), */ |
---|
| 526 | + 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ |
---|
| 527 | + 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ |
---|
| 528 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 529 | + 0x09, 0x31, /* Usage (Y), */ |
---|
| 530 | + 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ |
---|
| 531 | + 0x26, 0x00, 0x28, /* Logical Maximum (10240), */ |
---|
| 532 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 533 | + 0xB4, /* Pop, */ |
---|
| 534 | + 0x09, 0x30, /* Usage (Tip Pressure), */ |
---|
| 535 | + 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ |
---|
| 536 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 537 | + 0xC0, /* End Collection, */ |
---|
| 538 | + 0xC0, /* End Collection */ |
---|
| 539 | + 0x05, 0x0C, /* Usage Page (Consumer), */ |
---|
| 540 | + 0x09, 0x01, /* Usage (Consumer Control), */ |
---|
| 541 | + 0xA1, 0x01, /* Collection (Application), */ |
---|
| 542 | + 0x85, 0x12, /* Report ID (18), */ |
---|
| 543 | + 0x14, /* Logical Minimum (0), */ |
---|
| 544 | + 0x25, 0x01, /* Logical Maximum (1), */ |
---|
| 545 | + 0x75, 0x01, /* Report Size (1), */ |
---|
| 546 | + 0x95, 0x04, /* Report Count (4), */ |
---|
| 547 | + 0x0A, 0x79, 0x02, /* Usage (AC Redo Or Repeat), */ |
---|
| 548 | + 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ |
---|
| 549 | + 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ |
---|
| 550 | + 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ |
---|
| 551 | + 0x81, 0x02, /* Input (Variable), */ |
---|
| 552 | + 0x95, 0x34, /* Report Count (52), */ |
---|
| 553 | + 0x81, 0x03, /* Input (Constant, Variable), */ |
---|
| 554 | + 0xC0 /* End Collection */ |
---|
| 555 | +}; |
---|
| 556 | + |
---|
486 | 557 | static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, |
---|
487 | 558 | unsigned int *rsize, int offset, const char *device_name) { |
---|
488 | 559 | /* |
---|
.. | .. |
---|
553 | 624 | if (*rsize == EASYPEN_M610X_RDESC_ORIG_SIZE) { |
---|
554 | 625 | rdesc = easypen_m610x_rdesc_fixed; |
---|
555 | 626 | *rsize = sizeof(easypen_m610x_rdesc_fixed); |
---|
| 627 | + } |
---|
| 628 | + break; |
---|
| 629 | + case USB_DEVICE_ID_KYE_EASYPEN_M406XE: |
---|
| 630 | + if (*rsize == EASYPEN_M406XE_RDESC_ORIG_SIZE) { |
---|
| 631 | + rdesc = easypen_m406xe_rdesc_fixed; |
---|
| 632 | + *rsize = sizeof(easypen_m406xe_rdesc_fixed); |
---|
556 | 633 | } |
---|
557 | 634 | break; |
---|
558 | 635 | case USB_DEVICE_ID_KYE_PENSKETCH_M912: |
---|
.. | .. |
---|
644 | 721 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: |
---|
645 | 722 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2: |
---|
646 | 723 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: |
---|
| 724 | + case USB_DEVICE_ID_KYE_EASYPEN_M406XE: |
---|
647 | 725 | case USB_DEVICE_ID_KYE_PENSKETCH_M912: |
---|
648 | 726 | ret = kye_tablet_enable(hdev); |
---|
649 | 727 | if (ret) { |
---|
.. | .. |
---|
679 | 757 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
---|
680 | 758 | USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
---|
681 | 759 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
---|
| 760 | + USB_DEVICE_ID_KYE_EASYPEN_M406XE) }, |
---|
| 761 | + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
---|
682 | 762 | USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, |
---|
683 | 763 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, |
---|
684 | 764 | USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, |
---|