From 5b875366d981d8e1a6aa0a7b5b86095e78d249c8 Mon Sep 17 00:00:00 2001 From: Marcin Kaluza Date: Tue, 24 Oct 2017 12:08:48 +0200 Subject: [PATCH] setmod2: add symbol rate parameter, add verbose messages --- apps/setmod2.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/setmod2.c b/apps/setmod2.c index c868f4f..32dfc7b 100644 --- a/apps/setmod2.c +++ b/apps/setmod2.c @@ -35,19 +35,32 @@ static int set_property(int fd, uint32_t cmd, uint32_t data) 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]); + fprintf(stderr, "Usage: %s /dev/dvb/adapterX/modY freq[MHz] bitrate[kbit/s] [symbolrate[ksyms/s]]\n", argv[0]); exit(1); } int fd; + unsigned int freq = atoi(argv[2])*1000000; + unsigned int bitrate = atoi(argv[3])*1000; + unsigned int symbol_rate = 6900000; struct dvb_mod_params mp; struct dvb_mod_channel_params mc; + if (argc == 4) symbol_rate = atoi(argv[3]); + if (symbol_rate <= 7100) symbol_rate *= 1000; + 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, atoi(argv[2])*1000000); - set_property(fd, MODULATOR_INPUT_BITRATE, atoi(argv[3])*1000); + + fprintf(stderr, "Symbol rate: %u\n", symbol_rate); + set_property(fd, MODULATOR_SYMBOL_RATE, symbol_rate); + + fprintf(stderr, "Frequency: %u\n", freq); + set_property(fd, MODULATOR_FREQUENCY, freq); + + fprintf(stderr, "Bitrate: %u\n", bitrate); + set_property(fd, MODULATOR_INPUT_BITRATE, bitrate); + close(fd); }