I purchased a led multicoloured keyboard from Dollarama (Everything is a buck store) Keyboad cost $5.00 bucks. Instructions on the box said press Scroll Lock button to turn on/Off LED. After many key-presses and nothing lighting up I threw the keyboard away. Later on I suddenly remembered in Linux we have :
So to confirm the scroll lock key on the keyboard was actually kaput I ran this from a root shell:
root@debian:~# echo 1 > /sys/class/leds/input18::scrolllock/brightness
And voila it lit up just fine. As a learning experience I wrote a small program that controls the keyboard. This works fine. But I have a question.
procedure TForm1.Button2Click(Sender: TObject);
var
result:Boolean;
s:string;
begin
result:=RunCommand('/bin/bash', ['-c', 'echo 0 | sudo tee /sys/class/leds/input18::scrolllock/brightness'], s); // Turn OFF
end;
For this to work it requires elevated priviledges (sudo) and the very first time I run it the console in the IDE says: (Screenshot is attached. )
[sudo] password for aruna:
I enter my password hit enter the keyboard lights up. From then on I can turn the keyboard led on or off at will. How can I suppress the initial one time sudo if that is possible at all?