From 6d105a002cb7bd8d7b34fd2ad6f78e18335eefd8 Mon Sep 17 00:00:00 2001 From: Thomas Hindoe Paaboel Andersen Date: Tue, 19 Sep 2017 22:42:37 +0200 Subject: [PATCH] G300: fix writing multiple profiles Writing multiple changed profiles was broken as we would exit the loop after the first profile write. We were returning the number of bytes written and this was interpreted as an error. Fix it my returning 0 when we have written the correct number of bytes to the mouse. --- src/driver-logitech-g300.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/driver-logitech-g300.c b/src/driver-logitech-g300.c index 4299b295..b6ad2c6b 100644 --- a/src/driver-logitech-g300.c +++ b/src/driver-logitech-g300.c @@ -480,7 +480,13 @@ logitech_g300_write_profile(struct ratbag_profile *profile) HID_FEATURE_REPORT, HID_REQ_SET_REPORT); - return rc; + if (rc < (signed)sizeof(*report)) { + log_error(device->ratbag, + "Error while writing profile: %d\n", rc); + return rc; + } + + return 0; } static int