fbd-dev-led: Check max_brightness_percentage range

Percentages are always between 0.0 and 100.0.
Also fix a typo along the way.
This commit is contained in:
Dylan Van Assche
2024-06-09 11:21:20 +02:00
committed by Guido Günther
parent 63b564494b
commit 60ce9ecb3c
+2 -1
View File
@@ -85,7 +85,7 @@ fbd_dev_led_probe_default (FbdDevLed *led, GError **error)
if (!success) {
g_set_error (error,
G_FILE_ERROR, G_FILE_ERROR_FAILED,
"%s not usable as RBG LED", name);
"%s not usable as RGB LED", name);
}
return success;
@@ -127,6 +127,7 @@ fbd_dev_led_start_periodic_default (FbdDevLed *led,
gdouble t;
g_return_val_if_fail (FBD_IS_DEV_LED (led), FALSE);
g_return_val_if_fail (max_brightness_percentage <= 100, FALSE);
priv = fbd_dev_led_get_instance_private (led);
max = priv->max_brightness * (max_brightness_percentage / 100.0);