mirror of
https://github.com/DigitalDevices/octonet.git
synced 2023-10-10 13:36:52 +02:00
support new msmode config file
This commit is contained in:
parent
713ef3bc51
commit
54d57e1d4b
@ -1078,7 +1078,7 @@ int dvb_tune(struct dvbfe *fe, struct dvb_params *p)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int init_fe(struct octoserve *os, int a, int f, int fd, int nodvbt, int noswitch)
|
||||
static int init_fe(struct octoserve *os, int a, int f, int fd, int nodvbt, int msmode)
|
||||
{
|
||||
struct dtv_properties dps;
|
||||
struct dtv_property dp[10];
|
||||
@ -1132,13 +1132,13 @@ static int init_fe(struct octoserve *os, int a, int f, int fd, int nodvbt, int n
|
||||
}
|
||||
if (fe->input[3]) {
|
||||
os->has_feswitch = 1;
|
||||
if (noswitch) {
|
||||
if (!msmode) {
|
||||
if (fe->input[2] >= fe->input[1]) {
|
||||
fe->type = 0;
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
os->do_feswitch = 1;
|
||||
os->do_feswitch = msmode;
|
||||
}
|
||||
|
||||
os->dvbfe_num++;
|
||||
@ -1146,7 +1146,7 @@ static int init_fe(struct octoserve *os, int a, int f, int fd, int nodvbt, int n
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int scan_dvbfe(struct octoserve *os, int nodvbt, int noswitch)
|
||||
static int scan_dvbfe(struct octoserve *os, int nodvbt, int msmode)
|
||||
{
|
||||
int a, f, fd;
|
||||
char fname[80];
|
||||
@ -1156,7 +1156,7 @@ static int scan_dvbfe(struct octoserve *os, int nodvbt, int noswitch)
|
||||
sprintf(fname, "/dev/dvb/adapter%d/frontend%d", a, f);
|
||||
fd = open(fname, O_RDWR);
|
||||
if (fd >= 0) {
|
||||
init_fe(os, a, f, fd, nodvbt, noswitch);
|
||||
init_fe(os, a, f, fd, nodvbt, msmode);
|
||||
close(fd);
|
||||
}
|
||||
}
|
||||
@ -1747,14 +1747,14 @@ void lnb_config(struct octoserve *os, char *name, char *val)
|
||||
}
|
||||
}
|
||||
|
||||
int init_dvb(struct octoserve *os, int nodvbt, int noswitch)
|
||||
int init_dvb(struct octoserve *os, int nodvbt, int msmode)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
pthread_mutex_init(&nsd_lock, 0);
|
||||
pthread_mutex_init(&os->uni_lock, 0);
|
||||
|
||||
scan_dvbfe(os, nodvbt, noswitch);
|
||||
scan_dvbfe(os, nodvbt, msmode);
|
||||
scan_dvbca(os);
|
||||
|
||||
os->scif_type = 0;
|
||||
@ -1764,7 +1764,7 @@ int init_dvb(struct octoserve *os, int nodvbt, int noswitch)
|
||||
uint32_t fmode = 0;
|
||||
|
||||
if (os->do_feswitch) {
|
||||
fmode = 1;
|
||||
fmode = msmode;
|
||||
if (os->scif_type)
|
||||
fmode = 0;//3;
|
||||
}
|
||||
|
@ -2686,7 +2686,7 @@ static void os_serve(struct octoserve *os)
|
||||
killall_sessions(os);
|
||||
}
|
||||
|
||||
static struct octoserve *os_init(char *ifname, int nossdp, int nodms, int nodvbt, int noswitch)
|
||||
static struct octoserve *os_init(char *ifname, int nossdp, int nodms, int nodvbt, int msmode)
|
||||
{
|
||||
struct octoserve *os;
|
||||
struct os_ssdp *ss;
|
||||
@ -2728,7 +2728,7 @@ static struct octoserve *os_init(char *ifname, int nossdp, int nodms, int nodvbt
|
||||
if (os->has_switch)
|
||||
switch_get_port(os->mac);
|
||||
|
||||
init_dvb(os, nodvbt, noswitch);
|
||||
init_dvb(os, nodvbt, msmode);
|
||||
|
||||
ss = &os->ssdp;
|
||||
if (init_ssdp(os, &os->ssdp, debug, nossdp, nodms) < 0) {
|
||||
@ -2778,6 +2778,27 @@ static int fexists(char *fn)
|
||||
return (!stat(fn, &b));
|
||||
}
|
||||
|
||||
static int read_msmode(char *fn)
|
||||
{
|
||||
int fd, len;
|
||||
char mode[80];
|
||||
|
||||
fd = open(fn, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return 0;
|
||||
len = read(fd, mode, 7);
|
||||
if (len < 0)
|
||||
return 0;
|
||||
close (fd);
|
||||
if (len == 4 && !strncasecmp(mode, "none", 4))
|
||||
return 0;
|
||||
if (len == 4 && !strncasecmp(mode, "quad", 4))
|
||||
return 1;
|
||||
if (len == 7 && !strncasecmp(mode, "quattro", 7))
|
||||
return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void awrite(char *fn, char *txt)
|
||||
{
|
||||
FILE *f = fopen(fn, "w");
|
||||
@ -2788,7 +2809,7 @@ static void awrite(char *fn, char *txt)
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int nodms = 0, nossdp = 0, nodvbt = 0, vlan = 0, noswitch = 0;
|
||||
int nodms = 0, nossdp = 0, nodvbt = 0, vlan = 0, msmode = 1;
|
||||
|
||||
printf("Octoserve " OCTOSERVE_VERSION
|
||||
", Copyright (C) 2012-15 Digital Devices GmbH\n");
|
||||
@ -2803,7 +2824,6 @@ int main(int argc, char **argv)
|
||||
{"nossdp", no_argument, 0, 'n'},
|
||||
{"nodms", no_argument, 0, 'm'},
|
||||
{"nodvbt", no_argument, 0, 't'},
|
||||
{"noswitch", no_argument, 0, 's'},
|
||||
{"conform", no_argument, 0, 'c'},
|
||||
{"help", no_argument , 0, 'h'},
|
||||
{0, 0, 0, 0}
|
||||
@ -2830,9 +2850,6 @@ int main(int argc, char **argv)
|
||||
case 't':
|
||||
nodvbt = 1;
|
||||
break;
|
||||
case 's':
|
||||
noswitch = 1;
|
||||
break;
|
||||
case 'c':
|
||||
conform = 1;
|
||||
break;
|
||||
@ -2848,7 +2865,9 @@ int main(int argc, char **argv)
|
||||
if (fexists("/config/nodms.enabled"))
|
||||
nodms = 1;
|
||||
if (fexists("/config/noswitch.enabled"))
|
||||
noswitch = 1;
|
||||
msmode = 0;
|
||||
else
|
||||
msmode = read_msmode("/config/msmode");
|
||||
if (fexists("/config/nodvbt.enabled"))
|
||||
nodvbt = 1;
|
||||
if (fexists("/config/vlan.enabled")) {
|
||||
@ -2858,7 +2877,7 @@ int main(int argc, char **argv)
|
||||
awrite("/sys/class/ddbridge/ddbridge0/vlan", "0");
|
||||
printf("nodms = %d, nodvbt = %d, vlan = %d\n", nodms, nodvbt, vlan);
|
||||
|
||||
os = os_init("eth0", nossdp, nodms, nodvbt, noswitch);
|
||||
os = os_init("eth0", nossdp, nodms, nodvbt, msmode);
|
||||
if (!os)
|
||||
return -1;
|
||||
set_termaction();
|
||||
|
Loading…
Reference in New Issue
Block a user