diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | skey.c | 23 | ||||
-rw-r--r-- | skey.service | 2 |
3 files changed, 11 insertions, 15 deletions
@@ -9,5 +9,6 @@ install: depmod cp skey.dtbo /boot/overlays/skey.dtbo cp skey.service /etc/systemd/system/skey.service + systemctl daemon-reload clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean @@ -169,17 +169,12 @@ int processkey(int row, int column, int state) { return -EINVAL; break; } - printk("skey: previous KEYSTATE_PHYS for r:%d,c:%d was %d\n", row, column, (KEYSTATE_PHYS & keystate[row][column])); + if ((KEYSTATE_PHYS & keystate[row][column])) { + printk(KERN_INFO "skey: previous KEYSTATE_PHYS for r:%d,c:%d was %d\n", row, column, (KEYSTATE_PHYS & keystate[row][column])); + } //falling edge if ((KEYSTATE_PHYS & keystate[row][column]) && !state) { printk(KERN_INFO "skey: falling edge detected for r:%d,c:%d\n", row, column); - //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]; - } - if (!stickymode) { //reports key up input_report_key(skey_dev, skey_keymap[current_keymap][row][column], 0); @@ -189,12 +184,6 @@ int processkey(int row, int column, int state) { //rising edge }else if (!(KEYSTATE_PHYS & keystate[row][column]) && state) { printk(KERN_INFO "skey: rising edge detected for r:%d,c:%d\n", row, column); - //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]; - } /* *handles keys that have special behavior, and to which stickykey do not apply * if sticky keys don't apply then only the falling edge applies @@ -279,6 +268,12 @@ int processkey(int row, int column, int state) { input_sync(skey_dev); } } + //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]; + } return 0; } diff --git a/skey.service b/skey.service index 16ded57..3d10b68 100644 --- a/skey.service +++ b/skey.service @@ -2,6 +2,6 @@ Description="Sets up and loads the drivers for the Omnicom Switch Keyboard" Type=oneshot [Service] -ExecStart=gpio -g mode 3 out;gpio -g mode 6 out;gpio -g mode 5 out;gpio -g mode 10 low;gpio -g mode 24 low;gpio -g mode 23 low;gpio -g mode 22 low;gpio -g mode 27 low;gpio -g mode 18 low;gpio -g mode 17 low;gpio -g mode 15 low;gpio -g mode 14 low;gpio -g mode 4 low;modprobe skey +ExecStart=/bin/bash -c "gpio -g mode 3 out;gpio -g mode 6 out;gpio -g mode 5 out;gpio -g mode 10 down;gpio -g mode 24 down;gpio -g mode 23 down;gpio -g mode 22 down;gpio -g mode 27 down;gpio -g mode 18 down;gpio -g mode 17 down;gpio -g mode 15 down;gpio -g mode 14 down;gpio -g mode 4 down;modprobe skey" [Install] WantedBy=multi-user.target graphical.target emergency.target |