From 00e0f00974b9ff2a43da46cf4d3db323964f70c0 Mon Sep 17 00:00:00 2001 From: lwvmobile Date: Sat, 29 Apr 2023 17:02:55 -0400 Subject: [PATCH] NXDN Tweaks to clear stale key values on keyload; --- src/dmr_flco.c | 1 + src/dsd_main.c | 44 +++++++++++++------------------------------- src/dsd_ncurses.c | 4 ++-- src/nxdn_deperm.c | 3 ++- src/nxdn_element.c | 4 ++-- 5 files changed, 20 insertions(+), 36 deletions(-) diff --git a/src/dmr_flco.c b/src/dmr_flco.c index 2c9c997..eb4215b 100644 --- a/src/dmr_flco.c +++ b/src/dmr_flco.c @@ -907,6 +907,7 @@ void dmr_slco (dsd_opts * opts, dsd_state * state, uint8_t slco_bits[]) { fprintf (stderr, "[%02X]", slco_bytes[i]); } + fprintf (stderr, "\n"); //if its a voice frame, we need the line break } fprintf (stderr, "%s", KNRM); diff --git a/src/dsd_main.c b/src/dsd_main.c index 8006b8b..2dadf96 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -52,7 +52,7 @@ char * FM_banner[9] = { " ██║ ██║ ╚═══██╗██║ ██║   ██╔══╝ ██║╚██╔╝██║██╔══╝ ", " ██████╔╝██████╔╝██████╔╝   ██║ ██║ ╚═╝ ██║███████╗", " ╚═════╝ ╚═════╝ ╚═════╝    ╚═╝ ╚═╝ ╚═╝╚══════╝", - " 'Aero' Edition v2.0.0-84-gacd2b0b Windows 32-bit " + " 'Aero' Edition v2.0.0-86-gfef36e3 Windows 32-bit " }; int comp (const void *a, const void *b) @@ -77,36 +77,6 @@ void noCarrier (dsd_opts * opts, dsd_state * state) { - // // experimental conventional frequency scanner mode - // if (opts->scanner_mode == 1) - // { - - // if (state->lcn_freq_roll > state->lcn_freq_count) //with >= we were cutting one short - // { - // state->lcn_freq_roll = 0; //reset to zero - // } - // //check that we have a non zero value first, then tune next frequency - // if (state->trunk_lcn_freq[state->lcn_freq_roll] != 0) - // { - // //rigctl - // if (opts->use_rigctl == 1) - // { - // if (opts->setmod_bw != 0 ) SetModulation(opts->rigctl_sockfd, opts->setmod_bw); - // SetFreq(opts->rigctl_sockfd, state->trunk_lcn_freq[state->lcn_freq_roll]); - // } - // //rtludp - // if (opts->audio_in_type == 3) - // { - // rtl_udp_tune (opts, state, state->trunk_lcn_freq[state->lcn_freq_roll]); - // } - - // if (state->lastsynctype != -1) fprintf (stderr, "Resume Scanning Mode\n"); - - // } - // state->lcn_freq_roll++; - // } - // //end experimental conventional frequency scanner mode - //experimental conventional frequency scanner mode if (opts->scanner_mode == 1 && ( (time(NULL) - state->last_cc_sync_time) > opts->trunk_hangtime)) { @@ -360,6 +330,18 @@ noCarrier (dsd_opts * opts, dsd_state * state) memset (state->nxdn_alias_block_segment, 0, sizeof(state->nxdn_alias_block_segment)); sprintf (state->nxdn_call_type, "%s", ""); + //unload keys when using keylaoder + if (state->keyloader == 1) + { + state->R = 0; //NXDN + state->K = 0; //BP + state->K1 = 0; //tera 10 char BP + state->H = 0; //shim for above + } + + //forcing key application will re-enable this at the time of voice tx + state->nxdn_cipher_type = 0; + //dmr overaching manufacturer in use for a particular system or radio // state->dmr_mfid = -1; diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index 26ac621..87b3c96 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -2073,7 +2073,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (opts->ncurses_compact == 1) { printw ("------------------------------------------------------------------------------\n"); - printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-84-gacd2b0b Win32"); + printw ("| Digital Speech Decoder: Florida Man Edition - Aero %s \n", "v2.0.0-86-gfef36e3 Win32"); } if (opts->ncurses_compact == 0) { @@ -2085,7 +2085,7 @@ ncursesPrinter (dsd_opts * opts, dsd_state * state) if (i == 2) printw (" 'q' to Quit "); if (i == 4) printw (" MBElib %s", versionstr); if (i == 5) printw (" %s ", "Aero Win32"); //printw (" %s \n", GIT_TAG); - if (i == 6) printw (" %s \n", "v2.0.0-84-gacd2b0b"); //printw (" %s \n", GIT_TAG); + if (i == 6) printw (" %s \n", "v2.0.0-86-gfef36e3"); //printw (" %s \n", GIT_TAG); else printw ("\n"); } attroff(COLOR_PAIR(6)); //6 diff --git a/src/nxdn_deperm.c b/src/nxdn_deperm.c index bb7255e..474d23e 100644 --- a/src/nxdn_deperm.c +++ b/src/nxdn_deperm.c @@ -932,7 +932,8 @@ void nxdn_message_type (dsd_opts * opts, dsd_state * state, uint8_t MessageType) memset (state->nxdn_alias_block_segment, 0, sizeof(state->nxdn_alias_block_segment)); state->nxdn_last_rid = 0; state->nxdn_last_tg = 0; - if (state->M == 0) state->nxdn_cipher_type = 0; + state->nxdn_cipher_type = 0; //force will reactivate it if needed during voice tx + if (state->keyloader == 1) state->R = 0; memset (state->nxdn_sacch_frame_segcrc, 1, sizeof(state->nxdn_sacch_frame_segcrc)); memset (state->nxdn_sacch_frame_segment, 1, sizeof(state->nxdn_sacch_frame_segment)); sprintf (state->nxdn_call_type, "%s", ""); diff --git a/src/nxdn_element.c b/src/nxdn_element.c index 9036ab7..47a0f1a 100644 --- a/src/nxdn_element.c +++ b/src/nxdn_element.c @@ -442,11 +442,11 @@ void NXDN_decode_VCALL_ASSGN(dsd_opts * opts, dsd_state * state, uint8_t * Messa if (state->nxdn_rcn == 1) fprintf(stderr, "- DFA Channel [%04X][%05d] ", OFN, OFN); - //test VCALL_ASSGN_DUP, if no voice sync activity in 1-2 seconds, then convert to assgn and allow tuning + //test VCALL_ASSGN_DUP, if no voice sync activity (by trunk_hangtime), then convert to assgn and allow tuning //VCALL_ASSGN_DUP has been seen in the middle of calls, but also on the tail end instead of a TX_REL or DISC if (MessageType == 0x5 && opts->p25_is_tuned == 1 && opts->p25_trunk == 1) { - if ( (time(NULL) - state->last_vc_sync_time) > 1 ) + if ( (time(NULL) - state->last_vc_sync_time) > opts->trunk_hangtime ) { MessageType = 0x04; //convert to VCALL opts->p25_is_tuned = 0; //open tuning back up to tune