ok i'm about ready to pull my hair out with this one. Can anyone get the op25 repeater to work? I'm trying to run disc_tap.py and it always gives me the same error:
chan_usrp_rx expected 4 arguments, got 3
I've looked through the disctap_rx.py and repeater.py at the appropriate lines. I see where disctap_rx.py is calling chan_usrp_rx with 3 variables, and i see where repeater.py expects 4 variables.
Now what?
-Ryan KC9GMY
Apologies and thanks all at the same time for serving as guinea pig on this - some of that code has a degree of bitrot.
The 4th argument should be set to gr.sizeof_short - if super-lazy you could just use 2 .
Max
Hi Max,
I just made the change and I still get the same error. I changed it in disctap_rx.py and repeater.py, no luck. Can you give a bit more direction?
Thanks! -Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:20 PM, ikj1234i@yahoo.com wrote:
Apologies and thanks all at the same time for serving as guinea pig on this - some of that code has a degree of bitrot.
The 4th argument should be set to gr.sizeof_short - if super-lazy you could just use 2 .
Max
oh wait I think I got it, one sec
On Thu, Dec 26, 2013 at 9:25 PM, Ryan Schilder rjschilder@gmail.com wrote:
Hi Max,
I just made the change and I still get the same error. I changed it in disctap_rx.py and repeater.py, no luck. Can you give a bit more direction?
Thanks! -Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:20 PM, ikj1234i@yahoo.com wrote:
Apologies and thanks all at the same time for serving as guinea pig on this - some of that code has a degree of bitrot.
The 4th argument should be set to gr.sizeof_short - if super-lazy you could just use 2 .
Max
yep looks like I got it. had to change it in disctap_rx.py. changed chan usrp 1 and 2.
I'll try to give this a try more over the weekend. I have to find the cable i made for the ft 7800r so i can transmit.
Thanks Max!!
-Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:26 PM, Ryan Schilder rjschilder@gmail.com wrote:
oh wait I think I got it, one sec
On Thu, Dec 26, 2013 at 9:25 PM, Ryan Schilder rjschilder@gmail.comwrote:
Hi Max,
I just made the change and I still get the same error. I changed it in disctap_rx.py and repeater.py, no luck. Can you give a bit more direction?
Thanks! -Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:20 PM, ikj1234i@yahoo.com wrote:
Apologies and thanks all at the same time for serving as guinea pig on this - some of that code has a degree of bitrot.
The 4th argument should be set to gr.sizeof_short - if super-lazy you could just use 2 .
Max
Just a quick update.
I believe I have a working repeater with asterisk app_rpt and op25. I'm working entirely in vmware so it's a bit easier since i can snapshot everything.
I have a discriminator tapped pro-95 thats receiving p25 from my motorola astro saber on 446.000.
I have one vm running ubuntu 10.04, gnuradio 3.2.2, and op25. Another vm is running the acid install from app_rpt. The /etc/asterisk/rpt.conf has been updated based on the examples on the repeater page.
I have the disctap_rx.py pointing to the asterisk vm on port 32001, and the rpt.conf file on the asterisk vm pointing to the op25 vm on port 34001. I have the soundcard_tx.py listening on 34001 and using -A pulse (for pulse audio output).
When i key up on the Astro Saber I hear a p25 stream about .2 seconds later. I also checked in the asterisk CLI using "show usrp". Everytime I key up i see additional read/write stats. As soon as I release the mic button I see a "hungup zaptel....." message, assuming it's closing the channel.
All I have to do is hook this up to my ft7800r's 9600bps data port and I should have a working p25 repeater!!!!!
I'm also thinking of using sdr# on my laptop to grab the datastream from 446.000 directly and piping the audio via virtual audio cable. we'll see how that works.
Thanks for the help Max!!
-Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:29 PM, Ryan Schilder rjschilder@gmail.com wrote:
yep looks like I got it. had to change it in disctap_rx.py. changed chan usrp 1 and 2.
I'll try to give this a try more over the weekend. I have to find the cable i made for the ft 7800r so i can transmit.
Thanks Max!!
-Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:26 PM, Ryan Schilder rjschilder@gmail.comwrote:
oh wait I think I got it, one sec
On Thu, Dec 26, 2013 at 9:25 PM, Ryan Schilder rjschilder@gmail.comwrote:
Hi Max,
I just made the change and I still get the same error. I changed it in disctap_rx.py and repeater.py, no luck. Can you give a bit more direction?
Thanks! -Ryan KC9GMY
On Thu, Dec 26, 2013 at 9:20 PM, ikj1234i@yahoo.com wrote:
Apologies and thanks all at the same time for serving as guinea pig on this - some of that code has a degree of bitrot.
The 4th argument should be set to gr.sizeof_short - if super-lazy you could just use 2 .
Max
Sounds excellent - will look forward to reading your report!
One thing to note, the soundcard_tx TX stack utilizes a different waveform generation algo than the previous TX that you were using. This one uses table lookups - for efficiency but may be different spectrally.
Might not be a bad idea to keep an eye on things using a spectrum analyser - if one is available...
73
Max
Ok thanks for the heads up. I'll clone another op25 vm and route the "Tx" audio from the first vm into op25_audio_rx.py on the second vm. I think there are enough tools to check out the signal. Hopefully i'll have something to report in the next day or two!
-Ryan
On Fri, Dec 27, 2013 at 7:31 AM, ikj1234i@yahoo.com wrote:
Sounds excellent - will look forward to reading your report!
One thing to note, the soundcard_tx TX stack utilizes a different waveform generation algo than the previous TX that you were using. This one uses table lookups - for efficiency but may be different spectrally.
Might not be a bad idea to keep an eye on things using a spectrum analyser
- if one is available...
73
Max
Well good news bad news.
Good news: I got the repeater working with analog (ctcss) or p25 input.
Bad news: it shows up on my bcd396xt as "ENC" (encrypted). My Astro Saber also shows its receiving a signal, but the light flashes in sets of two (i'm guessing it thinks the signal is encrypted too). The saber's LED only lit up once I got the levels right.
I did run into this problem in an earlier version of op25 when trying the op25_audio_tx, but using the latest version seemed to take care of that problem.
Any ideas Max? Is there something in the source I can tweak without rebuilding the whole thing?
-Ryan
On Fri, Dec 27, 2013 at 9:15 AM, Ryan Schilder rjschilder@gmail.com wrote:
Ok thanks for the heads up. I'll clone another op25 vm and route the "Tx" audio from the first vm into op25_audio_rx.py on the second vm. I think there are enough tools to check out the signal. Hopefully i'll have something to report in the next day or two!
-Ryan
On Fri, Dec 27, 2013 at 7:31 AM, ikj1234i@yahoo.com wrote:
Sounds excellent - will look forward to reading your report!
One thing to note, the soundcard_tx TX stack utilizes a different waveform generation algo than the previous TX that you were using. This one uses table lookups - for efficiency but may be different spectrally.
Might not be a bad idea to keep an eye on things using a spectrum analyser - if one is available...
73
Max
Hi Ryan
This is an interesting update - sounds like some progress, anyway!
As to the encryption, older versions of the TX code did not properly set the crypto algo ID, and if you're using one of these that would explain why. The way to tell is to look in repeater_vocoder.cc to see if you have the following (see below). If this code is not there that would explain what's happening. If it is there then I think the next step would be to run some type of trace so we can confirm what the settings are by looking at the actual air data, there would be no doubt as to whether or not the bits are being set OK...
73
Max ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/* bits to be preset to 1 for all transmitted frames */ static const bool ldu1_preset[] = { ...
ok i'll give it a shot. just for giggles i tried the op25_audio_tx.py that I have on a local repeater. I was able to make it into the repeater!
I'll check the file you mentioned above right now.
Thanks! -Ryan
On Sat, Dec 28, 2013 at 9:40 AM, ikj1234i@yahoo.com wrote:
Hi Ryan
This is an interesting update - sounds like some progress, anyway!
As to the encryption, older versions of the TX code did not properly set the crypto algo ID, and if you're using one of these that would explain why. The way to tell is to look in repeater_vocoder.cc to see if you have the following (see below). If this code is not there that would explain what's happening. If it is there then I think the next step would be to run some type of trace so we can confirm what the settings are by looking at the actual air data, there would be no doubt as to whether or not the bits are being set OK...
73
Max
/* bits to be preset to 1 for all transmitted frames */ static const bool ldu1_preset[] = { ...
I believe the code you mentioned is in there. just in case, here is my repeater_vocoder.cc:
/* -*- c++ -*- */ /* * GNU Radio interface for Pavel Yazev's Project 25 IMBE Encoder/Decoder * * Copyright 2004 Free Software Foundation, Inc. * Copyright 2009 Pavel Yazev E-mail: pyazev@gmail.com * Copyright 2009-2013 KA1RBI * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * It is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with it; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */
/* * config.h is generated by configure. It contains the results * of probing for features, options etc. It should be the first * file included in your .cc file. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif
#include <vector> #include <stdint.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>
#include <imbe_vocoder.h> #include <repeater_vocoder.h> #include <op25_p25_frame.h> #include <op25_imbe_frame.h> #include <gr_io_signature.h>
/* bits to be preset to 1 for all transmitted frames */ static const bool ldu1_preset[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0-35 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1, /* 36-71 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 72-107 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 108-143 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 144-179 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 180-215 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 216-251 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 252-287 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 288-323 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0, /* 324-359 */ 0,0,0,0,0,0,0,0,0,0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) { v[i]=0; } }
/* * Create a new instance of repeater_vocoder and return * a boost shared_ptr. This is effectively the public constructor. */ repeater_vocoder_sptr repeater_make_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag) { return repeater_vocoder_sptr (new repeater_vocoder (encode_flag, verbose_flag, stretch_amt, udp_host, udp_port, raw_vectors_flag)); }
////////////////////////////////////////////////////////////// // enc/dec udp operation // dec no byte input; short output // dec yes byte input; null output // enc no short input; char output // enc yes short input; null output
#define M_IN(encode_flag, udp_port) (1) #define M_OUT(encode_flag, udp_port) ((udp_port) ? 0 : 1) #define S_IN(encode_flag, udp_port) ((encode_flag) ? sizeof(int16_t) : sizeof(uint8_t)) #define S_OUT(encode_flag, udp_port) ((udp_port) ? 0 : ((encode_flag) ? sizeof(uint8_t) : sizeof(int16_t)))
/* * The private constructor */ repeater_vocoder::repeater_vocoder (bool encode_flag, bool verbose_flag, int stretch_amt, char* udp_host, int udp_port, bool raw_vectors_flag) : gr_block ("vocoder", gr_make_io_signature (M_IN(encode_flag, udp_port), M_IN(encode_flag, udp_port), S_IN(encode_flag, udp_port)), gr_make_io_signature (M_OUT(encode_flag, udp_port), M_OUT(encode_flag, udp_port), S_OUT(encode_flag, udp_port))), frame_cnt(0), write_sock(0), write_bufp(0), peak_amplitude(0), peak(0), samp_ct(0), rxbufp(0), codeword_ct(0), sampbuf_ct(0), stretch_count(0), save_l(0), f_body(P25_VOICE_FRAME_SIZE) { opt_encode_flag = encode_flag; opt_dump_raw_vectors = raw_vectors_flag; opt_verbose = verbose_flag; opt_udp_port = udp_port;
opt_stretch_amt = 0; if (stretch_amt < 0) { opt_stretch_sign = -1; opt_stretch_amt = 0 - stretch_amt; } else { opt_stretch_sign = 1; opt_stretch_amt = stretch_amt; }
if (opt_udp_port == 0) if (encode_flag) { // local output to gr source // encoding: an LDU's worth of dibits set_output_multiple(P25_VOICE_FRAME_SIZE >> 1); } else { // decoding: an LDU's worth of audio samples // set_output_multiple(FRAME * nof_voice_codewords); } else // remote UDP output init_sock(udp_host, opt_udp_port);
clear_bits(f_body);
const char *p = getenv("IMBE"); if (p && strcasecmp(p, "soft") == 0) d_software_imbe_decoder = true; else d_software_imbe_decoder = false; }
/* * Our virtual destructor. */ repeater_vocoder::~repeater_vocoder () { }
static const int STATS_INTERVAL = 20; static const int SAMP_INTERVAL = 8192;
void repeater_vocoder::append_imbe_codeword(bit_vector& frame_body, int16_t frame_vector[], unsigned int& codeword_ct) { voice_codeword cw(voice_codeword_sz); uint8_t obuf[P25_VOICE_FRAME_SIZE/2]; // construct 144-bit codeword from 88 bits of parameters imbe_header_encode(cw, frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]);
// add codeword to voice data unit imbe_interleave(frame_body, cw, codeword_ct);
// after the ninth and final codeword added, dispose of frame if (++codeword_ct >= nof_voice_codewords) { static const uint64_t hws[2] = { 0x293555ef2c653437LL, 0x293aba93bec26a2bLL }; int ldu_type = frame_cnt & 1; // set ldu_type = 0(LDU1) or 1(LDU2) const bool* ldu_preset = (ldu_type == 0) ? ldu1_preset : ldu2_preset;
p25_setup_frame_header(frame_body, hws[ldu_type]); for (size_t i = 0; i < frame_body.size(); i++) { frame_body[i] = frame_body[i] | ldu_preset[i]; } // finally, output the frame if (opt_udp_port > 0) { // pack the bits into bytes, MSB first size_t obuf_ct = 0; for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 8) { uint8_t b = (frame_body[i+0] << 7) + (frame_body[i+1] << 6) + (frame_body[i+2] << 5) + (frame_body[i+3] << 4) + (frame_body[i+4] << 3) + (frame_body[i+5] << 2) + (frame_body[i+6] << 1) + (frame_body[i+7] ); obuf[obuf_ct++] = b; } sendto(write_sock, obuf, obuf_ct, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr)); } else { for (uint32_t i = 0; i < P25_VOICE_FRAME_SIZE; i += 2) { uint8_t dibit = (frame_body[i+0] << 1) + (frame_body[i+1] ); output_queue.push_back(dibit); } } codeword_ct = 0; frame_cnt++; if (opt_verbose && (frame_cnt % STATS_INTERVAL) == 0) { gettimeofday(&tv, &tz); int s = tv.tv_sec - oldtv.tv_sec; int us = tv.tv_usec - oldtv.tv_usec; if (us < 0) { us = us + 1000000; s = s - 1; } float f = us; f /= 1000000; f += s; fprintf (stderr, "time %f peak %5d\n", f / STATS_INTERVAL, peak_amplitude); oldtv = tv; } clear_bits(f_body); } }
void repeater_vocoder::rxchar(char c) { int16_t snd[FRAME]; int16_t frame_vector[8]; int u[8];
if (c < ' ') { if (c == '\n') { rxbuf[rxbufp] = 0; sscanf(rxbuf, "%x %x %x %x %x %x %x %x", &u[0], &u[1], &u[2], &u[3], &u[4], &u[5], &u[6], &u[7]); rxbufp = 0; // decode 88 bits, outputs 160 sound samples (8000 rate) if (d_software_imbe_decoder) { voice_codeword cw(voice_codeword_sz); imbe_header_encode(cw, u[0], u[1], u[2], u[3], u[4], u[5], u[6], u[7]); software_decoder.decode(cw); audio_samples *samples = software_decoder.audio(); for (int i=0; i < FRAME; i++) { if (samples->size() > 0) { snd[i] = (int16_t)(samples->front() * 32768.0); samples->pop_front(); } else { snd[i] = 0; } } } else { for (int i=0; i < 8; i++) { frame_vector[i] = u[i]; } /* TEST*/ frame_vector[7] >>= 1; vocoder.imbe_decode(frame_vector, snd); } if (opt_udp_port > 0) { sendto(write_sock, snd, FRAME * sizeof(int16_t), 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr)); } else { // add generated samples to output queue for (int i = 0; i < FRAME; i++) { output_queue_decode.push_back(snd[i]); } } } return; } rxbuf[rxbufp++] = c; if (rxbufp >= RXBUF_MAX) { rxbufp = RXBUF_MAX - 1; } }
void repeater_vocoder::compress_frame(int16_t snd[]) { int16_t frame_vector[8];
// encode 160 audio samples into 88 bits (u0-u7) vocoder.imbe_encode(frame_vector, snd);
// if dump option, dump u0-u7 to output if (opt_dump_raw_vectors) { char s[128]; sprintf(s, "%03x %03x %03x %03x %03x %03x %03x %03x\n", frame_vector[0], frame_vector[1], frame_vector[2], frame_vector[3], frame_vector[4], frame_vector[5], frame_vector[6], frame_vector[7]); memcpy(&write_buf[write_bufp], s, strlen(s)); write_bufp += strlen(s); if (write_bufp >= 288) { sendto(write_sock, write_buf, 288, 0, (struct sockaddr*)&write_sock_addr, sizeof(write_sock_addr)); write_bufp = 0; } return; } append_imbe_codeword(f_body, frame_vector, codeword_ct); }
void repeater_vocoder::add_sample(int16_t samp) { // add one sample to 160-sample frame buffer and process if filled sampbuf[sampbuf_ct++] = samp; if (sampbuf_ct >= FRAME) { compress_frame(sampbuf); sampbuf_ct = 0; }
// track signal amplitudes int16_t asamp = (samp < 0) ? 0 - samp : samp; peak = (asamp > peak) ? asamp : peak; if (++samp_ct >= SAMP_INTERVAL) { peak_amplitude = peak; peak = 0; samp_ct = 0; } }
void repeater_vocoder::compress_samp(int16_t samp) { // Apply sample rate slew to accomodate sound card rate discrepancy - // workaround for USRP underrun problem occurring when sound card // capture rate is slower than the correct rate
// FIXME: autodetect proper value for opt_stretch_amt // perhaps by steering the LDU output rate to a 180.0 msec. rate
stretch_count++; if (opt_stretch_amt != 0 && stretch_count >= opt_stretch_amt) { stretch_count = 0; if (opt_stretch_sign < 0) // spill this samp return; // repeat this samp add_sample(samp); } add_sample(samp); }
void repeater_vocoder::init_sock(char* udp_host, int udp_port) { memset (&write_sock_addr, 0, sizeof(write_sock_addr)); write_sock = socket(PF_INET, SOCK_DGRAM, 17); // UDP socket if (write_sock < 0) { fprintf(stderr, "repeater_vocoder: socket: %d\n", errno); write_sock = 0; return; } if (!inet_aton(udp_host, &write_sock_addr.sin_addr)) { fprintf(stderr, "repeater_vocoder: bad IP address\n"); close(write_sock); write_sock = 0; return; } write_sock_addr.sin_family = AF_INET; write_sock_addr.sin_port = htons(udp_port); }
void repeater_vocoder::forecast(int nof_output_items, gr_vector_int &nof_input_items_reqd) { /* When encoding, this block consumes 8000 symbols/s and produces 4800 * samples/s. That's a sampling rate of 5/3 or 1.66667. * * When decoding, the block consumes one line of text per voice codeword. * Each line of text is exactly 32 bytes. It outputs 160 samples for each * codeword; the ratio is thus 32/160 = 0.2. * * Thanks to Matt Mills for catching a bug where this value wasn't set correctly */ const size_t nof_inputs = nof_input_items_reqd.size(); const int nof_samples_reqd = (opt_encode_flag) ? (1.66667 * nof_output_items) : (0.2 * nof_output_items); std::fill(&nof_input_items_reqd[0], &nof_input_items_reqd[nof_inputs], nof_samples_reqd); }
int repeater_vocoder::general_work_decode (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { const char *in = (const char *) input_items[0];
for (int i = 0; i < ninput_items[0]; i++){ rxchar(in[i]); }
// Tell runtime system how many input items we consumed on // each input stream.
consume_each (ninput_items[0]);
uint16_t *out = reinterpret_cast<uint16_t*>(output_items[0]); const int n = std::min(static_cast<int>(output_queue_decode.size()), noutput_items); if(0 < n) { copy(output_queue_decode.begin(), output_queue_decode.begin() + n, out); output_queue_decode.erase(output_queue_decode.begin(), output_queue_decode.begin() + n); } // Tell runtime system how many output items we produced. return n; }
int repeater_vocoder::general_work_encode (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { const short *in = (const short *) input_items[0];
for (int i = 0; i < ninput_items[0]; i++){ compress_samp(in[i]); }
// Tell runtime system how many input items we consumed on // each input stream.
consume_each (ninput_items[0]);
if (opt_udp_port > 0) // in udp option, we are a gr sink only return 0;
uint8_t *out = reinterpret_cast<uint8_t*>(output_items[0]); const int n = std::min(static_cast<int>(output_queue.size()), noutput_items); if(0 < n) { copy(output_queue.begin(), output_queue.begin() + n, out); output_queue.erase(output_queue.begin(), output_queue.begin() + n); } // Tell runtime system how many output items we produced. return n; }
int repeater_vocoder::general_work (int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) { if (opt_encode_flag) return general_work_encode(noutput_items, ninput_items, input_items, output_items); else return general_work_decode(noutput_items, ninput_items, input_items, output_items); }
On Sat, Dec 28, 2013 at 9:47 AM, Ryan Schilder rjschilder@gmail.com wrote:
ok i'll give it a shot. just for giggles i tried the op25_audio_tx.py that I have on a local repeater. I was able to make it into the repeater!
I'll check the file you mentioned above right now.
Thanks! -Ryan
On Sat, Dec 28, 2013 at 9:40 AM, ikj1234i@yahoo.com wrote:
Hi Ryan
This is an interesting update - sounds like some progress, anyway!
As to the encryption, older versions of the TX code did not properly set the crypto algo ID, and if you're using one of these that would explain why. The way to tell is to look in repeater_vocoder.cc to see if you have the following (see below). If this code is not there that would explain what's happening. If it is there then I think the next step would be to run some type of trace so we can confirm what the settings are by looking at the actual air data, there would be no doubt as to whether or not the bits are being set OK...
73
Max
/* bits to be preset to 1 for all transmitted frames */ static const bool ldu1_preset[] = { ...
yeah, the code is there, so it suggests something else may be happening. Does the "encrypted problem" happen in all cases, or does it happen only when using the app_rpt piece? I.e., does it happen only when using soundcard_tx? I think at this point before going into problem determination mode it would be good to have an idea of your configuration, sounds like there are a few moving parts, so it's not clear here what pieces are in play... Can you send a description of the network ? Also it may expedite if we were to talk via voice phone - email me at ikj1234i at yahoo dot com if you want
Max
Hey Max I emailed you directly. Just making sure you got it and it's not in the spam box or something :)
-Ryan
On Sat, Dec 28, 2013 at 10:06 AM, ikj1234i@yahoo.com wrote:
yeah, the code is there, so it suggests something else may be happening. Does the "encrypted problem" happen in all cases, or does it happen only when using the app_rpt piece? I.e., does it happen only when using soundcard_tx? I think at this point before going into problem determination mode it would be good to have an idea of your configuration, sounds like there are a few moving parts, so it's not clear here what pieces are in play... Can you send a description of the network ? Also it may expedite if we were to talk via voice phone - email me at ikj1234i at yahoo dot com if you want
Max
ouch - I think I've confirmed why you have the crypto problem. Actually in a way it's sort of good because you're getting solid enough RX for that to occur. I'll try to develop an update for this
Max
On Saturday, December 28, 2013 12:02 PM, Ryan Schilder rjschilder@gmail.com wrote:
Hey Max I emailed you directly. Just making sure you got it and it's not in the spam box or something :)
-Ryan
On Sat, Dec 28, 2013 at 10:06 AM, ikj1234i@yahoo.com wrote:
yeah, the code is there, so it suggests something else may be happening. Does the "encrypted problem" happen in all cases, or does it happen only when using the app_rpt piece? I.e., does it happen only when using soundcard_tx? I think at this point before going into problem determination mode it would be good to have an idea of your configuration, sounds like there are a few moving parts, so it's not clear here what pieces are in play... Can you send a description of the network ? Also it may expedite if we were to talk via voice phone - email me at ikj1234i at yahoo dot com if you want
Max
ok cool. you still want me to give you a call? im at 414-331-9963. i'll be out and about from 330pm - 530pm cst.
-Ryan
On Sat, Dec 28, 2013 at 2:19 PM, ikjtel ikj1234i@yahoo.com wrote:
ouch - I think I've confirmed why you have the crypto problem. Actually in a way it's sort of good because you're getting solid enough RX for that to occur. I'll try to develop an update for this
Max
On Saturday, December 28, 2013 12:02 PM, Ryan Schilder < rjschilder@gmail.com> wrote:
Hey Max I emailed you directly. Just making sure you got it and it's not in the spam box or something :)
-Ryan
On Sat, Dec 28, 2013 at 10:06 AM, ikj1234i@yahoo.com wrote:
yeah, the code is there, so it suggests something else may be happening. Does the "encrypted problem" happen in all cases, or does it happen only when using the app_rpt piece? I.e., does it happen only when using soundcard_tx? I think at this point before going into problem determination mode it would be good to have an idea of your configuration, sounds like there are a few moving parts, so it's not clear here what pieces are in play... Can you send a description of the network ? Also it may expedite if we were to talk via voice phone - email me at ikj1234i at yahoo dot com if you want
Max
yeah give me a call - should be able to fix it pretty quick
On Saturday, December 28, 2013 3:23 PM, Ryan Schilder rjschilder@gmail.com wrote:
ok cool. you still want me to give you a call? im at 414-331-9963. i'll be out and about from 330pm - 530pm cst.
-Ryan
On Sat, Dec 28, 2013 at 2:19 PM, ikjtel ikj1234i@yahoo.com wrote:
ouch - I think I've confirmed why you have the crypto problem. Actually in a way it's sort of good because you're getting solid enough RX for that to occur. I'll try to develop an update for this
Max
On Saturday, December 28, 2013 12:02 PM, Ryan Schilder rjschilder@gmail.com wrote:
Hey Max I emailed you directly. Just making sure you got it and it's not in the spam box or something :)
-Ryan
On Sat, Dec 28, 2013 at 10:06 AM, ikj1234i@yahoo.com wrote:
yeah, the code is there, so it suggests something else may be happening. Does the "encrypted problem" happen in all cases, or does it happen only when using the app_rpt piece? I.e., does it happen only when using soundcard_tx? I think at this point before going into problem determination mode it would be good to have an idea of your configuration, sounds like there are a few moving parts, so it's not clear here what pieces are in play... Can you send a description of the network ? Also it may expedite if we were to talk via voice phone - email me at ikj1234i at yahoo dot com if you want
Max