mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
roccat: abort if the macro does not match
If there is any problem while retrieving a macro, the first element in the report might not match. In such cases, abort. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
@@ -679,6 +679,13 @@ roccat_read_button(struct ratbag_button *button)
|
||||
button->index, button->profile->index,
|
||||
rc < 0 ? strerror(-rc) : "not read enough", rc);
|
||||
} else {
|
||||
if (buf[0] != ROCCAT_REPORT_ID_MACRO) {
|
||||
log_error(device->ratbag,
|
||||
"Error while reading the macro of button %d of profile %d.\n",
|
||||
button->index,
|
||||
button->profile->index);
|
||||
goto out_macro;
|
||||
}
|
||||
if (!roccat_crc_is_valid(device, buf, ROCCAT_REPORT_SIZE_MACRO)) {
|
||||
log_error(device->ratbag,
|
||||
"wrong checksum while reading the macro of button %d of profile %d.\n",
|
||||
|
||||
Reference in New Issue
Block a user