Skip to content

Commit 5d28bc6

Browse files
author
Jiri Kosina
committed
Merge branch 'for-6.15/bpf' into for-linus
- a few hid-bpf device fixes from udev-hid-bpf; XP-Pen and Huion plus one from TUXEDO (Benjamin Tissoires)
2 parents ac91d5c + 834da37 commit 5d28bc6

File tree

7 files changed

+1257
-8
lines changed

7 files changed

+1257
-8
lines changed

drivers/hid/bpf/progs/Huion__Kamvas-Pro-19.bpf.c

Lines changed: 71 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static const __u8 fixed_rdesc[] = {
4141
0x15, 0x00, // Logical Minimum (0) 22
4242
0x25, 0x01, // Logical Maximum (1) 24
4343
0x75, 0x01, // Report Size (1) 26
44-
0x95, 0x05, // Report Count (5) 28 /* changed (was 5) */
44+
0x95, 0x05, // Report Count (5) 28 /* changed (was 6) */
4545
0x81, 0x02, // Input (Data,Var,Abs) 30
4646
0x05, 0x09, // Usage Page (Button) /* inserted */
4747
0x09, 0x4a, // Usage (0x4a) /* inserted to be translated as input usage 0x149: BTN_STYLUS3 */
@@ -189,8 +189,68 @@ static const __u8 fixed_rdesc[] = {
189189
0x96, 0x00, 0x01, // Report Count (256) 322
190190
0xb1, 0x02, // Feature (Data,Var,Abs) 325
191191
0xc0, // End Collection 327
192+
/* New in Firmware Version: HUION_M220_240524 */
193+
0x05, 0x01, // Usage Page (Generic Desktop) 328
194+
0x09, 0x01, // Usage (Pointer) 330
195+
0xa1, 0x01, // Collection (Application) 332
196+
0x09, 0x01, // Usage (Pointer) 334
197+
0xa1, 0x00, // Collection (Physical) 336
198+
0x05, 0x09, // Usage Page (Button) 338
199+
0x19, 0x01, // UsageMinimum (1) 340
200+
0x29, 0x03, // UsageMaximum (3) 342
201+
0x15, 0x00, // Logical Minimum (0) 344
202+
0x25, 0x01, // Logical Maximum (1) 346
203+
0x85, 0x02, // Report ID (2) 348
204+
0x95, 0x03, // Report Count (3) 350
205+
0x75, 0x01, // Report Size (1) 352
206+
0x81, 0x02, // Input (Data,Var,Abs) 354
207+
0x95, 0x01, // Report Count (1) 356
208+
0x75, 0x05, // Report Size (5) 358
209+
0x81, 0x01, // Input (Cnst,Arr,Abs) 360
210+
0x05, 0x01, // Usage Page (Generic Desktop) 362
211+
0x09, 0x30, // Usage (X) 364
212+
0x09, 0x31, // Usage (Y) 366
213+
0x15, 0x81, // Logical Minimum (-127) 368
214+
0x25, 0x7f, // Logical Maximum (127) 370
215+
0x75, 0x08, // Report Size (8) 372
216+
0x95, 0x02, // Report Count (2) 374
217+
0x81, 0x06, // Input (Data,Var,Rel) 376
218+
0x95, 0x04, // Report Count (4) 378
219+
0x75, 0x08, // Report Size (8) 380
220+
0x81, 0x01, // Input (Cnst,Arr,Abs) 382
221+
0xc0, // End Collection 384
222+
0xc0, // End Collection 385
223+
0x05, 0x0d, // Usage Page (Digitizers) 386
224+
0x09, 0x05, // Usage (Touch Pad) 388
225+
0xa1, 0x01, // Collection (Application) 390
226+
0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page FF00) 392
227+
0x09, 0x0c, // Usage (Vendor Usage 0x0c) 395
228+
0x15, 0x00, // Logical Minimum (0) 397
229+
0x26, 0xff, 0x00, // Logical Maximum (255) 399
230+
0x75, 0x08, // Report Size (8) 402
231+
0x95, 0x10, // Report Count (16) 404
232+
0x85, 0x3f, // Report ID (63) 406
233+
0x81, 0x22, // Input (Data,Var,Abs,NoPref) 408
234+
0xc0, // End Collection 410
235+
0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page FF00) 411
236+
0x09, 0x0c, // Usage (Vendor Usage 0x0c) 414
237+
0xa1, 0x01, // Collection (Application) 416
238+
0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page FF00) 418
239+
0x09, 0x0c, // Usage (Vendor Usage 0x0c) 421
240+
0x15, 0x00, // Logical Minimum (0) 423
241+
0x26, 0xff, 0x00, // Logical Maximum (255) 425
242+
0x85, 0x44, // Report ID (68) 428
243+
0x75, 0x08, // Report Size (8) 430
244+
0x96, 0x6b, 0x05, // Report Count (1387) 432
245+
0x81, 0x00, // Input (Data,Arr,Abs) 435
246+
0xc0, // End Collection 437
192247
};
193248

249+
#define PRE_240524_RDESC_SIZE 328
250+
#define PRE_240524_RDESC_FIXED_SIZE 338 /* The original bits of the descriptor */
251+
#define FW_240524_RDESC_SIZE 438
252+
#define FW_240524_RDESC_FIXED_SIZE sizeof(fixed_rdesc)
253+
194254
SEC(HID_BPF_RDESC_FIXUP)
195255
int BPF_PROG(hid_fix_rdesc_huion_kamvas_pro_19, struct hid_bpf_ctx *hctx)
196256
{
@@ -199,9 +259,14 @@ int BPF_PROG(hid_fix_rdesc_huion_kamvas_pro_19, struct hid_bpf_ctx *hctx)
199259
if (!data)
200260
return 0; /* EPERM check */
201261

202-
__builtin_memcpy(data, fixed_rdesc, sizeof(fixed_rdesc));
262+
if (hctx->size == FW_240524_RDESC_SIZE) {
263+
__builtin_memcpy(data, fixed_rdesc, FW_240524_RDESC_FIXED_SIZE);
264+
return sizeof(fixed_rdesc);
265+
}
266+
267+
__builtin_memcpy(data, fixed_rdesc, PRE_240524_RDESC_FIXED_SIZE);
203268

204-
return sizeof(fixed_rdesc);
269+
return PRE_240524_RDESC_FIXED_SIZE;
205270
}
206271

207272
/*
@@ -263,7 +328,9 @@ HID_BPF_OPS(huion_Kamvas_pro_19) = {
263328
SEC("syscall")
264329
int probe(struct hid_bpf_probe_args *ctx)
265330
{
266-
ctx->retval = ctx->rdesc_size != 328;
331+
332+
ctx->retval = !((ctx->rdesc_size == PRE_240524_RDESC_SIZE) ||
333+
(ctx->rdesc_size == FW_240524_RDESC_SIZE));
267334
if (ctx->retval)
268335
ctx->retval = -EINVAL;
269336

0 commit comments

Comments
 (0)