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
This commit is contained in:
Michael Lotz
2010-01-27 00:44:39 +00:00
parent 9af4e61b28
commit c14db1b2a1
@@ -65,11 +65,12 @@ KeyboardDevice::KeyboardDevice(HIDReport *inputReport, HIDReport *outputReport)
continue; continue;
if (item->UsagePage() == HID_USAGE_PAGE_KEYBOARD 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()); TRACE("keyboard item with usage %lx\n", item->UsageMinimum());
if (item->Array()) { if (item->Array()) {
// normal or "consumer" keys handled as array items // normal or "consumer"/button keys handled as array items
if (fKeyCount < MAX_KEYS) if (fKeyCount < MAX_KEYS)
fKeys[fKeyCount++] = item; fKeys[fKeyCount++] = item;
} else { } else {
@@ -81,11 +82,6 @@ KeyboardDevice::KeyboardDevice(HIDReport *inputReport, HIDReport *outputReport)
fModifiers[fModifierCount++] = item; 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); HIDReportItem *item = input->ItemAt(j);
if (item->UsagePage() == HID_USAGE_PAGE_KEYBOARD if (item->UsagePage() == HID_USAGE_PAGE_KEYBOARD
|| (item->UsagePage() == HID_USAGE_PAGE_CONSUMER || (item->UsagePage() == HID_USAGE_PAGE_CONSUMER
&& item->Array())
|| (item->UsagePage() == HID_USAGE_PAGE_BUTTON
&& item->Array())) { && item->Array())) {
// found at least one item with a keyboard usage or with // 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; foundKeyboardUsage = true;
break; break;
} }
@@ -611,7 +609,7 @@ KeyboardDevice::_ReadReport(bigtime_t timeout)
} }
if (key == 0) { if (key == 0) {
// unmapped normal key or consumer key // unmapped normal key or consumer/button key
key = fKeys[i]->UsageMinimum() + current[i]; key = fKeys[i]->UsageMinimum() + current[i];
} }