From 3ff3705dbf96cb64bac465bf54a2d1d91557b6b0 Mon Sep 17 00:00:00 2001 From: Yaroslav Chvanov Date: Sat, 16 Apr 2022 19:07:55 +0300 Subject: [PATCH] sinowealth: add partial support for reading BREATHING7 lighting mode Only partial as libratbag can only have 1 color in breathing lighting mode. --- src/driver-sinowealth.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/driver-sinowealth.c b/src/driver-sinowealth.c index 08abf261..540505e8 100644 --- a/src/driver-sinowealth.c +++ b/src/driver-sinowealth.c @@ -708,9 +708,24 @@ sinowealth_update_profile_from_config(struct ratbag_profile *profile) led->color = sinowealth_raw_to_color(device, config->single_color); led->brightness = sinowealth_rgb_mode_to_brightness(config->single_mode); break; + case RGB_BREATHING7: + /* NOTE: I don't know how mice would react to this, but this + * can happen if configuration data gets broken. + */ + if (config->breathing7_colorcount < 1) { + log_error(device->ratbag, "LED mode is multi-colored breathing, but there are no colors configured\n"); + led->mode = RATBAG_LED_OFF; + break; + } + if (config->breathing7_colorcount > 1) { + log_debug(device->ratbag, "LED mode is multi-colored breathing, but we can only use one color. Using the first one...\n"); + } + led->mode = RATBAG_LED_BREATHING; + led->color = sinowealth_raw_to_color(device, config->breathing7_colors[0]); + sinowealth_set_led_from_rgb_mode(led, config->breathing7_mode); + break; case RGB_GLORIOUS: case RGB_BREATHING: - case RGB_BREATHING7: case RGB_CONSTANT: case RGB_RANDOM: case RGB_TAIL: