forked from drath/libratbag
hidpp10: add set_led_status
Only enabled for 4 leds and I'm not even sure they're the same on all devices. Still, works on the G500s so that's a good enough start. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -328,6 +328,26 @@ hidpp10_get_led_status(struct ratbag_device *device,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
hidpp10_set_led_status(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
const bool led[4])
|
||||
{
|
||||
unsigned idx = dev->index;
|
||||
union hidpp10_message led_status = CMD_LED_STATUS(idx, SET_REGISTER_REQ);
|
||||
int res;
|
||||
|
||||
|
||||
/* each led is 4-bits, 0x1 == off, 0x2 == on */
|
||||
led_status.msg.parameters[0] |= led[0] ? 0x02 : 0x01; /* running man logo */
|
||||
led_status.msg.parameters[0] |= led[1] ? 0x20 : 0x10; /* lowest */
|
||||
led_status.msg.parameters[1] |= led[2] ? 0x02 : 0x01; /* middle */
|
||||
led_status.msg.parameters[1] |= led[3] ? 0x20 : 0x10; /* highest */
|
||||
|
||||
res = hidpp10_request_command(device, &led_status);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0x61: Optical Sensor Settings */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
@@ -80,6 +80,10 @@ int
|
||||
hidpp10_get_led_status(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
bool led[4]);
|
||||
int
|
||||
hidpp10_set_led_status(struct ratbag_device *device,
|
||||
struct hidpp10_device *dev,
|
||||
const bool led[4]);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* 0x63: Current Resolution */
|
||||
|
||||
Reference in New Issue
Block a user