Commit 48fd2b04 authored by Klaus Schmidinger's avatar Klaus Schmidinger

Version 1.1.20

- Now checking if there is a connection to the keyboard (thanks to Jaakko Hyvätti)
  and only creating the KBD remote control if VDR is running in the foreground.
- Fixed taking an active SVDRP connection into account when doing shutdown (thanks
  to Gregoire Favre for reporting this one).
- Changed setting of CXX and CXXFLAGS variables in Makefile, so that an externally
  defined value will be taken if present (suggested by Robert Schiele).
  Plugin authors should please change the lines

  CXX      = g++
  CXXFLAGS = -O2 -Wall -Woverloaded-virtual

  in their Makefile to

  CXX      ?= g++
  CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual

- Fixed recording overlapping timers on the same channel in case
  DO_REC_AND_PLAY_ON_PRIMARY_DEVICE and/or DO_MULTIPLE_RECORDINGS is not defined
  (thanks to Jaakko Hyvätti).
- No longer stopping/restarting the DMX when switching audio channels (thanks to
  Sven Goethel).
- Fixed high CPU load in 'Transfer Mode' (thanks to Oliver Endriss).
- If a PC keyboard is used as remote control, the string entry fields in the
  menus now accept character input directly (however, this works only for keys that
  are not otherwise defined as remote control keys). Also, plugins can switch the
  cKbdRemote class into "raw mode", where all keyboard input will be made available
  through the new 'kKbd' key code and none of it will be processed as normal remote
  control functions (thanks to Jan Rieger for suggestions and testing).
- Fixed deleting characters in string entry fields in 'insert' mode.
- Now using "Doxygen" to generate source documentation (thanks to Walter Stroebel
  for providing an initial 'Doxyfile' configuration and adjusting some comments).
  See INSTALL for information how to do this. Some function descriptions have
  already been adapted to Doxygen, more will follow.
