TriggerHappy Daemon (THD) doesn't work on my Pi running Retropie ! Help
-
I already tried it in the past, but i'll try it again now
let's see -
The new status, seems to be working on paper @mitu :
sudo systemctl status triggerhappy● triggerhappy.service - triggerhappy global hotkey daemon
Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre
Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago
Main PID: 752 (thd)
CGroup: /system.slice/triggerhappy.service
└─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon.
Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:
Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd
Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.
lines 1-11/11 (END)...skipping...
● triggerhappy.service - triggerhappy global hotkey daemon
Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre
Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago
Main PID: 752 (thd)
CGroup: /system.slice/triggerhappy.service
└─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon.
Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:
Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd
Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-11/11 (END)...skipping...
● triggerhappy.service - triggerhappy global hotkey daemon
Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago
Main PID: 752 (thd)
CGroup: /system.slice/triggerhappy.service
└─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*
Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon...
Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:
Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd
Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.
-
Now that TriggerHappy seems to be "running well", i think we're close to make it work !
Poorly, when i press the button, nothing seems to be happening...
@mitu -
FYI: i edited the line as follow: " DAEMON_OPTS"--user pi"
-
No, it's still not working:
- User running the service seems to be still
nobody
- probably the configuration file I mentioned works only for the old style service file - You get an error in the configuration file, which means it's running but ignoring your config.
I think your best bet is to disable the service and run it as the pi user from the
autostart.sh
file (where Emulationstation is started).
Run it from the terminal, as thepi
user with/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event*
Make sure it works like this - i.e. it gets your button inputs correctly. Then, add the line in either
/etc/rc.local
or in theautostart.sh
script. Make sure you add an&
at the end of the command when adding it to either file. - User running the service seems to be still
-
Waaa we're so close now !!
So when i type
"/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event*" from the terminal and press my button, it actually works !Now i'm not sure when to add the line, should i do "sudo nano /etc/rc.local" and go at the end and copy and paste ?
FYI, when i type "sudo nano autostart.sh" the file is empty
@mitu -
@djon The
autostart.sh
file is in/opt/retropie/configs/all/autostart.sh
, but try with/etc/rc.local
first. You'll need to reboot to test it. -
@mitu
if the line need to start at boot, i also have a python code running at boot, i added the pyton path at the end of /etc/profile
Don't know if it can help here :) -
@mitu
So i did : sudo nano /etc/rc.local
And added at the end of the file
"/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event* &"
Then sudo rebootBut it still not working
-
Maybe should i past it before "exit 0" line ?
-
@djon Does the process shows up when your run
ps -ef
from the terminal ?
EDIT: Yes, of course you need to add it before theexit
, otherwise it's not executed. -
Ok so i add it before "exit 0" this time and run ps -ef @mitu
And i think the line you're interested in is
"nobody 364 1 0 03:26 ? 00:00:00 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*" -
@djon Doesn't seem to be correct. Have you disabled the service ? The process shown there seems the one started from the built-in service script. Post your
rc.local
file contents, surrounded by code tags (```
). -
No prob ! @mitu
# # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. # Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --devicelob /dev/input/event* & exit 0
-
@djon Just change it to
# Start THD as user pi nohup /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --user pi --deviceglob /dev/input/event* & exit 0
and reboot. Disable the service with
sudo systemctl disable triggerhappy
first. -
I'll do it in a sec, so i'll change all the file just with these lines ? @mitu
-
Okay so i made the mistake to erase all the file, to put just your line...
So i did it again, with just your line at the end, and i can say... that... it is workinggggggggggg !!!!!!! @mituI think that i will start again from stratch with a brand new retropie image, next time i'll just need to put :
# Start THD as user pi nohup /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --user pi --deviceglob /dev/input/event* & exit 0
Or i'll need to take all the steps we made ?
-
Since you're here @mitu and that your the best guy ever, i need to change a bit the script to make the brightness increase by 25% each time, i was thinking :
sudo chmod 777 /sys/class/backlight/rpi_backlight/brightness && echo 25% > /sys/class/backlight/rpi_backlight/brightness
... hum no i just test it and they say "invalid argument"
FYI the brightness can go from 0 to 250
-
I ran into the same issue trying to get triggerhappy to process the VOLUME_UP and VOLUME_DOWN events from my Dell AC511 soundbar.
No matter whether I set the user to run the process as in /etc/defaults/triggerhappy, or /etc/init.d/triggerhappy, it would always run as user nobody.
The process would run, but because nobody doesn't have privileges, my commands to amixer would not run.
The solution I found was to edit /etc/systemd/system/multi-user.target.wants/triggerhappy.service and set the user in there to pi.
After doing that and restarting the daemon, the triggerhappy process ran under user pi and everything worked.
Edit: Future updates my overwrite changes to this file, I don't know.
-
@headrush69 Thank you sssssssssssssooooooooooooooooooo much headrush!
I have spent the last 2 days digging for this!!
My volume knob, It WORKS!I literally created an account here just to thank you!
-
-
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.