summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-09-20 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-09-20 18:00:00 +0200
commit7e4b4d290570aee1d24241b0e0ac10e7c8148a36 (patch)
tree699b8f551fb4a2deb3c79030d57a56e5f04fc1a4 /remote.c
parent76c331181a23f97d5e3f2b55c4741ef4e521242d (diff)
downloadvdr-patch-lnbsharing-7e4b4d290570aee1d24241b0e0ac10e7c8148a36.tar.gz
vdr-patch-lnbsharing-7e4b4d290570aee1d24241b0e0ac10e7c8148a36.tar.bz2
Version 0.64vdr-0.64
- NOTE: If you are using DVB driver version 0.7 you need to load the dvb.o module with option outstream=0, so your insmod statement should read 'insmod dvb.o outstream=0'. This is currently necessary because 'vdr' still works with AV_PES data. - Video files now have the 'group read' bit set. - Fixed handling errors in 'readstring()'. - Handling SIGPIPE and re-establishing handler after intercepting a signal. - The configuration files are now by default read from the video directory. This can be changed by using the new '-c' option. Make sure you copy your current '*.conf' files to your video directory ('/video' by default), or use "-c ." to get the old behaviour of loading the configuration files from the current directory. - Waiting for input is now handled by a common function, which improves response time on user actions. As a consequence the EIT data may sometimes not be displayed, but this will change later when cEIT runs as a separate thread. - The new SVDRP command 'HITK' (thanks to Guido Fiala!) can be used to 'hit' a remote control key. Establish an SVDRP connection and enter HITK without a parameter for a list of all valid key names. - The new SVDRP command 'GRAB' (thanks to Guido Fiala!) can be used to grab the current frame and save it to a file. - The new SVDRP commands 'OVL*' can be used to control video overlays (thanks to Guido Fiala!). This is mainly for use in the 'kvdr' tool (see the 'kvdr' page at http://www.s.netic.de/gfiala). - If the name of the video directory used with the '-v' option had trailing slashes, the recording file names have been damaged. Trailing slashes are now silently removed. - Fixed a buffer overflow in EIT parsing. - Added a security warning regarding SVDRP to the INSTALL file. - Fixed 'confirm' dialog. - The daemon mode (option '-d') now no longer works with REMOTE=KBD (there is no stdin in daemon mode, so KBD makes no sense - plus it sometimes crashed).
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/remote.c b/remote.c
index 0476962..46565a8 100644
--- a/remote.c
+++ b/remote.c
@@ -6,7 +6,7 @@
*
* Ported to LIRC by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
*
- * $Id: remote.c 1.11 2000/07/29 16:23:47 kls Exp $
+ * $Id: remote.c 1.13 2000/09/19 17:40:52 kls Exp $
*/
#include "remote.h"
@@ -49,33 +49,29 @@ cRcIoBase::~cRcIoBase()
cRcIoKBD::cRcIoKBD(void)
{
+ f.Open(0); // stdin
}
cRcIoKBD::~cRcIoKBD()
{
}
-void cRcIoKBD::Flush(int WaitSeconds)
+void cRcIoKBD::Flush(int WaitMs)
{
- time_t t0 = time(NULL);
+ int t0 = time_ms();
timeout(10);
for (;;) {
while (getch() > 0)
- t0 = time(NULL);
- if (time(NULL) - t0 >= WaitSeconds)
+ t0 = time_ms();
+ if (time_ms() - t0 >= WaitMs)
break;
}
}
bool cRcIoKBD::InputAvailable(bool Wait)
{
- timeout(Wait ? 1000 : 10);
- int ch = getch();
- if (ch == ERR)
- return false;
- ungetch(ch);
- return true;
+ return f.Ready(Wait);
}
bool cRcIoKBD::GetCommand(unsigned int *Command, unsigned short *)
@@ -98,7 +94,7 @@ cRcIoRCU::cRcIoRCU(char *DeviceName)
code = 0;
address = 0xFFFF;
lastNumber = 0;
- if ((f = open(DeviceName, O_RDWR | O_NONBLOCK)) >= 0) {
+ if (f.Open(DeviceName, O_RDWR | O_NONBLOCK)) {
struct termios t;
if (tcgetattr(f, &t) == 0) {
cfsetspeed(&t, B9600);
@@ -107,17 +103,14 @@ cRcIoRCU::cRcIoRCU(char *DeviceName)
return;
}
LOG_ERROR_STR(DeviceName);
- close(f);
+ f.Close();
}
else
LOG_ERROR_STR(DeviceName);
- f = -1;
}
cRcIoRCU::~cRcIoRCU()
{
- if (f >= 0)
- close(f);
}
int cRcIoRCU::ReceiveByte(bool Wait)
@@ -135,7 +128,7 @@ int cRcIoRCU::ReceiveByte(bool Wait)
bool cRcIoRCU::SendByteHandshake(unsigned char c)
{
- if (f >= 0) {
+ if (f.IsOpen()) {
int w = write(f, &c, 1);
if (w == 1) {
for (int reply = ReceiveByte(); reply >= 0;) {
@@ -179,21 +172,21 @@ bool cRcIoRCU::SetMode(unsigned char Mode)
return SendCommand(mode);
}
-void cRcIoRCU::Flush(int WaitSeconds)
+void cRcIoRCU::Flush(int WaitMs)
{
- time_t t0 = time(NULL);
+ int t0 = time_ms();
for (;;) {
while (ReceiveByte(false) >= 0)
- t0 = time(NULL);
- if (time(NULL) - t0 >= WaitSeconds)
+ t0 = time_ms();
+ if (time_ms() - t0 >= WaitMs)
break;
}
}
bool cRcIoRCU::InputAvailable(bool Wait)
{
- return DataAvailable(f, Wait);
+ return f.Ready(Wait);
}
bool cRcIoRCU::GetCommand(unsigned int *Command, unsigned short *Address)
@@ -349,22 +342,21 @@ cRcIoLIRC::cRcIoLIRC(char *DeviceName)
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, DeviceName);
- f = socket(AF_UNIX, SOCK_STREAM, 0);
- if (f >= 0) {
- if (connect(f, (struct sockaddr *)&addr, sizeof(addr)) >= 0)
+ int sock = socket(AF_UNIX, SOCK_STREAM, 0);
+ if (sock >= 0) {
+ if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) >= 0) {
+ f.Open(sock);
return;
+ }
LOG_ERROR_STR(DeviceName);
- close(f);
+ close(sock);
}
else
LOG_ERROR_STR(DeviceName);
- f = -1;
}
cRcIoLIRC::~cRcIoLIRC()
{
- if (f >= 0)
- close(f);
}
const char *cRcIoLIRC::ReceiveString(void)
@@ -389,24 +381,24 @@ const char *cRcIoLIRC::ReceiveString(void)
return NULL;
}
-void cRcIoLIRC::Flush(int WaitSeconds)
+void cRcIoLIRC::Flush(int WaitMs)
{
char buf[LIRC_BUFFER_SIZE];
- time_t t0 = time(NULL);
+ int t0 = time_ms();
for (;;) {
while (InputAvailable(false)) {
read(f, buf, sizeof(buf));
- t0 = time(NULL);
+ t0 = time_ms();
}
- if (time(NULL) - t0 >= WaitSeconds)
+ if (time_ms() - t0 >= WaitMs)
break;
}
}
bool cRcIoLIRC::InputAvailable(bool Wait)
{
- return DataAvailable(f, Wait);
+ return f.Ready(Wait);
}
bool cRcIoLIRC::GetCommand(unsigned int *Command, unsigned short *)