projects/linux·commit b57807cb

Merge tag 'hid-for-linus-2024111801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

b57807cb · Linus Torvalds <[email protected]> · 2024-11-20 13:57:40 -08:00

Pull HID updates from Jiri Kosina:

 - improvement in the way hid-bpf coexists with specific drivers (others
   than hid-generic) that are already bound to devices (Benjamin
   Tissoires)

 - removal of three way-too-aggressive BUG_ON()s from HID drivers (He
   Lugang)

 - assorted cleanups and small code fixes to HID core (Dmitry Torokhov,
   Yan Zhen, Nathan Chancellor, Andy Shevchenko)

 - support for Corsair Void headset family (Stuart Hayhurst)

 - Support for Goodix GT7986U SPI (Charles Wang)

 - initial vendor-specific driver for Kysona, currently adding support
   for Kysona M600 (Lode Willems)

 - other assorted code cleanups and small bugfixes all over the place

* tag 'hid-for-linus-2024111801' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (40 commits)
  HID: multitouch: make mt_set_mode() less cryptic
  HID: hid-goodix-spi: Add OF supports
  dt-bindings: input: Goodix GT7986U SPI HID Touchscreen
  HID: hyperv: streamline driver probe to avoid devres issues
  HID: magicmouse: Apple Magic Trackpad 2 USB-C driver support
  HID: rmi: Add select RMI4_F3A in Kconfig
  HID: wacom: Interpret tilt data from Intuos Pro BT as signed values
  HID: steelseries: Add capacity_level mapping
  HID: steelseries: Fix battery requests stopping after some time
  HID: hid-goodix: Fix HID get/set feature operation overwritten problem
  HID: hid-goodix: Return 0 when receiving an empty HID feature package
  HID: bpf: drop use of Logical|Physical|UsageRange
  HID: bpf: Fix Rapoo M50 Plus Silent side buttons
  HID: bpf: Fix NKRO on Mistel MD770
  HID: replace BUG_ON() with WARN_ON()
  HID: wacom: Set eraser status when either 'Eraser' or 'Invert' usage is set
  HID: Kysona: add basic online status
  HID: Kysona: check battery status every 5s using a workqueue
  HID: Kysona: Add basic battery reporting for Kysona M600
  HID: Add IDs for Kysona
  ...
Commit
b57807cbbf36f17448cdb42e69a949aa76605440
Parents
e6de688e · 90379685

Merge commit. Changes below are compared with the first parent: e6de688e.

Changes

50 files changed · +2288 −412

