mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-13 09:17:20 -05:00
P25 Additions, Tweaks, Testing
This commit is contained in:
@@ -263,7 +263,7 @@ initOpts (dsd_opts * opts)
|
||||
sprintf (opts->serial_dev, "/dev/ttyUSB0");
|
||||
opts->resume = 0;
|
||||
opts->frame_dstar = 0;
|
||||
opts->frame_x2tdma = 1;
|
||||
opts->frame_x2tdma = 0;
|
||||
opts->frame_p25p1 = 1;
|
||||
opts->frame_p25p2 = 1;
|
||||
opts->frame_nxdn48 = 0;
|
||||
@@ -273,7 +273,7 @@ initOpts (dsd_opts * opts)
|
||||
opts->frame_provoice = 0;
|
||||
opts->frame_ysf = 0; //forgot to init this, and Cygwin treated as it was turned on.
|
||||
opts->mod_c4fm = 1;
|
||||
opts->mod_qpsk = 1;
|
||||
opts->mod_qpsk = 0;
|
||||
opts->mod_gfsk = 0;
|
||||
opts->uvquality = 3;
|
||||
opts->inverted_x2tdma = 1; // most transmitter + scanner + sound card combinations show inverted signals for this
|
||||
@@ -693,11 +693,16 @@ usage ()
|
||||
printf (" -X <hex> Manually Set P2 Parameters (WACN, SYSID, CC/NAC)\n");
|
||||
printf (" (-X BEE00ABC123)\n");
|
||||
printf ("\n");
|
||||
// printf (" -A <num> QPSK modulation auto detection threshold (default=26)\n");
|
||||
// printf (" -S <num> Symbol buffer size for QPSK decision point tracking\n");
|
||||
// printf (" (default=36)\n");
|
||||
// printf (" -M <num> Min/Max buffer size for QPSK decision point tracking\n");
|
||||
// printf (" (default=15)\n");
|
||||
printf (" -A <num> QPSK modulation auto detection threshold (default=26)\n");
|
||||
printf (" -S <num> Symbol buffer size for QPSK decision point tracking\n");
|
||||
printf (" (default=36)\n");
|
||||
printf (" -M <num> Min/Max buffer size for QPSK decision point tracking\n");
|
||||
printf (" (default=15)\n");
|
||||
printf (" -ma Auto-select modulation optimizations (default)\n");
|
||||
printf (" -mc Use only C4FM modulation optimizations\n");
|
||||
printf (" -mg Use only GFSK modulation optimizations\n");
|
||||
printf (" -mq Use only QPSK modulation optimizations\n");
|
||||
printf (" -m2 Use Phase 2 6000 sps CQPSK modulation optimizations (testing, not fully implemented) \n");
|
||||
// printf (" -F Enable DMR TDMA Stereo Passive Frame Sync\n");
|
||||
// printf (" This feature will attempt to resync less often due to excessive voice errors\n");
|
||||
// printf (" Use if skipping occurs, but may cause wonky audio due to loss of good sync\n");
|
||||
@@ -1390,14 +1395,14 @@ main (int argc, char **argv)
|
||||
opts.frame_dpmr = 0;
|
||||
opts.frame_provoice = 0;
|
||||
opts.frame_ysf = 0;
|
||||
state.samplesPerSymbol = 20; //10
|
||||
state.symbolCenter = 10;
|
||||
opts.mod_c4fm = 0;
|
||||
opts.mod_qpsk = 1;
|
||||
state.samplesPerSymbol = 10;
|
||||
state.symbolCenter = 4;
|
||||
opts.mod_c4fm = 1;
|
||||
opts.mod_qpsk = 0;
|
||||
opts.mod_gfsk = 0;
|
||||
state.rf_mod = 0;
|
||||
opts.dmr_stereo = 1;
|
||||
state.dmr_stereo = 1;
|
||||
state.dmr_stereo = 0;
|
||||
sprintf (opts.output_name, "P25P2");
|
||||
fprintf (stderr,"Decoding P25-P2 frames C4FM or OP25 Symbol Captures!\n");
|
||||
}
|
||||
@@ -1558,6 +1563,16 @@ main (int argc, char **argv)
|
||||
state.rf_mod = 1;
|
||||
fprintf (stderr,"Enabling only QPSK modulation optimizations.\n");
|
||||
}
|
||||
else if (optarg[0] == '2')
|
||||
{
|
||||
opts.mod_c4fm = 0;
|
||||
opts.mod_qpsk = 1;
|
||||
opts.mod_gfsk = 0;
|
||||
state.rf_mod = 1;
|
||||
state.samplesPerSymbol = 8;
|
||||
state.symbolCenter = 3;
|
||||
fprintf (stderr,"Enabling 6000 sps P25 CQPSK (testing only).\n");
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
sscanf (optarg, "%i", &opts.uvquality);
|
||||
|
||||
@@ -255,8 +255,8 @@ char *choicesc[] = {
|
||||
"Save Per Call Decoded WAV (XDMA and NXDN)",
|
||||
"Setup and Start RTL Input ",
|
||||
"Retune RTL Dongle ",
|
||||
" ",
|
||||
"Toggle Audio Mute ", //removing options no longer necesary or not recommended
|
||||
"Toggle C4FM/CQPSK (testing)",
|
||||
"Toggle Audio Mute ",
|
||||
"Toggle NCurses Compact Mode",
|
||||
"Toggle NCurses Call History",
|
||||
"Stop All Decoded WAV Saving",
|
||||
@@ -705,7 +705,22 @@ void ncursesMenu (dsd_opts * opts, dsd_state * state)
|
||||
|
||||
if (choicec == 8)
|
||||
{
|
||||
//vacant box
|
||||
if (state->rf_mod == 0)
|
||||
{
|
||||
state->rf_mod = 1;
|
||||
state->samplesPerSymbol = 8;
|
||||
state->symbolCenter = 3;
|
||||
opts->mod_c4fm = 0;
|
||||
opts->mod_qpsk = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->rf_mod = 0;
|
||||
state->samplesPerSymbol = 10;
|
||||
state->symbolCenter = 4;
|
||||
opts->mod_c4fm = 1;
|
||||
opts->mod_qpsk = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (choicec == 9)
|
||||
|
||||
@@ -21,7 +21,7 @@ static const uint8_t mac_msg_len[256] = {
|
||||
8, 0, 0, 7, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //8F
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //9F
|
||||
16, 0, 0, 11, 13, 11, 11, 11, 10, 0, 0, 0, 0, 0, 0, 0, //AF
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //BF
|
||||
17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //BF, b0 was 0, set to 17
|
||||
11, 0, 0, 8, 15, 12, 15, 32, 12, 12, 0, 27, 14, 29, 29, 32, //CF
|
||||
0, 0, 0, 0, 0, 0, 9, 0, 14, 29, 11, 27, 14, 0, 40, 11, //DF
|
||||
28, 0, 0, 14, 17, 14, 0, 0, 16, 8, 11, 0, 13, 19, 0, 0, //EF
|
||||
@@ -345,6 +345,56 @@ void process_MAC_VPDU(dsd_opts * opts, dsd_state * state, int type, unsigned lon
|
||||
}
|
||||
}
|
||||
|
||||
//MFIDA4 Group Regroup Explicit Encryption Command
|
||||
if (MAC[1+len_a] == 0xB0 && MAC[2+len_a] == 0xA4) //&& MAC[2+len_a] == 0xA4
|
||||
{
|
||||
int len_grg = MAC[3+len_a] & 0x3F;
|
||||
int grg = MAC[4+len_a] >> 5; //3 bits
|
||||
int ssn = MAC[4+len_a] & 0x1F; //5 bits
|
||||
fprintf (stderr, "\n MFIDA4 Group Regroup Explicit Encryption Command\n");
|
||||
//fprintf (stderr, " LEN [%02X] GRG [%02X]\n", len_grg, grg);
|
||||
if (grg & 0x2) //if grg == wgid //&0x2 according to OP25
|
||||
{
|
||||
int sg = (MAC[5+len_a] << 8) | MAC[6+len_a];
|
||||
int key = (MAC[7+len_a] << 8) | MAC[8+len_a];
|
||||
int alg = MAC[9+len_a];
|
||||
int t1 = (MAC[10+len_a] << 8) | MAC[11+len_a];
|
||||
int t2 = (MAC[12+len_a] << 8) | MAC[13+len_a];
|
||||
int t3 = (MAC[14+len_a] << 8) | MAC[15+len_a];
|
||||
int t4 = (MAC[16+len_a] << 8) | MAC[17+len_a];
|
||||
fprintf (stderr, " SG [%05d] KEY [%02X] ALG [%02X]\n ", sg, key, alg);
|
||||
int a = 0;
|
||||
int wgid = 0;
|
||||
//worried a bad decode may cause an oob array crash on this one
|
||||
for (int i = 10; i < len_grg;)
|
||||
{
|
||||
//failsafe to prevent oob array
|
||||
if ( (i + len_a) > 20)
|
||||
{
|
||||
goto END_PDU;
|
||||
}
|
||||
wgid = (MAC[10+len_a+a] << 8) | MAC[11+len_a+a];
|
||||
fprintf (stderr, "WGID [%02X][%05d] ", wgid, wgid);
|
||||
a = a + 2;
|
||||
i = i + 2;
|
||||
}
|
||||
|
||||
}
|
||||
else //if grg == wuid
|
||||
{
|
||||
int sg = (MAC[5+len_a] << 8) | MAC[6+len_a];
|
||||
int key = (MAC[7+len_a] << 8) | MAC[8+len_a];
|
||||
int t1 = (MAC[9+len_a] << 16) | (MAC[10+len_a] << 8) | MAC[11+len_a];
|
||||
int t2 = (MAC[12+len_a] << 16) | (MAC[13+len_a] << 8) | MAC[14+len_a];
|
||||
int t3 = (MAC[15+len_a] << 16) | (MAC[16+len_a] << 8) | MAC[17+len_a];
|
||||
fprintf (stderr, " SG [%02X] KEY [%02X]", sg, key);
|
||||
fprintf (stderr, " U1 [%02X] U2 [%02X] U3 [%02X] ", t1, t2, t3);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//1 or 21, group voice channel message, abb and ext
|
||||
if (MAC[1+len_a] == 0x1 || MAC[1+len_a] == 0x21)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user