Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
SAT>IP server: fix the tuner configuration
  • Loading branch information
perexg committed Mar 11, 2015
1 parent a4c2cc2 commit 6753203
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 12 deletions.
14 changes: 10 additions & 4 deletions src/config.c
Expand Up @@ -1360,13 +1360,14 @@ config_check ( void )
* Initialisation / Shutdown / Saving
* *************************************************************************/

static int config_newcfg = 0;

void
config_init ( const char *path, int backup )
config_boot ( const char *path )
{
struct stat st;
char buf[1024];
const char *homedir = getenv("HOME");
int new = 0;

/* Generate default */
if (!path) {
Expand All @@ -1376,7 +1377,7 @@ config_init ( const char *path, int backup )

/* Ensure directory exists */
if (stat(path, &st)) {
new = 1;
config_newcfg = 1;
if (makedirs(path, 0700)) {
tvhwarn("START", "failed to create settings directory %s,"
" settings will not be saved", path);
Expand Down Expand Up @@ -1407,9 +1408,13 @@ config_init ( const char *path, int backup )
tvhlog(LOG_DEBUG, "config", "no configuration, loading defaults");
config = htsmsg_create_map();
}
}

void
config_init ( int backup )
{
/* Store version number */
if (new) {
if (config_newcfg) {
htsmsg_set_u32(config, "version", ARRAY_SIZE(config_migrate_table));
htsmsg_set_str(config, "fullversion", tvheadend_version);
config_save();
Expand All @@ -1419,6 +1424,7 @@ config_init ( const char *path, int backup )
if (config_migrate(backup))
config_check();
}
tvhinfo("config", "loaded");
}

void config_done ( void )
Expand Down
3 changes: 2 additions & 1 deletion src/config.h
Expand Up @@ -23,7 +23,8 @@

#include "htsmsg.h"

void config_init ( const char *path, int backup );
void config_boot ( const char *path );
void config_init ( int backup );
void config_done ( void );
void config_save ( void );

Expand Down
3 changes: 2 additions & 1 deletion src/main.c
Expand Up @@ -709,6 +709,7 @@ main(int argc, char **argv)
signal(SIGILL, handle_sigill); // see handler..

uuid_init();
config_boot(opt_config);
tcp_server_preinit(opt_ipv6);
http_server_init(opt_bindaddr); // bind to ports only
htsp_init(opt_bindaddr); // bind to ports only
Expand Down Expand Up @@ -817,7 +818,7 @@ main(int argc, char **argv)
/* Initialise configuration */
idnode_init();
spawn_init();
config_init(opt_config, opt_nobackup == 0);
config_init(opt_nobackup == 0);

/**
* Initialize subsystems
Expand Down
4 changes: 3 additions & 1 deletion src/satip/rtsp.c
Expand Up @@ -1029,12 +1029,14 @@ void satip_server_rtsp_init(const char *bindaddr, int port)
rtsp_close_sessions();
pthread_mutex_unlock(&rtsp_lock);
tcp_server_delete(rtsp_server);
rtsp_server = NULL;
reg = 1;
}
free(rtsp_ip);
rtsp_ip = strdup(bindaddr);
rtsp_port = port;
rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
if (!rtsp_server)
rtsp_server = tcp_server_create(bindaddr, port, &ops, NULL);
if (reg)
tcp_server_register(rtsp_server);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tcp.c
Expand Up @@ -695,7 +695,7 @@ tcp_server_create

if(x != 0)
{
tvhlog(LOG_ERR, "tcp", "bind: %s: %s", bindaddr != NULL ? bindaddr : "*", strerror(errno));
tvhlog(LOG_ERR, "tcp", "bind: %s:%i: %s", bindaddr != NULL ? bindaddr : "*", port, strerror(errno));
close(fd);
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions src/webui/extjs.c
Expand Up @@ -532,9 +532,9 @@ extjs_config(http_connection_t *hc, const char *remain, void *opaque)
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbt")))
ssave |= config_set_int("satip_dvbt", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbs")))
ssave |= config_set_int("satip_dvbt", atoi(str));
ssave |= config_set_int("satip_dvbs", atoi(str));
if ((str = http_arg_get(&hc->hc_req_args, "satip_dvbc")))
ssave |= config_set_int("satip_dvbt", atoi(str));
ssave |= config_set_int("satip_dvbc", atoi(str));
if (save | ssave)
config_save();
if (ssave)
Expand Down
4 changes: 2 additions & 2 deletions src/webui/static/app/config.js
Expand Up @@ -234,11 +234,11 @@ tvheadend.miscconf = function(panel, index) {
fieldLabel: 'Exported DVB-T Tuners'
});
var dvbs = new Ext.form.NumberField({
name: 'satip_dvbt',
name: 'satip_dvbs',
fieldLabel: 'Exported DVB-S2 Tuners'
});
var dvbc = new Ext.form.NumberField({
name: 'satip_dvbt',
name: 'satip_dvbc',
fieldLabel: 'Exported DVB-C Tuners'
});
satipPanel = new Ext.form.FieldSet({
Expand Down

0 comments on commit 6753203

Please sign in to comment.