From 76374f6b27d5fab6708d421a99280fc3756bd06e Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Fri, 29 Dec 2017 19:59:04 -0500 Subject: have the special keys switch also update KEYSTATE_PHYS. that was likely the cause of stickymap not working --- skey.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'skey.c') diff --git a/skey.c b/skey.c index 0440c19..3212504 100644 --- a/skey.c +++ b/skey.c @@ -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; } -- cgit v1.1