Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-29 Thread Sebastian Frei
Hello,

I don't want to hijack your thread, but just as a reference here is my solution 
with acpid to achieve nearly the same:


/etc/acpid/power:

event=button/power*
action=/sbin/acpishutdown.sh



/sbin/acpishutdown.sh:

#!/bin/sh
if [ -e /tmp/acpibutton ]; then
  if [ `/bin/ls /tmp/acpibutton -lc --time-style=+%s|/bin/cut --delemiter=  
--fields 6` -gt `/bin/date --date=20 seconds ago +%s` ]; then
/sbin/shutdown -h now
  else
/bin/touch /tmp/acpibutton
/bin/svdrpsend HITK Power
  fi
else
  /bin/touch /tmp/acpibutton
  /bin/svdrpsend HITK Power
fi



If you press the power button VDR is told via SVDRP to shut down.
If you press the power button two times within 20 seconds, the computer is 
shutdown directly with /sbin/shutdown.

Best regards
Sebastian

Am Mittwoch, 27. März 2013, 18:44:28 schrieb Manuel Reimer:
 Hello List,
 
 I have written a small daemon, which can replace acpid on VDR systems and
 was written with dedicated VDR systems in mind.
 
 Core Features:
 - Faster than acpid with all the required external scripts.
 - Emergency reboot feature. You don't loose the power button as safe
 emergency exit button. Just press it four times within three seconds and a
 clean reboot is triggered.
 - Very easy to set up. If you want, you can just copy the vdrpbd file to
 your VDR system and execute it. VDR should react to the power button
 immediately! - Systemd integration. If systemd is detected, then vdrpbd
 tries to register itself as power button inhibitor. The module
 Net::DBus is required for this to work.
 
 Note that it requires an up-to-date kernel, as the only supported way, to
 access the power button, is the input layer. There is no netlink support
 and I also won't add it.
 
 Download from here:
 http://projects.vdr-developer.org/attachments/download/1331/vdrpbd-0.0.1.tar
 .xz
 
 To post bug reports and feature requests, you may use the ticket system
 here: http://projects.vdr-developer.org/projects/vdrpbd/issues/new
 
 Or just answer to this mail and tell me about your opinion and/or give
 feature requests.
 
 Yours
 
 Manuel Reimer
 
 ___
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-28 Thread YUP
OK, thanks, it's good to know such a thing before installing on Archlinux.
Did you mean set PowerKeyIgnoreInhibited to yes in
/etc/systemd/logind.conf ? BTW, could you post a link to your bug report on
systemd?

Yarema


2013/3/27 Manuel Reimer manuel.rei...@gmx.de

 YUP wrote:

 Very cool! Gonna try it. Integration with systemd is very useful.


 Would be very useful, but at least the inhibitor thing, which was intented
 to block systemd from shutting down the system if the button is pressed,
 seems to be broken. So if you use it on systemd-based systems, you have to
 edit /etc/systemd/logind.conf to make systemd ignore the power button.

 But as the official console utility systemd-inhibit is broken, too, it
 doesn't seem to be my code but a bug in systemd itself. I reported this to
 the mailing list and I hope someone can tell me what's going on here.


 Yours

 Manuel Reimer

 __**_
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-**bin/mailman/listinfo/vdrhttp://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-28 Thread Lucian Muresan
On 28.03.2013 09:44, YUP wrote:
 OK, thanks, it's good to know such a thing before installing on
 Archlinux. Did you mean set PowerKeyIgnoreInhibited to yes in
 /etc/systemd/logind.conf ? BTW, could you post a link to your bug report
 on systemd?

What about using this with non-systemd init, does it just work by
actually deactivating or rather replacing acpid? If that's the case, I
could give it a try, but have few more questions:

- I just had a quick look in the git repository, could not find a config
file sample, how should that look like?

- Could the command trigger pattern (the 4 presses on the power button
within a certain time) also be configurable in that config file?

- Is it feasible to extend the functionality to one or two more patterns
to be able to issue different shutdown commands (like a custom
hibernation script for example)?

Regards,
Lucian

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-28 Thread Manuel Reimer

Lucian Muresan wrote:

What about using this with non-systemd init, does it just work by
actually deactivating or rather replacing acpid?


Just execute the binary. It will work without any configuration.

The default behaviour is to fork to background (classic Unix daemon).

If you want to run the daemon in foreground, then call it with the -f 
parameter.


- I just had a quick look in the git repository, could not find a config
file sample, how should that look like?


So far, officially no config file is needed at all, but on vdr-portal.de my 
experimental dbus2vdr support has been tested and seems to work, so if you want 
to use it, create a config file like this:


# echo USE_DBUS=1  /etc/vdrpbd.conf


- Could the command trigger pattern (the 4 presses on the power button
within a certain time) also be configurable in that config file?


