Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: 1.1.19 and learning keys without STDIN



Jaakko Hyvätti wrote:
> 
>   Hi all,
> 
> May I suggest this quick fix to handle the case when 1.1.19 tries to
> learn keys without connection to keyboard.  Also closing the input
> descriptor in runvdr script with <&- might be necessary in some
> situations.
> 
> diff -ru old/vdr-1.1.19/vdr.c vdr-1.1.19/vdr.c
> --- old/vdr-1.1.19/vdr.c        Sun Dec  8 15:34:39 2002
> +++ vdr-1.1.19/vdr.c    Mon Dec  9 00:13:11 2002
> @@ -81,7 +81,7 @@
>    // Save terminal settings:
> 
>    struct termios savedTm;
> -  tcgetattr(STDIN_FILENO, &savedTm);
> +  bool has_stdin = !tcgetattr(STDIN_FILENO, &savedTm);
> 
>    // Initiate locale:
> 
> @@ -386,7 +386,7 @@
>    new cLircRemote("/dev/lircd");
>  #endif
>  #if defined(REMOTE_KBD)
> -  if (!DaemonMode)
> +  if (!DaemonMode && has_stdin)
>       new cKbdRemote;
>  #endif
>    Interface->LearnKeys();
> @@ -724,7 +724,8 @@
>    isyslog("exiting");
>    if (SysLogLevel > 0)
>       closelog();
> -  tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
> +  if (has_stdin)
> +     tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
>    if (cThread::EmergencyExit()) {
>       esyslog("emergency exit!");
>       return 1;

I believe this should be extended to also check whether VDR is running in
background, since in that case it makes no sense to access the keyboard:

  bool has_stdin = tcgetpgrp(STDIN_FILENO) == getpid() && !tcgetattr(STDIN_FILENO, &savedTm);

Klaus
-- 
_______________________________________________________________

Klaus Schmidinger                       Phone: +49-8635-6989-10
CadSoft Computer GmbH                   Fax:   +49-8635-6989-40
Hofmark 2                               Email:   kls@cadsoft.de
D-84568 Pleiskirchen, Germany           URL:     www.cadsoft.de
_______________________________________________________________


--
Info:
To unsubscribe send a mail to listar@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index