capmt: fix problems with capmt not being properly enabled

This was due to failure to properly reported which adapters have
been enabled. There are other problems with the capmt setup code
that really need addressing, but I don't have the time right now!
This commit is contained in:
Adam Sutton 2013-09-11 21:04:30 +01:00
parent 95c76059f7
commit 46b3f984c8
2 changed files with 19 additions and 3 deletions

View file

@ -530,7 +530,7 @@ capmt_create_udp_socket(int *socket, int port)
if (bind(*socket, (const struct sockaddr*)&serv_addr, sizeof(serv_addr)) != 0)
{
perror("[CapmtServer] ERROR binding to ca0");
tvherror("capmt", "failed to bind to ca0 (port %d)", port);
return 0;
}
else

View file

@ -104,6 +104,21 @@ linuxdvb_adapter_current_weight ( linuxdvb_adapter_t *la )
return 0;
}
/*
* Enabled
*/
static int
linuxdvb_adapter_is_enabled ( mpegts_input_t *mi )
{
linuxdvb_adapter_t *la = (linuxdvb_adapter_t*)mi;
linuxdvb_hardware_t *lh;
LIST_FOREACH(lh, &la->lh_children, lh_parent_link)
if (lh->mi_is_enabled && lh->mi_is_enabled((mpegts_input_t*)lh))
return 1;
return 0;
}
/*
* Create
*/
@ -124,8 +139,9 @@ linuxdvb_adapter_create0
}
LIST_INSERT_HEAD(&ld->lh_children, (linuxdvb_hardware_t*)la, lh_parent_link);
la->lh_parent = (linuxdvb_hardware_t*)ld;
la->mi_enabled = 1;
la->lh_parent = (linuxdvb_hardware_t*)ld;
la->mi_is_enabled = linuxdvb_adapter_is_enabled;
la->mi_enabled = 1;
/* No conf */
if (!conf)