mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
grpyhon-led-module: Add ability to read back color
To aid remote debugging we want to be able to read back the set color on the RGB LED. This commit implements this functionality.
This commit is contained in:
parent
bd8dd65766
commit
924b54d8d3
1 changed files with 7 additions and 2 deletions
|
|
@ -43,10 +43,15 @@
|
|||
static ssize_t get_led_color(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
/* [ln] todo: dummy implementation */
|
||||
int len;
|
||||
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
|
||||
|
||||
len = scnprintf(buf, PAGE_SIZE, "%d\n", 123);
|
||||
if (IS_ERR(sk9822)) {
|
||||
printk(KERN_ERR "Platform get drvdata returned NULL\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
len = scnprintf(buf, PAGE_SIZE, "%02x%02x%02x\n", sk9822->led_colors[0].r, sk9822->led_colors[0].g, sk9822->led_colors[0].b);
|
||||
if (len <= 0) {
|
||||
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
|
||||
return -EIO;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue