From 0be25ac4e78f21b42592ee9183c0159efa40270a Mon Sep 17 00:00:00 2001 From: knolax <1339802534.kk@gmail.com> Date: Fri, 29 Dec 2017 16:12:14 -0500 Subject: added debug prints, testing this in production at the moment, also increased the scan period back to 1s. --- skey.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'skey.c') diff --git a/skey.c b/skey.c index bc94680..070be79 100644 --- a/skey.c +++ b/skey.c @@ -165,12 +165,14 @@ 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; } - + printk("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]; @@ -186,6 +188,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); //after the previous keystate is checked, it is updated if (state) { keystate[row][column] = KEYSTATE_PHYS | keystate[row][column]; @@ -254,7 +257,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 @@ -309,6 +312,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); } @@ -322,7 +326,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; -- cgit v1.1