mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
add options to setmod app for type 3 mods
This commit is contained in:
parent
35e0de3968
commit
d293b9a702
@ -10,6 +10,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <pthread.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include <linux/dvb/mod.h>
|
||||
|
||||
@ -51,33 +52,96 @@ static int get_property(int fd, uint32_t cmd, uint32_t *data)
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
int main(int argc, char*argv[])
|
||||
{
|
||||
int fd;
|
||||
struct dvb_mod_params mp;
|
||||
struct dvb_mod_channel_params mc;
|
||||
uint32_t data;
|
||||
int adapter = 0, channel = 0, gain = -1;
|
||||
int32_t base = -1, freq = -1, rate = -1;
|
||||
char mod_name[128];
|
||||
|
||||
while (1) {
|
||||
int cur_optind = optind ? optind : 1;
|
||||
int option_index = 0;
|
||||
int c;
|
||||
static struct option long_options[] = {
|
||||
{"adapter", required_argument, 0, 'a'},
|
||||
{"channel", required_argument, 0, 'c'},
|
||||
{"gain", required_argument, 0, 'g'},
|
||||
{"base", required_argument, 0, 'b'},
|
||||
{"frequency", required_argument, 0, 'f'},
|
||||
{"rate", required_argument, 0, 'r'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
c = getopt_long(argc, argv,
|
||||
"a:c:g:b:f:r:",
|
||||
long_options, &option_index);
|
||||
if (c==-1)
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
case 'a':
|
||||
adapter = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'c':
|
||||
channel = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'g':
|
||||
gain = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'b':
|
||||
base = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'f':
|
||||
freq = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
case 'r':
|
||||
if (!strcmp(optarg, "DVBT_8"))
|
||||
rate = SYS_DVBT_8;
|
||||
else if (!strcmp(optarg, "DVBT_7"))
|
||||
rate = SYS_DVBT_7;
|
||||
else if (!strcmp(optarg, "DVBT_6"))
|
||||
rate = SYS_DVBT_6;
|
||||
else if (!strcmp(optarg, "ISDBT_6"))
|
||||
rate = SYS_ISDBT_6;
|
||||
else rate = strtoul(optarg, NULL, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (optind < argc) {
|
||||
printf("too man arguments\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
snprintf(mod_name, 127, "/dev/dvb/adapter%d/mod%d", adapter, channel);
|
||||
fd = open(mod_name, O_RDONLY);
|
||||
|
||||
if (fd < 0) {
|
||||
printf("Could not open modulator device.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fd = open("/dev/dvb/adapter0/mod0", O_RDONLY);
|
||||
|
||||
/* gain 0-255 */
|
||||
get_property(fd, MODULATOR_GAIN, &data);
|
||||
printf("Modulator gain = %u\n", data);
|
||||
set_property(fd, MODULATOR_GAIN, 100);
|
||||
//get_property(fd, MODULATOR_GAIN, &data);
|
||||
//printf("Modulator gain = %u\n", data);
|
||||
//set_property(fd, MODULATOR_GAIN, 100);
|
||||
|
||||
get_property(fd, MODULATOR_GAIN, &data);
|
||||
printf("Modulator gain = %u\n", data);
|
||||
//get_property(fd, MODULATOR_ATTENUATOR, &data);
|
||||
//printf("Modulator attenuator = %u\n", data);
|
||||
|
||||
get_property(fd, MODULATOR_ATTENUATOR, &data);
|
||||
printf("Modulator attenuator = %u\n", data);
|
||||
if (base > 0)
|
||||
set_property(fd, MODULATOR_BASE_FREQUENCY, base);
|
||||
if (freq > 0)
|
||||
set_property(fd, MODULATOR_FREQUENCY, base);
|
||||
if (rate > 0)
|
||||
set_property(fd, MODULATOR_OUTPUT_RATE, rate);
|
||||
|
||||
|
||||
get_property(fd, MODULATOR_STATUS, &data);
|
||||
printf("Modulator status = %u\n", data);
|
||||
set_property(fd, MODULATOR_STATUS, 2);
|
||||
|
||||
|
||||
//set_property(fd, MODULATOR_RESET, 0);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user