Lines Matching +full:tablet +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
18 /* Filled in by udev-hid-bpf */
26 /* How this BPF program works: the tablet has two modes, firmware mode and
27 * tablet mode. In firmware mode (out of the box) the tablet sends button events
28 * and the dial as keyboard combinations. In tablet mode it uses a vendor specific
30 * Depending on the mode some hid reports are never sent and the corresponding
33 * To switch the tablet use e.g. https://github.com/whot/huion-switcher
36 * This BPF works for both modes. The huion-switcher tool sets the
37 * HUION_FIRMWARE_ID udev property - if that is set then we disable the firmware
39 * If that property is not set we fix all hidraw nodes so the tablet works in
40 * either mode though the drawback is that the device will show up twice if
58 * This rdesc does nothing until the tablet is switched to raw mode, see
59 * https://github.com/whot/huion-switcher
62 * Second hidraw node is the Pen. This one sends events until the tablet is
63 * switched to raw mode, then it's mute.
75 * # 0x09, 0x3c, // Usage (Invert) 18 <-- has no Invert eraser
89 * # 0x55, 0x0d, // Unit Exponent (-3) 46 <-- change to -2
90 * # 0x65, 0x33, // Unit (EnglishLinear: in³) 48 <-- change in³ to in
93 * # 0x46, 0x00, 0x08, // Physical Maximum (2048) 55 <-- invalid size
103 * # 0x09, 0x3d, // Usage (X Tilt) 77 <-- No tilt reported
105 * # 0x15, 0x81, // Logical Minimum (-127) 81
115 * the tablet is switched to raw mode, then it's mute:
171 // -- Byte 0 in report
177 // Byte 1 in report - just exists so we get to be a tablet pad
184 // Bytes 2/3 in report - just exists so we get to be a tablet pad
193 LogicalRange_i8(-1, 1)
214 // -- Byte 0 in report
218 // -- Byte 1 in report
236 UnitExponent(-1)
285 UnitExponent(-1)
315 Usage_Dig_BarrelSwitch // BTN_STYLUS, needed so we get to be a tablet pad
321 // Bytes 2/3 - x/y just exist so we get to be a tablet pad
340 LogicalRange_i8(-1, 1)
362 __s32 rdesc_size = hctx->size; in SEC()
374 sizeof(EXPECTED_FIRMWARE_ID) - 1) == 0; in SEC()
393 /* Always fix the vendor mode so the tablet will work even if nothing sets in SEC()
394 * the udev property (e.g. huion-switcher run manually) in SEC()
412 /* Only sent if tablet is in default mode */ in SEC()
417 * Button 1: 03 00 05 00 00 00 00 00 -> b in SEC()
418 * Button 2: 03 00 0c 00 00 00 00 00 -> i in SEC()
419 * Button 3: 03 00 08 00 00 00 00 00 -> e in SEC()
420 * Button 4: 03 01 16 00 00 00 00 00 -> Ctrl S in SEC()
421 * Button 5: 03 00 2c 00 00 00 00 00 -> space in SEC()
422 * Button 6: 03 05 1d 00 00 00 00 00 -> Ctrl Alt Z in SEC()
424 * Wheel down: 03 01 2d 00 00 00 00 00 -> Ctrl - in SEC()
425 * Wheel up: 03 01 2e 00 00 00 00 00 -> Ctrl = in SEC()
452 wheel = -1; in SEC()
468 /* Only sent if tablet is in raw mode */ in SEC()
497 pad_report->report_id = PAD_REPORT_ID; in SEC()
498 pad_report->btn_stylus = 0; in SEC()
499 pad_report->x = 0; in SEC()
500 pad_report->y = 0; in SEC()
501 pad_report->buttons = last_button_state; in SEC()
502 pad_report->wheel = wheel; in SEC()
521 switch (ctx->rdesc_size) { in probe()
525 ctx->retval = 0; in probe()
528 ctx->retval = -EINVAL; in probe()