1010#define VID_UGEE 0x28BD /* VID is shared with SinoWealth and Glorious and prob others */
1111#define PID_ARTIST_PRO14_GEN2 0x095A
1212#define PID_ARTIST_PRO16_GEN2 0x095B
13+ #define PID_ARTIST_PRO19_GEN2 0x096A
1314
1415HID_BPF_CONFIG (
1516 HID_DEVICE (BUS_USB , HID_GROUP_GENERIC , VID_UGEE , PID_ARTIST_PRO14_GEN2 ),
16- HID_DEVICE (BUS_USB , HID_GROUP_GENERIC , VID_UGEE , PID_ARTIST_PRO16_GEN2 )
17+ HID_DEVICE (BUS_USB , HID_GROUP_GENERIC , VID_UGEE , PID_ARTIST_PRO16_GEN2 ),
18+ HID_DEVICE (BUS_USB , HID_GROUP_GENERIC , VID_UGEE , PID_ARTIST_PRO19_GEN2 )
1719);
1820
1921/*
@@ -22,7 +24,7 @@ HID_BPF_CONFIG(
2224 * - when the eraser button is pressed and the stylus is touching the tablet,
2325 * the device sends Tip Switch instead of sending Eraser
2426 *
25- * This descriptor uses physical dimensions of the 16" device.
27+ * This descriptor uses the physical dimensions of the 16" device.
2628 */
2729static const __u8 fixed_rdesc [] = {
2830 0x05 , 0x0d , // Usage Page (Digitizers) 0
@@ -100,6 +102,12 @@ int BPF_PROG(hid_fix_rdesc_xppen_artistpro16gen2, struct hid_bpf_ctx *hctx)
100102 data [62 ] = 0x62 ;
101103 data [73 ] = 0x1c ;
102104 data [72 ] = 0xfd ;
105+ } else if (hctx -> hid -> product == PID_ARTIST_PRO19_GEN2 ) {
106+ /* 19" screen reports 16.101" x 9.057" */
107+ data [63 ] = 0x3e ;
108+ data [62 ] = 0xe5 ;
109+ data [73 ] = 0x23 ;
110+ data [72 ] = 0x61 ;
103111 }
104112
105113 return sizeof (fixed_rdesc );
@@ -177,6 +185,27 @@ static const __u16 angle_offsets_vertical_16[128] = {
177185 188 , 186 , 184 , 182 , 180 , 178 , 176 , 174 , 172
178186};
179187
188+ /* 19" inch screen 16.101" x 9.057" */
189+ static const __u16 angle_offsets_horizontal_19 [128 ] = {
190+ 0 , 2 , 4 , 6 , 8 , 10 , 12 , 14 , 16 , 18 , 20 , 22 , 24 , 25 , 27 , 29 , 31 , 33 , 35 , 37 , 39 , 41 ,
191+ 42 , 44 , 46 , 48 , 50 , 51 , 53 , 55 , 57 , 58 , 60 , 62 , 63 , 65 , 67 , 68 , 70 , 71 , 73 , 74 , 76 ,
192+ 77 , 79 , 80 , 82 , 83 , 84 , 86 , 87 , 88 , 89 , 90 , 92 , 93 , 94 , 95 , 96 , 97 , 98 , 99 , 100 ,
193+ 101 , 102 , 103 , 104 , 104 , 105 , 106 , 106 , 107 , 108 , 108 , 109 , 109 , 110 , 110 , 111 ,
194+ 111 , 112 , 112 , 112 , 112 , 113 , 113 , 113 , 113 , 113 , 113 , 113 , 113 , 113 , 113 , 113 ,
195+ 113 , 113 , 112 , 112 , 112 , 112 , 111 , 111 , 110 , 110 , 109 , 109 , 108 , 108 , 107 , 106 ,
196+ 106 , 105 , 104 , 104 , 103 , 102 , 101 , 100 , 99 , 98 , 97 , 96 , 95 , 94 , 93 , 92 , 90
197+ };
198+ static const __u16 angle_offsets_vertical_19 [128 ] = {
199+ 0 , 4 , 7 , 11 , 14 , 18 , 21 , 25 , 28 , 32 , 35 , 38 , 42 , 45 , 49 , 52 , 56 , 59 , 62 , 66 , 69 , 72 ,
200+ 75 , 79 , 82 , 85 , 88 , 91 , 95 , 98 , 101 , 104 , 107 , 110 , 113 , 116 , 118 , 121 , 124 , 127 ,
201+ 129 , 132 , 135 , 137 , 140 , 142 , 145 , 147 , 150 , 152 , 154 , 157 , 159 , 161 , 163 , 165 , 167 ,
202+ 169 , 171 , 173 , 174 , 176 , 178 , 179 , 181 , 183 , 184 , 185 , 187 , 188 , 189 , 190 , 192 , 193 ,
203+ 194 , 195 , 195 , 196 , 197 , 198 , 198 , 199 , 199 , 200 , 200 , 201 , 201 , 201 , 201 , 201 , 201 ,
204+ 201 , 201 , 201 , 201 , 201 , 200 , 200 , 199 , 199 , 198 , 198 , 197 , 196 , 195 , 195 , 194 , 193 ,
205+ 192 , 190 , 189 , 188 , 187 , 185 , 184 , 183 , 181 , 179 , 178 , 176 , 174 , 173 , 171 , 169 , 167 ,
206+ 165 , 163 , 161
207+ };
208+
180209static void compensate_coordinates_by_tilt (__u8 * data , const __u8 idx ,
181210 const __s8 tilt , const __u16 (* compensation_table )[128 ])
182211{
@@ -241,12 +270,19 @@ static int xppen_16_fix_angle_offset(struct hid_bpf_ctx *hctx)
241270 __s8 tilt_x = (__s8 ) data [8 ];
242271 __s8 tilt_y = (__s8 ) data [9 ];
243272
244- if (hctx -> hid -> product == PID_ARTIST_PRO14_GEN2 ) {
273+ switch (hctx -> hid -> product ) {
274+ case PID_ARTIST_PRO14_GEN2 :
245275 compensate_coordinates_by_tilt (data , 2 , tilt_x , & angle_offsets_horizontal_14 );
246276 compensate_coordinates_by_tilt (data , 4 , tilt_y , & angle_offsets_vertical_14 );
247- } else if (hctx -> hid -> product == PID_ARTIST_PRO16_GEN2 ) {
277+ break ;
278+ case PID_ARTIST_PRO16_GEN2 :
248279 compensate_coordinates_by_tilt (data , 2 , tilt_x , & angle_offsets_horizontal_16 );
249280 compensate_coordinates_by_tilt (data , 4 , tilt_y , & angle_offsets_vertical_16 );
281+ break ;
282+ case PID_ARTIST_PRO19_GEN2 :
283+ compensate_coordinates_by_tilt (data , 2 , tilt_x , & angle_offsets_horizontal_19 );
284+ compensate_coordinates_by_tilt (data , 4 , tilt_y , & angle_offsets_vertical_19 );
285+ break ;
250286 }
251287
252288 return 0 ;
0 commit comments