Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


[Deprecated} Using the Flirc USB for remote control with mOde 5.4+
#41
@rh2018

Hi, Richard.


TL;DR Use triggerhappy!

Yeah, that was a clue. I have my suspicions, but, like I said, I'm deprecating the use of my Python script so I'm not eager to spend time chasing this issue.

I misread your earlier post http://moodeaudio.org/forum/showthread.p...0#pid16600 to mean you saw the conflict using CDPlay with triggerhappy, hence the way I composed my response here.

Regards,
Kent
Reply
#42
(02-19-2020, 12:52 PM)TheOldPresbyope Wrote: @rh2018

Hi, Richard.


TL;DR Use triggerhappy!

Yeah, that was a clue. I have my suspicions, but, like I said, I'm deprecating the use of my Python script so I'm not eager to spend time chasing this issue.

I misread your earlier post http://moodeaudio.org/forum/showthread.p...0#pid16600 to mean you saw the conflict using CDPlay with triggerhappy, hence the way I composed my response here.

Regards,
Kent

Hi Kent,

My bad, sort of. I did mean conflict with Triggerhappy in the earlier post but then changed threads to keep the problem in the original context - and created more confusion!

Anyway I will try a fresh install using Triggerhappy and report.

Thanks and regards,
Richard.
Reply
#43
Hi Kent,

It seems the problem was the Flirc USB dongle sharing the powered USB hub with the external USB optical drive.


Moving Flirc to the RPi, after three days testing with a fresh moode 6.4.2 install, Triggerhappy IR and CDPlay no glitches have occurred.

In explanation of a comment in my earlier post http://moodeaudio.org/forum/showthread.p...0#pid16600  - "I had to power down via script KEY P: power.sh"


Code:
#!/bin/bash
sudo /sbin/shutdown -h now

Triggerhappy works fine with all mpc or commands that don't require root privileges but THD executes commands like "sudo shutdown -h now" as User "nobody" and the command fails.

A little Googling found the solution:
https://hackernoon.com/shut-down-your-ra...7be0b4fff8

Hope this helps.

Regards,
Richard
Reply
#44
@rh2018

Hi, Richard.

Nice catch about the permissions issue. I can't find any explicit mention in the README or the man pages. I suppose my spidey sense should have tingled when I read "it works independently from a specific user being logged in ". 


Curious about the powered USB-hub. They seem to be a bit of chimera---solve one problem and create another.

Regards,
Kent
Reply
#45
(02-22-2020, 12:48 PM)TheOldPresbyope Wrote: @rh2018

Hi, Richard.

Nice catch about the permissions issue. I can't find any explicit mention in the README or the man pages. I suppose my spidey sense should have tingled when I read "it works independently from a specific user being logged in ". 


Curious about the powered USB-hub. They seem to be a bit of chimera---solve one problem and create another.

Regards,
Kent

Hi Kent,

/etc/default/triggerhappy contains;
Code:
                                                                                                                   
# Defaults for triggerhappy initscript
# sourced by /etc/init.d/triggerhappy
# installed at /etc/default/triggerhappy by the maintainer scripts
                                                                                                                     
#
# This is a POSIX shell fragment
#
                                                                                                                     
# Additional options that are passed to the Daemon.
DAEMON_OPTS=""                                                                                                        
                                                                                                                     
# The Triggerhappy daemon (thd) drops its root privileges after
# startup and becomes "nobody". If you want it to retain its root
# status (e.g. to run commands only accessible to the system user),
# uncomment the following line or specifiy the user option yourself:
#
# DAEMON_OPTS="--user root"

I tried uncommenting the last line but still couldn't use a direct shutdown command so don't know how that is supposed to work.

Regards,
Richard.
Reply
#46
You might have to edit the system unit.

Code:
pi@rp3:~ $ cat /lib/systemd/system/triggerhappy.service
[Unit]
Description=triggerhappy global hotkey daemon
After=local-fs.target

[Service]
Type=notify
ExecStart=/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*

[Install]
WantedBy=multi-user.target


Then 

Code:
sudo systemctl daemon-reload
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#47
/var/local/www/commandw/restart.sh is already owned by root. I thought I'd just use setuid on it and then call it with the "poweroff" argument.
Reply
#48
(02-22-2020, 01:33 PM)TheOldPresbyope Wrote: /var/local/www/commandw/restart.sh is already owned by root. I thought I'd just use setuid on it and then call it with the "poweroff" argument.

Thanks Tim and Kent,

That's getting beyond my meagre Linux expertise. I'll have to stick with the script for a while. Smile

Regards,
Richard.
Reply
#49
(02-22-2020, 01:47 PM)rh2018 Wrote:
(02-22-2020, 01:33 PM)TheOldPresbyope Wrote: /var/local/www/commandw/restart.sh is already owned by root. I thought I'd just use setuid on it and then call it with the "poweroff" argument.

Thanks Tim and Kent,

That's getting beyond my meagre Linux expertise. I'll have to stick with the script for a while. Smile

Regards,
Richard.


Hi, Richard.

<tl;dr Standing pat is the right answer for now Smile >

I replied to the specific issue of shutting down moOde via triggerhappy. My thought turned out to be half-baked so please ignore it until further notice.

Tim responded to the more general possibility of running the triggerhappy daemon as root rather than nobody [1]. That's a discussion best left for another thread. In a well-ordered world, thd would run under its own dedicated user account, the way mpd (user mpd), nginx (user www-data), and avahi (user avahi) do.

Regards,
Kent

[1] the special user nobody was originally an NFS construct. The InterWeb™ has several running flamewars concerning its use in other applications.
Reply
#50
Why not simply change the --user from nobody to root in the system unit file?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: