From 41cf0176f0b46cfb094946cbbfb0e550a6538e27 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 15 Sep 2015 10:46:26 -0400 Subject: [PATCH] roccat: remove spurious errors when waiting for the device to be ready Not perfect but we need to figure out what 0x02 means eventually. Signed-off-by: Benjamin Tissoires --- src/driver-roccat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/driver-roccat.c b/src/driver-roccat.c index 04c39795..5617afae 100644 --- a/src/driver-roccat.c +++ b/src/driver-roccat.c @@ -278,7 +278,7 @@ roccat_is_ready(struct ratbag_device *device) msleep(100); if (buf[1] == 0x02) - return -EINVAL; + return 2; return buf[1] == 0x01; } @@ -298,6 +298,9 @@ roccat_wait_ready(struct ratbag_device *device) if (rc == 1) return 0; + if (rc == 2) + return 2; + msleep(10); } @@ -383,7 +386,7 @@ roccat_set_config_profile(struct ratbag_device *device, uint8_t profile, uint8_t return -EIO; ret = roccat_wait_ready(device); - if (ret) + if (ret < 0) log_error(device->ratbag, "Error while waiting for the device to be ready: %s (%d)\n", strerror(-ret), ret);