18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * HID driver for Kye/Genius devices not fully compliant with HID standard 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2009 Jiri Kosina 68c2ecf20Sopenharmony_ci * Copyright (c) 2009 Tomas Hanak 78c2ecf20Sopenharmony_ci * Copyright (c) 2012 Nikolai Kondrashov 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/device.h> 148c2ecf20Sopenharmony_ci#include <linux/hid.h> 158c2ecf20Sopenharmony_ci#include <linux/module.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#include "hid-ids.h" 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci/* Original EasyPen i405X report descriptor size */ 208c2ecf20Sopenharmony_ci#define EASYPEN_I405X_RDESC_ORIG_SIZE 476 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* Fixed EasyPen i405X report descriptor */ 238c2ecf20Sopenharmony_cistatic __u8 easypen_i405x_rdesc_fixed[] = { 248c2ecf20Sopenharmony_ci 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 258c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 268c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 278c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 288c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 298c2ecf20Sopenharmony_ci 0x15, 0x80, /* Logical Minimum (-128), */ 308c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 318c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 328c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 338c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 348c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 358c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 368c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 378c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 388c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 398c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 408c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 418c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 428c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 438c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 448c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 458c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 468c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 478c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 488c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 498c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 508c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 518c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 528c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 538c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 548c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 558c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 568c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 578c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 588c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 598c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 608c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 618c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 628c2ecf20Sopenharmony_ci 0x46, 0x7C, 0x15, /* Physical Maximum (5500), */ 638c2ecf20Sopenharmony_ci 0x26, 0x00, 0x37, /* Logical Maximum (14080), */ 648c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 658c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 668c2ecf20Sopenharmony_ci 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ 678c2ecf20Sopenharmony_ci 0x26, 0x00, 0x28, /* Logical Maximum (10240), */ 688c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 698c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 708c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 718c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ 728c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 738c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 748c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 758c2ecf20Sopenharmony_ci}; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ci/* Original MousePen i608X report descriptor size */ 788c2ecf20Sopenharmony_ci#define MOUSEPEN_I608X_RDESC_ORIG_SIZE 476 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci/* Fixed MousePen i608X report descriptor */ 818c2ecf20Sopenharmony_cistatic __u8 mousepen_i608x_rdesc_fixed[] = { 828c2ecf20Sopenharmony_ci 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 838c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 848c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 858c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 868c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 878c2ecf20Sopenharmony_ci 0x15, 0x80, /* Logical Minimum (-128), */ 888c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 898c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 908c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 918c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 928c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 938c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 948c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 958c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 968c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 978c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 988c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 998c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 1008c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 1018c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 1028c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 1038c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 1048c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 1058c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 1068c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1078c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 1088c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 1098c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 1108c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 1118c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1128c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 1138c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 1148c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 1158c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 1168c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 1178c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 1188c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 1198c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 1208c2ecf20Sopenharmony_ci 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ 1218c2ecf20Sopenharmony_ci 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ 1228c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1238c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 1248c2ecf20Sopenharmony_ci 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ 1258c2ecf20Sopenharmony_ci 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ 1268c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1278c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 1288c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 1298c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ 1308c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1318c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 1328c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 1338c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 1348c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Mouse), */ 1358c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 1368c2ecf20Sopenharmony_ci 0x85, 0x11, /* Report ID (17), */ 1378c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (Pointer), */ 1388c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 1398c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 1408c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 1418c2ecf20Sopenharmony_ci 0x05, 0x09, /* Usage Page (Button), */ 1428c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 1438c2ecf20Sopenharmony_ci 0x19, 0x01, /* Usage Minimum (01h), */ 1448c2ecf20Sopenharmony_ci 0x29, 0x03, /* Usage Maximum (03h), */ 1458c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 1468c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 1478c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1488c2ecf20Sopenharmony_ci 0x95, 0x05, /* Report Count (5), */ 1498c2ecf20Sopenharmony_ci 0x81, 0x01, /* Input (Constant), */ 1508c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 1518c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 1528c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 1538c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 1548c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 1558c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 1568c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 1578c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 1588c2ecf20Sopenharmony_ci 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ 1598c2ecf20Sopenharmony_ci 0x26, 0x00, 0x50, /* Logical Maximum (20480), */ 1608c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1618c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 1628c2ecf20Sopenharmony_ci 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ 1638c2ecf20Sopenharmony_ci 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ 1648c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 1658c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 1668c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 1678c2ecf20Sopenharmony_ci 0x09, 0x38, /* Usage (Wheel), */ 1688c2ecf20Sopenharmony_ci 0x15, 0xFF, /* Logical Minimum (-1), */ 1698c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 1708c2ecf20Sopenharmony_ci 0x81, 0x06, /* Input (Variable, Relative), */ 1718c2ecf20Sopenharmony_ci 0x81, 0x01, /* Input (Constant), */ 1728c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 1738c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 1748c2ecf20Sopenharmony_ci}; 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci/* Original MousePen i608X v2 report descriptor size */ 1778c2ecf20Sopenharmony_ci#define MOUSEPEN_I608X_V2_RDESC_ORIG_SIZE 482 1788c2ecf20Sopenharmony_ci 1798c2ecf20Sopenharmony_ci/* Fixed MousePen i608X v2 report descriptor */ 1808c2ecf20Sopenharmony_cistatic __u8 mousepen_i608x_v2_rdesc_fixed[] = { 1818c2ecf20Sopenharmony_ci 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 1828c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 1838c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 1848c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 1858c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 1868c2ecf20Sopenharmony_ci 0x15, 0x80, /* Logical Minimum (-128), */ 1878c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 1888c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 1898c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 1908c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 1918c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 1928c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 1938c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 1948c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 1958c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 1968c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 1978c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 1988c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 1998c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 2008c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 2018c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 2028c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 2038c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 2048c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 2058c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2068c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 2078c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 2088c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 2098c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 2108c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2118c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 2128c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 2138c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 2148c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 2158c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 2168c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 2178c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 2188c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 2198c2ecf20Sopenharmony_ci 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ 2208c2ecf20Sopenharmony_ci 0x27, 0x00, 0xA0, 0x00, 0x00, /* Logical Maximum (40960), */ 2218c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2228c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 2238c2ecf20Sopenharmony_ci 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ 2248c2ecf20Sopenharmony_ci 0x26, 0x00, 0x78, /* Logical Maximum (30720), */ 2258c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2268c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 2278c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 2288c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x07, /* Logical Maximum (2047), */ 2298c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2308c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 2318c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 2328c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 2338c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Mouse), */ 2348c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 2358c2ecf20Sopenharmony_ci 0x85, 0x11, /* Report ID (17), */ 2368c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (Pointer), */ 2378c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 2388c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 2398c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 2408c2ecf20Sopenharmony_ci 0x05, 0x09, /* Usage Page (Button), */ 2418c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 2428c2ecf20Sopenharmony_ci 0x19, 0x01, /* Usage Minimum (01h), */ 2438c2ecf20Sopenharmony_ci 0x29, 0x03, /* Usage Maximum (03h), */ 2448c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 2458c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 2468c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2478c2ecf20Sopenharmony_ci 0x95, 0x05, /* Report Count (5), */ 2488c2ecf20Sopenharmony_ci 0x81, 0x01, /* Input (Constant), */ 2498c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 2508c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 2518c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 2528c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 2538c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 2548c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 2558c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 2568c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 2578c2ecf20Sopenharmony_ci 0x46, 0x40, 0x1F, /* Physical Maximum (8000), */ 2588c2ecf20Sopenharmony_ci 0x27, 0x00, 0xA0, 0x00, 0x00, /* Logical Maximum (40960), */ 2598c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2608c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 2618c2ecf20Sopenharmony_ci 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ 2628c2ecf20Sopenharmony_ci 0x26, 0x00, 0x78, /* Logical Maximum (30720), */ 2638c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 2648c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 2658c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 2668c2ecf20Sopenharmony_ci 0x09, 0x38, /* Usage (Wheel), */ 2678c2ecf20Sopenharmony_ci 0x15, 0xFF, /* Logical Minimum (-1), */ 2688c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 2698c2ecf20Sopenharmony_ci 0x81, 0x06, /* Input (Variable, Relative), */ 2708c2ecf20Sopenharmony_ci 0x81, 0x01, /* Input (Constant), */ 2718c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 2728c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 2738c2ecf20Sopenharmony_ci}; 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci/* Original EasyPen M610X report descriptor size */ 2768c2ecf20Sopenharmony_ci#define EASYPEN_M610X_RDESC_ORIG_SIZE 476 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci/* Fixed EasyPen M610X report descriptor */ 2798c2ecf20Sopenharmony_cistatic __u8 easypen_m610x_rdesc_fixed[] = { 2808c2ecf20Sopenharmony_ci 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 2818c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 2828c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 2838c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 2848c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 2858c2ecf20Sopenharmony_ci 0x15, 0x80, /* Logical Minimum (-128), */ 2868c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 2878c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 2888c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 2898c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 2908c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 2918c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 2928c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 2938c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 2948c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 2958c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 2968c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 2978c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 2988c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 2998c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 3008c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 3018c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 3028c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 3038c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 3048c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3058c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 3068c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 3078c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 3088c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 3098c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3108c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 3118c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 3128c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 3138c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 3148c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 3158c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 3168c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 3178c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 3188c2ecf20Sopenharmony_ci 0x46, 0x10, 0x27, /* Physical Maximum (10000), */ 3198c2ecf20Sopenharmony_ci 0x27, 0x00, 0xA0, 0x00, 0x00, /* Logical Maximum (40960), */ 3208c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3218c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 3228c2ecf20Sopenharmony_ci 0x46, 0x6A, 0x18, /* Physical Maximum (6250), */ 3238c2ecf20Sopenharmony_ci 0x26, 0x00, 0x64, /* Logical Maximum (25600), */ 3248c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3258c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 3268c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 3278c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ 3288c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3298c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 3308c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 3318c2ecf20Sopenharmony_ci 0x05, 0x0C, /* Usage Page (Consumer), */ 3328c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (Consumer Control), */ 3338c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 3348c2ecf20Sopenharmony_ci 0x85, 0x12, /* Report ID (18), */ 3358c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 3368c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 3378c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 3388c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 3398c2ecf20Sopenharmony_ci 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ 3408c2ecf20Sopenharmony_ci 0x0A, 0x79, 0x02, /* Usage (AC Redo Or Repeat), */ 3418c2ecf20Sopenharmony_ci 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ 3428c2ecf20Sopenharmony_ci 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ 3438c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3448c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 3458c2ecf20Sopenharmony_ci 0x75, 0x14, /* Report Size (20), */ 3468c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 3478c2ecf20Sopenharmony_ci 0x75, 0x20, /* Report Size (32), */ 3488c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 3498c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 3508c2ecf20Sopenharmony_ci}; 3518c2ecf20Sopenharmony_ci 3528c2ecf20Sopenharmony_ci 3538c2ecf20Sopenharmony_ci/* Original PenSketch M912 report descriptor size */ 3548c2ecf20Sopenharmony_ci#define PENSKETCH_M912_RDESC_ORIG_SIZE 482 3558c2ecf20Sopenharmony_ci 3568c2ecf20Sopenharmony_ci/* Fixed PenSketch M912 report descriptor */ 3578c2ecf20Sopenharmony_cistatic __u8 pensketch_m912_rdesc_fixed[] = { 3588c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 3598c2ecf20Sopenharmony_ci 0x08, /* Usage (00h), */ 3608c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 3618c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 3628c2ecf20Sopenharmony_ci 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ 3638c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 3648c2ecf20Sopenharmony_ci 0x15, 0x81, /* Logical Minimum (-127), */ 3658c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 3668c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 3678c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 3688c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 3698c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 3708c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 3718c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 3728c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 3738c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 3748c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 3758c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 3768c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 3778c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 3788c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 3798c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 3808c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 3818c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 3828c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 3838c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3848c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 3858c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 3868c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 3878c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 3888c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 3898c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 3908c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 3918c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 3928c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 3938c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 3948c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 3958c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 3968c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 3978c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 3988c2ecf20Sopenharmony_ci 0x27, 0x00, 0xF0, 0x00, 0x00, /* Logical Maximum (61440), */ 3998c2ecf20Sopenharmony_ci 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ 4008c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4018c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 4028c2ecf20Sopenharmony_ci 0x27, 0x00, 0xB4, 0x00, 0x00, /* Logical Maximum (46080), */ 4038c2ecf20Sopenharmony_ci 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ 4048c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4058c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 4068c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 4078c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 4088c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x07, /* Logical Maximum (2047), */ 4098c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4108c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 4118c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 4128c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 4138c2ecf20Sopenharmony_ci 0x09, 0x21, /* Usage (Puck), */ 4148c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 4158c2ecf20Sopenharmony_ci 0x85, 0x11, /* Report ID (17), */ 4168c2ecf20Sopenharmony_ci 0x09, 0x21, /* Usage (Puck), */ 4178c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 4188c2ecf20Sopenharmony_ci 0x05, 0x09, /* Usage Page (Button), */ 4198c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 4208c2ecf20Sopenharmony_ci 0x19, 0x01, /* Usage Minimum (01h), */ 4218c2ecf20Sopenharmony_ci 0x29, 0x03, /* Usage Maximum (03h), */ 4228c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 4238c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 4248c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 4258c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4268c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 4278c2ecf20Sopenharmony_ci 0x81, 0x01, /* Input (Constant), */ 4288c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 4298c2ecf20Sopenharmony_ci 0x0B, 0x32, 0x00, 0x0D, 0x00, /* Usage (Digitizer In Range), */ 4308c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 4318c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 4328c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4338c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 4348c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 4358c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 4368c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 4378c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 4388c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 4398c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 4408c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 4418c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 4428c2ecf20Sopenharmony_ci 0x27, 0x00, 0xF0, 0x00, 0x00, /* Logical Maximum (61440), */ 4438c2ecf20Sopenharmony_ci 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ 4448c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4458c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 4468c2ecf20Sopenharmony_ci 0x27, 0x00, 0xB4, 0x00, 0x00, /* Logical Maximum (46080), */ 4478c2ecf20Sopenharmony_ci 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ 4488c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4498c2ecf20Sopenharmony_ci 0x09, 0x38, /* Usage (Wheel), */ 4508c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 4518c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 4528c2ecf20Sopenharmony_ci 0x15, 0xFF, /* Logical Minimum (-1), */ 4538c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 4548c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 4558c2ecf20Sopenharmony_ci 0x44, /* Physical Maximum (0), */ 4568c2ecf20Sopenharmony_ci 0x81, 0x06, /* Input (Variable, Relative), */ 4578c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 4588c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 4598c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 4608c2ecf20Sopenharmony_ci 0x05, 0x0C, /* Usage Page (Consumer), */ 4618c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (Consumer Control), */ 4628c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 4638c2ecf20Sopenharmony_ci 0x85, 0x12, /* Report ID (18), */ 4648c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 4658c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 4668c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 4678c2ecf20Sopenharmony_ci 0x95, 0x08, /* Report Count (8), */ 4688c2ecf20Sopenharmony_ci 0x05, 0x0C, /* Usage Page (Consumer), */ 4698c2ecf20Sopenharmony_ci 0x0A, 0x6A, 0x02, /* Usage (AC Delete), */ 4708c2ecf20Sopenharmony_ci 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ 4718c2ecf20Sopenharmony_ci 0x0A, 0x01, 0x02, /* Usage (AC New), */ 4728c2ecf20Sopenharmony_ci 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ 4738c2ecf20Sopenharmony_ci 0x0A, 0x25, 0x02, /* Usage (AC Forward), */ 4748c2ecf20Sopenharmony_ci 0x0A, 0x24, 0x02, /* Usage (AC Back), */ 4758c2ecf20Sopenharmony_ci 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ 4768c2ecf20Sopenharmony_ci 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ 4778c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 4788c2ecf20Sopenharmony_ci 0x95, 0x30, /* Report Count (48), */ 4798c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 4808c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 4818c2ecf20Sopenharmony_ci}; 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci/* Original EasyPen M406XE report descriptor size */ 4848c2ecf20Sopenharmony_ci#define EASYPEN_M406XE_RDESC_ORIG_SIZE 476 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci/* Fixed EasyPen M406XE report descriptor */ 4878c2ecf20Sopenharmony_cistatic __u8 easypen_m406xe_rdesc_fixed[] = { 4888c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 4898c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 4908c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 4918c2ecf20Sopenharmony_ci 0x85, 0x05, /* Report ID (5), */ 4928c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (01h), */ 4938c2ecf20Sopenharmony_ci 0x15, 0x80, /* Logical Minimum (-128), */ 4948c2ecf20Sopenharmony_ci 0x25, 0x7F, /* Logical Maximum (127), */ 4958c2ecf20Sopenharmony_ci 0x75, 0x08, /* Report Size (8), */ 4968c2ecf20Sopenharmony_ci 0x95, 0x07, /* Report Count (7), */ 4978c2ecf20Sopenharmony_ci 0xB1, 0x02, /* Feature (Variable), */ 4988c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 4998c2ecf20Sopenharmony_ci 0x05, 0x0D, /* Usage Page (Digitizer), */ 5008c2ecf20Sopenharmony_ci 0x09, 0x02, /* Usage (Pen), */ 5018c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 5028c2ecf20Sopenharmony_ci 0x85, 0x10, /* Report ID (16), */ 5038c2ecf20Sopenharmony_ci 0x09, 0x20, /* Usage (Stylus), */ 5048c2ecf20Sopenharmony_ci 0xA0, /* Collection (Physical), */ 5058c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 5068c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 5078c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 5088c2ecf20Sopenharmony_ci 0x09, 0x42, /* Usage (Tip Switch), */ 5098c2ecf20Sopenharmony_ci 0x09, 0x44, /* Usage (Barrel Switch), */ 5108c2ecf20Sopenharmony_ci 0x09, 0x46, /* Usage (Tablet Pick), */ 5118c2ecf20Sopenharmony_ci 0x95, 0x03, /* Report Count (3), */ 5128c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5138c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 5148c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 5158c2ecf20Sopenharmony_ci 0x09, 0x32, /* Usage (In Range), */ 5168c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 5178c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5188c2ecf20Sopenharmony_ci 0x75, 0x10, /* Report Size (16), */ 5198c2ecf20Sopenharmony_ci 0x95, 0x01, /* Report Count (1), */ 5208c2ecf20Sopenharmony_ci 0xA4, /* Push, */ 5218c2ecf20Sopenharmony_ci 0x05, 0x01, /* Usage Page (Desktop), */ 5228c2ecf20Sopenharmony_ci 0x55, 0xFD, /* Unit Exponent (-3), */ 5238c2ecf20Sopenharmony_ci 0x65, 0x13, /* Unit (Inch), */ 5248c2ecf20Sopenharmony_ci 0x34, /* Physical Minimum (0), */ 5258c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (X), */ 5268c2ecf20Sopenharmony_ci 0x46, 0x70, 0x17, /* Physical Maximum (6000), */ 5278c2ecf20Sopenharmony_ci 0x26, 0x00, 0x3C, /* Logical Maximum (15360), */ 5288c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5298c2ecf20Sopenharmony_ci 0x09, 0x31, /* Usage (Y), */ 5308c2ecf20Sopenharmony_ci 0x46, 0xA0, 0x0F, /* Physical Maximum (4000), */ 5318c2ecf20Sopenharmony_ci 0x26, 0x00, 0x28, /* Logical Maximum (10240), */ 5328c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5338c2ecf20Sopenharmony_ci 0xB4, /* Pop, */ 5348c2ecf20Sopenharmony_ci 0x09, 0x30, /* Usage (Tip Pressure), */ 5358c2ecf20Sopenharmony_ci 0x26, 0xFF, 0x03, /* Logical Maximum (1023), */ 5368c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5378c2ecf20Sopenharmony_ci 0xC0, /* End Collection, */ 5388c2ecf20Sopenharmony_ci 0xC0, /* End Collection */ 5398c2ecf20Sopenharmony_ci 0x05, 0x0C, /* Usage Page (Consumer), */ 5408c2ecf20Sopenharmony_ci 0x09, 0x01, /* Usage (Consumer Control), */ 5418c2ecf20Sopenharmony_ci 0xA1, 0x01, /* Collection (Application), */ 5428c2ecf20Sopenharmony_ci 0x85, 0x12, /* Report ID (18), */ 5438c2ecf20Sopenharmony_ci 0x14, /* Logical Minimum (0), */ 5448c2ecf20Sopenharmony_ci 0x25, 0x01, /* Logical Maximum (1), */ 5458c2ecf20Sopenharmony_ci 0x75, 0x01, /* Report Size (1), */ 5468c2ecf20Sopenharmony_ci 0x95, 0x04, /* Report Count (4), */ 5478c2ecf20Sopenharmony_ci 0x0A, 0x79, 0x02, /* Usage (AC Redo Or Repeat), */ 5488c2ecf20Sopenharmony_ci 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ 5498c2ecf20Sopenharmony_ci 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ 5508c2ecf20Sopenharmony_ci 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ 5518c2ecf20Sopenharmony_ci 0x81, 0x02, /* Input (Variable), */ 5528c2ecf20Sopenharmony_ci 0x95, 0x34, /* Report Count (52), */ 5538c2ecf20Sopenharmony_ci 0x81, 0x03, /* Input (Constant, Variable), */ 5548c2ecf20Sopenharmony_ci 0xC0 /* End Collection */ 5558c2ecf20Sopenharmony_ci}; 5568c2ecf20Sopenharmony_ci 5578c2ecf20Sopenharmony_cistatic __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, 5588c2ecf20Sopenharmony_ci unsigned int *rsize, int offset, const char *device_name) { 5598c2ecf20Sopenharmony_ci /* 5608c2ecf20Sopenharmony_ci * the fixup that need to be done: 5618c2ecf20Sopenharmony_ci * - change Usage Maximum in the Consumer Control 5628c2ecf20Sopenharmony_ci * (report ID 3) to a reasonable value 5638c2ecf20Sopenharmony_ci */ 5648c2ecf20Sopenharmony_ci if (*rsize >= offset + 31 && 5658c2ecf20Sopenharmony_ci /* Usage Page (Consumer Devices) */ 5668c2ecf20Sopenharmony_ci rdesc[offset] == 0x05 && rdesc[offset + 1] == 0x0c && 5678c2ecf20Sopenharmony_ci /* Usage (Consumer Control) */ 5688c2ecf20Sopenharmony_ci rdesc[offset + 2] == 0x09 && rdesc[offset + 3] == 0x01 && 5698c2ecf20Sopenharmony_ci /* Usage Maximum > 12287 */ 5708c2ecf20Sopenharmony_ci rdesc[offset + 10] == 0x2a && rdesc[offset + 12] > 0x2f) { 5718c2ecf20Sopenharmony_ci hid_info(hdev, "fixing up %s report descriptor\n", device_name); 5728c2ecf20Sopenharmony_ci rdesc[offset + 12] = 0x2f; 5738c2ecf20Sopenharmony_ci } 5748c2ecf20Sopenharmony_ci return rdesc; 5758c2ecf20Sopenharmony_ci} 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_cistatic __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, 5788c2ecf20Sopenharmony_ci unsigned int *rsize) 5798c2ecf20Sopenharmony_ci{ 5808c2ecf20Sopenharmony_ci switch (hdev->product) { 5818c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_ERGO_525V: 5828c2ecf20Sopenharmony_ci /* the fixups that need to be done: 5838c2ecf20Sopenharmony_ci * - change led usage page to button for extra buttons 5848c2ecf20Sopenharmony_ci * - report size 8 count 1 must be size 1 count 8 for button 5858c2ecf20Sopenharmony_ci * bitfield 5868c2ecf20Sopenharmony_ci * - change the button usage range to 4-7 for the extra 5878c2ecf20Sopenharmony_ci * buttons 5888c2ecf20Sopenharmony_ci */ 5898c2ecf20Sopenharmony_ci if (*rsize >= 75 && 5908c2ecf20Sopenharmony_ci rdesc[61] == 0x05 && rdesc[62] == 0x08 && 5918c2ecf20Sopenharmony_ci rdesc[63] == 0x19 && rdesc[64] == 0x08 && 5928c2ecf20Sopenharmony_ci rdesc[65] == 0x29 && rdesc[66] == 0x0f && 5938c2ecf20Sopenharmony_ci rdesc[71] == 0x75 && rdesc[72] == 0x08 && 5948c2ecf20Sopenharmony_ci rdesc[73] == 0x95 && rdesc[74] == 0x01) { 5958c2ecf20Sopenharmony_ci hid_info(hdev, 5968c2ecf20Sopenharmony_ci "fixing up Kye/Genius Ergo Mouse " 5978c2ecf20Sopenharmony_ci "report descriptor\n"); 5988c2ecf20Sopenharmony_ci rdesc[62] = 0x09; 5998c2ecf20Sopenharmony_ci rdesc[64] = 0x04; 6008c2ecf20Sopenharmony_ci rdesc[66] = 0x07; 6018c2ecf20Sopenharmony_ci rdesc[72] = 0x01; 6028c2ecf20Sopenharmony_ci rdesc[74] = 0x08; 6038c2ecf20Sopenharmony_ci } 6048c2ecf20Sopenharmony_ci break; 6058c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_I405X: 6068c2ecf20Sopenharmony_ci if (*rsize == EASYPEN_I405X_RDESC_ORIG_SIZE) { 6078c2ecf20Sopenharmony_ci rdesc = easypen_i405x_rdesc_fixed; 6088c2ecf20Sopenharmony_ci *rsize = sizeof(easypen_i405x_rdesc_fixed); 6098c2ecf20Sopenharmony_ci } 6108c2ecf20Sopenharmony_ci break; 6118c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 6128c2ecf20Sopenharmony_ci if (*rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE) { 6138c2ecf20Sopenharmony_ci rdesc = mousepen_i608x_rdesc_fixed; 6148c2ecf20Sopenharmony_ci *rsize = sizeof(mousepen_i608x_rdesc_fixed); 6158c2ecf20Sopenharmony_ci } 6168c2ecf20Sopenharmony_ci break; 6178c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2: 6188c2ecf20Sopenharmony_ci if (*rsize == MOUSEPEN_I608X_V2_RDESC_ORIG_SIZE) { 6198c2ecf20Sopenharmony_ci rdesc = mousepen_i608x_v2_rdesc_fixed; 6208c2ecf20Sopenharmony_ci *rsize = sizeof(mousepen_i608x_v2_rdesc_fixed); 6218c2ecf20Sopenharmony_ci } 6228c2ecf20Sopenharmony_ci break; 6238c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_M610X: 6248c2ecf20Sopenharmony_ci if (*rsize == EASYPEN_M610X_RDESC_ORIG_SIZE) { 6258c2ecf20Sopenharmony_ci rdesc = easypen_m610x_rdesc_fixed; 6268c2ecf20Sopenharmony_ci *rsize = sizeof(easypen_m610x_rdesc_fixed); 6278c2ecf20Sopenharmony_ci } 6288c2ecf20Sopenharmony_ci break; 6298c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_M406XE: 6308c2ecf20Sopenharmony_ci if (*rsize == EASYPEN_M406XE_RDESC_ORIG_SIZE) { 6318c2ecf20Sopenharmony_ci rdesc = easypen_m406xe_rdesc_fixed; 6328c2ecf20Sopenharmony_ci *rsize = sizeof(easypen_m406xe_rdesc_fixed); 6338c2ecf20Sopenharmony_ci } 6348c2ecf20Sopenharmony_ci break; 6358c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_PENSKETCH_M912: 6368c2ecf20Sopenharmony_ci if (*rsize == PENSKETCH_M912_RDESC_ORIG_SIZE) { 6378c2ecf20Sopenharmony_ci rdesc = pensketch_m912_rdesc_fixed; 6388c2ecf20Sopenharmony_ci *rsize = sizeof(pensketch_m912_rdesc_fixed); 6398c2ecf20Sopenharmony_ci } 6408c2ecf20Sopenharmony_ci break; 6418c2ecf20Sopenharmony_ci case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: 6428c2ecf20Sopenharmony_ci rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, 6438c2ecf20Sopenharmony_ci "Genius Gila Gaming Mouse"); 6448c2ecf20Sopenharmony_ci break; 6458c2ecf20Sopenharmony_ci case USB_DEVICE_ID_GENIUS_GX_IMPERATOR: 6468c2ecf20Sopenharmony_ci rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 83, 6478c2ecf20Sopenharmony_ci "Genius Gx Imperator Keyboard"); 6488c2ecf20Sopenharmony_ci break; 6498c2ecf20Sopenharmony_ci case USB_DEVICE_ID_GENIUS_MANTICORE: 6508c2ecf20Sopenharmony_ci rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, 6518c2ecf20Sopenharmony_ci "Genius Manticore Keyboard"); 6528c2ecf20Sopenharmony_ci break; 6538c2ecf20Sopenharmony_ci } 6548c2ecf20Sopenharmony_ci return rdesc; 6558c2ecf20Sopenharmony_ci} 6568c2ecf20Sopenharmony_ci 6578c2ecf20Sopenharmony_ci/** 6588c2ecf20Sopenharmony_ci * Enable fully-functional tablet mode by setting a special feature report. 6598c2ecf20Sopenharmony_ci * 6608c2ecf20Sopenharmony_ci * @hdev: HID device 6618c2ecf20Sopenharmony_ci * 6628c2ecf20Sopenharmony_ci * The specific report ID and data were discovered by sniffing the 6638c2ecf20Sopenharmony_ci * Windows driver traffic. 6648c2ecf20Sopenharmony_ci */ 6658c2ecf20Sopenharmony_cistatic int kye_tablet_enable(struct hid_device *hdev) 6668c2ecf20Sopenharmony_ci{ 6678c2ecf20Sopenharmony_ci struct list_head *list; 6688c2ecf20Sopenharmony_ci struct list_head *head; 6698c2ecf20Sopenharmony_ci struct hid_report *report; 6708c2ecf20Sopenharmony_ci __s32 *value; 6718c2ecf20Sopenharmony_ci 6728c2ecf20Sopenharmony_ci list = &hdev->report_enum[HID_FEATURE_REPORT].report_list; 6738c2ecf20Sopenharmony_ci list_for_each(head, list) { 6748c2ecf20Sopenharmony_ci report = list_entry(head, struct hid_report, list); 6758c2ecf20Sopenharmony_ci if (report->id == 5) 6768c2ecf20Sopenharmony_ci break; 6778c2ecf20Sopenharmony_ci } 6788c2ecf20Sopenharmony_ci 6798c2ecf20Sopenharmony_ci if (head == list) { 6808c2ecf20Sopenharmony_ci hid_err(hdev, "tablet-enabling feature report not found\n"); 6818c2ecf20Sopenharmony_ci return -ENODEV; 6828c2ecf20Sopenharmony_ci } 6838c2ecf20Sopenharmony_ci 6848c2ecf20Sopenharmony_ci if (report->maxfield < 1 || report->field[0]->report_count < 7) { 6858c2ecf20Sopenharmony_ci hid_err(hdev, "invalid tablet-enabling feature report\n"); 6868c2ecf20Sopenharmony_ci return -ENODEV; 6878c2ecf20Sopenharmony_ci } 6888c2ecf20Sopenharmony_ci 6898c2ecf20Sopenharmony_ci value = report->field[0]->value; 6908c2ecf20Sopenharmony_ci 6918c2ecf20Sopenharmony_ci value[0] = 0x12; 6928c2ecf20Sopenharmony_ci value[1] = 0x10; 6938c2ecf20Sopenharmony_ci value[2] = 0x11; 6948c2ecf20Sopenharmony_ci value[3] = 0x12; 6958c2ecf20Sopenharmony_ci value[4] = 0x00; 6968c2ecf20Sopenharmony_ci value[5] = 0x00; 6978c2ecf20Sopenharmony_ci value[6] = 0x00; 6988c2ecf20Sopenharmony_ci hid_hw_request(hdev, report, HID_REQ_SET_REPORT); 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci return 0; 7018c2ecf20Sopenharmony_ci} 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_cistatic int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) 7048c2ecf20Sopenharmony_ci{ 7058c2ecf20Sopenharmony_ci int ret; 7068c2ecf20Sopenharmony_ci 7078c2ecf20Sopenharmony_ci ret = hid_parse(hdev); 7088c2ecf20Sopenharmony_ci if (ret) { 7098c2ecf20Sopenharmony_ci hid_err(hdev, "parse failed\n"); 7108c2ecf20Sopenharmony_ci goto err; 7118c2ecf20Sopenharmony_ci } 7128c2ecf20Sopenharmony_ci 7138c2ecf20Sopenharmony_ci ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); 7148c2ecf20Sopenharmony_ci if (ret) { 7158c2ecf20Sopenharmony_ci hid_err(hdev, "hw start failed\n"); 7168c2ecf20Sopenharmony_ci goto err; 7178c2ecf20Sopenharmony_ci } 7188c2ecf20Sopenharmony_ci 7198c2ecf20Sopenharmony_ci switch (id->product) { 7208c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_I405X: 7218c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: 7228c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2: 7238c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_M610X: 7248c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_EASYPEN_M406XE: 7258c2ecf20Sopenharmony_ci case USB_DEVICE_ID_KYE_PENSKETCH_M912: 7268c2ecf20Sopenharmony_ci ret = kye_tablet_enable(hdev); 7278c2ecf20Sopenharmony_ci if (ret) { 7288c2ecf20Sopenharmony_ci hid_err(hdev, "tablet enabling failed\n"); 7298c2ecf20Sopenharmony_ci goto enabling_err; 7308c2ecf20Sopenharmony_ci } 7318c2ecf20Sopenharmony_ci break; 7328c2ecf20Sopenharmony_ci case USB_DEVICE_ID_GENIUS_MANTICORE: 7338c2ecf20Sopenharmony_ci /* 7348c2ecf20Sopenharmony_ci * The manticore keyboard needs to have all the interfaces 7358c2ecf20Sopenharmony_ci * opened at least once to be fully functional. 7368c2ecf20Sopenharmony_ci */ 7378c2ecf20Sopenharmony_ci if (hid_hw_open(hdev)) 7388c2ecf20Sopenharmony_ci hid_hw_close(hdev); 7398c2ecf20Sopenharmony_ci break; 7408c2ecf20Sopenharmony_ci } 7418c2ecf20Sopenharmony_ci 7428c2ecf20Sopenharmony_ci return 0; 7438c2ecf20Sopenharmony_cienabling_err: 7448c2ecf20Sopenharmony_ci hid_hw_stop(hdev); 7458c2ecf20Sopenharmony_cierr: 7468c2ecf20Sopenharmony_ci return ret; 7478c2ecf20Sopenharmony_ci} 7488c2ecf20Sopenharmony_ci 7498c2ecf20Sopenharmony_cistatic const struct hid_device_id kye_devices[] = { 7508c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) }, 7518c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7528c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_EASYPEN_I405X) }, 7538c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7548c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, 7558c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7568c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_MOUSEPEN_I608X_V2) }, 7578c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7588c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_EASYPEN_M610X) }, 7598c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7608c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_EASYPEN_M406XE) }, 7618c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7628c2ecf20Sopenharmony_ci USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE) }, 7638c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7648c2ecf20Sopenharmony_ci USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, 7658c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7668c2ecf20Sopenharmony_ci USB_DEVICE_ID_GENIUS_MANTICORE) }, 7678c2ecf20Sopenharmony_ci { HID_USB_DEVICE(USB_VENDOR_ID_KYE, 7688c2ecf20Sopenharmony_ci USB_DEVICE_ID_KYE_PENSKETCH_M912) }, 7698c2ecf20Sopenharmony_ci { } 7708c2ecf20Sopenharmony_ci}; 7718c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(hid, kye_devices); 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_cistatic struct hid_driver kye_driver = { 7748c2ecf20Sopenharmony_ci .name = "kye", 7758c2ecf20Sopenharmony_ci .id_table = kye_devices, 7768c2ecf20Sopenharmony_ci .probe = kye_probe, 7778c2ecf20Sopenharmony_ci .report_fixup = kye_report_fixup, 7788c2ecf20Sopenharmony_ci}; 7798c2ecf20Sopenharmony_cimodule_hid_driver(kye_driver); 7808c2ecf20Sopenharmony_ci 7818c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 782