From c14db1b2a17b7db92a15bb9b1b47265ce7005f28 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Wed, 27 Jan 2010 00:44:39 +0000 Subject: [PATCH] Also accept buttons from the "button page" as long as they are using arrays. That usually indicates keyboard-like usage and one of my keyboards uses this type for multimedia keys. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35311 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/input/usb_hid/KeyboardDevice.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp index 69dc3a227c..c7ce65017c 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp @@ -65,11 +65,12 @@ KeyboardDevice::KeyboardDevice(HIDReport *inputReport, HIDReport *outputReport) continue; if (item->UsagePage() == HID_USAGE_PAGE_KEYBOARD - || item->UsagePage() == HID_USAGE_PAGE_CONSUMER) { + || item->UsagePage() == HID_USAGE_PAGE_CONSUMER + || item->UsagePage() == HID_USAGE_PAGE_BUTTON) { TRACE("keyboard item with usage %lx\n", item->UsageMinimum()); if (item->Array()) { - // normal or "consumer" keys handled as array items + // normal or "consumer"/button keys handled as array items if (fKeyCount < MAX_KEYS) fKeys[fKeyCount++] = item; } else { @@ -81,11 +82,6 @@ KeyboardDevice::KeyboardDevice(HIDReport *inputReport, HIDReport *outputReport) fModifiers[fModifierCount++] = item; } } - } else if (item->UsagePage() == HID_USAGE_PAGE_CONSUMER) { - if (item->Array()) { - if (fKeyCount < MAX_KEYS) - fKeys[fKeyCount++] = item; - } } } @@ -162,9 +158,11 @@ KeyboardDevice::AddHandler(HIDDevice *device) HIDReportItem *item = input->ItemAt(j); if (item->UsagePage() == HID_USAGE_PAGE_KEYBOARD || (item->UsagePage() == HID_USAGE_PAGE_CONSUMER + && item->Array()) + || (item->UsagePage() == HID_USAGE_PAGE_BUTTON && item->Array())) { // found at least one item with a keyboard usage or with - // a consumer usage that is handled like a key + // a consumer/button usage that is handled like a key foundKeyboardUsage = true; break; } @@ -611,7 +609,7 @@ KeyboardDevice::_ReadReport(bigtime_t timeout) } if (key == 0) { - // unmapped normal key or consumer key + // unmapped normal key or consumer/button key key = fKeys[i]->UsageMinimum() + current[i]; }