mirror of
https://github.com/DigitalDevices/dddvb.git
synced 2023-10-10 13:37:43 +02:00
fix frontend allocation
This commit is contained in:
parent
9c920141ca
commit
ccfdc2b984
@ -484,7 +484,7 @@ int main(int argc, char **argv)
|
|||||||
else
|
else
|
||||||
fe = dddvb_fe_alloc(dd, delsys);
|
fe = dddvb_fe_alloc(dd, delsys);
|
||||||
if (!fe) {
|
if (!fe) {
|
||||||
fprintf(fout,"dddvb_fe_alloc failed\n");
|
fprintf(fout,"dddvb_fe_alloc failed\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
dddvb_param_init(&p);
|
dddvb_param_init(&p);
|
||||||
|
@ -30,7 +30,7 @@ LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc_num(struct dddvb *dd, uint32_t
|
|||||||
pthread_mutex_unlock(&dd->lock);
|
pthread_mutex_unlock(&dd->lock);
|
||||||
if (dddvb_fe_start(fe) < 0) {
|
if (dddvb_fe_start(fe) < 0) {
|
||||||
dbgprintf(DEBUG_SYS, "fe %d busy\n", fe->nr);
|
dbgprintf(DEBUG_SYS, "fe %d busy\n", fe->nr);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
dbgprintf(DEBUG_SYS, "Allocated fe %d = %d/%d, fd=%d\n",
|
dbgprintf(DEBUG_SYS, "Allocated fe %d = %d/%d, fd=%d\n",
|
||||||
fe->nr, fe->anum, fe->fnum, fe->fd);
|
fe->nr, fe->anum, fe->fnum, fe->fd);
|
||||||
@ -40,22 +40,25 @@ LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc_num(struct dddvb *dd, uint32_t
|
|||||||
LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc(struct dddvb *dd, uint32_t type)
|
LIBDDDVB_EXPORTED struct dddvb_fe *dddvb_fe_alloc(struct dddvb *dd, uint32_t type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct dddvb_fe *fe = NULL;
|
struct dddvb_fe *fe = NULL, *tfe;
|
||||||
|
|
||||||
pthread_mutex_lock(&dd->lock);
|
pthread_mutex_lock(&dd->lock);
|
||||||
dbgprintf(DEBUG_SYS, "alloc_fe type %u\n", type);
|
dbgprintf(DEBUG_SYS, "alloc_fe type %u\n", type);
|
||||||
for (i = 0; i < dd->dvbfe_num; i++) {
|
for (i = 0; i < dd->dvbfe_num; i++) {
|
||||||
fe = &dd->dvbfe[i];
|
tfe = &dd->dvbfe[i];
|
||||||
if (fe->state == 0 &&
|
if (tfe->state == 0 &&
|
||||||
(fe->type & (1UL << type))) {
|
(tfe->type & (1UL << type))) {
|
||||||
fe = dddvb_fe_alloc_num(dd, type, i);
|
fe = dddvb_fe_alloc_num(dd, type, i);
|
||||||
if (fe)
|
if (fe)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&dd->lock);
|
pthread_mutex_unlock(&dd->lock);
|
||||||
|
if (!fe)
|
||||||
|
dbgprintf(DEBUG_SYS, "alloc_fe type %u\n failed!", type);
|
||||||
|
else
|
||||||
|
dbgprintf(DEBUG_SYS, "alloc_fe type %u success!\n", type);
|
||||||
return fe;
|
return fe;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LIBDDDVB_EXPORTED int dddvb_dvb_tune(struct dddvb_fe *fe, struct dddvb_params *p)
|
LIBDDDVB_EXPORTED int dddvb_dvb_tune(struct dddvb_fe *fe, struct dddvb_params *p)
|
||||||
|
Loading…
Reference in New Issue
Block a user