diff --git a/src/userland/keyboard/main.c b/src/userland/keyboard/main.c index 3adf12b..982a47b 100644 --- a/src/userland/keyboard/main.c +++ b/src/userland/keyboard/main.c @@ -7,29 +7,12 @@ REQUEST(doKeyCallback, "ioManager", "keyCallback"); -enum { - MODIFIER_LEFT_SHIFT = 0, - MODIFIER_RIGHT_SHIFT = 1, - MODIFIER_LEFT_CONTROL = 2, - MODIFIER_RIGHT_CONTROL = 3, -}; - -uint32_t modifiers = 0; - // will be incremented every time a key is pressed. volatile uint32_t repeatingThreadId = 0; char repeatingKey = 0; char pressedKeys[] = { 0 }; -void modifierUp(uint8_t modifier) { - -} - -void modifierDown(uint8_t modifier) { - -} - void keyUp(char keycode) { // 'normal' keyboards additionaly restart the key repeat for the key that was pressed before a key was let go of if (keycode == repeatingKey) { @@ -38,16 +21,20 @@ } } -void keyRepeat(char keycode, uint32_t threadId) { +void sendPress(uint32_t keycode) { + doKeyCallback(keycode, 0); +} + +void keyRepeat(uint32_t keycode, uint32_t threadId) { sleep(500); while (threadId == repeatingThreadId) { - doKeyCallback(keycode, 0); + sendPress(keycode); sleep(50); } } -void keyDown(char keycode) { - doKeyCallback(keycode, 0); +void keyDown(uint32_t keycode) { + sendPress(keycode); repeatingKey = keycode; fork((void *)keyRepeat, PTR(keycode), PTR(++repeatingThreadId), 0); } @@ -55,8 +42,6 @@ void initialize() { createFunction("keyDown", (void *)keyDown); createFunction("keyUp", (void *)keyUp); - createFunction("modifierDown", (void *)modifierDown); - createFunction("modifierUp", (void *)modifierUp); } int32_t main() {