From 8ab78e2415a6178c91d61b8bb0d72cf74aea568a Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Fri, 29 Dec 2017 18:32:57 -0500 Subject: added keycode register, this is why the keyevents weren't being read` --- skey.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/skey.c b/skey.c index 906ed9d..c2b6dd2 100644 --- a/skey.c +++ b/skey.c @@ -345,6 +345,14 @@ int skey_update_thread (void *data) { * __init functions similar to __initdata */ static int __init skey_init (void) { + /* + * keycode register loop index vars, some keycodes have to be excluded because they + * are custom, so we have to use a loop. + */ + int code_m = 0; //map + int code_r = 0; //row + int code_c = 0; //column + unsigned long reg_keycode = 0; // the code to register printk(KERN_INFO "skey: module initiating...\n"); if (USE_GPIO) { //indexes for row and column pin init loops @@ -396,9 +404,40 @@ static int __init skey_init (void) { return -ENOMEM; } // declares the event code and typesthe device emmits - set_bit(EV_KEY, skey_dev->evbit); - set_bit(EV_REL, skey_dev->evbit); - set_bit(KEY_CAPSLOCK, skey_dev->keybit); + set_bit(EV_KEY, skey_dev->evbit); //for the mousebuttons and keyboard keys + set_bit(EV_REL, skey_dev->evbit); // for mouse and mousewheel movements + //all the mouse stuff + set_bit(REL_X, skey_dev->relbit); + set_bit(REL_Y, skey_dev->relbit); + set_bit(REL_WHEEL, skey_dev->relbit); + //registers everything in skey_keymap except for the specal codes + while (code_m < 4) { + code_r = 0; + while(code_r < 3) { + code_c = 0; + while (code_c < 10) { + reg_keycode = skey_keymap[code_m][code_r][code_c]; + //excludes all the special codes not actually sent + if (!( reg_keycode == KEY_ALPHAMAP || + reg_keycode == KEY_NUMBERMAP || + reg_keycode == KEY_SPECIALMAP || + reg_keycode == KEY_STICKYMAP || + reg_keycode == KEY_MS_2ND || + reg_keycode == MS_UP || + reg_keycode == MS_LEFT|| + reg_keycode == MS_RIGHT || + reg_keycode == MS_DOWN || + reg_keycode == MS_SCRL_UP || + reg_keycode == MS_SCRL_DOWN )) { + //registers the code + set_bit(reg_keycode, skey_dev->keybit); + } + code_c++; + } + code_r++; + } + code_m++; + } /* * skey_dev->name and skey_dev->id are metadata that are required for X11 * and libinput to use skey_dev -- cgit v1.1