From 186a1deda87b7eb14e84ccfe36042491e86bc201 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 22 Sep 2017 17:24:20 +1000 Subject: [PATCH] led: change RGB to RGB888 and add 1-bit RGB 1-bit RGB is needed for the Logitech G300, let's rename the main RGB to indicate how many bits we actually have. See #335 Signed-off-by: Peter Hutterer --- src/driver-hidpp20.c | 2 +- src/driver-logitech-g300.c | 2 +- src/libratbag.c | 2 +- src/libratbag.h | 9 ++++++--- tools/ratbagctl.in | 3 ++- tools/ratbagd.py | 3 ++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/driver-hidpp20.c b/src/driver-hidpp20.c index b5b52be4..840de13d 100644 --- a/src/driver-hidpp20.c +++ b/src/driver-hidpp20.c @@ -281,7 +281,7 @@ hidpp20drv_read_led(struct ratbag_led *led) led->color.blue = h_led->color.blue; led->hz = h_led->period; /* FIXME: should be ceil(1000.0 / h_led->period), but that would be very small */ led->brightness = h_led->brightness * 255 / 100; - led->colordepth = RATBAG_LED_COLORDEPTH_RGB; + led->colordepth = RATBAG_LED_COLORDEPTH_RGB_888; } static int diff --git a/src/driver-logitech-g300.c b/src/driver-logitech-g300.c index 9e60199c..2db155e5 100644 --- a/src/driver-logitech-g300.c +++ b/src/driver-logitech-g300.c @@ -390,7 +390,7 @@ logitech_g300_read_led(struct ratbag_led *led) led->type = RATBAG_LED_TYPE_SIDE; led->mode = RATBAG_LED_ON; - led->colordepth = RATBAG_LED_COLORDEPTH_MONOCHROME; + led->colordepth = RATBAG_LED_COLORDEPTH_RGB_111; led->color.red = profile_report->led_red * 255; led->color.green = profile_report->led_green * 255; led->color.blue = profile_report->led_blue * 255; diff --git a/src/libratbag.c b/src/libratbag.c index d66da3cc..15440376 100644 --- a/src/libratbag.c +++ b/src/libratbag.c @@ -599,7 +599,7 @@ ratbag_create_led(struct ratbag_profile *profile, unsigned int index) led->refcount = 0; led->profile = profile; led->index = index; - led->colordepth = RATBAG_LED_COLORDEPTH_RGB; + led->colordepth = RATBAG_LED_COLORDEPTH_RGB_888; list_insert(&profile->leds, &led->link); diff --git a/src/libratbag.h b/src/libratbag.h index d6860113..4feb7d6e 100644 --- a/src/libratbag.h +++ b/src/libratbag.h @@ -1530,10 +1530,13 @@ enum ratbag_led_colordepth { */ RATBAG_LED_COLORDEPTH_MONOCHROME = 400, /** - * The device supports RBG colors of an unspecified depth, - * but with at least 8 bits per color. + * The device supports RBG color with 8 bits per color. */ - RATBAG_LED_COLORDEPTH_RGB, + RATBAG_LED_COLORDEPTH_RGB_888, + /** + * The device supports RBG colors with 1 bit per color. + */ + RATBAG_LED_COLORDEPTH_RGB_111, }; /** diff --git a/tools/ratbagctl.in b/tools/ratbagctl.in index 96f08ecc..0ea2946e 100755 --- a/tools/ratbagctl.in +++ b/tools/ratbagctl.in @@ -132,7 +132,8 @@ def print_led(d, p, l, level): } depths = { RatbagdLed.COLORDEPTH_MONOCHROME: "monochrome", - RatbagdLed.COLORDEPTH_RGB: "rgb", + RatbagdLed.COLORDEPTH_RGB_888: "rgb", + RatbagdLed.COLORDEPTH_RGB_111: "rgb111", } if l.mode == RatbagdLed.MODE_OFF: print(" " * level + "LED: {} type: {}, depth: {}, mode: {}".format(l.index, diff --git a/tools/ratbagd.py b/tools/ratbagd.py index d837a620..35800999 100644 --- a/tools/ratbagd.py +++ b/tools/ratbagd.py @@ -890,7 +890,8 @@ class RatbagdLed(_RatbagdDBus): MODE_BREATHING = 3 COLORDEPTH_MONOCHROME = 400 - COLORDEPTH_RGB = 401 + COLORDEPTH_RGB_888 = 401 + COLORDEPTH_RGB_111 = 402 LED_DESCRIPTION = { # Translators: the LED is off.