Skip to content

Commit

Permalink
Convert CS8 from SoapyRTLSDR to librtlsdr native CU8 workaround potho…
Browse files Browse the repository at this point in the history
  • Loading branch information
rxseger committed Jul 15, 2016
1 parent 0c0187b commit d84d8e0
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/rtl_fm.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,16 +911,24 @@ static void *dongle_thread_fn(void *arg)
int r = 0;
do
{
void *buffs[] = {s->buf16};
int flags = 0;
long long timeNs;
long timeoutNs = 100000;
r = SoapySDRDevice_readStream(s->dev, s->stream, buffs, MAXIMUM_BUF_LENGTH, &flags, &timeNs, timeoutNs);
fprintf(stderr, "ret=%d, flags=%d, timeNs=%lld\n", r, flags, timeNs);
if (r >= 0) {
s->buf_len = r;
}
rtlsdr_callback((unsigned char *)s->buf16, s->buf_len, s);
void *buffs[] = {s->buf16};
int flags = 0;
long long timeNs;
long timeoutNs = 100000;
r = SoapySDRDevice_readStream(s->dev, s->stream, buffs, MAXIMUM_BUF_LENGTH, &flags, &timeNs, timeoutNs);
fprintf(stderr, "ret=%d, flags=%d, timeNs=%lld\n", r, flags, timeNs);
if (r >= 0) {
s->buf_len = r;
for(int i = 0; i < s->buf_len; ++i) {
//fprintf(stderr, "%.4x ", s->buf16[i]);
// Convert CS8 to CU8, back to RTL-SDR native format!
// TODO: see https://github.com/pothosware/SoapyRTLSDR/issues/15
// TODO: or use "direct buffer access API"?
s->buf16[i] += 127;
}
fprintf(stderr, "\n");
}
rtlsdr_callback((unsigned char *)s->buf16, s->buf_len, s);
} while(r > 0);

//rtlsdr_read_async(s->dev, rtlsdr_callback, s, 0, s->buf_len);
Expand Down

0 comments on commit d84d8e0

Please sign in to comment.