diff options
-rw-r--r-- | skey.c | 39 |
1 files changed, 22 insertions, 17 deletions
@@ -128,6 +128,16 @@ void clearkeystate(void) { return; } /* + * Updates KEYSTATE_PHYS + */ +void update_phys(int row, int column, int state) { + if (state) { + keystate[row][column] = KEYSTATE_PHYS | keystate[row][column]; + } else { + keystate[row][column] = (~KEYSTATE_PHYS) & keystate[row][column]; + } +} +/* * The keystates are processed as following, the current read value is compared with the * previous one stored in KEYSTATE_PHYS to detect a rising or falling edge. for regular keys, * the corresponding keycode from skey_keymap is sent, with the current_keymap. if stickymode @@ -197,16 +207,19 @@ int processkey(int row, int column, int state) { case KEY_ALPHAMAP: if(DEBUGMODE){printk(KERN_DEBUG "skey: changing to keymap ALPHA\n");} current_keymap = 0; + update_phys(row, column, state); return 0; break; case KEY_NUMBERMAP: if(DEBUGMODE){printk(KERN_DEBUG "skey: changing to keymap NUM\n");} current_keymap = 1; + update_phys(row, column, state); return 0; break; case KEY_SPECIALMAP: if(DEBUGMODE){printk(KERN_DEBUG "skey: changing to keymap SPECIAL\n");} current_keymap = 2; + update_phys(row, column, state); return 0; break; case KEY_STICKYMAP: @@ -216,6 +229,7 @@ int processkey(int row, int column, int state) { clearkeystate(); if(DEBUGMODE){printk(KERN_DEBUG "skey: cleaned stickmode states\n");} } + update_phys(row, column, state); return 0; break; case KEY_MS_2ND: @@ -225,48 +239,43 @@ int processkey(int row, int column, int state) { } else if (current_keymap == 3) { current_keymap = 2; } + update_phys(row, column, state); return 0; break; case MS_UP: input_event(skey_dev, EV_REL, REL_Y, -MOUSE_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_Y, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; case MS_DOWN: input_event(skey_dev, EV_REL, REL_Y, +MOUSE_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_Y, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; case MS_LEFT: input_event(skey_dev, EV_REL, REL_X, -MOUSE_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_X, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; case MS_RIGHT: input_event(skey_dev, EV_REL, REL_X, +MOUSE_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_X, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; case MS_SCRL_UP: input_event(skey_dev, EV_REL, REL_WHEEL, +WHEEL_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_WHEEL, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; case MS_SCRL_DOWN: input_event(skey_dev, EV_REL, REL_WHEEL, -WHEEL_DIST); input_sync(skey_dev); - input_event(skey_dev, EV_REL, REL_WHEEL, 0); - input_sync(skey_dev); + update_phys(row, column, state); return 0; break; } @@ -296,11 +305,7 @@ int processkey(int row, int column, int state) { } } //after the previous keystate is checked, it is updated - if (state) { - keystate[row][column] = KEYSTATE_PHYS | keystate[row][column]; - } else { - keystate[row][column] = (~KEYSTATE_PHYS) & keystate[row][column]; - } + update_phys(row, column, state); return 0; } |