From eeccaa023c1fdd947d5507ea41da100e7ec43ad4 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 20 Aug 2015 17:19:46 -0400 Subject: [PATCH] hidpp20: properly handle errors Signed-off-by: Benjamin Tissoires --- src/hidpp20.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hidpp20.c b/src/hidpp20.c index dfd4bdcb..d36bd7f6 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -91,7 +91,8 @@ hidpp20_request_command(struct ratbag_device *device, union hidpp20_message *msg /* error */ if (read_buffer.msg.sub_id == __ERROR_MSG && - (read_buffer.msg.parameters[0] & 0x0f) == (read_buffer.msg.address & 0x0f)) { + read_buffer.msg.address == msg->msg.sub_id && + read_buffer.msg.parameters[0] == msg->msg.address) { hidpp_err = read_buffer.msg.parameters[1]; log_error(ratbag, " HID++ error from the device (%d): %s (%02x)\n",