mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 11:43:59 +01:00
introduce set_color_code_region() with sane error checking
This commit is contained in:
parent
27aafcf1fd
commit
42e5c40f93
|
@ -373,6 +373,31 @@ static int set_color(u32 region, u32 color)
|
||||||
return tuxedo_evaluate_wmi_method(SET_KB_LED, cmd, NULL);
|
return tuxedo_evaluate_wmi_method(SET_KB_LED, cmd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int set_color_code_region(u32 region, u32 colorcode)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
if (0 == (err = set_color(region, colorcode))) {
|
||||||
|
// after succesfully setting color, update our state struct
|
||||||
|
// depending on which region was changed
|
||||||
|
switch (region) {
|
||||||
|
case REGION_LEFT:
|
||||||
|
kbd_led_state.color.left = colorcode;
|
||||||
|
break;
|
||||||
|
case REGION_CENTER:
|
||||||
|
kbd_led_state.color.center = colorcode;
|
||||||
|
break;
|
||||||
|
case REGION_RIGHT:
|
||||||
|
kbd_led_state.color.right = colorcode;
|
||||||
|
break;
|
||||||
|
case REGION_EXTRA:
|
||||||
|
kbd_led_state.color.extra = colorcode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int set_color_string_region(const char *color_string, size_t size, u32 region)
|
static int set_color_string_region(const char *color_string, size_t size, u32 region)
|
||||||
{
|
{
|
||||||
u32 colorcode;
|
u32 colorcode;
|
||||||
|
|
Loading…
Reference in a new issue