nsa325 copy button event February 01, 2017 10:08AM |
Registered: 12 years ago Posts: 39 |
Quote
Buttzy10169
And the following python script lets you do something with the copy button:
from evdev import InputDevice from select import select from subprocess import call dev = InputDevice('/dev/input/event0') while True: r,w,x = select([dev], [], []) for event in dev.read(): if event.code == 133: call(["shutdown", "-r", "now", "\"this is a test\""])
GPIO keys daemon setup February 01, 2017 03:03PM |
Admin Registered: 13 years ago Posts: 18,495 |
apt-get install esekeyd
POWER:/usr/bin/logger -s -i "POWER button pushed" RESTART:/usr/bin/logger -s -i "RESTART button pushed" COPY:/usr/bin/logger -s -i "COPY Button pushed"
Re: nsa325 copy button event February 02, 2017 07:24AM |
Registered: 12 years ago Posts: 39 |
Re: nsa325 copy button event March 05, 2017 11:25AM |
Registered: 7 years ago Posts: 183 |
Re: nsa325 copy button event March 05, 2017 03:24PM |
Admin Registered: 13 years ago Posts: 18,495 |
#POWER:/sbin/shutdown -h now #RESTART:/sbin/shutdown -r now POWER:/usr/bin/logger -s -i "POWER button pushed" RESTART:/usr/bin/logger -s -i "RESTART button pushed" COPY:/usr/bin/logger -s -i "COPY Button pushed"
logread -fAnd push the button, observe the log event.
/usr/bin/logger -s -i "COPY Button pushed"
Re: nsa325 copy button event November 25, 2017 02:19PM |
Registered: 6 years ago Posts: 47 |
/usr/bin/keytest
tail /var/log/user.logThats where /usr/bin/logger -s -i "COPY Button pushed" writes stuff on my LG T1N1
Re: nsa325 copy button event November 25, 2017 04:26PM |
Admin Registered: 13 years ago Posts: 18,495 |
Re: nsa325 copy button event November 26, 2017 04:28AM |
Registered: 6 years ago Posts: 47 |
Re: GPIO keys daemon setup August 15, 2019 03:05PM |
Registered: 4 years ago Posts: 20 |
root@kerstin:~$ keytest keytest (ESE Key Deamon 1.2.7, SVN-r63) (input device name as 1st option override autodetection) Pres ANY (fun)key... or Ctrl-C to exit... KEY_116 KEY_116 KEY_133 KEY_133
root@kerstin:~$ cat /etc/esekeyd.conf KEY_116:/usr/bin/logger -s -i "POWER button pushed" RESTART:/usr/bin/logger -s -i "RESTART button pushed" KEY_133:/usr/bin/logger -s -i "COPY Button pushed"