]> git.webhop.me Git - lcd4linux.git/commitdiff
disable unimplemented ioctls
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 4 Jan 2009 07:07:21 +0000 (07:07 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Sun, 4 Jan 2009 07:07:21 +0000 (07:07 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@937 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

plugin_dvb.c

index 95715ad2838899bcf19b3c76fc9e98c4ec941643..783519a4191df7e1671b7fbf3dc7ce131dde58c4 100644 (file)
@@ -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);