How to send echo to LED in LuCI JS?

Hey,
I guess the question is trivial, but I need to turn off the LED in my package and I'm having trouble with it.

I added to acl.d

"/bin/echo *": [ "exec" ],
"/sys/class/leds *": [ "write" ],

And I got stuck on executing the command correctly
echo "0" > /sys/class/leds/pca963x:caiman:white:wps/brightness

fs.exec_direct('/bin/echo', [ ? ]);

Of course, I could push it to some bash script and that way works, but I'd rather avoid it.

@jow maybe You could give me a hint?

Hi.

Use:

"/sys/class/leds/*/brightness": [ "write" ],

and

fs.write('/sys/class/leds/pca963x:caiman:white:wps/brightness', '0')

no executable permissions required

1 Like

Thanks @jow for the hint. Before writing this second post, I also thought about fs.write and weird, but it didn't want to work for me. Will try again tonight when I get home from work.

Edit.
Sure, if I improve acl.d it will work. :smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.