aboutsummaryrefslogtreecommitdiffstats
path: root/dvb.c
diff options
context:
space:
mode:
authorreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-07-19 09:42:42 +0000
committerreinelt <reinelt@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2003-07-19 09:42:42 +0000
commit6ae60a46a83b070e7ed257e07a3bbd14db18dea7 (patch)
tree0eb9527bc9dab4266905873cbf750180471e62b4 /dvb.c
parent73dfe3fa6f2464ae817368cf073725f835778018 (diff)
downloadlcd4linux-6ae60a46a83b070e7ed257e07a3bbd14db18dea7.tar.gz
[lcd4linux @ 2003-07-19 09:42:42 by reinelt]
check for dvb/frontend.h and disable DVB client if not found. git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@198 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to 'dvb.c')
-rw-r--r--dvb.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/dvb.c b/dvb.c
index be01168..53bf8d7 100644
--- a/dvb.c
+++ b/dvb.c
@@ -41,6 +41,30 @@
#include <time.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+
+#ifndef HAVE_LINUX_DVB_FRONTEND_H
+
+#warning linux/dvb/frontend.h not found.
+#warning DVB client will be disabled.
+
+int DVB (double *strength, double *snr)
+{
+ static int flag=0;
+
+ if (flag==0) {
+ error("lcd4linux has been compiled without DVB support");
+ error("DVB client will be disabled");
+ flag=1;
+ }
+
+ *strength=0.0;
+ *snr=0.0;
+
+ return 0;
+}
+
+#else
+
#include <linux/dvb/frontend.h>
#include "debug.h"
@@ -79,20 +103,21 @@ int DVB (double *strength, double *snr)
fd=-1;
return -1;
}
-
+
if (ioctl(fd, FE_READ_SNR, &raw_snr)) {
error("ioctl(FE_READ_SNR) failed: %s", strerror(errno));
fd=-1;
return -1;
}
-
+
// Normalize to 1.0
strength0=raw_strength/65535.0;
snr0=raw_snr/65535.0;
-
+
*strength=strength0;
*snr=snr0;
return 0;
}
+#endif