hidpp20: add profile field to special bindings in onboard profiles

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 <lains@archlinux.org>
This commit is contained in:
Filipe Laíns
2020-01-29 23:34:52 +00:00
committed by Filipe Laíns
parent f0b69aab19
commit 9fe511fcc5
2 changed files with 4 additions and 0 deletions

View File

@@ -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;

View File

@@ -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 */