I would prefer to not make it configurable, but this is a 0.x version, so if 
someone would prefer some other emergency code (more keypresses, 
shorter/longer time), then let's discuss about this.


My hope is, that if more than one distribution adopts this daemon, we'll have 
*one* standard way to emergency reboot a VDR system.



- Is it feasible to extend the functionality to one or two more patterns
to be able to issue different shutdown commands (like a custom
hibernation script for example)?


I think this should be done in the shutdown.sh or some similar script, that 
gets called by VDR as soon as the short timeout, where you can still stop 
shutdown, is over.


Yours

Manuel

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-28 Thread Manuel Reimer

YUP wrote:

OK, thanks, it's good to know such a thing before installing on Archlinux.
Did you mean set PowerKeyIgnoreInhibited to yes in
/etc/systemd/logind.conf ?


$ echo HandlePowerKey=ignore  /etc/systemd/logind.conf


BTW, could you post a link to your bug report on
systemd?


http://lists.freedesktop.org/archives/systemd-devel/2013-March/009988.html

Let's seem if this is a bug or a feature. If it is a feature (seems to depend on 
the session where inhibitor has been created and power key has been pressed) 
then I can try to find a workaround. If I can't find a workaround, then I'll 
drop this inhibitor stuff and add documentation on how to disable the systemd 
default handling in logind.conf.


Yours

Manuel

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-27 Thread Manuel Reimer

Hello List,

I have written a small daemon, which can replace acpid on VDR systems and was 
written with dedicated VDR systems in mind.


Core Features:
- Faster than acpid with all the required external scripts.
- Emergency reboot feature. You don't loose the power button as safe emergency
  exit button. Just press it four times within three seconds and a clean reboot
  is triggered.
- Very easy to set up. If you want, you can just copy the vdrpbd file to your
  VDR system and execute it. VDR should react to the power button immediately!
- Systemd integration. If systemd is detected, then vdrpbd tries to register
  itself as power button inhibitor. The module Net::DBus is required for
  this to work.

Note that it requires an up-to-date kernel, as the only supported way, to access 
the power button, is the input layer. There is no netlink support and I also 
won't add it.


Download from here:
http://projects.vdr-developer.org/attachments/download/1331/vdrpbd-0.0.1.tar.xz

To post bug reports and feature requests, you may use the ticket system here:
http://projects.vdr-developer.org/projects/vdrpbd/issues/new

Or just answer to this mail and tell me about your opinion and/or give feature 
requests.


Yours

Manuel Reimer

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-27 Thread YUP
Very cool! Gonna try it. Integration with systemd is very useful.
Best,
Yarema
On Mar 27, 2013 6:45 PM, Manuel Reimer manuel.rei...@gmx.de wrote:

 Hello List,

 I have written a small daemon, which can replace acpid on VDR systems and
 was written with dedicated VDR systems in mind.

 Core Features:
 - Faster than acpid with all the required external scripts.
 - Emergency reboot feature. You don't loose the power button as safe
 emergency
   exit button. Just press it four times within three seconds and a clean
 reboot
   is triggered.
 - Very easy to set up. If you want, you can just copy the vdrpbd file to
 your
   VDR system and execute it. VDR should react to the power button
 immediately!
 - Systemd integration. If systemd is detected, then vdrpbd tries to
 register
   itself as power button inhibitor. The module Net::DBus is required
 for
   this to work.

 Note that it requires an up-to-date kernel, as the only supported way, to
 access the power button, is the input layer. There is no netlink support
 and I also won't add it.

 Download from here:
 http://projects.vdr-developer.**org/attachments/download/1331/**
 vdrpbd-0.0.1.tar.xzhttp://projects.vdr-developer.org/attachments/download/1331/vdrpbd-0.0.1.tar.xz

 To post bug reports and feature requests, you may use the ticket system
 here:
 http://projects.vdr-developer.**org/projects/vdrpbd/issues/newhttp://projects.vdr-developer.org/projects/vdrpbd/issues/new

 Or just answer to this mail and tell me about your opinion and/or give
 feature requests.

 Yours

 Manuel Reimer

 __**_
 vdr mailing list
 vdr@linuxtv.org
 http://www.linuxtv.org/cgi-**bin/mailman/listinfo/vdrhttp://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] [ANNOUNCE] VDR Power Button Daemon 0.0.1

2013-03-27 Thread Manuel Reimer

YUP wrote:

Very cool! Gonna try it. Integration with systemd is very useful.


Would be very useful, but at least the inhibitor thing, which was intented to 
block systemd from shutting down the system if the button is pressed, seems to 
be broken. So if you use it on systemd-based systems, you have to edit 
/etc/systemd/logind.conf to make systemd ignore the power button.


But as the official console utility systemd-inhibit is broken, too, it doesn't 
seem to be my code but a bug in systemd itself. I reported this to the mailing 
list and I hope someone can tell me what's going on here.


Yours

Manuel Reimer

___
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr