summary refs log tree commit diff
path: root/key_process.c
diff options
context:
space:
mode:
authortmk <nobody@nowhere>2011-01-04 20:30:23 +0900
committertmk <nobody@nowhere>2011-01-04 20:30:23 +0900
commit7272c65d3d24187487e7d38e332401002f5f233b (patch)
treecd098c31eff384ce8d448c825620e55bb54e3df6 /key_process.c
parent2a562a4191a5b9e88731efb5eabd921821f25f7e (diff)
add error handling to ps2_mouse
Diffstat (limited to 'key_process.c')
-rw-r--r--key_process.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/key_process.c b/key_process.c
index f3b65d1014..e3bee02e3b 100644
--- a/key_process.c
+++ b/key_process.c
@@ -129,6 +129,7 @@ void proc_matrix(void) {
 #ifdef PS2_MOUSE_ENABLE
                 print("1: ps2_mouse_init \n");
                 print("2: ps2_mouse_read \n");
+                print("3: ps2_mouse: on/off toggle \n");
 #endif
                 _delay_ms(500);
                 print_enable = false;
@@ -154,6 +155,16 @@ void proc_matrix(void) {
                 phex(ps2_mouse_y); print("\n");
                 print("ps2_mouse_error_count: "); phex(ps2_mouse_error_count); print("\n");
                 break;
+            case KB_3:
+                ps2_mouse_enable = !ps2_mouse_enable;
+                print("ps2_mouse: ");
+                if (ps2_mouse_enable)
+                    print("on");
+                else
+                    print("off");
+                print("\n");
+                _delay_ms(500);
+                break;
 #endif
             case KB_B: // bootloader
                 usb_keyboard_clear_report();
@@ -299,9 +310,7 @@ void proc_matrix(void) {
 
 #ifdef PS2_MOUSE_ENABLE
     // ps2 mouse
-    //if (ps2_mouse_error_count > 10) {
-        ps2_mouse_read();
+    if (ps2_mouse_read() == 0)
         ps2_mouse_usb_send();
-    //}
 #endif
 }