diff --git a/README.md b/README.md index 615278f..9635fde 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ This version of DSD is a flavor blend of [szechyjs](https://github.com/szechyjs/dsd "szechyjs") RTL branch and some of my own additions, along with portions of DMR and NXDN code from the [LouisErigHerve](https://github.com/LouisErigHerve/dsd "LouisErigHerve") branch. This code also borrows snippets, inspiration, and ideas from other open source works including [Boatbod OP25](https://github.com/boatbod/op25 "Boatbod OP25"), [DSDcc](https://github.com/f4exb/dsdcc "DSDcc"), [SDTRunk](https://github.com/DSheirer/sdrtrunk "SDRTrunk"), [MMDVMHost](https://github.com/g4klx/MMDVMHost "MMDVMHost"), [LFSR](https://github.com/mattames/LFSR "LFSR"), and [EZPWD-Reed-Solomon](https://github.com/pjkundert/ezpwd-reed-solomon "EZPWD"). This project wouldn't be possible without a few good people providing me plenty of sample audio files to run over and over again. Special thanks to jurek1111, KrisMar, noamlivne, racingfan360, iScottyBotty, LimaZulu and hrh17 for the many hours of wav samples submitted by them. +## 2022.10.01 Update ## + +DSD-FME, and The Florida Man Labs will be taking a hiatus period from straigth development of this project. Currently, I feel we are at a bit of a stand still as far as what can be done with the project without new demodulation, dibit buffer, audio, and input methods. DSD-FME will continue to receive maintenance updates for simple bug fixes and also any major bug issues that cause crashing, etc., but I am reluctant to continue developing with the current underlying issues mentioned above. I am going to go into a period of hiatus with this project and do lots of experimentation, learning, and testing to see what viable options are out there or need to be created from scratch. I feel like I've learned a lot, achieved a lot, made tons of mistakes, learned from a few of them, but ultimately improved on the DSD project. DSD-FME will continue to receive replies and support in any opened issues but will currently only extend to help in setting up and using the software, on top of regular minor maintenance and any crash related issues. + ## 2022.09.28 Mini Update ## Back by popular demand, I've re-implemented DMR Stereo as a standalone decoder. DMR Stereo is also still available in XDMA decoding for P25 1, 2, and DMR BS/MS Simplex as well. @@ -102,16 +106,11 @@ and in a second terminal tab, same folder, run ## Roadmap The Current list of objectives include: -1. ~~Include P25 P2 Audio decoding with capture bin files~~, new demodulators and input method(s) (considering liquid-dsp). -~~Random Tinkering~~ ~~More Random Tinkering~~ +1. New demodulators and input method(s) (considering liquid-dsp). -2. ~~Implemented Pulse Audio~~ ~~Remove remaining PortAudio code,~~ ~~improved Pulse Audio for stereo output and channel/slot separation~~ ~~and reimplement wav file saving using DMR Stereo method for stereo wav files, or seperate as per call wav files.~~ +2. Graphical User Interface (may need to migrate to new project). -3. ~~Improve NXDN and DMR support~~ Continue to improve all data and voice decoding. - -4. ~~More Concise Printouts - Ncurses~~ - -5. ~~Make simple to use installer script.~~ +3. Lots of experimentation. ## How to clone, check out, and build this branch diff --git a/src/dsd_main.c b/src/dsd_main.c index fe67ad4..7dfbd29 100644 --- a/src/dsd_main.c +++ b/src/dsd_main.c @@ -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 Manually Set P2 Parameters (WACN, SYSID, CC/NAC)\n"); printf (" (-X BEE00ABC123)\n"); printf ("\n"); - // printf (" -A QPSK modulation auto detection threshold (default=26)\n"); - // printf (" -S Symbol buffer size for QPSK decision point tracking\n"); - // printf (" (default=36)\n"); - // printf (" -M Min/Max buffer size for QPSK decision point tracking\n"); - // printf (" (default=15)\n"); + printf (" -A QPSK modulation auto detection threshold (default=26)\n"); + printf (" -S Symbol buffer size for QPSK decision point tracking\n"); + printf (" (default=36)\n"); + printf (" -M 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); diff --git a/src/dsd_ncurses.c b/src/dsd_ncurses.c index f1bd80f..54d0b1a 100644 --- a/src/dsd_ncurses.c +++ b/src/dsd_ncurses.c @@ -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) diff --git a/src/p25p2_vpdu.c b/src/p25p2_vpdu.c index c61e8d5..7232e67 100644 --- a/src/p25p2_vpdu.c +++ b/src/p25p2_vpdu.c @@ -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) {