Drop has_color API since supported colors are set during probing and can be handled completely separately from the classes for each type of hardware. Rename set_color to set_supported_color because the usage of this API is to check if the color is supported, but not setting it. Setting the color is also separated from start_periodic API to re-use multicolor across multiple LED types with a set_color API. Multicolor LEDs are actually the same as regular LEDs but they require a few additional sysfs entries to actually set the color. Single color LEDs only have a single color so the set_color method just returns TRUE for these LEDs. Supported colors are advertised through the supports_color API now. This way, each LED driver define which colors are supported through supports_color API. RGB multicolor LEDs will report only fixed colors like red, blue, green and white until the kernel can expose if a diffusor is present to mix these colors.
23 lines
524 B
C
23 lines
524 B
C
/*
|
|
* Copyright (C) 2023 Purism SPC
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0+
|
|
*/
|
|
#pragma once
|
|
|
|
#include "fbd-dev-led.h"
|
|
#include "fbd-feedback-led.h"
|
|
|
|
#include <gudev/gudev.h>
|
|
#include <glib-object.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define LED_MAX_BRIGHTNESS_ATTR "max_brightness"
|
|
|
|
GUdevDevice *fbd_dev_led_get_device (FbdDevLed *led);
|
|
void fbd_dev_led_set_max_brightness (FbdDevLed *led, guint max_brightness);
|
|
void fbd_dev_led_set_supported_color (FbdDevLed *led, FbdFeedbackLedColor color);
|
|
|
|
G_END_DECLS
|