18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  HID driver for UC-Logic devices not fully compliant with HID standard
48c2ecf20Sopenharmony_ci *  - original and fixed report descriptors
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci *  Copyright (c) 2010-2017 Nikolai Kondrashov
78c2ecf20Sopenharmony_ci *  Copyright (c) 2013 Martin Rusko
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/*
118c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify it
128c2ecf20Sopenharmony_ci * under the terms of the GNU General Public License as published by the Free
138c2ecf20Sopenharmony_ci * Software Foundation; either version 2 of the License, or (at your option)
148c2ecf20Sopenharmony_ci * any later version.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#include "hid-uclogic-rdesc.h"
188c2ecf20Sopenharmony_ci#include <linux/slab.h>
198c2ecf20Sopenharmony_ci#include <asm/unaligned.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* Fixed WP4030U report descriptor */
228c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_wp4030u_fixed_arr[] = {
238c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
248c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
258c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
268c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
278c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
288c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
298c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
308c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
318c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
328c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
338c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
348c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
358c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
368c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
378c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
388c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
398c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
408c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
418c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
428c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
438c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
448c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
458c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
468c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
478c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
488c2ecf20Sopenharmony_ci	0x46, 0xA0, 0x0F,   /*          Physical Maximum (4000),    */
498c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
508c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
518c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
528c2ecf20Sopenharmony_ci	0x46, 0xB8, 0x0B,   /*          Physical Maximum (3000),    */
538c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
548c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
558c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
568c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
578c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
588c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
598c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
608c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
618c2ecf20Sopenharmony_ci};
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_wp4030u_fixed_size =
648c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_wp4030u_fixed_arr);
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* Fixed WP5540U report descriptor */
678c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_wp5540u_fixed_arr[] = {
688c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
698c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
708c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
718c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
728c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
738c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
748c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
758c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
768c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
778c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
788c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
798c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
808c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
818c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
828c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
838c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
848c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
858c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
868c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
878c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
888c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
898c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
908c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
918c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
928c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
938c2ecf20Sopenharmony_ci	0x46, 0x7C, 0x15,   /*          Physical Maximum (5500),    */
948c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
958c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
968c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
978c2ecf20Sopenharmony_ci	0x46, 0xA0, 0x0F,   /*          Physical Maximum (4000),    */
988c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
998c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1008c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
1018c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
1028c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
1038c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1048c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
1058c2ecf20Sopenharmony_ci	0xC0,               /*  End Collection,                     */
1068c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
1078c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Mouse),                      */
1088c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
1098c2ecf20Sopenharmony_ci	0x85, 0x08,         /*      Report ID (8),                  */
1108c2ecf20Sopenharmony_ci	0x09, 0x01,         /*      Usage (Pointer),                */
1118c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
1128c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
1138c2ecf20Sopenharmony_ci	0x05, 0x09,         /*          Usage Page (Button),        */
1148c2ecf20Sopenharmony_ci	0x19, 0x01,         /*          Usage Minimum (01h),        */
1158c2ecf20Sopenharmony_ci	0x29, 0x03,         /*          Usage Maximum (03h),        */
1168c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
1178c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
1188c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
1198c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1208c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
1218c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
1228c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
1238c2ecf20Sopenharmony_ci	0x75, 0x08,         /*          Report Size (8),            */
1248c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
1258c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
1268c2ecf20Sopenharmony_ci	0x15, 0x81,         /*          Logical Minimum (-127),     */
1278c2ecf20Sopenharmony_ci	0x25, 0x7F,         /*          Logical Maximum (127),      */
1288c2ecf20Sopenharmony_ci	0x95, 0x02,         /*          Report Count (2),           */
1298c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
1308c2ecf20Sopenharmony_ci	0x09, 0x38,         /*          Usage (Wheel),              */
1318c2ecf20Sopenharmony_ci	0x15, 0xFF,         /*          Logical Minimum (-1),       */
1328c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
1338c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
1348c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
1358c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
1368c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
1378c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
1388c2ecf20Sopenharmony_ci};
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_wp5540u_fixed_size =
1418c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_wp5540u_fixed_arr);
1428c2ecf20Sopenharmony_ci
1438c2ecf20Sopenharmony_ci/* Fixed WP8060U report descriptor */
1448c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_wp8060u_fixed_arr[] = {
1458c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
1468c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
1478c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
1488c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
1498c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
1508c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
1518c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
1528c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
1538c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
1548c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
1558c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
1568c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
1578c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
1588c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1598c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
1608c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
1618c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
1628c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
1638c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
1648c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
1658c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
1668c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
1678c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
1688c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
1698c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
1708c2ecf20Sopenharmony_ci	0x46, 0x40, 0x1F,   /*          Physical Maximum (8000),    */
1718c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
1728c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1738c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
1748c2ecf20Sopenharmony_ci	0x46, 0x70, 0x17,   /*          Physical Maximum (6000),    */
1758c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
1768c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1778c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
1788c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
1798c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
1808c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1818c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
1828c2ecf20Sopenharmony_ci	0xC0,               /*  End Collection,                     */
1838c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
1848c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Mouse),                      */
1858c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
1868c2ecf20Sopenharmony_ci	0x85, 0x08,         /*      Report ID (8),                  */
1878c2ecf20Sopenharmony_ci	0x09, 0x01,         /*      Usage (Pointer),                */
1888c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
1898c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
1908c2ecf20Sopenharmony_ci	0x05, 0x09,         /*          Usage Page (Button),        */
1918c2ecf20Sopenharmony_ci	0x19, 0x01,         /*          Usage Minimum (01h),        */
1928c2ecf20Sopenharmony_ci	0x29, 0x03,         /*          Usage Maximum (03h),        */
1938c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
1948c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
1958c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
1968c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
1978c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
1988c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
1998c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
2008c2ecf20Sopenharmony_ci	0x75, 0x08,         /*          Report Size (8),            */
2018c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
2028c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
2038c2ecf20Sopenharmony_ci	0x15, 0x81,         /*          Logical Minimum (-127),     */
2048c2ecf20Sopenharmony_ci	0x25, 0x7F,         /*          Logical Maximum (127),      */
2058c2ecf20Sopenharmony_ci	0x95, 0x02,         /*          Report Count (2),           */
2068c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
2078c2ecf20Sopenharmony_ci	0x09, 0x38,         /*          Usage (Wheel),              */
2088c2ecf20Sopenharmony_ci	0x15, 0xFF,         /*          Logical Minimum (-1),       */
2098c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
2108c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
2118c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
2128c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
2138c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
2148c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
2158c2ecf20Sopenharmony_ci};
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_wp8060u_fixed_size =
2188c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_wp8060u_fixed_arr);
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci/* Fixed WP1062 report descriptor */
2218c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_wp1062_fixed_arr[] = {
2228c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
2238c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
2248c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
2258c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
2268c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
2278c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
2288c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
2298c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
2308c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
2318c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
2328c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
2338c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
2348c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
2358c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2368c2ecf20Sopenharmony_ci	0x95, 0x04,         /*          Report Count (4),           */
2378c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
2388c2ecf20Sopenharmony_ci	0x09, 0x32,         /*          Usage (In Range),           */
2398c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
2408c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2418c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
2428c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
2438c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
2448c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
2458c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
2468c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
2478c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
2488c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
2498c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
2508c2ecf20Sopenharmony_ci	0x46, 0x10, 0x27,   /*          Physical Maximum (10000),   */
2518c2ecf20Sopenharmony_ci	0x26, 0x20, 0x4E,   /*          Logical Maximum (20000),    */
2528c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2538c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
2548c2ecf20Sopenharmony_ci	0x46, 0xB7, 0x19,   /*          Physical Maximum (6583),    */
2558c2ecf20Sopenharmony_ci	0x26, 0x6E, 0x33,   /*          Logical Maximum (13166),    */
2568c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2578c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
2588c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
2598c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
2608c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2618c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
2628c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
2638c2ecf20Sopenharmony_ci};
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_wp1062_fixed_size =
2668c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_wp1062_fixed_arr);
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci/* Fixed PF1209 report descriptor */
2698c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_pf1209_fixed_arr[] = {
2708c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
2718c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
2728c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
2738c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
2748c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
2758c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
2768c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
2778c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
2788c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
2798c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
2808c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
2818c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
2828c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
2838c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2848c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
2858c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
2868c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
2878c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
2888c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
2898c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
2908c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
2918c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
2928c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
2938c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
2948c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
2958c2ecf20Sopenharmony_ci	0x46, 0xE0, 0x2E,   /*          Physical Maximum (12000),   */
2968c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
2978c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
2988c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
2998c2ecf20Sopenharmony_ci	0x46, 0x28, 0x23,   /*          Physical Maximum (9000),    */
3008c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
3018c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3028c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
3038c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
3048c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
3058c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3068c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
3078c2ecf20Sopenharmony_ci	0xC0,               /*  End Collection,                     */
3088c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
3098c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Mouse),                      */
3108c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
3118c2ecf20Sopenharmony_ci	0x85, 0x08,         /*      Report ID (8),                  */
3128c2ecf20Sopenharmony_ci	0x09, 0x01,         /*      Usage (Pointer),                */
3138c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
3148c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
3158c2ecf20Sopenharmony_ci	0x05, 0x09,         /*          Usage Page (Button),        */
3168c2ecf20Sopenharmony_ci	0x19, 0x01,         /*          Usage Minimum (01h),        */
3178c2ecf20Sopenharmony_ci	0x29, 0x03,         /*          Usage Maximum (03h),        */
3188c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
3198c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
3208c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
3218c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3228c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
3238c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
3248c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
3258c2ecf20Sopenharmony_ci	0x75, 0x08,         /*          Report Size (8),            */
3268c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
3278c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
3288c2ecf20Sopenharmony_ci	0x15, 0x81,         /*          Logical Minimum (-127),     */
3298c2ecf20Sopenharmony_ci	0x25, 0x7F,         /*          Logical Maximum (127),      */
3308c2ecf20Sopenharmony_ci	0x95, 0x02,         /*          Report Count (2),           */
3318c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
3328c2ecf20Sopenharmony_ci	0x09, 0x38,         /*          Usage (Wheel),              */
3338c2ecf20Sopenharmony_ci	0x15, 0xFF,         /*          Logical Minimum (-1),       */
3348c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
3358c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
3368c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
3378c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
3388c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
3398c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
3408c2ecf20Sopenharmony_ci};
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_pf1209_fixed_size =
3438c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_pf1209_fixed_arr);
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
3468c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_twhl850_fixed0_arr[] = {
3478c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
3488c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
3498c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
3508c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
3518c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
3528c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
3538c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
3548c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
3558c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
3568c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
3578c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
3588c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
3598c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
3608c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3618c2ecf20Sopenharmony_ci	0x81, 0x03,         /*          Input (Constant, Variable), */
3628c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
3638c2ecf20Sopenharmony_ci	0x09, 0x32,         /*          Usage (In Range),           */
3648c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3658c2ecf20Sopenharmony_ci	0x81, 0x03,         /*          Input (Constant, Variable), */
3668c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
3678c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
3688c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
3698c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
3708c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
3718c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
3728c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
3738c2ecf20Sopenharmony_ci	0x46, 0x40, 0x1F,   /*          Physical Maximum (8000),    */
3748c2ecf20Sopenharmony_ci	0x26, 0x00, 0x7D,   /*          Logical Maximum (32000),    */
3758c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3768c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
3778c2ecf20Sopenharmony_ci	0x46, 0x88, 0x13,   /*          Physical Maximum (5000),    */
3788c2ecf20Sopenharmony_ci	0x26, 0x20, 0x4E,   /*          Logical Maximum (20000),    */
3798c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3808c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
3818c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
3828c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
3838c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
3848c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
3858c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
3868c2ecf20Sopenharmony_ci};
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_twhl850_fixed0_size =
3898c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_twhl850_fixed0_arr);
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
3928c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_twhl850_fixed1_arr[] = {
3938c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
3948c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Mouse),                      */
3958c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
3968c2ecf20Sopenharmony_ci	0x85, 0x01,         /*      Report ID (1),                  */
3978c2ecf20Sopenharmony_ci	0x09, 0x01,         /*      Usage (Pointer),                */
3988c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
3998c2ecf20Sopenharmony_ci	0x05, 0x09,         /*          Usage Page (Button),        */
4008c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
4018c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
4028c2ecf20Sopenharmony_ci	0x19, 0x01,         /*          Usage Minimum (01h),        */
4038c2ecf20Sopenharmony_ci	0x29, 0x03,         /*          Usage Maximum (03h),        */
4048c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
4058c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
4068c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4078c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
4088c2ecf20Sopenharmony_ci	0x81, 0x03,         /*          Input (Constant, Variable), */
4098c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
4108c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
4118c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
4128c2ecf20Sopenharmony_ci	0x16, 0x00, 0x80,   /*          Logical Minimum (-32768),   */
4138c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x7F,   /*          Logical Maximum (32767),    */
4148c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
4158c2ecf20Sopenharmony_ci	0x95, 0x02,         /*          Report Count (2),           */
4168c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
4178c2ecf20Sopenharmony_ci	0x09, 0x38,         /*          Usage (Wheel),              */
4188c2ecf20Sopenharmony_ci	0x15, 0xFF,         /*          Logical Minimum (-1),       */
4198c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
4208c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
4218c2ecf20Sopenharmony_ci	0x75, 0x08,         /*          Report Size (8),            */
4228c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
4238c2ecf20Sopenharmony_ci	0x81, 0x03,         /*          Input (Constant, Variable), */
4248c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
4258c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
4268c2ecf20Sopenharmony_ci};
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_twhl850_fixed1_size =
4298c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_twhl850_fixed1_arr);
4308c2ecf20Sopenharmony_ci
4318c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
4328c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_twhl850_fixed2_arr[] = {
4338c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
4348c2ecf20Sopenharmony_ci	0x09, 0x06,         /*  Usage (Keyboard),                   */
4358c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
4368c2ecf20Sopenharmony_ci	0x85, 0x03,         /*      Report ID (3),                  */
4378c2ecf20Sopenharmony_ci	0x05, 0x07,         /*      Usage Page (Keyboard),          */
4388c2ecf20Sopenharmony_ci	0x14,               /*      Logical Minimum (0),            */
4398c2ecf20Sopenharmony_ci	0x19, 0xE0,         /*      Usage Minimum (KB Leftcontrol), */
4408c2ecf20Sopenharmony_ci	0x29, 0xE7,         /*      Usage Maximum (KB Right GUI),   */
4418c2ecf20Sopenharmony_ci	0x25, 0x01,         /*      Logical Maximum (1),            */
4428c2ecf20Sopenharmony_ci	0x75, 0x01,         /*      Report Size (1),                */
4438c2ecf20Sopenharmony_ci	0x95, 0x08,         /*      Report Count (8),               */
4448c2ecf20Sopenharmony_ci	0x81, 0x02,         /*      Input (Variable),               */
4458c2ecf20Sopenharmony_ci	0x18,               /*      Usage Minimum (None),           */
4468c2ecf20Sopenharmony_ci	0x29, 0xFF,         /*      Usage Maximum (FFh),            */
4478c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x00,   /*      Logical Maximum (255),          */
4488c2ecf20Sopenharmony_ci	0x75, 0x08,         /*      Report Size (8),                */
4498c2ecf20Sopenharmony_ci	0x95, 0x06,         /*      Report Count (6),               */
4508c2ecf20Sopenharmony_ci	0x80,               /*      Input,                          */
4518c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
4528c2ecf20Sopenharmony_ci};
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_twhl850_fixed2_size =
4558c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_twhl850_fixed2_arr);
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
4588c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_twha60_fixed0_arr[] = {
4598c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*  Usage Page (Digitizer),             */
4608c2ecf20Sopenharmony_ci	0x09, 0x02,         /*  Usage (Pen),                        */
4618c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
4628c2ecf20Sopenharmony_ci	0x85, 0x09,         /*      Report ID (9),                  */
4638c2ecf20Sopenharmony_ci	0x09, 0x20,         /*      Usage (Stylus),                 */
4648c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
4658c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
4668c2ecf20Sopenharmony_ci	0x09, 0x42,         /*          Usage (Tip Switch),         */
4678c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
4688c2ecf20Sopenharmony_ci	0x09, 0x46,         /*          Usage (Tablet Pick),        */
4698c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
4708c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
4718c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
4728c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4738c2ecf20Sopenharmony_ci	0x95, 0x04,         /*          Report Count (4),           */
4748c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
4758c2ecf20Sopenharmony_ci	0x09, 0x32,         /*          Usage (In Range),           */
4768c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
4778c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4788c2ecf20Sopenharmony_ci	0x75, 0x10,         /*          Report Size (16),           */
4798c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
4808c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
4818c2ecf20Sopenharmony_ci	0xA4,               /*          Push,                       */
4828c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
4838c2ecf20Sopenharmony_ci	0x55, 0xFD,         /*          Unit Exponent (-3),         */
4848c2ecf20Sopenharmony_ci	0x65, 0x13,         /*          Unit (Inch),                */
4858c2ecf20Sopenharmony_ci	0x34,               /*          Physical Minimum (0),       */
4868c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
4878c2ecf20Sopenharmony_ci	0x46, 0x10, 0x27,   /*          Physical Maximum (10000),   */
4888c2ecf20Sopenharmony_ci	0x27, 0x3F, 0x9C,
4898c2ecf20Sopenharmony_ci		0x00, 0x00, /*          Logical Maximum (39999),    */
4908c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4918c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
4928c2ecf20Sopenharmony_ci	0x46, 0x6A, 0x18,   /*          Physical Maximum (6250),    */
4938c2ecf20Sopenharmony_ci	0x26, 0xA7, 0x61,   /*          Logical Maximum (24999),    */
4948c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4958c2ecf20Sopenharmony_ci	0xB4,               /*          Pop,                        */
4968c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (Tip Pressure),       */
4978c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x03,   /*          Logical Maximum (1023),     */
4988c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
4998c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
5008c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
5018c2ecf20Sopenharmony_ci};
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_twha60_fixed0_size =
5048c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_twha60_fixed0_arr);
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
5078c2ecf20Sopenharmony_ci__u8 uclogic_rdesc_twha60_fixed1_arr[] = {
5088c2ecf20Sopenharmony_ci	0x05, 0x01, /*  Usage Page (Desktop),       */
5098c2ecf20Sopenharmony_ci	0x09, 0x06, /*  Usage (Keyboard),           */
5108c2ecf20Sopenharmony_ci	0xA1, 0x01, /*  Collection (Application),   */
5118c2ecf20Sopenharmony_ci	0x85, 0x05, /*      Report ID (5),          */
5128c2ecf20Sopenharmony_ci	0x05, 0x07, /*      Usage Page (Keyboard),  */
5138c2ecf20Sopenharmony_ci	0x14,       /*      Logical Minimum (0),    */
5148c2ecf20Sopenharmony_ci	0x25, 0x01, /*      Logical Maximum (1),    */
5158c2ecf20Sopenharmony_ci	0x75, 0x01, /*      Report Size (1),        */
5168c2ecf20Sopenharmony_ci	0x95, 0x08, /*      Report Count (8),       */
5178c2ecf20Sopenharmony_ci	0x81, 0x01, /*      Input (Constant),       */
5188c2ecf20Sopenharmony_ci	0x95, 0x0C, /*      Report Count (12),      */
5198c2ecf20Sopenharmony_ci	0x19, 0x3A, /*      Usage Minimum (KB F1),  */
5208c2ecf20Sopenharmony_ci	0x29, 0x45, /*      Usage Maximum (KB F12), */
5218c2ecf20Sopenharmony_ci	0x81, 0x02, /*      Input (Variable),       */
5228c2ecf20Sopenharmony_ci	0x95, 0x0C, /*      Report Count (12),      */
5238c2ecf20Sopenharmony_ci	0x19, 0x68, /*      Usage Minimum (KB F13), */
5248c2ecf20Sopenharmony_ci	0x29, 0x73, /*      Usage Maximum (KB F24), */
5258c2ecf20Sopenharmony_ci	0x81, 0x02, /*      Input (Variable),       */
5268c2ecf20Sopenharmony_ci	0x95, 0x08, /*      Report Count (8),       */
5278c2ecf20Sopenharmony_ci	0x81, 0x01, /*      Input (Constant),       */
5288c2ecf20Sopenharmony_ci	0xC0        /*  End Collection              */
5298c2ecf20Sopenharmony_ci};
5308c2ecf20Sopenharmony_ci
5318c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_twha60_fixed1_size =
5328c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_twha60_fixed1_arr);
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v1 pen reports */
5358c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_pen_v1_template_arr[] = {
5368c2ecf20Sopenharmony_ci	0x05, 0x0D,             /*  Usage Page (Digitizer),                 */
5378c2ecf20Sopenharmony_ci	0x09, 0x02,             /*  Usage (Pen),                            */
5388c2ecf20Sopenharmony_ci	0xA1, 0x01,             /*  Collection (Application),               */
5398c2ecf20Sopenharmony_ci	0x85, 0x07,             /*      Report ID (7),                      */
5408c2ecf20Sopenharmony_ci	0x09, 0x20,             /*      Usage (Stylus),                     */
5418c2ecf20Sopenharmony_ci	0xA0,                   /*      Collection (Physical),              */
5428c2ecf20Sopenharmony_ci	0x14,                   /*          Logical Minimum (0),            */
5438c2ecf20Sopenharmony_ci	0x25, 0x01,             /*          Logical Maximum (1),            */
5448c2ecf20Sopenharmony_ci	0x75, 0x01,             /*          Report Size (1),                */
5458c2ecf20Sopenharmony_ci	0x09, 0x42,             /*          Usage (Tip Switch),             */
5468c2ecf20Sopenharmony_ci	0x09, 0x44,             /*          Usage (Barrel Switch),          */
5478c2ecf20Sopenharmony_ci	0x09, 0x46,             /*          Usage (Tablet Pick),            */
5488c2ecf20Sopenharmony_ci	0x95, 0x03,             /*          Report Count (3),               */
5498c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
5508c2ecf20Sopenharmony_ci	0x95, 0x03,             /*          Report Count (3),               */
5518c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
5528c2ecf20Sopenharmony_ci	0x09, 0x32,             /*          Usage (In Range),               */
5538c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
5548c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
5558c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
5568c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
5578c2ecf20Sopenharmony_ci	0x75, 0x10,             /*          Report Size (16),               */
5588c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
5598c2ecf20Sopenharmony_ci	0xA4,                   /*          Push,                           */
5608c2ecf20Sopenharmony_ci	0x05, 0x01,             /*          Usage Page (Desktop),           */
5618c2ecf20Sopenharmony_ci	0x65, 0x13,             /*          Unit (Inch),                    */
5628c2ecf20Sopenharmony_ci	0x55, 0xFD,             /*          Unit Exponent (-3),             */
5638c2ecf20Sopenharmony_ci	0x34,                   /*          Physical Minimum (0),           */
5648c2ecf20Sopenharmony_ci	0x09, 0x30,             /*          Usage (X),                      */
5658c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(X_LM),
5668c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
5678c2ecf20Sopenharmony_ci	0x47, UCLOGIC_RDESC_PEN_PH(X_PM),
5688c2ecf20Sopenharmony_ci				/*          Physical Maximum (PLACEHOLDER), */
5698c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
5708c2ecf20Sopenharmony_ci	0x09, 0x31,             /*          Usage (Y),                      */
5718c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(Y_LM),
5728c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
5738c2ecf20Sopenharmony_ci	0x47, UCLOGIC_RDESC_PEN_PH(Y_PM),
5748c2ecf20Sopenharmony_ci				/*          Physical Maximum (PLACEHOLDER), */
5758c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
5768c2ecf20Sopenharmony_ci	0xB4,                   /*          Pop,                            */
5778c2ecf20Sopenharmony_ci	0x09, 0x30,             /*          Usage (Tip Pressure),           */
5788c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(PRESSURE_LM),
5798c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
5808c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
5818c2ecf20Sopenharmony_ci	0xC0,                   /*      End Collection,                     */
5828c2ecf20Sopenharmony_ci	0xC0                    /*  End Collection                          */
5838c2ecf20Sopenharmony_ci};
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_pen_v1_template_size =
5868c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_pen_v1_template_arr);
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v2 pen reports */
5898c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_pen_v2_template_arr[] = {
5908c2ecf20Sopenharmony_ci	0x05, 0x0D,             /*  Usage Page (Digitizer),                 */
5918c2ecf20Sopenharmony_ci	0x09, 0x02,             /*  Usage (Pen),                            */
5928c2ecf20Sopenharmony_ci	0xA1, 0x01,             /*  Collection (Application),               */
5938c2ecf20Sopenharmony_ci	0x85, 0x08,             /*      Report ID (8),                      */
5948c2ecf20Sopenharmony_ci	0x09, 0x20,             /*      Usage (Stylus),                     */
5958c2ecf20Sopenharmony_ci	0xA0,                   /*      Collection (Physical),              */
5968c2ecf20Sopenharmony_ci	0x14,                   /*          Logical Minimum (0),            */
5978c2ecf20Sopenharmony_ci	0x25, 0x01,             /*          Logical Maximum (1),            */
5988c2ecf20Sopenharmony_ci	0x75, 0x01,             /*          Report Size (1),                */
5998c2ecf20Sopenharmony_ci	0x09, 0x42,             /*          Usage (Tip Switch),             */
6008c2ecf20Sopenharmony_ci	0x09, 0x44,             /*          Usage (Barrel Switch),          */
6018c2ecf20Sopenharmony_ci	0x09, 0x46,             /*          Usage (Tablet Pick),            */
6028c2ecf20Sopenharmony_ci	0x95, 0x03,             /*          Report Count (3),               */
6038c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
6048c2ecf20Sopenharmony_ci	0x95, 0x03,             /*          Report Count (3),               */
6058c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
6068c2ecf20Sopenharmony_ci	0x09, 0x32,             /*          Usage (In Range),               */
6078c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
6088c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
6098c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
6108c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
6118c2ecf20Sopenharmony_ci	0x95, 0x01,             /*          Report Count (1),               */
6128c2ecf20Sopenharmony_ci	0xA4,                   /*          Push,                           */
6138c2ecf20Sopenharmony_ci	0x05, 0x01,             /*          Usage Page (Desktop),           */
6148c2ecf20Sopenharmony_ci	0x65, 0x13,             /*          Unit (Inch),                    */
6158c2ecf20Sopenharmony_ci	0x55, 0xFD,             /*          Unit Exponent (-3),             */
6168c2ecf20Sopenharmony_ci	0x75, 0x18,             /*          Report Size (24),               */
6178c2ecf20Sopenharmony_ci	0x34,                   /*          Physical Minimum (0),           */
6188c2ecf20Sopenharmony_ci	0x09, 0x30,             /*          Usage (X),                      */
6198c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(X_LM),
6208c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
6218c2ecf20Sopenharmony_ci	0x47, UCLOGIC_RDESC_PEN_PH(X_PM),
6228c2ecf20Sopenharmony_ci				/*          Physical Maximum (PLACEHOLDER), */
6238c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
6248c2ecf20Sopenharmony_ci	0x09, 0x31,             /*          Usage (Y),                      */
6258c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(Y_LM),
6268c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
6278c2ecf20Sopenharmony_ci	0x47, UCLOGIC_RDESC_PEN_PH(Y_PM),
6288c2ecf20Sopenharmony_ci				/*          Physical Maximum (PLACEHOLDER), */
6298c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
6308c2ecf20Sopenharmony_ci	0xB4,                   /*          Pop,                            */
6318c2ecf20Sopenharmony_ci	0x09, 0x30,             /*          Usage (Tip Pressure),           */
6328c2ecf20Sopenharmony_ci	0x75, 0x10,             /*          Report Size (16),               */
6338c2ecf20Sopenharmony_ci	0x27, UCLOGIC_RDESC_PEN_PH(PRESSURE_LM),
6348c2ecf20Sopenharmony_ci				/*          Logical Maximum (PLACEHOLDER),  */
6358c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
6368c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
6378c2ecf20Sopenharmony_ci	0xC0,                   /*      End Collection,                     */
6388c2ecf20Sopenharmony_ci	0xC0                    /*  End Collection                          */
6398c2ecf20Sopenharmony_ci};
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_pen_v2_template_size =
6428c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_pen_v2_template_arr);
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci/**
6458c2ecf20Sopenharmony_ci * Expand to the contents of a generic buttonpad report descriptor.
6468c2ecf20Sopenharmony_ci *
6478c2ecf20Sopenharmony_ci * @_padding:	Padding from the end of button bits at bit 44, until
6488c2ecf20Sopenharmony_ci *		the end of the report, in bits.
6498c2ecf20Sopenharmony_ci */
6508c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_BUTTONPAD_BYTES(_padding) \
6518c2ecf20Sopenharmony_ci	0x05, 0x01,     /*  Usage Page (Desktop),               */ \
6528c2ecf20Sopenharmony_ci	0x09, 0x07,     /*  Usage (Keypad),                     */ \
6538c2ecf20Sopenharmony_ci	0xA1, 0x01,     /*  Collection (Application),           */ \
6548c2ecf20Sopenharmony_ci	0x85, 0xF7,     /*      Report ID (247),                */ \
6558c2ecf20Sopenharmony_ci	0x14,           /*      Logical Minimum (0),            */ \
6568c2ecf20Sopenharmony_ci	0x25, 0x01,     /*      Logical Maximum (1),            */ \
6578c2ecf20Sopenharmony_ci	0x75, 0x01,     /*      Report Size (1),                */ \
6588c2ecf20Sopenharmony_ci	0x05, 0x0D,     /*      Usage Page (Digitizer),         */ \
6598c2ecf20Sopenharmony_ci	0x09, 0x39,     /*      Usage (Tablet Function Keys),   */ \
6608c2ecf20Sopenharmony_ci	0xA0,           /*      Collection (Physical),          */ \
6618c2ecf20Sopenharmony_ci	0x09, 0x44,     /*          Usage (Barrel Switch),      */ \
6628c2ecf20Sopenharmony_ci	0x95, 0x01,     /*          Report Count (1),           */ \
6638c2ecf20Sopenharmony_ci	0x81, 0x02,     /*          Input (Variable),           */ \
6648c2ecf20Sopenharmony_ci	0x05, 0x01,     /*          Usage Page (Desktop),       */ \
6658c2ecf20Sopenharmony_ci	0x09, 0x30,     /*          Usage (X),                  */ \
6668c2ecf20Sopenharmony_ci	0x09, 0x31,     /*          Usage (Y),                  */ \
6678c2ecf20Sopenharmony_ci	0x95, 0x02,     /*          Report Count (2),           */ \
6688c2ecf20Sopenharmony_ci	0x81, 0x02,     /*          Input (Variable),           */ \
6698c2ecf20Sopenharmony_ci	0x95, 0x15,     /*          Report Count (21),          */ \
6708c2ecf20Sopenharmony_ci	0x81, 0x01,     /*          Input (Constant),           */ \
6718c2ecf20Sopenharmony_ci	0x05, 0x09,     /*          Usage Page (Button),        */ \
6728c2ecf20Sopenharmony_ci	0x19, 0x01,     /*          Usage Minimum (01h),        */ \
6738c2ecf20Sopenharmony_ci	0x29, 0x0A,     /*          Usage Maximum (0Ah),        */ \
6748c2ecf20Sopenharmony_ci	0x95, 0x0A,     /*          Report Count (10),          */ \
6758c2ecf20Sopenharmony_ci	0x81, 0x02,     /*          Input (Variable),           */ \
6768c2ecf20Sopenharmony_ci	0xC0,           /*      End Collection,                 */ \
6778c2ecf20Sopenharmony_ci	0x05, 0x01,     /*      Usage Page (Desktop),           */ \
6788c2ecf20Sopenharmony_ci	0x09, 0x05,     /*      Usage (Gamepad),                */ \
6798c2ecf20Sopenharmony_ci	0xA0,           /*      Collection (Physical),          */ \
6808c2ecf20Sopenharmony_ci	0x05, 0x09,     /*          Usage Page (Button),        */ \
6818c2ecf20Sopenharmony_ci	0x19, 0x01,     /*          Usage Minimum (01h),        */ \
6828c2ecf20Sopenharmony_ci	0x29, 0x02,     /*          Usage Maximum (02h),        */ \
6838c2ecf20Sopenharmony_ci	0x95, 0x02,     /*          Report Count (2),           */ \
6848c2ecf20Sopenharmony_ci	0x81, 0x02,     /*          Input (Variable),           */ \
6858c2ecf20Sopenharmony_ci	0x95, _padding, /*          Report Count (_padding),    */ \
6868c2ecf20Sopenharmony_ci	0x81, 0x01,     /*          Input (Constant),           */ \
6878c2ecf20Sopenharmony_ci	0xC0,           /*      End Collection,                 */ \
6888c2ecf20Sopenharmony_ci	0xC0            /*  End Collection                      */
6898c2ecf20Sopenharmony_ci
6908c2ecf20Sopenharmony_ci/* Fixed report descriptor for (tweaked) v1 buttonpad reports */
6918c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_buttonpad_v1_arr[] = {
6928c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_BUTTONPAD_BYTES(20)
6938c2ecf20Sopenharmony_ci};
6948c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_buttonpad_v1_size =
6958c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_buttonpad_v1_arr);
6968c2ecf20Sopenharmony_ci
6978c2ecf20Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 buttonpad reports */
6988c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_buttonpad_v2_arr[] = {
6998c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_BUTTONPAD_BYTES(52)
7008c2ecf20Sopenharmony_ci};
7018c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_buttonpad_v2_size =
7028c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_buttonpad_v2_arr);
7038c2ecf20Sopenharmony_ci
7048c2ecf20Sopenharmony_ci/* Fixed report descriptor for Ugee EX07 buttonpad */
7058c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[] = {
7068c2ecf20Sopenharmony_ci	0x05, 0x01,             /*  Usage Page (Desktop),                   */
7078c2ecf20Sopenharmony_ci	0x09, 0x07,             /*  Usage (Keypad),                         */
7088c2ecf20Sopenharmony_ci	0xA1, 0x01,             /*  Collection (Application),               */
7098c2ecf20Sopenharmony_ci	0x85, 0x06,             /*      Report ID (6),                      */
7108c2ecf20Sopenharmony_ci	0x05, 0x0D,             /*      Usage Page (Digitizer),             */
7118c2ecf20Sopenharmony_ci	0x09, 0x39,             /*      Usage (Tablet Function Keys),       */
7128c2ecf20Sopenharmony_ci	0xA0,                   /*      Collection (Physical),              */
7138c2ecf20Sopenharmony_ci	0x05, 0x09,             /*          Usage Page (Button),            */
7148c2ecf20Sopenharmony_ci	0x75, 0x01,             /*          Report Size (1),                */
7158c2ecf20Sopenharmony_ci	0x19, 0x03,             /*          Usage Minimum (03h),            */
7168c2ecf20Sopenharmony_ci	0x29, 0x06,             /*          Usage Maximum (06h),            */
7178c2ecf20Sopenharmony_ci	0x95, 0x04,             /*          Report Count (4),               */
7188c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
7198c2ecf20Sopenharmony_ci	0x95, 0x1A,             /*          Report Count (26),              */
7208c2ecf20Sopenharmony_ci	0x81, 0x03,             /*          Input (Constant, Variable),     */
7218c2ecf20Sopenharmony_ci	0x19, 0x01,             /*          Usage Minimum (01h),            */
7228c2ecf20Sopenharmony_ci	0x29, 0x02,             /*          Usage Maximum (02h),            */
7238c2ecf20Sopenharmony_ci	0x95, 0x02,             /*          Report Count (2),               */
7248c2ecf20Sopenharmony_ci	0x81, 0x02,             /*          Input (Variable),               */
7258c2ecf20Sopenharmony_ci	0xC0,                   /*      End Collection,                     */
7268c2ecf20Sopenharmony_ci	0xC0                    /*  End Collection                          */
7278c2ecf20Sopenharmony_ci};
7288c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_ugee_ex07_buttonpad_size =
7298c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_ugee_ex07_buttonpad_arr);
7308c2ecf20Sopenharmony_ci
7318c2ecf20Sopenharmony_ci/* Fixed report descriptor for Ugee G5 frame controls */
7328c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_ugee_g5_frame_arr[] = {
7338c2ecf20Sopenharmony_ci	0x05, 0x01,         /*  Usage Page (Desktop),               */
7348c2ecf20Sopenharmony_ci	0x09, 0x07,         /*  Usage (Keypad),                     */
7358c2ecf20Sopenharmony_ci	0xA1, 0x01,         /*  Collection (Application),           */
7368c2ecf20Sopenharmony_ci	0x85, 0x06,         /*      Report ID (6),                  */
7378c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*      Usage Page (Digitizer),         */
7388c2ecf20Sopenharmony_ci	0x09, 0x39,         /*      Usage (Tablet Function Keys),   */
7398c2ecf20Sopenharmony_ci	0xA0,               /*      Collection (Physical),          */
7408c2ecf20Sopenharmony_ci	0x14,               /*          Logical Minimum (0),        */
7418c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
7428c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
7438c2ecf20Sopenharmony_ci	0x05, 0x09,         /*          Usage Page (Button),        */
7448c2ecf20Sopenharmony_ci	0x19, 0x01,         /*          Usage Minimum (01h),        */
7458c2ecf20Sopenharmony_ci	0x29, 0x05,         /*          Usage Maximum (05h),        */
7468c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
7478c2ecf20Sopenharmony_ci	0x95, 0x05,         /*          Report Count (5),           */
7488c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
7498c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
7508c2ecf20Sopenharmony_ci	0x95, 0x03,         /*          Report Count (3),           */
7518c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
7528c2ecf20Sopenharmony_ci	0x05, 0x0D,         /*          Usage Page (Digitizer),     */
7538c2ecf20Sopenharmony_ci	0x0A, 0xFF, 0xFF,   /*          Usage (FFFFh),              */
7548c2ecf20Sopenharmony_ci	0x26, 0xFF, 0x00,   /*          Logical Maximum (255),      */
7558c2ecf20Sopenharmony_ci	0x75, 0x08,         /*          Report Size (8),            */
7568c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
7578c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
7588c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
7598c2ecf20Sopenharmony_ci	0x09, 0x44,         /*          Usage (Barrel Switch),      */
7608c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
7618c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
7628c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
7638c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
7648c2ecf20Sopenharmony_ci	0x09, 0x30,         /*          Usage (X),                  */
7658c2ecf20Sopenharmony_ci	0x09, 0x31,         /*          Usage (Y),                  */
7668c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
7678c2ecf20Sopenharmony_ci	0x95, 0x02,         /*          Report Count (2),           */
7688c2ecf20Sopenharmony_ci	0x81, 0x02,         /*          Input (Variable),           */
7698c2ecf20Sopenharmony_ci	0x75, 0x01,         /*          Report Size (1),            */
7708c2ecf20Sopenharmony_ci	0x95, 0x0B,         /*          Report Count (11),          */
7718c2ecf20Sopenharmony_ci	0x81, 0x01,         /*          Input (Constant),           */
7728c2ecf20Sopenharmony_ci	0x05, 0x01,         /*          Usage Page (Desktop),       */
7738c2ecf20Sopenharmony_ci	0x09, 0x38,         /*          Usage (Wheel),              */
7748c2ecf20Sopenharmony_ci	0x15, 0xFF,         /*          Logical Minimum (-1),       */
7758c2ecf20Sopenharmony_ci	0x25, 0x01,         /*          Logical Maximum (1),        */
7768c2ecf20Sopenharmony_ci	0x75, 0x02,         /*          Report Size (2),            */
7778c2ecf20Sopenharmony_ci	0x95, 0x01,         /*          Report Count (1),           */
7788c2ecf20Sopenharmony_ci	0x81, 0x06,         /*          Input (Variable, Relative), */
7798c2ecf20Sopenharmony_ci	0xC0,               /*      End Collection,                 */
7808c2ecf20Sopenharmony_ci	0xC0                /*  End Collection                      */
7818c2ecf20Sopenharmony_ci};
7828c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_ugee_g5_frame_size =
7838c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_ugee_g5_frame_arr);
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci/* Fixed report descriptor for XP-Pen Deco 01 frame controls */
7868c2ecf20Sopenharmony_ciconst __u8 uclogic_rdesc_xppen_deco01_frame_arr[] = {
7878c2ecf20Sopenharmony_ci	0x05, 0x01, /*  Usage Page (Desktop),               */
7888c2ecf20Sopenharmony_ci	0x09, 0x07, /*  Usage (Keypad),                     */
7898c2ecf20Sopenharmony_ci	0xA1, 0x01, /*  Collection (Application),           */
7908c2ecf20Sopenharmony_ci	0x85, 0x06, /*      Report ID (6),                  */
7918c2ecf20Sopenharmony_ci	0x14,       /*      Logical Minimum (0),            */
7928c2ecf20Sopenharmony_ci	0x25, 0x01, /*      Logical Maximum (1),            */
7938c2ecf20Sopenharmony_ci	0x75, 0x01, /*      Report Size (1),                */
7948c2ecf20Sopenharmony_ci	0x05, 0x0D, /*      Usage Page (Digitizer),         */
7958c2ecf20Sopenharmony_ci	0x09, 0x39, /*      Usage (Tablet Function Keys),   */
7968c2ecf20Sopenharmony_ci	0xA0,       /*      Collection (Physical),          */
7978c2ecf20Sopenharmony_ci	0x05, 0x09, /*          Usage Page (Button),        */
7988c2ecf20Sopenharmony_ci	0x19, 0x01, /*          Usage Minimum (01h),        */
7998c2ecf20Sopenharmony_ci	0x29, 0x08, /*          Usage Maximum (08h),        */
8008c2ecf20Sopenharmony_ci	0x95, 0x08, /*          Report Count (8),           */
8018c2ecf20Sopenharmony_ci	0x81, 0x02, /*          Input (Variable),           */
8028c2ecf20Sopenharmony_ci	0x05, 0x0D, /*          Usage Page (Digitizer),     */
8038c2ecf20Sopenharmony_ci	0x09, 0x44, /*          Usage (Barrel Switch),      */
8048c2ecf20Sopenharmony_ci	0x95, 0x01, /*          Report Count (1),           */
8058c2ecf20Sopenharmony_ci	0x81, 0x02, /*          Input (Variable),           */
8068c2ecf20Sopenharmony_ci	0x05, 0x01, /*          Usage Page (Desktop),       */
8078c2ecf20Sopenharmony_ci	0x09, 0x30, /*          Usage (X),                  */
8088c2ecf20Sopenharmony_ci	0x09, 0x31, /*          Usage (Y),                  */
8098c2ecf20Sopenharmony_ci	0x95, 0x02, /*          Report Count (2),           */
8108c2ecf20Sopenharmony_ci	0x81, 0x02, /*          Input (Variable),           */
8118c2ecf20Sopenharmony_ci	0x95, 0x15, /*          Report Count (21),          */
8128c2ecf20Sopenharmony_ci	0x81, 0x01, /*          Input (Constant),           */
8138c2ecf20Sopenharmony_ci	0xC0,       /*      End Collection,                 */
8148c2ecf20Sopenharmony_ci	0xC0        /*  End Collection                      */
8158c2ecf20Sopenharmony_ci};
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ciconst size_t uclogic_rdesc_xppen_deco01_frame_size =
8188c2ecf20Sopenharmony_ci			sizeof(uclogic_rdesc_xppen_deco01_frame_arr);
8198c2ecf20Sopenharmony_ci
8208c2ecf20Sopenharmony_ci/**
8218c2ecf20Sopenharmony_ci * uclogic_rdesc_template_apply() - apply report descriptor parameters to a
8228c2ecf20Sopenharmony_ci * report descriptor template, creating a report descriptor. Copies the
8238c2ecf20Sopenharmony_ci * template over to the new report descriptor and replaces every occurrence of
8248c2ecf20Sopenharmony_ci * UCLOGIC_RDESC_PH_HEAD, followed by an index byte, with the value from the
8258c2ecf20Sopenharmony_ci * parameter list at that index.
8268c2ecf20Sopenharmony_ci *
8278c2ecf20Sopenharmony_ci * @template_ptr:	Pointer to the template buffer.
8288c2ecf20Sopenharmony_ci * @template_size:	Size of the template buffer.
8298c2ecf20Sopenharmony_ci * @param_list:		List of template parameters.
8308c2ecf20Sopenharmony_ci * @param_num:		Number of parameters in the list.
8318c2ecf20Sopenharmony_ci *
8328c2ecf20Sopenharmony_ci * Returns:
8338c2ecf20Sopenharmony_ci *	Kmalloc-allocated pointer to the created report descriptor,
8348c2ecf20Sopenharmony_ci *	or NULL if allocation failed.
8358c2ecf20Sopenharmony_ci */
8368c2ecf20Sopenharmony_ci__u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
8378c2ecf20Sopenharmony_ci				   size_t template_size,
8388c2ecf20Sopenharmony_ci				   const s32 *param_list,
8398c2ecf20Sopenharmony_ci				   size_t param_num)
8408c2ecf20Sopenharmony_ci{
8418c2ecf20Sopenharmony_ci	static const __u8 head[] = {UCLOGIC_RDESC_PH_HEAD};
8428c2ecf20Sopenharmony_ci	__u8 *rdesc_ptr;
8438c2ecf20Sopenharmony_ci	__u8 *p;
8448c2ecf20Sopenharmony_ci	s32 v;
8458c2ecf20Sopenharmony_ci
8468c2ecf20Sopenharmony_ci	rdesc_ptr = kmemdup(template_ptr, template_size, GFP_KERNEL);
8478c2ecf20Sopenharmony_ci	if (rdesc_ptr == NULL)
8488c2ecf20Sopenharmony_ci		return NULL;
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci	for (p = rdesc_ptr; p + sizeof(head) < rdesc_ptr + template_size;) {
8518c2ecf20Sopenharmony_ci		if (memcmp(p, head, sizeof(head)) == 0 &&
8528c2ecf20Sopenharmony_ci		    p[sizeof(head)] < param_num) {
8538c2ecf20Sopenharmony_ci			v = param_list[p[sizeof(head)]];
8548c2ecf20Sopenharmony_ci			put_unaligned(cpu_to_le32(v), (s32 *)p);
8558c2ecf20Sopenharmony_ci			p += sizeof(head) + 1;
8568c2ecf20Sopenharmony_ci		} else {
8578c2ecf20Sopenharmony_ci			p++;
8588c2ecf20Sopenharmony_ci		}
8598c2ecf20Sopenharmony_ci	}
8608c2ecf20Sopenharmony_ci
8618c2ecf20Sopenharmony_ci	return rdesc_ptr;
8628c2ecf20Sopenharmony_ci}
863