git: 0661cf74e6e5 - main - hms(4): Disable vendor usage page button support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Dec 2022 09:02:17 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=0661cf74e6e5dbd585c4a5a3e621d915bb6787d3
commit 0661cf74e6e5dbd585c4a5a3e621d915bb6787d3
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2022-12-24 09:01:20 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-12-24 09:01:20 +0000
hms(4): Disable vendor usage page button support
for all devices except Kensington Slimblade Trackball as it brokes
some other devices like Contour Rollermouse Red
Add a quirk for it as well.
Reported by: Atte Peltomäki <koston_AT_iki_DOT_fi>
PR: 267922
MFC after: 2 weeks
---
share/man/man4/hidquirk.4 | 2 ++
sys/dev/hid/hidquirk.c | 2 ++
sys/dev/hid/hidquirk.h | 1 +
sys/dev/hid/hms.c | 12 ++++++++----
4 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/share/man/man4/hidquirk.4 b/share/man/man4/hidquirk.4
index aa78e189765c..cbe0e33c934c 100644
--- a/share/man/man4/hidquirk.4
+++ b/share/man/man4/hidquirk.4
@@ -53,6 +53,8 @@ doesn't identify properly
mouse sends an unknown leading byte
.It HQ_MS_REVZ
mouse has Z-axis reversed
+.It HQ_MS_VENDOR_BTN
+mouse has buttons in vendor usage page
.It HQ_SPUR_BUT_UP
spurious mouse button up events
.It HQ_MT_TIMESTAMP
diff --git a/sys/dev/hid/hidquirk.c b/sys/dev/hid/hidquirk.c
index 7c28e240582b..dfb97a3e5597 100644
--- a/sys/dev/hid/hidquirk.c
+++ b/sys/dev/hid/hidquirk.c
@@ -151,6 +151,8 @@ static struct hidquirk_entry hidquirks[HID_DEV_QUIRKS_MAX] = {
USB_QUIRK(CORSAIR, STRAFE2, 0x0000, 0xffff, HQ_KBD_BOOTPROTO),
/* Holtek USB gaming keyboard */
USB_QUIRK(HOLTEK, F85, 0x0000, 0xffff, HQ_KBD_BOOTPROTO),
+ /* Quirk for Kensington Slimblade Trackball */
+ USB_QUIRK(KENSINGTON, SLIMBLADE, 0x0000, 0xffff, HQ_MS_VENDOR_BTN),
};
#undef HID_QUIRK_VP
#undef USB_QUIRK
diff --git a/sys/dev/hid/hidquirk.h b/sys/dev/hid/hidquirk.h
index 0201f2f0746c..5f0dafb8a8a2 100644
--- a/sys/dev/hid/hidquirk.h
+++ b/sys/dev/hid/hidquirk.h
@@ -59,6 +59,7 @@
HQ(MS_BAD_CLASS), /* doesn't identify properly */ \
HQ(MS_LEADING_BYTE), /* mouse sends an unknown leading byte */ \
HQ(MS_REVZ), /* mouse has Z-axis reversed */ \
+ HQ(MS_VENDOR_BTN), /* mouse has buttons in vendor usage page */ \
HQ(SPUR_BUT_UP), /* spurious mouse button up events */ \
HQ(MT_TIMESTAMP) /* Multitouch device exports HW timestamps */
diff --git a/sys/dev/hid/hms.c b/sys/dev/hid/hms.c
index b1580c3db358..87d207cc3f6b 100644
--- a/sys/dev/hid/hms.c
+++ b/sys/dev/hid/hms.c
@@ -61,8 +61,6 @@ enum {
HMS_ABS_Z,
HMS_HWHEEL,
HMS_BTN,
- HMS_BTN_MS1,
- HMS_BTN_MS2,
HMS_FINAL_CB,
};
@@ -95,8 +93,6 @@ static const struct hidmap_item hms_map[] = {
[HMS_ABS_Z] = HMS_MAP_ABS(HUG_Z, ABS_Z),
[HMS_HWHEEL] = HMS_MAP_REL_CN(HUC_AC_PAN, REL_HWHEEL),
[HMS_BTN] = HMS_MAP_BUT_RG(1, 16, BTN_MOUSE),
- [HMS_BTN_MS1] = HMS_MAP_BUT_MS(1, BTN_RIGHT),
- [HMS_BTN_MS2] = HMS_MAP_BUT_MS(2, BTN_MIDDLE),
[HMS_FINAL_CB] = HMS_FINAL_CB(hms_final_cb),
};
@@ -107,6 +103,11 @@ static const struct hidmap_item hms_map_wheel_rev[] = {
HMS_MAP_REL_REV(HUG_WHEEL, REL_WHEEL),
};
+static const struct hidmap_item hms_map_kensington_slimblade[] = {
+ HMS_MAP_BUT_MS(1, BTN_RIGHT),
+ HMS_MAP_BUT_MS(2, BTN_MIDDLE),
+};
+
/* A match on these entries will load hms */
static const struct hid_device_id hms_devs[] = {
{ HID_TLC(HUP_GENERIC_DESKTOP, HUG_POINTER) },
@@ -261,6 +262,9 @@ hms_attach(device_t dev)
else
HIDMAP_ADD_MAP(&sc->hm, hms_map_wheel, cap_wheel);
+ if (hid_test_quirk(hw, HQ_MS_VENDOR_BTN))
+ HIDMAP_ADD_MAP(&sc->hm, hms_map_kensington_slimblade, NULL);
+
#ifdef IICHID_SAMPLING
if (hid_test_quirk(hw, HQ_IICHID_SAMPLING) &&
hidmap_test_cap(sc->caps, HMS_REL_X) &&