Skip to content

Commit

Permalink
- added parity between simpleusb and usbradio (the current settings w…
Browse files Browse the repository at this point in the history
…ill also

  be displayed by the latter).
- found a "better" way to return the added parameters from the driver to the
  menu utility
- added micplaymax, spkrmax, and micmax to the "tune menu-support 0+#" info
  • Loading branch information
Allan-N committed Oct 8, 2024
1 parent 850c3cb commit f427f20
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
7 changes: 4 additions & 3 deletions channels/chan_simpleusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -3330,11 +3330,12 @@ static void tune_menusupport(int fd, struct chan_simpleusb_pvt *o, const char *c
values to be returned (and in a specific order). So, we only add to the end
of the returned list. Also, once an update has been released we can't change
the format/content of any previously returned string */
if (!strcmp(cmd, "0+1")) {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
if (!strcmp(cmd, "0+4")) {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
o->txmixaset, o->txmixbset, o->echomode, o->rxboost, o->preemphasis,
o->deemphasis, o->plfilter, o->invertptt, o->rxcdtype, o->rxsdtype,
o->rxondelay, o->txoffdelay, o->rxmixerset);
o->rxondelay, o->txoffdelay, o->rxmixerset,
o->micplaymax, o->spkrmax, o->micmax);
} else {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
o->txmixaset, o->txmixbset, o->echomode, o->rxboost, o->preemphasis,
Expand Down
7 changes: 4 additions & 3 deletions channels/chan_usbradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3972,13 +3972,14 @@ static void tune_menusupport(int fd, struct chan_usbradio_pvt *o, const char *cm
values to be returned (and in a specific order). So, we only add to the end
of the returned list. Also, once an update has been released we can't change
the format/content of any previously returned string */
if (!strcmp(cmd, "0+6")) {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%d,%d,%d,%d\n",
if (!strcmp(cmd, "0+9")) {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%d,%d,%d,%d,%d,%d,%d\n",
flatrx, txhasctcss, o->echomode, o->rxboost, o->txboost,
o->rxcdtype, o->rxsdtype, o->rxondelay, o->txoffdelay,
o->txprelim, o->txlimonly, o->rxdemod, o->txmixa, o->txmixb,
o->rxmixerset, o->rxvoiceadj, o->rxsquelchadj, o->txmixaset,
o->txmixbset, o->txctcssadj);
o->txmixbset, o->txctcssadj, o->micplaymax, o->spkrmax,
o->micmax);
} else {
ast_cli(fd, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",
flatrx, txhasctcss, o->echomode, o->rxboost, o->txboost,
Expand Down
7 changes: 4 additions & 3 deletions utils/radio-tune-menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ static void options_menu(void)
int rxmixerset = 0, rxsquelchadj = 0;
float rxvoiceadj = 0;
int txmixaset = 0, txmixbset = 0, txctcssadj = 0;
int micplaymax = 0, spkrmax = 0, micmax = 0;
char str[256];
int result;

Expand All @@ -987,17 +988,17 @@ static void options_menu(void)
for (;;) {

/* get device parameters from Asterisk */
if (astgetline(COMMAND_PREFIX "tune menu-support 0+6", str, sizeof(str) - 1)) {
if (astgetline(COMMAND_PREFIX "tune menu-support 0+9", str, sizeof(str) - 1)) {
printf("The setup information for chan_usbradio could not be retrieved!\n\n");
printf("Verify that Asterisk is running and chan_usbradio is loaded.\n\n");
exit(255);
}
if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%d,%d,%d,%d",
if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%f,%d,%d,%d,%d,%d,%d,%d",
&flatrx, &txhasctcss, &echomode, &rxboost, &txboost,
&carrierfrom, &ctcssfrom, &rxondelay, &txoffdelay,
&txprelim, &txlimonly, &rxdemod, &txmixa, &txmixb,
&rxmixerset, &rxvoiceadj, &rxsquelchadj, &txmixaset,
&txmixbset, &txctcssadj) != 20) {
&txmixbset, &txctcssadj, &micplaymax, &spkrmax, &micmax) != 23) {
fprintf(stderr, "Error parsing device parameters: %s\n", str);
exit(255);
}
Expand Down
8 changes: 4 additions & 4 deletions utils/simpleusb-tune-menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ static int astgetresp(char *cmd)
int rxboost = 0, preemphasis = 0, deemphasis = 0;
int plfilter = 0, pttmode = 0, carrierfrom = 0, ctcssfrom = 0;
int rxondelay = 0, txoffdelay = 0;
int rxmixerset = 0;
int rxmixerset = 0, micplaymax = 0, spkrmax = 0, micmax = 0;
int result;
char str[256];

Expand All @@ -756,15 +756,15 @@ static int astgetresp(char *cmd)
for (;;) {

/* get device parameters from Asterisk */
if (astgetline(COMMAND_PREFIX "tune menu-support 0+1", str, sizeof(str) - 1)) {
if (astgetline(COMMAND_PREFIX "tune menu-support 0+4", str, sizeof(str) - 1)) {
printf("The chan_simpleusb setup information could not be retrieved!\n\n");
printf("Verify that Asterisk is running and chan_simpleusb is loaded.\n\n");
exit(255);
}
if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
if (sscanf(str, "%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
&txmixaset, &txmixbset, &echomode, &rxboost, &preemphasis, &deemphasis,
&plfilter, &pttmode, &carrierfrom, &ctcssfrom, &rxondelay, &txoffdelay,
&rxmixerset) != 13) {
&rxmixerset, &micplaymax, &spkrmax, &micmax) != 16) {
fprintf(stderr, "Error parsing device parameters: %s\n", str);
exit(255);
}
Expand Down

0 comments on commit f427f20

Please sign in to comment.