Prepare uw state data structure and lookup for color strings

This commit is contained in:
Christoffer Sandberg 2020-07-27 16:31:38 +02:00
parent 5f2db68a9b
commit a85ccf9a4e
No known key found for this signature in database
GPG key ID: BF563F71B6C7A96D
2 changed files with 30 additions and 1 deletions

View file

@ -95,4 +95,22 @@ static struct color_list_t color_list = {
}
};
/**
* Looks up a color in the color_list
*
* Returns found color, or -1 if string did not match
*/
static u32 color_lookup(const struct color_list_t *color_list, const char *color_name)
{
u32 found_color = -1;
int i;
for (i = 0; i < color_list->size; ++i) {
if (strcmp(color_list->colors[i].name, color_name) == 0) {
found_color = color_list->colors[i].code;
}
}
return found_color;
}
#endif

View file

@ -34,7 +34,10 @@
#define UNIWILL_OSD_RADIOON 0x01A
#define UNIWILL_OSD_RADIOOFF 0x01B
#define UNIWILL_OSD_TOUCHPADWORKAROUND 0xFFF
#define UNIWILL_OSD_TOUCHPADWORKAROUND 0xFFF
#define UNIWILL_BRIGHTNESS_DEFAULT 0xc8 * 0.75 // Note: values 0x00 - 0xc8
#define UNIWILL_COLOR_DEFAULT 0xffffff
union uw_ec_read_return {
u32 dword;
@ -59,6 +62,14 @@ extern u32 uniwill_wmi_ec_write(u8, u8, u8, u8, union uw_ec_write_return *);
struct tuxedo_keyboard_driver uniwill_keyboard_driver;
struct kbd_led_state_uw_t {
u8 brightness;
u32 color;
} kbd_led_state_cl = {
.brightness = UNIWILL_BRIGHTNESS_DEFAULT,
.color = UNIWILL_COLOR_DEFAULT,
};
static struct key_entry uniwill_wmi_keymap[] = {
// { KE_KEY, UNIWILL_OSD_RADIOON, { KEY_RFKILL } },
// { KE_KEY, UNIWILL_OSD_RADIOOFF, { KEY_RFKILL } },