1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  *  HID driver for UC-Logic devices not fully compliant with HID standard
4  *  - original and fixed report descriptors
5  *
6  *  Copyright (c) 2010-2018 Nikolai Kondrashov
7  *  Copyright (c) 2013 Martin Rusko
8  */
9 
10 /*
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms of the GNU General Public License as published by the Free
13  * Software Foundation; either version 2 of the License, or (at your option)
14  * any later version.
15  */
16 
17 #ifndef _HID_UCLOGIC_RDESC_H
18 #define _HID_UCLOGIC_RDESC_H
19 
20 #include <linux/usb.h>
21 
22 /* Size of the original descriptor of WPXXXXU tablets */
23 #define UCLOGIC_RDESC_WPXXXXU_ORIG_SIZE		212
24 
25 /* Fixed WP4030U report descriptor */
26 extern __u8 uclogic_rdesc_wp4030u_fixed_arr[];
27 extern const size_t uclogic_rdesc_wp4030u_fixed_size;
28 
29 /* Fixed WP5540U report descriptor */
30 extern __u8 uclogic_rdesc_wp5540u_fixed_arr[];
31 extern const size_t uclogic_rdesc_wp5540u_fixed_size;
32 
33 /* Fixed WP8060U report descriptor */
34 extern __u8 uclogic_rdesc_wp8060u_fixed_arr[];
35 extern const size_t uclogic_rdesc_wp8060u_fixed_size;
36 
37 /* Size of the original descriptor of the new WP5540U tablet */
38 #define UCLOGIC_RDESC_WP5540U_V2_ORIG_SIZE	232
39 
40 /* Size of the original descriptor of WP1062 tablet */
41 #define UCLOGIC_RDESC_WP1062_ORIG_SIZE		254
42 
43 /* Fixed WP1062 report descriptor */
44 extern __u8 uclogic_rdesc_wp1062_fixed_arr[];
45 extern const size_t uclogic_rdesc_wp1062_fixed_size;
46 
47 /* Size of the original descriptor of PF1209 tablet */
48 #define UCLOGIC_RDESC_PF1209_ORIG_SIZE		234
49 
50 /* Fixed PF1209 report descriptor */
51 extern __u8 uclogic_rdesc_pf1209_fixed_arr[];
52 extern const size_t uclogic_rdesc_pf1209_fixed_size;
53 
54 /* Size of the original descriptors of TWHL850 tablet */
55 #define UCLOGIC_RDESC_TWHL850_ORIG0_SIZE	182
56 #define UCLOGIC_RDESC_TWHL850_ORIG1_SIZE	161
57 #define UCLOGIC_RDESC_TWHL850_ORIG2_SIZE	92
58 
59 /* Fixed PID 0522 tablet report descriptor, interface 0 (stylus) */
60 extern __u8 uclogic_rdesc_twhl850_fixed0_arr[];
61 extern const size_t uclogic_rdesc_twhl850_fixed0_size;
62 
63 /* Fixed PID 0522 tablet report descriptor, interface 1 (mouse) */
64 extern __u8 uclogic_rdesc_twhl850_fixed1_arr[];
65 extern const size_t uclogic_rdesc_twhl850_fixed1_size;
66 
67 /* Fixed PID 0522 tablet report descriptor, interface 2 (frame buttons) */
68 extern __u8 uclogic_rdesc_twhl850_fixed2_arr[];
69 extern const size_t uclogic_rdesc_twhl850_fixed2_size;
70 
71 /* Size of the original descriptors of TWHA60 tablet */
72 #define UCLOGIC_RDESC_TWHA60_ORIG0_SIZE		254
73 #define UCLOGIC_RDESC_TWHA60_ORIG1_SIZE		139
74 
75 /* Fixed TWHA60 report descriptor, interface 0 (stylus) */
76 extern __u8 uclogic_rdesc_twha60_fixed0_arr[];
77 extern const size_t uclogic_rdesc_twha60_fixed0_size;
78 
79 /* Fixed TWHA60 report descriptor, interface 1 (frame buttons) */
80 extern __u8 uclogic_rdesc_twha60_fixed1_arr[];
81 extern const size_t uclogic_rdesc_twha60_fixed1_size;
82 
83 /* Report descriptor template placeholder head */
84 #define UCLOGIC_RDESC_PH_HEAD	0xFE, 0xED, 0x1D
85 
86 /* Apply report descriptor parameters to a report descriptor template */
87 extern __u8 *uclogic_rdesc_template_apply(const __u8 *template_ptr,
88 					  size_t template_size,
89 					  const s32 *param_list,
90 					  size_t param_num);
91 
92 /* Pen report descriptor template placeholder IDs */
93 enum uclogic_rdesc_pen_ph_id {
94 	UCLOGIC_RDESC_PEN_PH_ID_X_LM,
95 	UCLOGIC_RDESC_PEN_PH_ID_X_PM,
96 	UCLOGIC_RDESC_PEN_PH_ID_Y_LM,
97 	UCLOGIC_RDESC_PEN_PH_ID_Y_PM,
98 	UCLOGIC_RDESC_PEN_PH_ID_PRESSURE_LM,
99 	UCLOGIC_RDESC_PEN_PH_ID_NUM
100 };
101 
102 /* Report descriptor pen template placeholder */
103 #define UCLOGIC_RDESC_PEN_PH(_ID) \
104 	UCLOGIC_RDESC_PH_HEAD, UCLOGIC_RDESC_PEN_PH_ID_##_ID
105 
106 /* Report ID for v1 pen reports */
107 #define UCLOGIC_RDESC_PEN_V1_ID	0x07
108 
109 /* Fixed report descriptor template for (tweaked) v1 pen reports */
110 extern const __u8 uclogic_rdesc_pen_v1_template_arr[];
111 extern const size_t uclogic_rdesc_pen_v1_template_size;
112 
113 /* Report ID for v2 pen reports */
114 #define UCLOGIC_RDESC_PEN_V2_ID	0x08
115 
116 /* Fixed report descriptor template for (tweaked) v2 pen reports */
117 extern const __u8 uclogic_rdesc_pen_v2_template_arr[];
118 extern const size_t uclogic_rdesc_pen_v2_template_size;
119 
120 /* Fixed report descriptor for (tweaked) v1 buttonpad reports */
121 extern const __u8 uclogic_rdesc_buttonpad_v1_arr[];
122 extern const size_t uclogic_rdesc_buttonpad_v1_size;
123 
124 /* Report ID for tweaked v1 buttonpad reports */
125 #define UCLOGIC_RDESC_BUTTONPAD_V1_ID 0xf7
126 
127 /* Fixed report descriptor for (tweaked) v2 buttonpad reports */
128 extern const __u8 uclogic_rdesc_buttonpad_v2_arr[];
129 extern const size_t uclogic_rdesc_buttonpad_v2_size;
130 
131 /* Report ID for tweaked v2 buttonpad reports */
132 #define UCLOGIC_RDESC_BUTTONPAD_V2_ID 0xf7
133 
134 /* Fixed report descriptor for Ugee EX07 buttonpad */
135 extern const __u8 uclogic_rdesc_ugee_ex07_buttonpad_arr[];
136 extern const size_t uclogic_rdesc_ugee_ex07_buttonpad_size;
137 
138 /* Fixed report descriptor for XP-Pen Deco 01 frame controls */
139 extern const __u8 uclogic_rdesc_xppen_deco01_frame_arr[];
140 extern const size_t uclogic_rdesc_xppen_deco01_frame_size;
141 
142 /* Fixed report descriptor for Ugee G5 frame controls */
143 extern const __u8 uclogic_rdesc_ugee_g5_frame_arr[];
144 extern const size_t uclogic_rdesc_ugee_g5_frame_size;
145 
146 /* Report ID of Ugee G5 frame control reports */
147 #define UCLOGIC_RDESC_UGEE_G5_FRAME_ID 0x06
148 
149 /* Device ID byte offset in Ugee G5 frame report */
150 #define UCLOGIC_RDESC_UGEE_G5_FRAME_DEV_ID_BYTE	0x2
151 
152 /* Least-significant bit of Ugee G5 frame rotary encoder state */
153 #define UCLOGIC_RDESC_UGEE_G5_FRAME_RE_LSB 38
154 
155 #endif /* _HID_UCLOGIC_RDESC_H */
156