From c12c97a6f1edb8197f09e636be76de36a6855fb9 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 16 May 2020 21:10:14 +0200 Subject: [PATCH] usb_hid: do not publish a keyboard device when a mouse is connected My trackball has a "system control" in its descriptor, but is definitely not a keyboard. This results in an extra entry in Input preferences for it. If we actually want to accept input from such devices, we should scan them more closely to check there is actually a valid input there, and consider publishing them as something else than keyboards, because that's not really suitable in Input preferences. Change-Id: I9027454b3b24d0f39ea562aed851402d0be7aeb4 Reviewed-on: https://review.haiku-os.org/c/haiku/+/2715 Reviewed-by: waddlesplash --- .../drivers/input/usb_hid/KeyboardProtocolHandler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardProtocolHandler.cpp b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardProtocolHandler.cpp index 921a1d1a5a..edd4db1898 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardProtocolHandler.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardProtocolHandler.cpp @@ -188,7 +188,13 @@ KeyboardProtocolHandler::AddHandlers(HIDDevice &device, switch (collection.UsageID()) { case B_HID_UID_GD_KEYBOARD: case B_HID_UID_GD_KEYPAD: +#if 0 + // This is not specific enough to deserve a keyboard device on + // its own (some mice have one such descriptor, for example). + // If your keyboard uses this, do a more extensive check of + // the descriptor to make sure there actually are keys in it. case B_HID_UID_GD_SYSTEM_CONTROL: +#endif handled = true; }