USBHost library

Dependencies:   FATFileSystem

Dependents:   x4180_Tank Totaleprogramma Handmatig Totaleprogramma1

Fork of USBHost by mbed official

Revision:
5:e48791a1ef18
Parent:
4:b320d68e98e7
Child:
8:93da8ea2708b
diff -r b320d68e98e7 -r e48791a1ef18 USBHostHID/USBHostKeyboard.cpp
--- a/USBHostHID/USBHostKeyboard.cpp	Tue Mar 12 17:23:37 2013 +0000
+++ b/USBHostHID/USBHostKeyboard.cpp	Wed Mar 13 10:23:01 2013 +0000
@@ -103,13 +103,11 @@
 
 bool USBHostKeyboard::connect() {
     
-    U8 i;
-    
     if (dev_connected) {
         return true;
     }
     
-    for (i = 0; i < MAX_DEVICE_CONNECTED; i++) {
+    for (uint8_t i = 0; i < MAX_DEVICE_CONNECTED; i++) {
         if ((dev = host->getDevice(i)) != NULL) {
 
             if (host->enumerate(dev, this))
@@ -149,11 +147,11 @@
         if (key && onKey) {
             (*onKey)(key);
         }
-        if (onKeyCode) {
+        if ((report[index + 2] || modifier) && onKeyCode) {
             (*onKeyCode)(report[index + 2], modifier);
         }
     }
-    if (dev != NULL)
+    if (dev && int_in)
         host->interruptRead(dev, int_in, report, len_listen, false);
 }