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-2018 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#ifndef _HID_UCLOGIC_RDESC_H
188c2ecf20Sopenharmony_ci#define _HID_UCLOGIC_RDESC_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <linux/usb.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Size of the original descriptor of WPXXXXU tablets */
238c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE		212
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* Fixed WP4030U report descriptor */
268c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
278c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_wp4030u_fixed_size;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* Fixed WP5540U report descriptor */
308c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
318c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_wp5540u_fixed_size;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci/* Fixed WP8060U report descriptor */
348c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
358c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_wp8060u_fixed_size;
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/* Size of the original descriptor of the new WP5540U tablet */
388c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE	232
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* Size of the original descriptor of WP1062 tablet */
418c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_WP1062_ORIG_SIZE		254
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Fixed WP1062 report descriptor */
448c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_wp1062_fixed_arr[];
458c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_wp1062_fixed_size;
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/* Size of the original descriptor of PF1209 tablet */
488c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_PF1209_ORIG_SIZE		234
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/* Fixed PF1209 report descriptor */
518c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_pf1209_fixed_arr[];
528c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_pf1209_fixed_size;
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci/* Size of the original descriptors of TWHL850 tablet */
558c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG0_SIZE	182
568c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG1_SIZE	161
578c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE	92
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
608c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
618c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed0_size;
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
648c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
658c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed1_size;
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci/* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
688c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
698c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_twhl850_fixed2_size;
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* Size of the original descriptors of TWHA60 tablet */
728c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE		254
738c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE		139
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 0 (stylus) */
768c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_twha60_fixed0_arr[];
778c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_twha60_fixed0_size;
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci/* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
808c2ecf20Sopenharmony_ciextern __u8 uclogic_rdesc_twha60_fixed1_arr[];
818c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_twha60_fixed1_size;
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci/* Report descriptor template placeholder head */
848c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_PH_HEAD	0xFE, 0xED, 0x1D
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* Apply report descriptor parameters to a report descriptor template */
878c2ecf20Sopenharmony_ciextern __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
888c2ecf20Sopenharmony_ci					  size_t template_size,
898c2ecf20Sopenharmony_ci					  const s32 *param_list,
908c2ecf20Sopenharmony_ci					  size_t param_num);
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/* Pen report descriptor template placeholder IDs */
938c2ecf20Sopenharmony_cienum uclogic_rdesc_pen_ph_id {
948c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_X_LM,
958c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_X_PM,
968c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_Y_LM,
978c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_Y_PM,
988c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM,
998c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PEN_PH_ID_NUM
1008c2ecf20Sopenharmony_ci};
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* Report descriptor pen template placeholder */
1038c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_PEN_PH(_ID) \
1048c2ecf20Sopenharmony_ci	UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* Report ID for v1 pen reports */
1078c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_PEN_V1_ID	0x07
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v1 pen reports */
1108c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_pen_v1_template_arr[];
1118c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_pen_v1_template_size;
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci/* Report ID for v2 pen reports */
1148c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_PEN_V2_ID	0x08
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci/* Fixed report descriptor template for (tweaked) v2 pen reports */
1178c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_pen_v2_template_arr[];
1188c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_pen_v2_template_size;
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci/* Fixed report descriptor for (tweaked) v1 buttonpad reports */
1218c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_buttonpad_v1_arr[];
1228c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_buttonpad_v1_size;
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci/* Report ID for tweaked v1 buttonpad reports */
1258c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Fixed report descriptor for (tweaked) v2 buttonpad reports */
1288c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_buttonpad_v2_arr[];
1298c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_buttonpad_v2_size;
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ci/* Report ID for tweaked v2 buttonpad reports */
1328c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci/* Fixed report descriptor for Ugee EX07 buttonpad */
1358c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[];
1368c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size;
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* Fixed report descriptor for XP-Pen Deco 01 frame controls */
1398c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[];
1408c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_xppen_deco01_frame_size;
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/* Fixed report descriptor for Ugee G5 frame controls */
1438c2ecf20Sopenharmony_ciextern const __u8 uclogic_rdesc_ugee_g5_frame_arr[];
1448c2ecf20Sopenharmony_ciextern const size_t uclogic_rdesc_ugee_g5_frame_size;
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ci/* Report ID of Ugee G5 frame control reports */
1478c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_ID 0x06
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* Device ID byte offset in Ugee G5 frame report */
1508c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE	0x2
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci/* Least-significant bit of Ugee G5 frame rotary encoder state */
1538c2ecf20Sopenharmony_ci#define UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB 38
1548c2ecf20Sopenharmony_ci
1558c2ecf20Sopenharmony_ci#endif /* _HID_UCLOGIC_RDESC_H */
156