1
0
forked from drath/libratbag

hidpp20: do not overwrite macros when writing a profile

Same commit for hidpp20:
Previously, we would put a random address in the macro value, meaning we
lose the content of the macros.

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
This commit is contained in:
Benjamin Tissoires
2015-12-18 13:27:15 +01:00
parent f05aafc786
commit 8ed646fd7f

View File

@@ -1503,7 +1503,11 @@ hidpp20_buttons_to_cpu(struct hidpp20_device *device,
b->macro.page,
b->macro.offset,
&profile->macros[i]);
/* the actual page is stored in the 'zero' field */
button->macro.page = i;
button->macro.offset = b->macro.offset;
button->macro.zero = b->macro.page;
break;
case HIDPP20_BUTTON_DISABLED:
break;
@@ -1550,6 +1554,12 @@ hidpp20_buttons_from_cpu(struct hidpp20_profile *profile,
break;
case HIDPP20_BUTTON_DISABLED:
break;
case HIDPP20_BUTTON_MACRO:
/* the actual page is stored in the 'zero' field */
button->macro.page = b->macro.zero;
button->macro.offset = b->macro.offset;
button->macro.zero = 0;
break;
default:
break;
}