summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknolax <1339802534.kk@gmail.com>2017-12-29 18:32:57 -0500
committerknolax <1339802534.kk@gmail.com>2017-12-29 18:32:57 -0500
commit8ab78e2415a6178c91d61b8bb0d72cf74aea568a (patch)
treec812518b913217ddae3c26656469ab03f07a45b5
parent60c0a4dcd0ae35e057ed8dcaee86baf0a350e8c5 (diff)
added keycode register, this is why the keyevents weren't being read`debug
-rw-r--r--skey.c45
1 files 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