diff options
Diffstat (limited to 'plugin_dvb.c')
-rw-r--r-- | plugin_dvb.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/plugin_dvb.c b/plugin_dvb.c index 3482397..36d515a 100644 --- a/plugin_dvb.c +++ b/plugin_dvb.c @@ -1,9 +1,9 @@ -/* $Id: plugin_dvb.c 728 2007-01-14 11:14:38Z michael $ - * $URL: https://ssl.bulix.org/svn/lcd4linux/branches/0.10.1/plugin_dvb.c $ +/* $Id: plugin_dvb.c 939 2009-01-04 14:14:31Z michael $ + * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/plugin_dvb.c $ * * plugin for DVB status * - * Copyright (C) 2003 Michael Reinelt <reinelt@eunet.at> + * Copyright (C) 2003 Michael Reinelt <michael@reinelt.co.at> * Copyright (C) 2004 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net> * * This file is part of LCD4Linux. @@ -64,6 +64,8 @@ static HASH DVB; static int get_dvb_stats(void) { + static int ioc_disable = 0; + int age; int fd; unsigned short snr, sig; @@ -82,24 +84,40 @@ static int get_dvb_stats(void) return -1; } - if (ioctl(fd, FE_READ_SIGNAL_STRENGTH, &sig) != 0) { + sig = 0; + if ((ioc_disable & 0x01) == 0 && ioctl(fd, FE_READ_SIGNAL_STRENGTH, &sig) != 0) { error("ioctl(FE_READ_SIGNAL_STRENGTH) failed: %s", strerror(errno)); - sig = 0; + if (errno == ENOSYS) { + ioc_disable |= 0x01; + error("ioctl(FE_READ_SIGNAL_STRENGTH) disabled."); + } } - if (ioctl(fd, FE_READ_SNR, &snr) != 0) { + snr = 0; + if ((ioc_disable & 0x02) == 0 && ioctl(fd, FE_READ_SNR, &snr) != 0) { error("ioctl(FE_READ_SNR) failed: %s", strerror(errno)); - snr = 0; + if (errno == ENOSYS) { + ioc_disable |= 0x02; + error("ioctl(FE_READ_SNR) disabled."); + } } - if (ioctl(fd, FE_READ_BER, &ber) != 0) { + ber = 0; + if ((ioc_disable & 0x04) == 0 && ioctl(fd, FE_READ_BER, &ber) != 0) { error("ioctl(FE_READ_BER) failed: %s", strerror(errno)); - ber = 0; + if (errno == ENOSYS) { + ioc_disable |= 0x04; + error("ioctl(FE_READ_BER) disabled."); + } } - if (ioctl(fd, FE_READ_UNCORRECTED_BLOCKS, &ucb) != 0) { + ucb = 0; + if ((ioc_disable & 0x08) == 0 && ioctl(fd, FE_READ_UNCORRECTED_BLOCKS, &ucb) != 0) { error("ioctl(FE_READ_UNCORRECTED_BLOCKS) failed: %s", strerror(errno)); - ucb = 0; + if (errno == ENOSYS) { + ioc_disable |= 0x08; + error("ioctl(FE_READ_UNCORRECTED_BLOCKS) disabled."); + } } close(fd); |