aboutsummaryrefslogtreecommitdiffstats
path: root/test/sendburst.c
diff options
context:
space:
mode:
authoretobi <git@e-tobi.net>2013-09-03 09:48:38 +0200
committeretobi <git@e-tobi.net>2013-09-03 09:48:38 +0200
commit6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d (patch)
tree024bef311226653bdd1da4fa588becf5098bcff7 /test/sendburst.c
downloadlinux-dvb-apps-6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d.tar.gz
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to '')
-rw-r--r--test/sendburst.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/sendburst.c b/test/sendburst.c
new file mode 100644
index 0000000..a96b68c
--- /dev/null
+++ b/test/sendburst.c
@@ -0,0 +1,55 @@
+/*
+ * Test sending the burst mini command A/B on a SAT frontend.
+ *
+ * usage: FRONTEND=/dev/dvb/adapterX/frontendX sendburst {a|b}
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <linux/dvb/frontend.h>
+
+
+int main (int argc, char **argv)
+{
+ char *fedev = "/dev/dvb/adapter0/frontend0";
+ int fd, r;
+
+ if (argc != 2 || (strcmp(argv[1], "a") && strcmp(argv[1], "b"))) {
+ fprintf (stderr, "usage: %s <a|b>\n", argv[0]);
+ return 1;
+ }
+
+ if (getenv("FRONTEND"))
+ fedev = getenv("FRONTEND");
+
+ printf("set22k: using '%s'\n", fedev);
+
+ if ((fd = open (fedev, O_RDWR)) < 0) {
+ perror ("open");
+ return 1;
+ }
+
+ ioctl (fd, FE_SET_TONE, SEC_TONE_OFF);
+
+ usleep (30000); /* 30ms according to DiSEqC spec */
+
+ if (strcmp(argv[1], "a") == 0)
+ r = ioctl (fd, FE_DISEQC_SEND_BURST, SEC_MINI_A);
+ else
+ r = ioctl (fd, FE_DISEQC_SEND_BURST, SEC_MINI_B);
+
+ if (r == -1)
+ perror("ioctl FE_SET_TONE");
+
+ close (fd);
+
+ return 0;
+}
+