Commit 924b54d8 authored by Markus Gothe's avatar Markus Gothe 👌
Browse files

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.
parent bd8dd657
...@@ -43,10 +43,15 @@ ...@@ -43,10 +43,15 @@
static ssize_t get_led_color(struct device *dev, static ssize_t get_led_color(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
/* [ln] todo: dummy implementation */
int len; int len;
struct sk9822_leds *sk9822 = dev_get_drvdata(dev);
if (IS_ERR(sk9822)) {
printk(KERN_ERR "Platform get drvdata returned NULL\n");
return -EIO;
len = scnprintf(buf, PAGE_SIZE, "%d\n", 123); 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) { if (len <= 0) {
dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len); dev_err(dev, "sk9822: Invalid sprintf len: %d\n", len);
return -EIO; return -EIO;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment