From fefdde5e003a9978b5e32addaf1162408732f020 Mon Sep 17 00:00:00 2001 From: Marcin Kaluza Date: Thu, 19 Oct 2017 14:27:56 +0200 Subject: [PATCH] setmod2: add cmdline args: modulator, frequency, bitrate --- apps/setmod2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/setmod2.c b/apps/setmod2.c index 5d83ff7..c868f4f 100644 --- a/apps/setmod2.c +++ b/apps/setmod2.c @@ -26,22 +26,28 @@ static int set_property(int fd, uint32_t cmd, uint32_t data) ret = ioctl(fd, FE_SET_PROPERTY, &c); if (ret < 0) { fprintf(stderr, "FE_SET_PROPERTY returned %d\n", errno); + perror("FE_SET_PROPERTY"); return -1; } return 0; } -int main() +int main(int argc, char ** argv) { + if (argc < 3) { + fprintf(stderr, "Usage: %s /dev/dvb/adapterX/modY freq[MHz] bitrate[kbit/s]\n", argv[0]); + exit(1); + } int fd; struct dvb_mod_params mp; struct dvb_mod_channel_params mc; - fd = open("/dev/dvb/adapter0/mod0", O_RDONLY); + fd = open(argv[1], O_RDONLY); set_property(fd, MODULATOR_MODULATION, QAM_256); set_property(fd, MODULATOR_SYMBOL_RATE, 6900000); - set_property(fd, MODULATOR_FREQUENCY, 114000000); + set_property(fd, MODULATOR_FREQUENCY, atoi(argv[2])*1000000); + set_property(fd, MODULATOR_INPUT_BITRATE, atoi(argv[3])*1000); close(fd); }