diff options
-rw-r--r-- | skey.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -165,12 +165,16 @@ int processkey(int row, int column, int state) { break; //if current_keymap is out of range [0,3] default: + printk(KERN_ALERT "skey: current_keymap out of bounds\n"); return -EINVAL; break; } - + 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) { + if ((KEYSTATE_PHYS & keystate[row][column]) && !state) { + printk(KERN_INFO "skey: falling edge detected for r:%d,c:%d\n", row, column); if (!stickymode) { //reports key up input_report_key(skey_dev, skey_keymap[current_keymap][row][column], 0); @@ -179,6 +183,7 @@ 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); /* *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 @@ -241,7 +246,7 @@ int processkey(int row, int column, int state) { input_sync(skey_dev); return 0; break; - } + } //if it's stickymode, toggle the state stored and send corresponding vent if (stickymode) { //it was high before, so now it's being toggled off @@ -302,6 +307,7 @@ int skey_update_thread (void *data) { while (column_index < 10) { if (gpio_get_value_cansleep(column_pins[column_index])) { processkey(row_index, column_index, 1); + printk(KERN_INFO "skey:button pressed at r:%d,c:%d\n", row_index, column_index); } else { processkey(row_index, column_index, 0); } @@ -315,7 +321,7 @@ int skey_update_thread (void *data) { } //sleep 500us= .5ms = 0.0005 seconds // 1 / 0.0005 = 2000 hz fastest, but it's really 1/0.00052 - usleep_range(500,500); + usleep_range(1000000,1000000); //for when the thread has to stop if (kthread_should_stop()) { break; |