FileStatusAddDelContent
Documentation/ABI/testing/sysfs-driver-hid-corsair-voidadded+38−0View file
Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yamladded+69−0View file
drivers/hid/Kconfigmodified+13−0View file
drivers/hid/Makefilemodified+2−1View file
drivers/hid/bpf/hid_bpf_dispatch.cmodified+6−3View file
drivers/hid/bpf/hid_bpf_struct_ops.cmodified+1−0View file
drivers/hid/bpf/progs/Huion__Dial-2.bpf.cmodified+44−22View file
drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.cmodified+40−20View file
drivers/hid/bpf/progs/Mistel__MD770.bpf.cadded+154−0View file
drivers/hid/bpf/progs/Rapoo__M50-Plus-Silent.bpf.cadded+148−0View file
drivers/hid/bpf/progs/hid_report_helpers.hmodified+27−9View file
drivers/hid/hid-asus.cmodified+1−1View file
drivers/hid/hid-core.cmodified+105−77View file
drivers/hid/hid-corsair-void.cadded+829−0View file
drivers/hid/hid-cp2112.cmodified+2−1View file
drivers/hid/hid-debug.cmodified+4−5View file
drivers/hid/hid-generic.cmodified+3−0View file
drivers/hid/hid-goodix-spi.cmodified+22−13View file
drivers/hid/hid-hyperv.cmodified+41−17View file
drivers/hid/hid-ids.hmodified+5−0View file
drivers/hid/hid-kysona.cadded+248−0View file
drivers/hid/hid-lg4ff.cmodified+2−1View file
drivers/hid/hid-logitech-hidpp.cmodified+23−51View file
drivers/hid/hid-magicmouse.cmodified+41−15View file
drivers/hid/hid-multitouch.cmodified+18−12View file
drivers/hid/hid-picolcd_fb.cmodified+1−1View file
drivers/hid/hid-sensor-custom.cmodified+1−1View file
drivers/hid/hid-sony.cmodified+2−1View file
drivers/hid/hid-steam.cmodified+1−1View file
drivers/hid/hid-steelseries.cmodified+18−1View file
drivers/hid/i2c-hid/i2c-hid-of.cmodified+3−3View file
drivers/hid/intel-ish-hid/ipc/pci-ish.cmodified+45−0View file
drivers/hid/intel-ish-hid/ishtp-fw-loader.cmodified+1−1View file
drivers/hid/intel-ish-hid/ishtp-hid-client.cmodified+12−13View file
drivers/hid/intel-ish-hid/ishtp-hid.hmodified+7−4View file
drivers/hid/intel-ish-hid/ishtp/client.cmodified+1−1View file
drivers/hid/intel-ish-hid/ishtp/ishtp-dev.hmodified+12−0View file
drivers/hid/intel-ish-hid/ishtp/loader.cmodified+34−1View file
drivers/hid/intel-ish-hid/ishtp/loader.hmodified+34−0View file
drivers/hid/usbhid/hid-core.cmodified+1−1View file
drivers/hid/wacom_wac.cmodified+7−4View file
drivers/hid/wacom_wac.hmodified+1−1View file
include/linux/hid.hmodified+12−9View file
include/linux/hid_bpf.hmodified+3−8View file
tools/testing/selftests/hid/Makefilemodified+1−1View file
tools/testing/selftests/hid/hid_bpf.cmodified+103−48View file
tools/testing/selftests/hid/hid_common.hmodified+75−37View file
tools/testing/selftests/hid/hidraw.cmodified+10−26View file
tools/testing/selftests/hid/progs/hid.cmodified+12−0View file
tools/testing/selftests/hid/progs/hid_bpf_helpers.hmodified+5−1View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/ABI/testing/sysfs-driver-hid-corsair-void

View file
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-corsair-void b/Documentation/ABI/testing/sysfs-driver-hid-corsair-void
new file mode 100644
index 0000000..83fa625
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-hid-corsair-void
@@ -0,0 +1,38 @@
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_headset
+Date: January 2024
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (R) The firmware version of the headset
+ * Returns -ENODATA if no version was reported
+
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/fw_version_receiver
+Date: January 2024
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (R) The firmware version of the receiver
+
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/microphone_up
+Date: July 2023
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (R) Get the physical position of the microphone
+ * 1 -> Microphone up
+ * 0 -> Microphone down
+
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/send_alert
+Date: July 2023
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (W) Play a built-in notification from the headset (0 / 1)
+
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/set_sidetone
+Date: December 2023
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (W) Set the sidetone volume (0 - sidetone_max)
+
+What: /sys/bus/hid/drivers/hid-corsair-void/<dev>/sidetone_max
+Date: July 2024
+KernelVersion: 6.13
+Contact: Stuart Hayhurst <[email protected]>
+Description: (R) Report the maximum sidetone volume

Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml

