summaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-10-03 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-10-03 18:00:00 +0200
commitef8fe3f04c30caedeb17b11ac275581539f039c7 (patch)
tree40a00f075c4fc94b95fd070077e89a1916923789 /remote.c
parent7e4b4d290570aee1d24241b0e0ac10e7c8148a36 (diff)
downloadvdr-patch-lnbsharing-ef8fe3f04c30caedeb17b11ac275581539f039c7.tar.gz
vdr-patch-lnbsharing-ef8fe3f04c30caedeb17b11ac275581539f039c7.tar.bz2
Version 0.65vdr-0.65
- Modified LIRC interface to better handle repeat function. - Faster OSD by first writing into a bitmap and then sending the entire bitmap to the DVB driver at once (requires the patch 'dvb.c.071.diff' to be applied against the version 0.71 DVB driver file 'dvb.c'). - When switching channels the channel is now immediately displayed, and the current/next information is shown as soon as it becomes available. - No longer displaying the year in the 'Recordings' menu to saves space for the title. - The 'Recordings' menu now displays a '*' to indicate new recordings. - Added the description of the timers.conf file to the FORMATS file (thanks to Bastian Guse). - Displaying as much as possible of the current/next info (dropping characters that would display only partially). - In normal viewing mode the '0' key now toggles between the current and the previous channel.
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/remote.c b/remote.c
index 46565a8..1bf8108 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.13 2000/09/19 17:40:52 kls Exp $
+ * $Id: remote.c 1.15 2000/10/03 10:49:58 kls Exp $
*/
#include "remote.h"
@@ -339,6 +339,7 @@ bool cRcIoRCU::DetectCode(unsigned char *Code, unsigned short *Address)
cRcIoLIRC::cRcIoLIRC(char *DeviceName)
{
+ repeat = 1;
struct sockaddr_un addr;
addr.sun_family = AF_UNIX;
strcpy(addr.sun_path, DeviceName);
@@ -361,23 +362,27 @@ cRcIoLIRC::~cRcIoLIRC()
const char *cRcIoLIRC::ReceiveString(void)
{
- char buf[LIRC_BUFFER_SIZE];
+ int oldrepeat = 1;
- while (InputAvailable(true)) {
- if (read(f, buf, sizeof(buf)) > 21) {
- const int now = time_ms();
- int repeat;
- sscanf(buf, "%*s %x %7s", &repeat, keyName); // '7' in '%7s' is LIRC_KEY_BUF-1!
- if (repeat == 0) {
- firstTime = lastTime = now;
- return keyName;
- }
- else if ((now > firstTime + REPEATDELAY) && (now > lastTime + REPEATLIMIT)) {
- lastTime = now;
- return keyName;
- }
- }
+ if (repeat != 0) {
+ Flush();
+ if (repeat != 0) {
+ oldrepeat = repeat;
+ Flush(REPEATLIMIT);
}
+ }
+
+ if (repeat == 0) {
+ firstTime = time_ms();
+ repeat = 1;
+ return keyName;
+ }
+
+ if ((repeat > 1) && (repeat != oldrepeat) && (time_ms() > firstTime + REPEATDELAY)) {
+ repeat = 1;
+ return keyName;
+ }
+
return NULL;
}
@@ -386,14 +391,10 @@ void cRcIoLIRC::Flush(int WaitMs)
char buf[LIRC_BUFFER_SIZE];
int t0 = time_ms();
- for (;;) {
- while (InputAvailable(false)) {
- read(f, buf, sizeof(buf));
- t0 = time_ms();
- }
- if (time_ms() - t0 >= WaitMs)
- break;
- }
+ do {
+ if (InputAvailable(false) && (read(f, buf, sizeof(buf)) > 21))
+ sscanf(buf, "%*x %x %7s", &repeat, keyName); // '7' in '%7s' is LIRC_KEY_BUF-1!
+ } while ((repeat != 0) && (time_ms() < t0 + WaitMs));
}
bool cRcIoLIRC::InputAvailable(bool Wait)
@@ -403,7 +404,6 @@ bool cRcIoLIRC::InputAvailable(bool Wait)
bool cRcIoLIRC::GetCommand(unsigned int *Command, unsigned short *)
{
- Flush();
if (Command) {
const char *cmd = ReceiveString();
if (cmd) {