hotpaw2 / lmm_tcp

An rtl-tcp compatible, IQ server for LimeSDR Mini
17 stars 5 forks source link

"Invalid magic number" when used with rtlamr #2

Open theY4Kman opened 4 years ago

theY4Kman commented 4 years ago

When I use lmm_tcp with rtlamr, it complains about an "Invalid magic number"

$ rtlamr -server=127.0.0.1:1234 -msgtype=all

15:08:43.332225 main.go:85: Invalid magic number: expected "RTL0" received "\x03\x00\x01\x00"

Apparently, rtl_tcp sends a little header structure over the wire upon connection, including that magic number (as well as a tuner type enum and a count of distinct gain levels supported by that tuner)

rtl_tcp.c:602

memset(&dongle_info, 0, sizeof(dongle_info));
memcpy(&dongle_info.magic, "RTL0", 4);

r = rtlsdr_get_tuner_type(dev);
if (r >= 0)
    dongle_info.tuner_type = htonl(r);

r = rtlsdr_get_tuner_gains(dev, NULL);
if (r >= 0)
    dongle_info.tuner_gain_count = htonl(r);

r = send(s, (const char *)&dongle_info, sizeof(dongle_info), 0);
if (sizeof(dongle_info) != r)
    printf("failed to send dongle information\n");
mmiller7 commented 3 years ago

Getting the same error with rtlamr and a similar error with rtl_433 using rtl_tcp source about bad magic number... 22:40:35.584039 main.go:85: Invalid magic number: expected "RTL0" received "|\x80\x84\x84" Bad rtl_tcp header magic ""

zszhere commented 2 years ago

modify this in line 329

char header[16] = { 'R','T','L','0', 0,0,0,sampleBits, 0,0,0,1, 0,0,0,2 };

add this code to line 250

send_prefix();

could solve this issue