[SLOF] [PATCH v2 1/8] usb-hid: refactor usb key reading

Nikunj A Dadhania nikunj at linux.vnet.ibm.com
Fri Sep 18 18:46:55 AEST 2015


Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
---
 lib/libusb/usb-hid.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/lib/libusb/usb-hid.c b/lib/libusb/usb-hid.c
index 9d90006..16f3184 100644
--- a/lib/libusb/usb-hid.c
+++ b/lib/libusb/usb-hid.c
@@ -467,11 +467,8 @@ unsigned char usb_key_available(void *dev)
 
 unsigned char usb_read_keyb(void *vdev)
 {
-	if (!vdev)
-		return false;
-
-	while (usb_poll_key(vdev)) {
-		/* loop for all pending keys */
-	}
-	return read_key();
+	if (usb_key_available(vdev))
+		return read_key();
+	else
+		return 0;
 }
-- 
2.4.3



More information about the SLOF mailing list