From 8ed646fd7f700106ac9987318d08fbf1649b97ee Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Fri, 18 Dec 2015 13:27:15 +0100 Subject: [PATCH] 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 --- src/hidpp20.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hidpp20.c b/src/hidpp20.c index 7e25920d..464818dd 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -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; }