Lines Matching +full:0 +full:- +full:127
1 // SPDX-License-Identifier: GPL-2.0-only
10 #define VID_UGEE 0x28BD /* VID is shared with SinoWealth and Glorious and prob others */
11 #define PID_ARTIST_PRO14_GEN2 0x095A
12 #define PID_ARTIST_PRO16_GEN2 0x095B
13 #define PID_ARTIST_PRO19_GEN2 0x096A
23 * - the device reports Eraser instead of using Secondary Barrel Switch
24 * - when the eraser button is pressed and the stylus is touching the tablet,
30 0x05, 0x0d, // Usage Page (Digitizers) 0
31 0x09, 0x02, // Usage (Pen) 2
32 0xa1, 0x01, // Collection (Application) 4
33 0x85, 0x07, // Report ID (7) 6
34 0x09, 0x20, // Usage (Stylus) 8
35 0xa1, 0x00, // Collection (Physical) 10
36 0x09, 0x42, // Usage (Tip Switch) 12
37 0x09, 0x44, // Usage (Barrel Switch) 14
38 …0x09, 0x5a, // Usage (Secondary Barrel Switch) 16 /* changed from 0x45 (Er…
39 0x09, 0x3c, // Usage (Invert) 18
40 …0x09, 0x45, // Usage (Eraser) 16 /* created over a paddin…
41 0x15, 0x00, // Logical Minimum (0) 20
42 0x25, 0x01, // Logical Maximum (1) 22
43 0x75, 0x01, // Report Size (1) 24
44 0x95, 0x05, // Report Count (5) 26 /* changed from 4 to 5 */
45 0x81, 0x02, // Input (Data,Var,Abs) 28
46 0x09, 0x32, // Usage (In Range) 34
47 0x15, 0x00, // Logical Minimum (0) 36
48 0x25, 0x01, // Logical Maximum (1) 38
49 0x95, 0x01, // Report Count (1) 40
50 0x81, 0x02, // Input (Data,Var,Abs) 42
51 0x95, 0x02, // Report Count (2) 44
52 0x81, 0x03, // Input (Cnst,Var,Abs) 46
53 0x75, 0x10, // Report Size (16) 48
54 0x95, 0x01, // Report Count (1) 50
55 0x35, 0x00, // Physical Minimum (0) 52
56 0xa4, // Push 54
57 0x05, 0x01, // Usage Page (Generic Desktop) 55
58 0x09, 0x30, // Usage (X) 57
59 0x65, 0x13, // Unit (EnglishLinear: in) 59
60 0x55, 0x0d, // Unit Exponent (-3) 61
61 0x46, 0xff, 0x34, // Physical Maximum (13567) 63
62 0x26, 0xff, 0x7f, // Logical Maximum (32767) 66
63 0x81, 0x02, // Input (Data,Var,Abs) 69
64 0x09, 0x31, // Usage (Y) 71
65 0x46, 0x20, 0x21, // Physical Maximum (8480) 73
66 0x26, 0xff, 0x7f, // Logical Maximum (32767) 76
67 0x81, 0x02, // Input (Data,Var,Abs) 79
68 0xb4, // Pop 81
69 0x09, 0x30, // Usage (Tip Pressure) 82
70 0x45, 0x00, // Physical Maximum (0) 84
71 0x26, 0xff, 0x3f, // Logical Maximum (16383) 86
72 0x81, 0x42, // Input (Data,Var,Abs,Null) 89
73 0x09, 0x3d, // Usage (X Tilt) 91
74 0x15, 0x81, // Logical Minimum (-127) 93
75 0x25, 0x7f, // Logical Maximum (127) 95
76 0x75, 0x08, // Report Size (8) 97
77 0x95, 0x01, // Report Count (1) 99
78 0x81, 0x02, // Input (Data,Var,Abs) 101
79 0x09, 0x3e, // Usage (Y Tilt) 103
80 0x15, 0x81, // Logical Minimum (-127) 105
81 0x25, 0x7f, // Logical Maximum (127) 107
82 0x81, 0x02, // Input (Data,Var,Abs) 109
83 0xc0, // End Collection 111
84 0xc0, // End Collection 112
90 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 4096 /* size */); in SEC()
93 return 0; /* EPERM check */ in SEC()
100 if (hctx->hid->product == PID_ARTIST_PRO14_GEN2) { in SEC()
101 data[63] = 0x2e; in SEC()
102 data[62] = 0x62; in SEC()
103 data[73] = 0x1c; in SEC()
104 data[72] = 0xfd; in SEC()
105 } else if (hctx->hid->product == PID_ARTIST_PRO19_GEN2) { in SEC()
107 data[63] = 0x3e; in SEC()
108 data[62] = 0xe5; in SEC()
109 data[73] = 0x23; in SEC()
110 data[72] = 0x61; in SEC()
118 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 10 /* size */); in xppen_16_fix_eraser()
121 return 0; /* EPERM check */ in xppen_16_fix_eraser()
123 if ((data[1] & 0x29) != 0x29) /* tip switch=1 invert=1 inrange=1 */ in xppen_16_fix_eraser()
124 return 0; in xppen_16_fix_eraser()
126 /* xor bits 0,3 and 4: convert Tip Switch + Invert into Eraser only */ in xppen_16_fix_eraser()
127 data[1] ^= 0x19; in xppen_16_fix_eraser()
129 return 0; in xppen_16_fix_eraser()
140 * >>> [round(h*math.sin(math.radians(d))) for d in range(0, 128)]
141 * [0, 13, 26, ....]
146 0, 3, 5, 8, 11, 13, 16, 19, 21, 24, 27, 29, 32, 35, 37, 40, 42, 45, 47, 50, 53,
148 101, 103, 105, 107, 109, 111, 112, 114, 116, 118, 119, 121, 123, 124, 126, 127,
153 132, 130, 129, 127, 126, 124, 123
156 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 59, 64, 68, 72, 76, 80, 84,
157 88, 92, 96, 100, 104, 108, 112, 115, 119, 123, 127, 130, 134, 137, 141, 145, 148,
168 0, 2, 5, 7, 9, 12, 14, 16, 19, 21, 23, 26, 28, 30, 33, 35, 37, 39, 42, 44, 46, 48,
171 116, 118, 119, 120, 121, 122, 123, 124, 125, 126, 126, 127, 128, 129, 129, 130,
174 128, 127, 126, 126, 125, 124, 123, 122, 121, 120, 119, 118, 116, 115, 114, 113,
178 0, 4, 8, 11, 15, 19, 22, 26, 30, 34, 37, 41, 45, 48, 52, 56, 59, 63, 66, 70, 74,
190 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 25, 27, 29, 31, 33, 35, 37, 39, 41,
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,
217 …__u8 direction = tilt > 0 ? 0 : 1; /* Positive tilt means we need to subtract the compensation (vs… in compensate_coordinates_by_tilt()
218 __u8 angle = tilt > 0 ? tilt : -tilt; in compensate_coordinates_by_tilt()
220 if (angle > 127) in compensate_coordinates_by_tilt()
225 if (direction == 0) { in compensate_coordinates_by_tilt()
226 coords = (coords > compensation) ? coords - compensation : 0; in compensate_coordinates_by_tilt()
229 __u16 max = logical_maximum - compensation; in compensate_coordinates_by_tilt()
234 data[idx] = coords & 0xff; in compensate_coordinates_by_tilt()
240 __u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 10 /* size */); in xppen_16_fix_angle_offset()
243 return 0; /* EPERM check */ in xppen_16_fix_angle_offset()
261 * bytes 0 - report id in xppen_16_fix_angle_offset()
262 * 1 - buttons in xppen_16_fix_angle_offset()
263 * 2-3 - X coords (logical) in xppen_16_fix_angle_offset()
264 * 4-5 - Y coords in xppen_16_fix_angle_offset()
265 * 6-7 - pressure (ignore) in xppen_16_fix_angle_offset()
266 * 8 - tilt X in xppen_16_fix_angle_offset()
267 * 9 - tilt Y in xppen_16_fix_angle_offset()
273 switch (hctx->hid->product) { in xppen_16_fix_angle_offset()
288 return 0; in xppen_16_fix_angle_offset()
313 ctx->retval = ctx->rdesc_size != 113; in probe()
314 if (ctx->retval) in probe()
315 ctx->retval = -EINVAL; in probe()
318 if (ctx->rdesc[17] != 0x45) /* Eraser */ in probe()
319 ctx->retval = -EINVAL; in probe()
321 return 0; in probe()