summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTORS3
-rw-r--r--HISTORY13
-rw-r--r--INSTALL10
-rw-r--r--Makefile10
-rw-r--r--osd.c14
-rw-r--r--osd.h4
-rw-r--r--remote.c65
-rw-r--r--remote.h9
-rw-r--r--vdr.c19
9 files changed, 94 insertions, 53 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 4251460c..97090265 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -501,3 +501,6 @@ Emil Naepflein <Emil.Naepflein@philosys.de>
Gerald Berwolf <genka@genka.de>
for suggesting to deactivate some templates in tools.h in case some plugin needs to
use the STL
+
+Thomas Sailer <sailer@scs.ch>
+ for pointing out how to set the terminal parameters to read from the keyboard
diff --git a/HISTORY b/HISTORY
index c5f7d95e..d189379d 100644
--- a/HISTORY
+++ b/HISTORY
@@ -1837,7 +1837,7 @@ Video Disk Recorder Revision History
- The new plugin 'sky' can be used to integrate a Sky Digibox into the VDR system,
using a Kfir MPEG2 encoder card (see PLUGINS/src/sky/README for details).
-2002-12-07: Version 1.1.19
+2002-12-08: Version 1.1.19
- The character '|' in description texts of EPG records is now interpreted as a
newline character (suggested by Gerhard Steiner).
@@ -1851,3 +1851,14 @@ Video Disk Recorder Revision History
in testing this). Since switching channels now no longer explicitly waits for a
channel lock in the foreground thread, the "panic level" mechanism is no longer
used (maybe we don't need it nay more, anyway).
+- The keyboard is now by default always active to control VDR. The 'make' option
+ REMOTE=KBD is therefore obsolete. When compiling VDR with REMOTE=RCU or REMOTE=LIRC,
+ the keyboard can thus now be active together with the remote control. If you want
+ to build VDR _without_ keyboard support you can set NO_KBD=1 in the 'make' call.
+ Since the keyboard codes are now different from the ones used previously (which
+ were mapped by the 'ncurses' library) you will need to go through the "Learning
+ keys" procedure again. To do so, either delete the file /video/remote.conf or
+ remove the KBD.* entries from it before starting this version of VDR.
+ (Thanks to Thomas Sailer for pointing out how to set the terminal parameters to
+ read from the keyboard).
+- The 'ncurses' library is now only necessary when compiling VDR with DEBUG_OSD=1.
diff --git a/INSTALL b/INSTALL
index 841575d4..8e61605d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -26,17 +26,17 @@ installed.
IMPORTANT: See "Configuration files" below for information on how
========= to set up the configuration files at the proper location!
-The 'vdr' program can be controlled via the PC keyboard or
-an infrared remote control unit. Define the REMOTE macro to one of the
-following values 'make' call to activate the respective control mode:
+By default the 'vdr' program can be controlled via the PC keyboard. If you have
+an infrared remote control unit you can define the REMOTE macro to one of the
+following values in the 'make' call to activate the respective control mode:
- REMOTE=KBD control via the PC keyboard (default)
REMOTE=RCU control via the "Remote Control Unit" receiver
(see http://www.cadsoft.de/vdr/remote.htm)
REMOTE=LIRC control via the "Linux Infrared Remote Control"
(see http://www.lirc.org)
- REMOTE=NONE no remote control (in case only SVDRP shall be used)
+If you want to disable control via the PC keyboard, you can add NO_KBD=1
+to the 'make' call.
Adding "DEBUG_OSD=1" will use the PC screen (or current window)
to display texts instead of the DVB card's on-screen display
interface. These modes are useful when testing new menus if you
diff --git a/Makefile b/Makefile
index 1494cd64..7d169ce6 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
-# $Id: Makefile 1.52 2002/11/29 15:23:02 kls Exp $
+# $Id: Makefile 1.53 2002/12/08 12:20:37 kls Exp $
.DELETE_ON_ERROR:
@@ -38,12 +38,8 @@ OBJS = audio.o channels.o config.o cutter.o device.o diseqc.o dvbdevice.o dvbosd
OSDFONT = -adobe-helvetica-medium-r-normal--23-*-100-100-p-*-iso8859-1
FIXFONT = -adobe-courier-bold-r-normal--25-*-100-100-m-*-iso8859-1
-ifndef REMOTE
-REMOTE = KBD
-endif
-
-ifeq ($(REMOTE), KBD)
-NCURSESLIB = -lncurses
+ifndef NO_KBD
+DEFINES += -DREMOTE_KBD
endif
DEFINES += -DREMOTE_$(REMOTE)
diff --git a/osd.c b/osd.c
index eb0d2dc5..76229556 100644
--- a/osd.c
+++ b/osd.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.c 1.38 2002/11/16 14:20:26 kls Exp $
+ * $Id: osd.c 1.39 2002/12/08 13:17:13 kls Exp $
*/
#include "osd.h"
@@ -26,15 +26,8 @@
void cOsd::Initialize(void)
{
-#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
- initscr();
- keypad(stdscr, true);
- nonl();
- cbreak();
- noecho();
- timeout(10);
-#endif
#if defined(DEBUG_OSD)
+ initscr();
start_color();
leaveok(stdscr, true);
#endif
@@ -43,7 +36,7 @@ void cOsd::Initialize(void)
void cOsd::Shutdown(void)
{
Close();
-#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
+#if defined(DEBUG_OSD)
endwin();
#endif
}
@@ -150,6 +143,7 @@ void cOsd::Clear(void)
#ifdef DEBUG_OSD
SetColor(clrBackground, clrBackground);
Fill(0, 0, cols, rows, clrBackground);
+ refresh();
#else
osd->Clear();
#endif
diff --git a/osd.h b/osd.h
index 2cd2f4bf..5f1ec96f 100644
--- a/osd.h
+++ b/osd.h
@@ -4,13 +4,13 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: osd.h 1.37 2002/11/24 10:32:29 kls Exp $
+ * $Id: osd.h 1.38 2002/12/08 12:21:26 kls Exp $
*/
#ifndef __OSD_H
#define __OSD_H
-#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
+#if defined(DEBUG_OSD)
#include <ncurses.h>
#endif
#include "config.h"
diff --git a/remote.c b/remote.c
index 03d2a9c9..d4f1702b 100644
--- a/remote.c
+++ b/remote.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.c 1.33 2002/12/07 11:48:10 kls Exp $
+ * $Id: remote.c 1.34 2002/12/08 13:37:13 kls Exp $
*/
#include "remote.h"
@@ -13,13 +13,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/time.h>
-#include <termios.h>
#include <unistd.h>
-
-#if defined REMOTE_KBD
-#include <ncurses.h>
-#endif
-
#include "tools.h"
// --- cRemote ---------------------------------------------------------------
@@ -155,30 +149,65 @@ cRemotes Remotes;
// --- cKbdRemote ------------------------------------------------------------
-#if defined REMOTE_KBD
-
cKbdRemote::cKbdRemote(void)
:cRemote("KBD")
{
+ active = false;
+ tcgetattr(STDIN_FILENO, &savedTm);
+ struct termios tm;
+ if (tcgetattr(STDIN_FILENO, &tm) == 0) {
+ tm.c_iflag = 0;
+ tm.c_lflag &= ~(ICANON | ECHO);
+ tm.c_cc[VMIN] = 0;
+ tm.c_cc[VTIME] = 0;
+ tcsetattr(STDIN_FILENO, TCSANOW, &tm);
+ }
Start();
}
cKbdRemote::~cKbdRemote()
{
- Cancel();
+ active = false;
+ Cancel(3);
+ tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
}
void cKbdRemote::Action(void)
{
dsyslog("KBD remote control thread started (pid=%d)", getpid());
cPoller Poller(STDIN_FILENO);
- for (;;) {//XXX
- int Command = getch();
- if (Command != EOF)
- Put(Command);
- Poller.Poll(100);
- }
+ active = true;
+ while (active) {
+ if (Poller.Poll(100)) {
+ uint64 Command = 0;
+ uint i = 0;
+ int t0 = time_ms();
+ while (active && i < sizeof(Command)) {
+ uchar ch;
+ int r = read(STDIN_FILENO, &ch, 1);
+ if (r == 1) {
+ Command <<= 8;
+ Command |= ch;
+ i++;
+ }
+ else if (r == 0) {
+ // don't know why, but sometimes special keys that start with
+ // 0x1B ('ESC') cause a short gap between the 0x1B and the rest
+ // of their codes, so we'll need to wait some 100ms to see if
+ // there is more coming up - or whether this really is the 'ESC'
+ // key (if somebody knows how to clean this up, please let me know):
+ if (Command == 0x1B && time_ms() - t0 < 100)
+ continue;
+ if (Command)
+ Put(Command);
+ break;
+ }
+ else {
+ LOG_ERROR;
+ break;
+ }
+ }
+ }
+ }
dsyslog("KBD remote control thread ended (pid=%d)", getpid());
}
-
-#endif
diff --git a/remote.h b/remote.h
index 2aeec78c..1c087d0f 100644
--- a/remote.h
+++ b/remote.h
@@ -4,13 +4,14 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remote.h 1.21 2002/12/01 10:39:10 kls Exp $
+ * $Id: remote.h 1.22 2002/12/08 13:37:02 kls Exp $
*/
#ifndef __REMOTE_H
#define __REMOTE_H
#include <stdio.h>
+#include <termios.h>
#include <time.h>
#include "keys.h"
#include "thread.h"
@@ -50,16 +51,14 @@ class cRemotes : public cList<cRemote> {};
extern cRemotes Remotes;
-#if defined REMOTE_KBD
-
class cKbdRemote : public cRemote, private cThread {
private:
+ bool active;
+ struct termios savedTm;
virtual void Action(void);
public:
cKbdRemote(void);
virtual ~cKbdRemote();
};
-#endif
-
#endif //__REMOTE_H
diff --git a/vdr.c b/vdr.c
index 438f98fe..8f22f11b 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,13 +22,14 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
- * $Id: vdr.c 1.136 2002/12/01 10:44:48 kls Exp $
+ * $Id: vdr.c 1.137 2002/12/08 13:34:39 kls Exp $
*/
#include <getopt.h>
#include <locale.h>
#include <signal.h>
#include <stdlib.h>
+#include <termios.h>
#include <unistd.h>
#include "audio.h"
#include "channels.h"
@@ -77,6 +78,11 @@ static void Watchdog(int signum)
int main(int argc, char *argv[])
{
+ // Save terminal settings:
+
+ struct termios savedTm;
+ tcgetattr(STDIN_FILENO, &savedTm);
+
// Initiate locale:
setlocale(LC_ALL, "");
@@ -294,7 +300,7 @@ int main(int argc, char *argv[])
// Daemon mode:
if (DaemonMode) {
-#if !defined(DEBUG_OSD) && !defined(REMOTE_KBD)
+#if !defined(DEBUG_OSD)
pid_t pid = fork();
if (pid < 0) {
fprintf(stderr, "%m\n");
@@ -307,7 +313,7 @@ int main(int argc, char *argv[])
fclose(stdout);
fclose(stderr);
#else
- fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD or REMOTE_KBD on!\n");
+ fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD on!\n");
return 2;
#endif
}
@@ -378,8 +384,10 @@ int main(int argc, char *argv[])
new cRcuRemote("/dev/ttyS1");
#elif defined(REMOTE_LIRC)
new cLircRemote("/dev/lircd");
-#elif defined(REMOTE_KBD)
- new cKbdRemote;
+#endif
+#if defined(REMOTE_KBD)
+ if (!DaemonMode)
+ new cKbdRemote;
#endif
Interface->LearnKeys();
@@ -716,6 +724,7 @@ int main(int argc, char *argv[])
isyslog("exiting");
if (SysLogLevel > 0)
closelog();
+ tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
if (cThread::EmergencyExit()) {
esyslog("emergency exit!");
return 1;