From 6e40287e2f39a80fc72bd8d0fbc1a8334d688c2d Mon Sep 17 00:00:00 2001 From: etobi Date: Tue, 3 Sep 2013 09:48:38 +0200 Subject: Imported Upstream version 1.1.0 --- test/setvoltage.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/setvoltage.c (limited to 'test/setvoltage.c') diff --git a/test/setvoltage.c b/test/setvoltage.c new file mode 100644 index 0000000..1d14a4c --- /dev/null +++ b/test/setvoltage.c @@ -0,0 +1,47 @@ +/* + * Test switching the voltage signal high and low on a SAT frontend. + * (Note: DiSEqC equipment ignores this after it has once seen a diseqc + * sequence; reload the driver or unplug/replug the SAT cable to reset.) + * + * usage: FRONTEND=/dev/dvb/adapterX/frontendX setvoltage {13|18} + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +int main (int argc, char **argv) +{ + char *fedev = "/dev/dvb/adapter0/frontend0"; + int fd, r; + + if (argc != 2 || (strcmp(argv[1], "13") && strcmp(argv[1], "18"))) { + fprintf (stderr, "usage: %s <13|18>\n", argv[0]); + return -1; + } + if (getenv("FRONTEND")) + fedev = getenv("FRONTEND"); + printf("setvoltage: using '%s'\n", fedev); + + if ((fd = open (fedev, O_RDWR)) < 0) + perror ("open"); + + if (strcmp(argv[1], "13") == 0) + r = ioctl (fd, FE_SET_VOLTAGE, SEC_VOLTAGE_13); + else + r = ioctl (fd, FE_SET_VOLTAGE, SEC_VOLTAGE_18); + if (r == -1) + perror ("ioctl FE_SET_VOLTAGE"); + + close (fd); + + return 0; +} + -- cgit v1.2.3