From 570a565f37789e311e855f4d11340a44a2ee4701 Mon Sep 17 00:00:00 2001 From: Ralph Metzler Date: Fri, 2 Sep 2016 17:37:15 +0200 Subject: [PATCH] add test app for new modulator API --- apps/Makefile | 3 +++ apps/setmod2.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 apps/setmod2.c diff --git a/apps/Makefile b/apps/Makefile index 65ec4df..f553427 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -9,6 +9,9 @@ modt: modt.c setmod: setmod.c gcc -o setmod setmod.c -I../include/ +setmod2: setmod2.c + gcc -o setmod2 setmod2.c -I../include/ + flashprog: flashprog.c gcc -o flashprog flashprog.c diff --git a/apps/setmod2.c b/apps/setmod2.c new file mode 100644 index 0000000..efd1e61 --- /dev/null +++ b/apps/setmod2.c @@ -0,0 +1,47 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +static int set_property(int fd, uint32_t cmd, uint32_t data) +{ + struct dtv_property p; + struct dtv_properties c; + int ret; + + p.cmd = cmd; + c.num = 1; + c.props = &p; + p.u.data = data; + ret = ioctl(fd, FE_SET_PROPERTY, &c); + if (ret < 0) { + fprintf(stderr, "FE_SET_PROPERTY returned %d\n", errno); + return -1; + } + return 0; +} + +int main() +{ + int fd; + struct dvb_mod_params mp; + struct dvb_mod_channel_params mc; + + fd = open("/dev/dvb/adapter0/mod0", O_RDONLY); + + set_property(fd, MOD_MODULATION, QAM_256); + set_property(fd, MOD_SYMBOL_RATE, 6900000); + set_property(fd, MOD_FREQUENCY, 114000000); + close(fd); +} +