Merge remote-tracking branch 'origin/pr/349'

This commit is contained in:
Adam Sutton 2014-03-18 21:44:13 +00:00
commit 184a368a28

View file

@ -168,7 +168,8 @@ linuxdvb_adapter_add ( const char *path )
struct dvb_frontend_info dfi; struct dvb_frontend_info dfi;
SHA_CTX sha1; SHA_CTX sha1;
uint8_t uuidbin[20]; uint8_t uuidbin[20];
htsmsg_t *conf = NULL, *feconf = NULL; htsmsg_t *conf, *feconf;
int save = 0;
#if DVB_VER_ATLEAST(5,10) #if DVB_VER_ATLEAST(5,10)
int fetypes[4] = { 0 }; int fetypes[4] = { 0 };
struct dtv_property cmd = { struct dtv_property cmd = {
@ -194,6 +195,8 @@ linuxdvb_adapter_add ( const char *path )
/* Process each frontend */ /* Process each frontend */
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
conf = feconf = NULL;
snprintf(fe_path, sizeof(fe_path), FE_PATH, path, i); snprintf(fe_path, sizeof(fe_path), FE_PATH, path, i);
/* Wait for access (first FE can take a fe ms to be setup) */ /* Wait for access (first FE can take a fe ms to be setup) */
@ -268,6 +271,8 @@ linuxdvb_adapter_add ( const char *path )
conf = hts_settings_load("input/linuxdvb/adapters/%s", uuid); conf = hts_settings_load("input/linuxdvb/adapters/%s", uuid);
if (conf) if (conf)
feconf = htsmsg_get_map(conf, "frontends"); feconf = htsmsg_get_map(conf, "frontends");
else
save = 1;
/* Create */ /* Create */
if (!(la = linuxdvb_adapter_create(uuid, conf, path, a, &dfi))) { if (!(la = linuxdvb_adapter_create(uuid, conf, path, a, &dfi))) {
@ -298,14 +303,13 @@ linuxdvb_adapter_add ( const char *path )
#endif #endif
pthread_mutex_unlock(&global_lock); pthread_mutex_unlock(&global_lock);
htsmsg_destroy(conf); htsmsg_destroy(conf);
conf = feconf = NULL;
} }
/* Relock before exit */ /* Relock before exit */
pthread_mutex_lock(&global_lock); pthread_mutex_lock(&global_lock);
/* Save configuration */ /* Save configuration */
if (!conf && la) if (save && la)
linuxdvb_adapter_save(la); linuxdvb_adapter_save(la);
} }