diff options
Diffstat (limited to 'channels/chan_usbradio.c')
-rw-r--r-- | channels/chan_usbradio.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/channels/chan_usbradio.c b/channels/chan_usbradio.c index 2a829a685..9e5adb223 100644 --- a/channels/chan_usbradio.c +++ b/channels/chan_usbradio.c @@ -358,8 +358,8 @@ END_CONFIG #define MAX(a,b) ((a) > (b) ? (a) : (b)) #endif -static char *config = "usbradio.conf"; /* default config file */ -static char *config1 = "usbradio_tune_%s.conf"; /* tune config file */ +static const char *config = "usbradio.conf"; /* default config file */ +#define config1 "usbradio_tune_%s.conf" /* tune config file */ static FILE *frxcapraw = NULL, *frxcaptrace = NULL, *frxoutraw = NULL; static FILE *ftxcapraw = NULL, *ftxcaptrace = NULL, *ftxoutraw = NULL; @@ -1648,7 +1648,7 @@ static int usbradio_text(struct ast_channel *c, const char *text) /* print received messages */ if(o->debuglevel)ast_verbose(" << Console Received usbradio text %s >> \n", text); - cnt=sscanf(text,"%s %s %s %s %s %c",cmd,rxs,txs,rxpl,txpl,&pwr); + cnt = sscanf(text, "%300s %15s %15s %15s %15s %1c", cmd, rxs, txs, rxpl, txpl, &pwr); if (strcmp(cmd,"SETCHAN")==0) { @@ -2818,7 +2818,7 @@ static void store_rxsdtype(struct chan_usbradio_pvt *o, char *s) static void store_rxgain(struct chan_usbradio_pvt *o, char *s) { float f; - sscanf(s,"%f",&f); + sscanf(s, "%30f", &f); o->rxgain = f; //ast_log(LOG_WARNING, "set rxgain = %f\n", f); } @@ -2827,7 +2827,7 @@ static void store_rxgain(struct chan_usbradio_pvt *o, char *s) static void store_rxvoiceadj(struct chan_usbradio_pvt *o, char *s) { float f; - sscanf(s,"%f",&f); + sscanf(s, "%30f", &f); o->rxvoiceadj = f; //ast_log(LOG_WARNING, "set rxvoiceadj = %f\n", f); } @@ -2836,7 +2836,7 @@ static void store_rxvoiceadj(struct chan_usbradio_pvt *o, char *s) static void store_rxctcssadj(struct chan_usbradio_pvt *o, char *s) { float f; - sscanf(s,"%f",&f); + sscanf(s, "%30f", &f); o->rxctcssadj = f; //ast_log(LOG_WARNING, "set rxctcssadj = %f\n", f); } @@ -3821,6 +3821,8 @@ static char *res2cli(int r) static char *handle_console_key(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + char *argv[] = { "radio", "key", NULL }; + switch (cmd) { case CLI_INIT: e->command = "radio key"; @@ -3829,12 +3831,13 @@ static char *handle_console_key(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(console_key(a->fd,a->argc,a->argv)); + return res2cli(console_key(a->fd, 2, argv)); } static char *handle_console_unkey(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + char *argv[] = { "radio", "unkey", NULL }; switch (cmd) { case CLI_INIT: e->command = "radio unkey"; @@ -3843,12 +3846,13 @@ static char *handle_console_unkey(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(console_unkey(a->fd,a->argc,a->argv)); + return res2cli(console_unkey(a->fd, 2, argv)); } static char *handle_radio_tune(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + char *argv[5] = { "radio", "tune", a->argc > 2 ? (char *) a->argv[2] : NULL, a->argc > 3 ? (char *) a->argv[3] : NULL }; switch (cmd) { case CLI_INIT: e->command = "radio tune"; @@ -3857,7 +3861,7 @@ static char *handle_radio_tune(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(radio_tune(a->fd,a->argc,a->argv)); + return res2cli(radio_tune(a->fd, a->argc, argv)); } static char *handle_radio_debug(struct ast_cli_entry *e, @@ -3871,7 +3875,7 @@ static char *handle_radio_debug(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(radio_set_debug(a->fd,a->argc,a->argv)); + return res2cli(radio_set_debug(a->fd, a->argc, NULL /* ignored */)); } static char *handle_radio_debug_off(struct ast_cli_entry *e, @@ -3885,12 +3889,13 @@ static char *handle_radio_debug_off(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(radio_set_debug_off(a->fd,a->argc,a->argv)); + return res2cli(radio_set_debug_off(a->fd, a->argc, NULL /* ignored */)); } static char *handle_radio_active(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + char *argv[4] = { "radio", "active", a->argc > 2 ? (char *) a->argv[2] : NULL, }; switch (cmd) { case CLI_INIT: e->command = "radio active"; @@ -3899,12 +3904,13 @@ static char *handle_radio_active(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(radio_active(a->fd,a->argc,a->argv)); + return res2cli(radio_active(a->fd, a->argc, argv)); } static char *handle_set_xdebug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { + char *argv[5] = { "radio", "set", "xdebug", a->argc == 4 ? (char *) a->argv[3] : NULL, }; switch (cmd) { case CLI_INIT: e->command = "radio set xdebug"; @@ -3913,7 +3919,7 @@ static char *handle_set_xdebug(struct ast_cli_entry *e, case CLI_GENERATE: return NULL; } - return res2cli(radio_set_xpmr_debug(a->fd,a->argc,a->argv)); + return res2cli(radio_set_xpmr_debug(a->fd, a->argc, argv)); } |