View file
diff --git a/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml b/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml
new file mode 100644
index 0000000..92bd004
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/goodix,gt7986u-spifw.yaml
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/goodix,gt7986u-spifw.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Goodix GT7986U SPI HID Touchscreen
+
+maintainers:
+ - Charles Wang <[email protected]>
+
+description: |
+ Supports the Goodix GT7986U touchscreen.
+ This touch controller reports data packaged according to the HID protocol
+ over the SPI bus, but it is incompatible with Microsoft's HID-over-SPI protocol.
+
+ NOTE: these bindings are distinct from the bindings used with the
+ GT7986U when the chip is running I2C firmware. This is because there's
+ not a single device that talks over both I2C and SPI but rather
+ distinct touchscreens that happen to be built with the same ASIC but
+ that are distinct products running distinct firmware.
+
+allOf:
+ - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+ compatible:
+ enum:
+ - goodix,gt7986u-spifw
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ reset-gpios:
+ maxItems: 1
+
+ spi-max-frequency: true
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - reset-gpios
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/gpio/gpio.h>
+
+ spi {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ touchscreen@0 {
+ compatible = "goodix,gt7986u-spifw";
+ reg = <0>;
+ interrupt-parent = <&gpio>;
+ interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
+ reset-gpios = <&gpio1 1 GPIO_ACTIVE_LOW>;
+ spi-max-frequency = <10000000>;
+ };
+ };
+
+...

drivers/hid/Kconfig

View file
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index f8a56d6..4d2a89d 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -213,13 +213,16 @@ config HID_CHICONY
config HID_CORSAIR
tristate "Corsair devices"
depends on USB_HID && LEDS_CLASS
+ select POWER_SUPPLY
help
Support for Corsair devices that are not fully compliant with the
HID standard.
+ Support for Corsair Void headsets.
Supported devices:
- Vengeance K90
- Scimitar PRO RGB
+ - Corsair Void headsets
config HID_COUGAR
tristate "Cougar devices"
@@ -465,6 +468,15 @@ config HID_KYE
- MousePen i608X tablet
- EasyPen M610X tablet
+config HID_KYSONA
+ tristate "Kysona devices"
+ depends on USB_HID
+ help
+ Support for Kysona mice.
+
+ Say Y here if you have a Kysona M600 mouse
+ and want to be able to read its battery capacity.
+
config HID_UCLOGIC
tristate "UC-Logic"
depends on USB_HID
@@ -1096,6 +1108,7 @@ config HID_RMI
select RMI4_F11
select RMI4_F12
select RMI4_F30
+ select RMI4_F3A
help
Support for Synaptics RMI4 touchpads.
Say Y here if you have a Synaptics RMI4 touchpads over i2c-hid or usbhid

drivers/hid/Makefile

View file
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index 496dab5..24de45f 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -38,7 +38,7 @@ obj-$(CONFIG_HID_BIGBEN_FF) += hid-bigbenff.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CMEDIA) += hid-cmedia.o
-obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o
+obj-$(CONFIG_HID_CORSAIR) += hid-corsair.o hid-corsair-void.o
obj-$(CONFIG_HID_COUGAR) += hid-cougar.o
obj-$(CONFIG_HID_CP2112) += hid-cp2112.o
obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
@@ -70,6 +70,7 @@ obj-$(CONFIG_HID_JABRA) += hid-jabra.o
obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o
obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o
obj-$(CONFIG_HID_KYE) += hid-kye.o
+obj-$(CONFIG_HID_KYSONA) += hid-kysona.o
obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o
obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o
obj-$(CONFIG_HID_LETSKETCH) += hid-letsketch.o

drivers/hid/bpf/hid_bpf_dispatch.c

View file
diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c
index 8420c22..961b7f3 100644
--- a/drivers/hid/bpf/hid_bpf_dispatch.c
+++ b/drivers/hid/bpf/hid_bpf_dispatch.c
@@ -148,7 +148,7 @@ out:
}
EXPORT_SYMBOL_GPL(dispatch_hid_bpf_output_report);
-u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
+const u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned int *size)
{
int ret;
struct hid_bpf_ctx_kern ctx_kern = {
@@ -183,7 +183,7 @@ u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, const u8 *rdesc, unsigned
ignore_bpf:
kfree(ctx_kern.data);
- return kmemdup(rdesc, *size, GFP_KERNEL);
+ return rdesc;
}
EXPORT_SYMBOL_GPL(call_hid_bpf_rdesc_fixup);
@@ -260,8 +260,11 @@ int hid_bpf_allocate_event_data(struct hid_device *hdev)
int hid_bpf_reconnect(struct hid_device *hdev)
{
- if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status))
+ if (!test_and_set_bit(ffs(HID_STAT_REPROBED), &hdev->status)) {
+ /* trigger call to call_hid_bpf_rdesc_fixup() during the next probe */
+ hdev->bpf_rsize = 0;
return device_reprobe(&hdev->dev);
+ }
return 0;
}

