From ab4f740bc59e3ba2948bcc4e03bd6125b1dae36f Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Sat, 24 Dec 2022 12:01:20 +0300 Subject: ums(4): Disable vendor usage page button support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 PR: 267922 MFC after: 2 weeks --- sys/dev/usb/input/ums.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'sys/dev/usb/input') diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index 987c4b9d1309..2280cdc29e8d 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -122,6 +122,7 @@ struct ums_info { #define UMS_FLAG_SBU 0x0010 /* spurious button up events */ #define UMS_FLAG_REVZ 0x0020 /* Z-axis is reversed */ #define UMS_FLAG_W_AXIS 0x0040 +#define UMS_FLAG_VBTN 0x0080 /* Buttons in vendor usage page */ uint8_t sc_iid_w; uint8_t sc_iid_x; @@ -538,12 +539,13 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, } /* detect other buttons */ - - for (j = 0; (i < UMS_BUTTON_MAX) && (j < 2); i++, j++) { - if (!hid_locate(buf, len, HID_USAGE2(HUP_MICROSOFT, (j + 1)), - hid_input, index, &info->sc_loc_btn[i], NULL, - &info->sc_iid_btn[i])) { - break; + if (info->sc_flags & UMS_FLAG_VBTN) { + for (j = 0; (i < UMS_BUTTON_MAX) && (j < 2); i++, j++) { + if (!hid_locate(buf, len, HID_USAGE2(HUP_MICROSOFT, + (j + 1)), hid_input, index, &info->sc_loc_btn[i], + NULL, &info->sc_iid_btn[i])) { + break; + } } } @@ -618,6 +620,10 @@ ums_attach(device_t dev) isize = hid_report_size_max(d_ptr, d_len, hid_input, &sc->sc_iid); + if (usb_test_quirk(uaa, UQ_MS_VENDOR_BTN)) + for (i = 0; i < UMS_INFO_MAX; i++) + sc->sc_info[i].sc_flags |= UMS_FLAG_VBTN; + /* * The Microsoft Wireless Notebook Optical Mouse seems to be in worse * shape than the Wireless Intellimouse 2.0, as its X, Y, wheel, and -- cgit v1.3