From 3c33e2749f4984ba90a5175e0f29e5fc3eeeba73 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 31 Jan 2009 23:04:09 +0000 Subject: [PATCH] Don't exit early when encountering an empty slot in the report. There seem to be keyboards that leave gaps. It's not really specified in the docs, they only say that the ordering of keys is indetermined. So I guess intermixing empty slots is equally valid. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29106 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../drivers/input/usb_hid/KeyboardDevice.cpp | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 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 4d98de1e62..a179d5e90b 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp @@ -324,51 +324,51 @@ KeyboardDevice::_InterpretBuffer() uint8 *compare = fTransferBuffer; for (int32 twice = 0; twice < 2; twice++) { for (size_t i = 2; i < fTotalReportSize; i++) { - if (current[i] != 0x00 && current[i] != 0x01) { - bool found = false; - for (size_t j = 2; j < fTotalReportSize; j++) { - if (compare[j] == current[i]) { - found = true; - break; - } + if (current[i] == 0x00 || current[i] == 0x01) + continue; + + bool found = false; + for (size_t j = 2; j < fTotalReportSize; j++) { + if (compare[j] == current[i]) { + found = true; + break; } + } - if (found) - continue; + if (found) + continue; - // a change occured - uint32 key = 0; - if (current[i] < sKeyTableSize) - key = sKeyTable[current[i]]; + // a change occured + uint32 key = 0; + if (current[i] < sKeyTableSize) + key = sKeyTable[current[i]]; - if (key == KEY_Pause && (current[0] & 1)) - key = KEY_Break; - else if (key == 0xe && (current[0] & 1)) - key = KEY_SysRq; + if (key == KEY_Pause && (current[0] & 1)) + key = KEY_Break; + else if (key == 0xe && (current[0] & 1)) + key = KEY_SysRq; #if 0 - else if (keyDown && key == 0x0d) // ToDo: remove again - panic("keyboard requested halt.\n"); + else if (keyDown && key == 0x0d) // ToDo: remove again + panic("keyboard requested halt.\n"); #endif - else if (key == 0) { - // unmapped key - key = 0x200000 + current[i]; - } + else if (key == 0) { + // unmapped key + key = 0x200000 + current[i]; + } - _WriteKey(key, keyDown); + _WriteKey(key, keyDown); - if (keyDown) { - // repeat handling - fCurrentRepeatKey = key; - fCurrentRepeatDelay = fRepeatDelay; - } else { - // cancel the repeats if they are for this key - if (fCurrentRepeatKey == key) { - fCurrentRepeatDelay = B_INFINITE_TIMEOUT; - fCurrentRepeatKey = 0; - } + if (keyDown) { + // repeat handling + fCurrentRepeatKey = key; + fCurrentRepeatDelay = fRepeatDelay; + } else { + // cancel the repeats if they are for this key + if (fCurrentRepeatKey == key) { + fCurrentRepeatDelay = B_INFINITE_TIMEOUT; + fCurrentRepeatKey = 0; } - } else - break; + } } current = fTransferBuffer;