From 9fe511fcc5de36e11d5b2843606d331f829b15cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Wed, 29 Jan 2020 23:34:52 +0000 Subject: [PATCH] hidpp20: add profile field to special bindings in onboard profiles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New devices define a profile field in the button configuration. This allows us to map a button to set the target profile as active. Even though we don't support configuring this right now, some devices, such as the G915/G815, come pre-configured with this action on th M-Keys. This patch makes us able to read and write those settings, this way they don't get lost when we write a profile to the device. Signed-off-by: Filipe LaĆ­ns --- src/hidpp20.c | 2 ++ src/hidpp20.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/hidpp20.c b/src/hidpp20.c index 8966cc07..b31aed40 100644 --- a/src/hidpp20.c +++ b/src/hidpp20.c @@ -2572,6 +2572,7 @@ hidpp20_buttons_to_cpu(struct hidpp20_device *device, break; case HIDPP20_BUTTON_SPECIAL: button->special.special = b->special.special; + button->special.profile = b->special.profile; break; case HIDPP20_BUTTON_MACRO: if (profile->macros[i]) { @@ -2631,6 +2632,7 @@ hidpp20_buttons_from_cpu(struct hidpp20_profile *profile, break; case HIDPP20_BUTTON_SPECIAL: button->special.special = b->special.special; + button->special.profile = b->special.profile; break; case HIDPP20_BUTTON_DISABLED: break; diff --git a/src/hidpp20.h b/src/hidpp20.h index de370629..22629c32 100644 --- a/src/hidpp20.h +++ b/src/hidpp20.h @@ -618,6 +618,8 @@ union hidpp20_button_binding { struct { uint8_t type; /* HIDPP20_BUTTON_SPECIAL */ uint8_t special; + uint8_t reserved; + uint8_t profile; } __attribute__((packed)) special; struct { uint8_t type; /* HIDPP20_BUTTON_MACRO */