drivers/hid/bpf/hid_bpf_struct_ops.c

View file
diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c
index 702c22f..0e611a9 100644
--- a/drivers/hid/bpf/hid_bpf_struct_ops.c
+++ b/drivers/hid/bpf/hid_bpf_struct_ops.c
@@ -79,6 +79,7 @@ static int hid_bpf_ops_btf_struct_access(struct bpf_verifier_log *log,
WRITE_RANGE(hid_device, name, true),
WRITE_RANGE(hid_device, uniq, true),
WRITE_RANGE(hid_device, phys, true),
+ WRITE_RANGE(hid_device, quirks, false),
};
#undef WRITE_RANGE
const struct btf_type *state = NULL;

drivers/hid/bpf/progs/Huion__Dial-2.bpf.c

View file
diff --git a/drivers/hid/bpf/progs/Huion__Dial-2.bpf.c b/drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
index 2411dec..9670e5e 100644
--- a/drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
+++ b/drivers/hid/bpf/progs/Huion__Dial-2.bpf.c
@@ -214,7 +214,8 @@ static const __u8 fixed_rdesc_pad[] = {
CollectionApplication(
// -- Byte 0 in report
ReportId(PAD_REPORT_ID)
- LogicalRange_i8(0, 1)
+ LogicalMaximum_i8(0)
+ LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
@@ -234,14 +235,17 @@ static const __u8 fixed_rdesc_pad[] = {
Input(Var|Abs)
// Byte 4 in report is the dial
Usage_GD_Wheel
- LogicalRange_i8(-1, 1)
+ LogicalMinimum_i8(-1)
+ LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)
// Byte 5 is the button state
UsagePage_Button
- UsageRange_i8(0x01, 0x8)
- LogicalRange_i8(0x0, 0x1)
+ UsageMinimum_i8(0x01)
+ UsageMaximum_i8(0x08)
+ LogicalMinimum_i8(0x0)
+ LogicalMaximum_i8(0x1)
ReportCount(7)
ReportSize(1)
Input(Var|Abs)
@@ -265,7 +269,8 @@ static const __u8 fixed_rdesc_pen[] = {
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
Usage_Dig_SecondaryBarrelSwitch // maps eraser to BTN_STYLUS2
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
ReportSize(1)
ReportCount(3)
Input(Var|Abs)
@@ -280,22 +285,28 @@ static const __u8 fixed_rdesc_pen[] = {
UsagePage_GenericDesktop
Unit(cm)
UnitExponent(-1)
- PhysicalRange_i16(0, 266)
- LogicalRange_i16(0, 32767)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(266)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(32767)
Usage_GD_X
Input(Var|Abs) // Bytes 2+3
- PhysicalRange_i16(0, 166)
- LogicalRange_i16(0, 32767)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(166)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(32767)
Usage_GD_Y
Input(Var|Abs) // Bytes 4+5
)
UsagePage_Digitizers
Usage_Dig_TipPressure
- LogicalRange_i16(0, 8191)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(8191)
Input(Var|Abs) // Byte 6+7
ReportSize(8)
ReportCount(2)
- LogicalRange_i8(-60, 60)
+ LogicalMinimum_i8(-60)
+ LogicalMaximum_i8(60)
Usage_Dig_XTilt
Usage_Dig_YTilt
Input(Var|Abs) // Byte 8+9
@@ -313,7 +324,8 @@ static const __u8 fixed_rdesc_vendor[] = {
Usage_Dig_Pen
CollectionPhysical(
// Byte 1 are the buttons
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
ReportSize(1)
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
@@ -333,25 +345,31 @@ static const __u8 fixed_rdesc_vendor[] = {
UnitExponent(-1)
// Note: reported logical range differs
// from the pen report ID for x and y
- LogicalRange_i16(0, 53340)
- PhysicalRange_i16(0, 266)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(53340)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(266)
// Bytes 2/3 in report
Usage_GD_X
Input(Var|Abs)
- LogicalRange_i16(0, 33340)
- PhysicalRange_i16(0, 166)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(33340)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(166)
// Bytes 4/5 in report
Usage_GD_Y
Input(Var|Abs)
)
// Bytes 6/7 in report
- LogicalRange_i16(0, 8191)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(8191)
Usage_Dig_TipPressure
Input(Var|Abs)
// Bytes 8/9 in report
ReportCount(1) // Padding
Input(Const)
- LogicalRange_i8(-60, 60)
+ LogicalMinimum_i8(-60)
+ LogicalMaximum_i8(60)
// Byte 10 in report
Usage_Dig_XTilt
// Byte 11 in report
@@ -366,7 +384,8 @@ static const __u8 fixed_rdesc_vendor[] = {
CollectionApplication(
// Byte 0
ReportId(PAD_REPORT_ID)
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
@@ -386,15 +405,18 @@ static const __u8 fixed_rdesc_vendor[] = {
Input(Var|Abs)
// Byte 4 is the button state
UsagePage_Button
- UsageRange_i8(0x01, 0x8)
- LogicalRange_i8(0x0, 0x1)
+ UsageMinimum_i8(0x1)
+ UsageMaximum_i8(0x8)
+ LogicalMinimum_i8(0x0)
+ LogicalMaximum_i8(0x1)
ReportCount(8)
ReportSize(1)
Input(Var|Abs)
// Byte 5 is the top dial
UsagePage_GenericDesktop
Usage_GD_Wheel
- LogicalRange_i8(-1, 1)
+ LogicalMinimum_i8(-1)
+ LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)

drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.c

View file
diff --git a/drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.c b/drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.c
index b09b801..13f64fb 100644
--- a/drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.c
+++ b/drivers/hid/bpf/progs/Huion__Inspiroy-2-S.bpf.c
@@ -170,7 +170,8 @@ static const __u8 fixed_rdesc_pad[] = {
CollectionApplication(
// -- Byte 0 in report
ReportId(PAD_REPORT_ID)
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
@@ -190,14 +191,17 @@ static const __u8 fixed_rdesc_pad[] = {
Input(Var|Abs)
// Byte 4 in report is the wheel
Usage_GD_Wheel
- LogicalRange_i8(-1, 1)
+ LogicalMinimum_i8(-1)
+ LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)
// Byte 5 is the button state
UsagePage_Button
- UsageRange_i8(0x01, 0x6)
- LogicalRange_i8(0x01, 0x6)
+ UsageMinimum_i8(0x1)
+ UsageMaximum_i8(0x6)
+ LogicalMinimum_i8(0x1)
+ LogicalMaximum_i8(0x6)
ReportCount(1)
ReportSize(8)
Input(Arr|Abs)
@@ -219,7 +223,8 @@ static const __u8 fixed_rdesc_pen[] = {
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
Usage_Dig_SecondaryBarrelSwitch // maps eraser to BTN_STYLUS2
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
ReportSize(1)
ReportCount(3)
Input(Var|Abs)
@@ -234,18 +239,23 @@ static const __u8 fixed_rdesc_pen[] = {
UsagePage_GenericDesktop
Unit(cm)
UnitExponent(-1)
- PhysicalRange_i16(0, 160)
- LogicalRange_i16(0, 32767)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(160)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(32767)
Usage_GD_X
Input(Var|Abs) // Bytes 2+3
- PhysicalRange_i16(0, 100)
- LogicalRange_i16(0, 32767)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(100)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(32767)
Usage_GD_Y
Input(Var|Abs) // Bytes 4+5
)
UsagePage_Digitizers
Usage_Dig_TipPressure
- LogicalRange_i16(0, 8191)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(8191)
Input(Var|Abs) // Byte 6+7
// Two bytes padding so we don't need to change the report at all
ReportSize(8)
@@ -265,7 +275,8 @@ static const __u8 fixed_rdesc_vendor[] = {
Usage_Dig_Pen
CollectionPhysical(
// Byte 1 are the buttons
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
ReportSize(1)
Usage_Dig_TipSwitch
Usage_Dig_BarrelSwitch
@@ -285,19 +296,24 @@ static const __u8 fixed_rdesc_vendor[] = {
UnitExponent(-1)
// Note: reported logical range differs
// from the pen report ID for x and y
- LogicalRange_i16(0, 32000)
- PhysicalRange_i16(0, 160)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(32000)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(160)
// Bytes 2/3 in report
Usage_GD_X
Input(Var|Abs)
- LogicalRange_i16(0, 20000)
- PhysicalRange_i16(0, 100)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(20000)
+ PhysicalMinimum_i16(0)
+ PhysicalMaximum_i16(100)
// Bytes 4/5 in report
Usage_GD_Y
Input(Var|Abs)
)
// Bytes 6/7 in report
- LogicalRange_i16(0, 8192)
+ LogicalMinimum_i16(0)
+ LogicalMaximum_i16(8192)
Usage_Dig_TipPressure
Input(Var|Abs)
)
@@ -307,7 +323,8 @@ static const __u8 fixed_rdesc_vendor[] = {
CollectionApplication(
// Byte 0
ReportId(PAD_REPORT_ID)
- LogicalRange_i8(0, 1)
+ LogicalMinimum_i8(0)
+ LogicalMaximum_i8(1)
UsagePage_Digitizers
Usage_Dig_TabletFunctionKeys
CollectionPhysical(
@@ -327,8 +344,10 @@ static const __u8 fixed_rdesc_vendor[] = {
Input(Var|Abs)
// Byte 4 is the button state
UsagePage_Button
- UsageRange_i8(0x01, 0x6)
- LogicalRange_i8(0x0, 0x1)
+ UsageMinimum_i8(0x1)
+ UsageMaximum_i8(0x6)
+ LogicalMinimum_i8(0x0)
+ LogicalMaximum_i8(0x1)
ReportCount(6)
ReportSize(1)
Input(Var|Abs)
@@ -337,7 +356,8 @@ static const __u8 fixed_rdesc_vendor[] = {
// Byte 5 is the wheel
UsagePage_GenericDesktop
Usage_GD_Wheel
- LogicalRange_i8(-1, 1)
+ LogicalMinimum_i8(-1)
+ LogicalMaximum_i8(1)
ReportCount(1)
ReportSize(8)
Input(Var|Rel)

drivers/hid/bpf/progs/Mistel__MD770.bpf.c

View file
diff --git a/drivers/hid/bpf/progs/Mistel__MD770.bpf.c b/drivers/hid/bpf/progs/Mistel__MD770.bpf.c
new file mode 100644
index 0000000..fb8b5a6
--- /dev/null
+++ b/drivers/hid/bpf/progs/Mistel__MD770.bpf.c
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2024 Tatsuyuki Ishi
+ */
+
+#include "vmlinux.h"
+#include "hid_bpf.h"
+#include "hid_bpf_helpers.h"
+#include <bpf/bpf_tracing.h>
+
+#define VID_HOLTEK 0x04D9
+#define PID_MD770 0x0339
+#define RDESC_SIZE 203
+
+HID_BPF_CONFIG(
+ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC, VID_HOLTEK, PID_MD770)
+);
+
+/*
+ * The Mistel MD770 keyboard reports the first 6 simultaneous key presses
+ * through the first interface, and anything beyond that through a second
+ * interface. Unfortunately, the second interface's report descriptor has an
+ * error, causing events to be malformed and ignored. This HID-BPF driver
+ * fixes the descriptor to allow NKRO to work again.
+ *
+ * For reference, this is the original report descriptor:
+ *
+ * 0x05, 0x01, // Usage Page (Generic Desktop) 0
+ * 0x09, 0x80, // Usage (System Control) 2
+ * 0xa1, 0x01, // Collection (Application) 4
+ * 0x85, 0x01, // Report ID (1) 6
+ * 0x19, 0x81, // Usage Minimum (129) 8
+ * 0x29, 0x83, // Usage Maximum (131) 10
+ * 0x15, 0x00, // Logical Minimum (0) 12
+ * 0x25, 0x01, // Logical Maximum (1) 14
+ * 0x95, 0x03, // Report Count (3) 16
+ * 0x75, 0x01, // Report Size (1) 18
+ * 0x81, 0x02, // Input (Data,Var,Abs) 20
+ * 0x95, 0x01, // Report Count (1) 22
+ * 0x75, 0x05, // Report Size (5) 24
+ * 0x81, 0x01, // Input (Cnst,Arr,Abs) 26
+ * 0xc0, // End Collection 28
+ * 0x05, 0x0c, // Usage Page (Consumer Devices) 29
+ * 0x09, 0x01, // Usage (Consumer Control) 31
+ * 0xa1, 0x01, // Collection (Application) 33
+ * 0x85, 0x02, // Report ID (2) 35
+ * 0x15, 0x00, // Logical Minimum (0) 37
+ * 0x25, 0x01, // Logical Maximum (1) 39
+ * 0x95, 0x12, // Report Count (18) 41
+ * 0x75, 0x01, // Report Size (1) 43
+ * 0x0a, 0x83, 0x01, // Usage (AL Consumer Control Config) 45
+ * 0x0a, 0x8a, 0x01, // Usage (AL Email Reader) 48
+ * 0x0a, 0x92, 0x01, // Usage (AL Calculator) 51
+ * 0x0a, 0x94, 0x01, // Usage (AL Local Machine Browser) 54
+ * 0x09, 0xcd, // Usage (Play/Pause) 57
+ * 0x09, 0xb7, // Usage (Stop) 59

This diff is incomplete. Download the complete patch.

drivers/hid/bpf/progs/Rapoo__M50-Plus-Silent.bpf.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/bpf/progs/hid_report_helpers.h

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-asus.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-core.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-corsair-void.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-cp2112.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-debug.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-generic.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-goodix-spi.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-hyperv.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-ids.h

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-kysona.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-lg4ff.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-logitech-hidpp.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-magicmouse.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-multitouch.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-picolcd_fb.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-sensor-custom.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-sony.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-steam.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/hid-steelseries.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/i2c-hid/i2c-hid-of.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ipc/pci-ish.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp-fw-loader.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp-hid-client.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp-hid.h

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp/client.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp/loader.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/intel-ish-hid/ishtp/loader.h

View file

This diff is incomplete. Download the complete patch.

drivers/hid/usbhid/hid-core.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/wacom_wac.c

View file

This diff is incomplete. Download the complete patch.

drivers/hid/wacom_wac.h

View file

This diff is incomplete. Download the complete patch.

include/linux/hid.h

View file

This diff is incomplete. Download the complete patch.

include/linux/hid_bpf.h

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/Makefile

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/hid_bpf.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/hid_common.h

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/hidraw.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/progs/hid.c

View file

This diff is incomplete. Download the complete patch.

tools/testing/selftests/hid/progs/hid_bpf_helpers.h

View file

This diff is incomplete. Download the complete patch.