mirror of
https://github.com/libratbag/libratbag.git
synced 2026-11-07 23:23:52 +01:00
drv-hidpp20: implement set_current_profile()
Only enabled for PROFILES_8100. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
@@ -1101,6 +1101,33 @@ hidpp20_onboard_profiles_get_current_profile(struct hidpp20_device *device)
|
||||
return msg.msg.parameters[1];
|
||||
}
|
||||
|
||||
int
|
||||
hidpp20_onboard_profiles_set_current_profile(struct hidpp20_device *device,
|
||||
uint8_t index)
|
||||
{
|
||||
uint8_t feature_index;
|
||||
int rc;
|
||||
union hidpp20_message msg = {
|
||||
.msg.report_id = REPORT_ID_SHORT,
|
||||
.msg.device_idx = device->index,
|
||||
.msg.address = CMD_ONBOARD_PROFILES_SET_CURRENT_PROFILE,
|
||||
.msg.parameters[1] = index + 1,
|
||||
};
|
||||
|
||||
feature_index = hidpp_root_get_feature_idx(device,
|
||||
HIDPP_PAGE_ONBOARD_PROFILES);
|
||||
if (feature_index == 0)
|
||||
return -ENOTSUP;
|
||||
|
||||
msg.msg.sub_id = feature_index;
|
||||
|
||||
rc = hidpp20_request_command(device, &msg);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
hidpp20_onboard_profiles_initialize(struct hidpp20_device *device,
|
||||
unsigned profile_count,
|
||||
|
||||
Reference in New Issue
Block a user