From 920b426d72d56b477bc0f5102cb6309611373893 Mon Sep 17 00:00:00 2001 From: Serge Vakulenko Date: Mon, 10 Sep 2018 21:44:53 -0700 Subject: [PATCH] Fix parsing squelch. --- md380.c | 25 ++++++++----------------- uv380.c | 24 +++++++++--------------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/md380.c b/md380.c index 963113d..c1163c7 100644 --- a/md380.c +++ b/md380.c @@ -1419,18 +1419,18 @@ static void md380_parse_parameter(radio_device_t *radio, char *param, char *valu static int parse_digital_channel(radio_device_t *radio, int first_row, char *line) { char num_str[256], name_str[256], rxfreq_str[256], offset_str[256]; - char power_str[256], scanlist_str[256], autoscan_str[256], squelch_str[256]; + char power_str[256], scanlist_str[256], autoscan_str[256]; char tot_str[256], rxonly_str[256], admit_str[256], colorcode_str[256]; char slot_str[256], incall_str[256], grouplist_str[256], contact_str[256]; - int num, power, scanlist, autoscan, squelch, tot, rxonly, admit; + int num, power, scanlist, autoscan, tot, rxonly, admit; int colorcode, timeslot, incall, grouplist, contact; double rx_mhz, tx_mhz; - if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", + if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", num_str, name_str, rxfreq_str, offset_str, - power_str, scanlist_str, autoscan_str, squelch_str, + power_str, scanlist_str, autoscan_str, tot_str, rxonly_str, admit_str, colorcode_str, - slot_str, incall_str, grouplist_str, contact_str) != 16) + slot_str, incall_str, grouplist_str, contact_str) != 15) return 0; num = atoi(num_str); @@ -1481,15 +1481,6 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n"); return 0; } - if (strcasecmp ("Normal", squelch_str) == 0) { - squelch = SQ_NORMAL; - } else if (strcasecmp ("Tight", squelch_str) == 0) { - squelch = SQ_TIGHT; - } else { - fprintf (stderr, "Bad squelch level.\n"); - return 0; - } - tot = atoi(tot_str); if (tot > 555 || tot % 15 != 0) { fprintf(stderr, "Bad timeout timer.\n"); @@ -1566,7 +1557,7 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n"); } setup_channel(num-1, MODE_DIGITAL, name_str, rx_mhz, tx_mhz, - power, scanlist, autoscan, squelch, tot, rxonly, admit, + power, scanlist, autoscan, SQ_NORMAL, tot, rxonly, admit, colorcode, timeslot, incall, grouplist, contact, 0xffff, 0xffff, BW_12_5_KHZ); radio->channel_count++; @@ -1590,8 +1581,8 @@ static int parse_analog_channel(radio_device_t *radio, int first_row, char *line if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s", num_str, name_str, rxfreq_str, offset_str, - power_str, scanlist_str, autoscan_str, squelch_str, - tot_str, rxonly_str, admit_str, + power_str, scanlist_str, autoscan_str, + tot_str, rxonly_str, admit_str, squelch_str, rxtone_str, txtone_str, width_str) != 14) return 0; diff --git a/uv380.c b/uv380.c index bd8e237..e7d5f62 100644 --- a/uv380.c +++ b/uv380.c @@ -1506,18 +1506,18 @@ static void uv380_parse_parameter(radio_device_t *radio, char *param, char *valu static int parse_digital_channel(radio_device_t *radio, int first_row, char *line) { char num_str[256], name_str[256], rxfreq_str[256], offset_str[256]; - char power_str[256], scanlist_str[256], autoscan_str[256], squelch_str[256]; + char power_str[256], scanlist_str[256], autoscan_str[256]; char tot_str[256], rxonly_str[256], admit_str[256], colorcode_str[256]; char slot_str[256], incall_str[256], grouplist_str[256], contact_str[256]; - int num, power, scanlist, autoscan, squelch, tot, rxonly, admit; + int num, power, scanlist, autoscan, tot, rxonly, admit; int colorcode, timeslot, incall, grouplist, contact; double rx_mhz, tx_mhz; - if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", + if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s", num_str, name_str, rxfreq_str, offset_str, - power_str, scanlist_str, autoscan_str, squelch_str, + power_str, scanlist_str, autoscan_str, tot_str, rxonly_str, admit_str, colorcode_str, - slot_str, incall_str, grouplist_str, contact_str) != 16) + slot_str, incall_str, grouplist_str, contact_str) != 15) return 0; num = atoi(num_str); @@ -1570,12 +1570,6 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n"); return 0; } - squelch = atoi(squelch_str); - if (squelch > 9) { - fprintf(stderr, "Bad squelch level.\n"); - return 0; - } - tot = atoi(tot_str); if (tot > 555 || tot % 15 != 0) { fprintf(stderr, "Bad timeout timer.\n"); @@ -1654,8 +1648,8 @@ badtx: fprintf(stderr, "Bad transmit frequency.\n"); } setup_channel(num-1, MODE_DIGITAL, name_str, rx_mhz, tx_mhz, - power, scanlist, autoscan, squelch, tot, rxonly, admit, - colorcode, timeslot, incall, grouplist, contact, 0xffff, 0xffff, BW_12_5_KHZ); + power, scanlist, autoscan, 1, tot, rxonly, admit, colorcode, + timeslot, incall, grouplist, contact, 0xffff, 0xffff, BW_12_5_KHZ); radio->channel_count++; return 1; @@ -1678,8 +1672,8 @@ static int parse_analog_channel(radio_device_t *radio, int first_row, char *line if (sscanf(line, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s", num_str, name_str, rxfreq_str, offset_str, - power_str, scanlist_str, autoscan_str, squelch_str, - tot_str, rxonly_str, admit_str, + power_str, scanlist_str, autoscan_str, + tot_str, rxonly_str, admit_str, squelch_str, rxtone_str, txtone_str, width_str) != 14) return 0;