usb_hid: the report value for an array is an index starting at the logical minimum

to be tested, related to bug #18641

Change-Id: I54b09001a7baf5e868eb5f26ca3064d4e6f31e53
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7069
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
Jérôme Duval
2023-12-11 18:17:06 +00:00
committed by waddlesplash
parent 6fe3a560bd
commit 1a7cf57024
2 changed files with 2 additions and 1 deletions
@@ -23,6 +23,7 @@ public:
bool Relative() { return fRelative; }; bool Relative() { return fRelative; };
bool Array() { return fArray; }; bool Array() { return fArray; };
bool Signed() { return fMinimum > fMaximum; }; bool Signed() { return fMinimum > fMaximum; };
uint32 Minimum() { return fMinimum; }
uint16 UsagePage(); uint16 UsagePage();
uint16 UsageID(); uint16 UsageID();
@@ -549,7 +549,7 @@ KeyboardProtocolHandler::_ReadReport(bigtime_t timeout, uint32 *cookie)
if (key->Extract() == B_OK && key->Valid()) { if (key->Extract() == B_OK && key->Valid()) {
// handle both array and bitmap based keyboard reports // handle both array and bitmap based keyboard reports
if (key->Array()) { if (key->Array()) {
fCurrentKeys[i] = key->Data(); fCurrentKeys[i] = key->Data() - key->Minimum();
} else { } else {
if (key->Data() == 1) if (key->Data() == 1)
fCurrentKeys[i] = key->UsageID(); fCurrentKeys[i] = key->UsageID();