diff options
author | Manuel Reimer <manuel.reimer@gmx.de> | 2019-07-21 14:58:06 +0200 |
---|---|---|
committer | Manuel Reimer <manuel.reimer@gmx.de> | 2019-07-21 14:58:06 +0200 |
commit | 76bdbe2b2e910e642a2bfc14e73cec21da66bc45 (patch) | |
tree | 67f6517a8509a4c9283253f7fb81cac1c5a4d31b | |
parent | 32c1fd506a107a2a6abd04e86938532bef3af902 (diff) | |
download | vdrpbd-76bdbe2b2e910e642a2bfc14e73cec21da66bc45.tar.gz vdrpbd-76bdbe2b2e910e642a2bfc14e73cec21da66bc45.tar.bz2 |
Fix Kodi support
-rwxr-xr-x | vdrpbd | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -80,8 +80,14 @@ my $KEYQUEUE = Thread::Queue->new(); my $device = GetButtonDevice(); open(my $fhdev, '<', $device) or die("Failed to open $device\n"); - # Get exclusive access to power button device (Disconnect X server) - ioctl($fhdev, EVIOCGRAB, 1) or warn("Failed to get exclusive access!\n"); + # VDR reacts with "Press any key to cancel shutdown" if we send our + # shutdown request. If we let the KEY_POWER through to the X server, then + # this *is* a key press and depending on timing it may cancel shutdown. + # "Kodi mode" is just to not block the key from reaching the X server. + # Kodi properly handles KEY_POWER on its own. + if ($CONF{TARGET} ne 'kodi') { + ioctl($fhdev, EVIOCGRAB, 1) or warn("Failed to get exclusive access!\n"); + } # Register with systemd if needed/possible SystemdInhibit() if ($HAVE_DBUS && HaveSystemd()); @@ -124,10 +130,7 @@ sub KeyProcessor { if ($CONF{TARGET} eq 'dbus') { SendDBus(); } - elsif ($CONF{TARGET} eq 'kodi') { - SendKodi(); - } - else { + elsif ($CONF{TARGET} eq 'svdrp') { SendSVDRP(); } } @@ -257,12 +260,6 @@ sub SendSVDRP { } } -sub SendKodi { - my $sock = ConnectTCP(9090); - print $sock '{"jsonrpc":"2.0","method":"System.Shutdown","id":1}'; - # TODO: Do some "error tracking" here (read back feedback from Kodi?) -} - # This one requires the "dbus2vdr-plugin" to be installed. sub SendDBus { eval { |