parent 2b15337b
......@@ -386,6 +386,7 @@ Rudi Hofer (Rudi.Hofer@cadsoft.de)
Gregoire Favre <greg@ulima.unil.ch>
for fixing some function headers to make them compile with gcc 3.x
for reporting a bug in taking an active SVDRP connection into account when doing shutdown
Sven Grothklags <sven@uni-paderborn.de>
for fixing the cutting mechanism to make it re-sync in case a frame is larger
......@@ -438,6 +439,7 @@ Oliver Endriss <o.endriss@gmx.de>
it kicked in
for providing examples for 'diseqc.conf'
for improving deleting stale lock files
for fixing high CPU load in 'Transfer Mode'
Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf'
......@@ -453,6 +455,8 @@ Andy Carter <fruit@ukgateway.net>
Robert Schiele <rschiele@uni-mannheim.de>
for his help in keeping 'channels.conf.cable' up to date
for reporting some faulty default parameter initializations
for suggesting to only set the Makefile variables CXX and CXXFLAGS if they are not
yet defined
Gerhard Steiner <steiner@mail.austria.com>
for suggesting that the SVDRP command PUTE shall trigger an immediate write of
......@@ -464,6 +468,9 @@ Gerhard Steiner <steiner@mail.austria.com>
Jaakko Hyvätti <jaakko@hyvatti.iki.fi>
for translating OSD texts to the Finnish language
for adding a check if there is a connection to the keyboard
for fixing recording overlapping timers on the same channel in case
DO_REC_AND_PLAY_ON_PRIMARY_DEVICE and/or DO_MULTIPLE_RECORDINGS is not defined
Dennis Noordsij <dennis.noordsij@wiral.com>
for reporting a small glitch when switching channels
......@@ -504,3 +511,12 @@ Gerald Berwolf <genka@genka.de>
Thomas Sailer <sailer@scs.ch>
for pointing out how to set the terminal parameters to read from the keyboard
Sven Goethel <sgoethel@jausoft.com>
for making switching audio channels work without stopping/restarting the DMX
Jan Rieger <jan@ricomp.de>
for suggestions and testing raw keyboard input
Walter Stroebel <walter.stroebel@lifeline.nl>
for introducing "Doxygen" to document the VDR source code
This diff is collapsed.
......@@ -1850,7 +1850,7 @@ Video Disk Recorder Revision History
This also makes "Motor-DiSEqC" work (thanks to Reinhard Walter Buchner for his help
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).
used (maybe we don't need it any 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
......@@ -1862,3 +1862,39 @@ Video Disk Recorder Revision History
(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.
2002-12-15: Version 1.1.20
- Now checking if there is a connection to the keyboard (thanks to Jaakko Hyvätti)
and only creating the KBD remote control if VDR is running in the foreground.
- Fixed taking an active SVDRP connection into account when doing shutdown (thanks
to Gregoire Favre for reporting this one).
- Changed setting of CXX and CXXFLAGS variables in Makefile, so that an externally
defined value will be taken if present (suggested by Robert Schiele).
Plugin authors should please change the lines
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
in their Makefile to
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
- Fixed recording overlapping timers on the same channel in case
DO_REC_AND_PLAY_ON_PRIMARY_DEVICE and/or DO_MULTIPLE_RECORDINGS is not defined
(thanks to Jaakko Hyvätti).
- No longer stopping/restarting the DMX when switching audio channels (thanks to
Sven Goethel).
- Fixed high CPU load in 'Transfer Mode' (thanks to Oliver Endriss).
- If a PC keyboard is used as remote control, the string entry fields in the
menus now accept character input directly (however, this works only for keys that
are not otherwise defined as remote control keys). Also, plugins can switch the
cKbdRemote class into "raw mode", where all keyboard input will be made available
through the new 'kKbd' key code and none of it will be processed as normal remote
control functions (thanks to Jan Rieger for suggestions and testing).
- Fixed deleting characters in string entry fields in 'insert' mode.
- Now using "Doxygen" to generate source documentation (thanks to Walter Stroebel
for providing an initial 'Doxyfile' configuration and adjusting some comments).
See INSTALL for information how to do this. Some function descriptions have
already been adapted to Doxygen, more will follow.
......@@ -357,3 +357,11 @@ If you prefer different key assignments, or if the default doesn't work for
your keyboard, simply delete the file 'remote.conf' and restart 'vdr' to get
into learning mode.
Generating source code documentation:
-------------------------------------
You can do a 'make srcdoc' to generate source code documentation using the
Doxygen tool. To do so you need the Doxygen package from http://www.doxygen.src
and the Graphviz package from http://www.research.att.com/sw/tools/graphviz.
After installing these two packages you can do 'make srcdoc' and then use your
HTML browser to read srcdoc/html/index.html.
......@@ -4,15 +4,15 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: Makefile 1.53 2002/12/08 12:20:37 kls Exp $
# $Id: Makefile 1.55 2002/12/15 15:15:55 kls Exp $
.DELETE_ON_ERROR:
CC = gcc
CFLAGS = -O2
CC ?= gcc
CFLAGS ?= -O2
CXX = g++
CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual
DVBDIR = ../DVB
DTVDIR = ./libdtv
......@@ -23,6 +23,9 @@ PLUGINDIR= ./PLUGINS
VIDEODIR = /video
DOXYGEN = /usr/bin/doxygen
DOXYFILE = Doxyfile
-include Make.config
INCLUDES = -I$(DVBDIR)/include
......@@ -122,12 +125,21 @@ install:
cp *.conf $(VIDEODIR);\
fi
# Source documentation:
srcdoc:
@cp $(DOXYFILE) $(DOXYFILE).tmp
@echo PROJECT_NUMBER = `grep VDRVERSION config.h | awk '{ print $$3 }'` >> $(DOXYFILE).tmp
$(DOXYGEN) $(DOXYFILE).tmp
@rm $(DOXYFILE).tmp
# Housekeeping:
clean:
$(MAKE) -C $(DTVDIR) clean
-rm -f $(OBJS) $(DEPFILE) vdr genfontfile genfontfile.o core* *~
-rm -rf include
-rm -rf srcdoc
fontclean:
-rm -f fontfix.c fontosd.c
CLEAN: clean fontclean
......
......@@ -41,3 +41,7 @@ VDR Plugin 'hello' Revision History
2002-11-23: Version 0.0.9
- Changed return type of MainMenuAction().
2002-12-13: Version 0.1.0
- Changed setting of CXX and CXXFLAGS variables in Makefile.
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 1.7 2002/11/01 13:44:11 kls Exp $
# $Id: Makefile 1.8 2002/12/13 14:54:14 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
......@@ -15,8 +15,8 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
### The directory environment:
......
......@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: hello.c 1.10 2002/11/23 15:07:28 kls Exp $
* $Id: hello.c 1.11 2002/12/13 15:01:43 kls Exp $
*/
#include <getopt.h>
......@@ -12,7 +12,7 @@
#include <vdr/plugin.h>
#include "i18n.h"
static const char *VERSION = "0.0.9";
static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = "A friendly greeting";
static const char *MAINMENUENTRY = "Hello";
......
......@@ -4,3 +4,7 @@ VDR Plugin 'osddemo' Revision History
2002-11-23: Version 0.0.1
- Initial revision.
2002-12-13: Version 0.1.0
- Changed setting of CXX and CXXFLAGS variables in Makefile.
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 1.1 2002/11/23 14:56:44 kls Exp $
# $Id: Makefile 1.2 2002/12/13 14:54:29 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
......@@ -15,8 +15,8 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
### The directory environment:
......
......@@ -3,12 +3,12 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: osddemo.c 1.1 2002/11/24 10:32:59 kls Exp $
* $Id: osddemo.c 1.2 2002/12/13 15:02:01 kls Exp $
*/
#include <vdr/plugin.h>
static const char *VERSION = "0.0.1";
static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = "Demo of arbitrary OSD setup";
static const char *MAINMENUENTRY = "Osd Demo";
......
......@@ -4,3 +4,7 @@ VDR Plugin 'sky' Revision History
2002-12-01: Version 0.0.1
- Initial revision.
2002-12-13: Version 0.1.0
- Changed setting of CXX and CXXFLAGS variables in Makefile.
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 1.1 2002/11/01 13:45:13 kls Exp $
# $Id: Makefile 1.2 2002/12/13 14:54:24 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
......@@ -15,8 +15,8 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
### The directory environment:
......
......@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: sky.c 1.1 2002/10/26 16:27:13 kls Exp $
* $Id: sky.c 1.2 2002/12/13 15:01:57 kls Exp $
*/
#include <sys/socket.h>
......@@ -14,7 +14,7 @@
#include <vdr/plugin.h>
#include <vdr/sources.h>
static const char *VERSION = "0.0.1";
static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = "Sky Digibox interface";
// --- cDigiboxDevice --------------------------------------------------------
......
......@@ -27,3 +27,7 @@ VDR Plugin 'status' Revision History
2002-11-23: Version 0.0.6
- Changed return type of MainMenuAction().
2002-12-13: Version 0.1.0
- Changed setting of CXX and CXXFLAGS variables in Makefile.
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 1.5 2002/11/01 13:44:25 kls Exp $
# $Id: Makefile 1.6 2002/12/13 14:54:19 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
......@@ -15,8 +15,8 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
### The directory environment:
......
......@@ -3,13 +3,13 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: status.c 1.6 2002/11/23 15:07:40 kls Exp $
* $Id: status.c 1.7 2002/12/13 15:01:53 kls Exp $
*/
#include <vdr/plugin.h>
#include <vdr/status.h>
static const char *VERSION = "0.0.6";
static const char *VERSION = "0.1.0";
static const char *DESCRIPTION = "Status monitor test";
static const char *MAINMENUENTRY = NULL;
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.143 2002/12/06 14:17:55 kls Exp $
* $Id: config.h 1.144 2002/12/13 13:41:55 kls Exp $
*/
#ifndef __CONFIG_H
......@@ -19,7 +19,7 @@
#include "device.h"
#include "tools.h"
#define VDRVERSION "1.1.19"
#define VDRVERSION "1.1.20"
#define MAXPRIORITY 99
#define MAXLIFETIME 99
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.c 1.38 2002/12/07 14:50:46 kls Exp $
* $Id: dvbdevice.c 1.40 2002/12/14 10:52:13 kls Exp $
*/
#include "dvbdevice.h"
......@@ -537,31 +537,26 @@ bool cDvbDevice::ProvidesChannel(const cChannel *Channel, int Priority, bool *Ne
bool needsDetachReceivers = true;
if (ProvidesSource(Channel->Source()) && ProvidesCa(Channel->Ca())) {
#ifdef DO_MULTIPLE_RECORDINGS
result = hasPriority;
if (Receiving()) {
if (dvbTuner->IsTunedTo(Channel)) {
needsDetachReceivers = false;
if (!HasPid(Channel->Vpid())) {
if (Channel->Ca() > CACONFBASE) {
#ifdef DO_MULTIPLE_RECORDINGS
if (Channel->Ca() > CACONFBASE)
needsDetachReceivers = true;
result = hasPriority;
}
else if (!IsPrimaryDevice())
result = true;
#ifdef DO_REC_AND_PLAY_ON_PRIMARY_DEVICE
else
result = Priority >= Setup.PrimaryLimit;
#endif
#endif
}
else
result = !IsPrimaryDevice() || Priority >= Setup.PrimaryLimit;
}
else
result = hasPriority;
}
else
#endif
result = hasPriority;
}
if (NeedsDetachReceivers)
*NeedsDetachReceivers = needsDetachReceivers;
......@@ -691,11 +686,9 @@ const char **cDvbDevice::GetAudioTracksDevice(int *CurrentTrack) const
void cDvbDevice::SetAudioTrackDevice(int Index)
{
if (0 <= Index && Index < NumAudioTracksDevice()) {
int vpid = pidHandles[ptVideo].pid; // need to turn video PID off/on to restart demux
DelPid(vpid);
DelPid(pidHandles[ptAudio].pid);
AddPid(Index ? aPid2 : aPid1, ptAudio);
AddPid(vpid, ptVideo);
int Pid = Index ? aPid2 : aPid1;
pidHandles[ptAudio].pid = Pid;
SetPid(&pidHandles[ptAudio], ptAudio, true);
}
}
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbdevice.h 1.19 2002/12/07 14:44:29 kls Exp $
* $Id: dvbdevice.h 1.20 2002/12/15 14:45:29 kls Exp $
*/
#ifndef __DVBDEVICE_H
......@@ -24,15 +24,18 @@
class cDvbTuner;
/// The cDvbDevice implements a DVB device which can be accessed through the Linux DVB driver API.
class cDvbDevice : public cDevice {
friend class cDvbOsd;
private:
static bool Probe(const char *FileName);
// Probes for existing DVB devices.
///< Probes for existing DVB devices.
public:
static bool Initialize(void);
// Initializes the DVB devices.
// Must be called before accessing any DVB functions.
///< Initializes the DVB devices.
///< Must be called before accessing any DVB functions.
///< \return True if any devices are available.
private:
fe_type_t frontendType;
int fd_osd, fd_audio, fd_video, fd_dvr;
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: keys.h 1.4 2002/12/01 10:43:26 kls Exp $
* $Id: keys.h 1.5 2002/12/14 15:49:42 kls Exp $
*/
#ifndef __KEYS_H
......@@ -46,6 +46,7 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
kCommands,
kUser1, kUser2, kUser3, kUser4, kUser5, kUser6, kUser7, kUser8, kUser9,
kNone,
kKbd,
// The following codes are used internally:
k_Plugin,
k_Setup,
......@@ -69,6 +70,10 @@ enum eKeys { // "Up" and "Down" must be the first two keys!
#define NORMALKEY(k) (eKeys((k) & ~k_Repeat))
#define ISMODELESSKEY(k) (RAWKEY(k) > k9)
#define BASICKEY(k) (eKeys((k) & 0xFFFF))
#define KBDKEY(k) (eKeys(((k) << 16) | kKbd))
#define KEYKBD(k) (((k) >> 16) & 0xFFFF)
struct tKey {
eKeys type;
char *name;
......
......@@ -30,8 +30,8 @@
.DELETE_ON_ERROR:
CC = gcc
CFLAGS = -O2 -g -Wmissing-prototypes -Wstrict-prototypes \
CC ?= gcc
CFLAGS ?= -O2 -g -Wmissing-prototypes -Wstrict-prototypes \
-DNAPI -Wimplicit -D__USE_FIXED_PROTOTYPES__ # -ansi -pedantic
INCDIRS = -Iinclude -I../include
......
......@@ -27,8 +27,8 @@
#
#
#
CC = gcc
CFLAGS = -O2 -g -Wmissing-prototypes -Wstrict-prototypes \
CC ?= gcc
CFLAGS ?= -O2 -g -Wmissing-prototypes -Wstrict-prototypes \
-Wimplicit -D__USE_FIXED_PROTOTYPES__ -I../include # -DDEBUG
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menuitems.c 1.9 2002/09/08 14:51:28 kls Exp $
* $Id: menuitems.c 1.11 2002/12/15 11:05:19 kls Exp $
*/
#include "menuitems.h"
......@@ -262,7 +262,8 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
case kYellow: // Remove the character at current position; in insert mode it is the character to the right of cursor
if (pos >= 0) {
if (strlen(value) > 1) {
memmove(value + pos, value + pos + 1, strlen(value) - pos);
if (!insert || pos < int(strlen(value)) - 1)
memmove(value + pos, value + pos + 1, strlen(value) - pos);
// reduce position, if we removed the last character
if (pos == int(strlen(value)))
pos--;
......@@ -284,7 +285,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
uppercase = isupper(value[pos]);
break;
case kRight|k_Repeat:
case kRight: if (pos < length && pos < int(strlen(value)) ) {
case kRight: if (pos < length - 2 && pos < int(strlen(value)) ) {
if (++pos >= int(strlen(value))) {
if (pos >= 2 && value[pos - 1] == ' ' && value[pos - 2] == ' ')
pos--; // allow only two blanks at the end
......@@ -306,7 +307,7 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
case kDown: if (pos >= 0) {
if (insert && newchar) {
// create a new character in insert mode
if (int(strlen(value)) < length) {
if (int(strlen(value)) < length - 1) {
memmove(value + pos + 1, value + pos, strlen(value) - pos + 1);
value[pos] = ' ';
}
......@@ -328,7 +329,44 @@ eOSState cMenuEditStrItem::ProcessKey(eKeys Key)
break;
}
// run into default
default: return cMenuEditItem::ProcessKey(Key);
default: if (pos >= 0 && BASICKEY(Key) == kKbd) {
int c = KEYKBD(Key);
if (c <= 0xFF) {
const char *p = strchr(allowed, tolower(c));
if (p) {
int l = strlen(value);
if (insert && l < length - 1)
memmove(value + pos + 1, value + pos, l - pos + 1);
value[pos] = c;
if (pos < length - 2)
pos++;
if (pos >= l) {
value[pos] = ' ';
value[pos + 1] = 0;
}
}
else {
switch (c) {
case 0x7F: // backspace
if (pos > 0) {
pos--;
return ProcessKey(kYellow);
}
break;
}
}
}
else {
switch (c) {
case kfHome: pos = 0; break;
case kfEnd: pos = strlen(value) - 1; break;
case kfIns: return ProcessKey(kGreen);
case kfDel: return ProcessKey(kYellow);
}
}
}
else
return cMenuEditItem::ProcessKey(Key);
}
Set();
return osContinue;
......
......@@ -12,7 +12,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: newplugin 1.13 2002/11/29 15:23:54 kls Exp $
# $Id: newplugin 1.14 2002/12/13 14:51:46 kls Exp $
$PLUGIN_NAME = $ARGV[0] || die "Usage: newplugin <name>\n";
......@@ -70,8 +70,8 @@ VERSION = \$(shell grep 'static const char \\*VERSION *=' \$(PLUGIN).c | awk '{
### The C++ compiler and options:
CXX = g++
CXXFLAGS = -O2 -Wall -Woverloaded-virtual
CXX ?= g++
CXXFLAGS ?= -O2 -Wall -Woverloaded-virtual
### The directory environment:
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.c 1.34 2002/12/08 13:37:13 kls Exp $
* $Id: remote.c 1.36 2002/12/15 15:58:59 kls Exp $
*/
#include "remote.h"
......@@ -149,6 +149,40 @@ cRemotes Remotes;
// --- cKbdRemote ------------------------------------------------------------
struct tKbdMap {
eKbdFunc func;
uint64 code;
};
static tKbdMap KbdMap[] = {
{ kfF1, 0x0000001B5B31317EULL },
{ kfF2, 0x0000001B5B31327EULL },
{ kfF3, 0x0000001B5B31337EULL },
{ kfF4, 0x0000001B5B31347EULL },
{ kfF5, 0x0000001B5B31357EULL },
{ kfF6, 0x0000001B5B31377EULL },
{ kfF7, 0x0000001B5B31387EULL },
{ kfF8, 0x0000001B5B31397EULL },
{ kfF9, 0x0000001B5B32307EULL },
{ kfF10, 0x0000001B5B32317EULL },
{ kfF11, 0x0000001B5B32327EULL },
{ kfF12, 0x0000001B5B32337EULL },
{ kfUp, 0x00000000001B5B41ULL },
{ kfDown, 0x00000000001B5B42ULL },
{ kfLeft, 0x00000000001B5B44ULL },
{ kfRight, 0x00000000001B5B43ULL },
{ kfHome, 0x00000000001B5B48ULL },
{ kfEnd, 0x00000000001B5B46ULL },
{ kfPgUp, 0x000000001B5B357EULL },
{ kfPgDown, 0x000000001B5B367EULL },
{ kfIns, 0x000000001B5B327EULL },
{ kfDel, 0x000000001B5B337EULL },
{ kfNone, 0x0000000000000000ULL }
};
bool cKbdRemote::kbdAvailable = false;
bool cKbdRemote::rawMode = false;
cKbdRemote::cKbdRemote(void)
:cRemote("KBD")
{
......@@ -162,16 +196,41 @@ cKbdRemote::cKbdRemote(void)
tm.c_cc[VTIME] = 0;
tcsetattr(STDIN_FILENO, TCSANOW, &tm);
}
kbdAvailable = true;
Start();
}
cKbdRemote::~cKbdRemote()
{
kbdAvailable = false;
active = false;
Cancel(3);
tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
}
void cKbdRemote::SetRawMode(bool RawMode)
{
rawMode = RawMode;
}
uint64 cKbdRemote::MapFuncToCode(int Func)
{
for (tKbdMap *p = KbdMap; p->func != kfNone; p++) {
if (p->func == Func)
return p->code;
}
return (Func <= 0xFF) ? Func : 0;
}
int cKbdRemote::MapCodeToFunc(uint64 Code)
{
for (tKbdMap *p = KbdMap; p->func != kfNone; p++) {
if (p->code == Code)
return p->func;
}
return (Code <= 0xFF) ? Code : kfNone;
}
void cKbdRemote::Action(void)
{
dsyslog("KBD remote control thread started (pid=%d)", getpid());
......@@ -198,8 +257,13 @@ void cKbdRemote::Action(void)
// 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);
if (Command) {
if (rawMode || !Put(Command)) {
int func = MapCodeToFunc(Command);
if (func)
Put(KBDKEY(func));
}
}
break;
}
else {
......
......@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remote.h 1.22 2002/12/08 13:37:02 kls Exp $
* $Id: remote.h 1.24 2002/12/15 15:49:06 kls Exp $
*/
#ifndef __REMOTE_H
......@@ -51,14 +51,46 @@ class cRemotes : public cList<cRemote> {};
extern cRemotes Remotes;
enum eKbdFunc {
kfNone,
kfF1 = 0x100,
kfF2,
kfF3,
kfF4,
kfF5,
kfF6,
kfF7,
kfF8,
kfF9,
kfF10,
kfF11,
kfF12,
kfUp,
kfDown,
kfLeft,
kfRight,
kfHome,
kfEnd,
kfPgUp,
kfPgDown,
kfIns,
kfDel,
};
class cKbdRemote : public cRemote, private cThread {
private:
bool active;
static bool kbdAvailable;
static bool rawMode;
struct termios savedTm;
virtual void Action(void);
int MapCodeToFunc(uint64 Code);
public:
cKbdRemote(void);
virtual ~cKbdRemote();