From ee0c58ca35fafc4ac04f4b11b34202d84e471cba Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 15 Sep 2015 10:36:10 -0400 Subject: [PATCH] roccat: break infinite loops When waiting for a status, the mouse sometimes answers 0x02, which seems to be EINVAL (though it can be an ACK too). Treat this answer so we do not end up in some infinite loops. Signed-off-by: Benjamin Tissoires --- src/driver-roccat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/driver-roccat.c b/src/driver-roccat.c index b8f90ff8..1b68c107 100644 --- a/src/driver-roccat.c +++ b/src/driver-roccat.c @@ -277,6 +277,9 @@ roccat_is_ready(struct ratbag_device *device) if (buf[1] == 0x03) msleep(100); + if (buf[1] == 0x02) + return -EINVAL; + return buf[1] == 0x01; }