tests invited: rtl-sdr

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

tests invited: rtl-sdr

Stuart Henderson
I thought I'd write a port for this while I wait for my dongle to arrive
and thought I'd send it out in case anyone wants to give it a try.
No idea if it works on OpenBSD as-is or if it needs more work :)

-- -- -- -- -- -- --
DVB-T dongles based on the Realtek RTL2832U can be used as a cheap SDR
(software defined radio), since the chip allows transferring the raw I/Q
samples to the host, which is officially used for DAB/DAB+/FM demodulation.

RTL-SDR provides some tools to work with these devices:

rtl_adsb: simple ADS-B decoder (aircraft tracking)
rtl_eeprom: EEPROM programming tool
rtl_fm: general purpose analogue demodulator
                (narrow band FM, wide band FM, AM and SSB)
rtl_sdr: tunes the device and captures raw data to a file
rtl_tcp: provides a network server for remote access to an SDR
rtl_test: check the possible tuning range
-- -- -- -- -- -- --

http://sdr.osmocom.org/trac/wiki/rtl-sdr / http://www.rtlsdr.org/

rtl-sdr.tgz (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Zoran Ivanić
On Fri, Apr 12, 2013 at 10:58:11PM +0100, Stuart Henderson wrote:
> I thought I'd write a port for this while I wait for my dongle to arrive
> and thought I'd send it out in case anyone wants to give it a try.
> No idea if it works on OpenBSD as-is or if it needs more work :)

I have two dongles, with E4000 and with R820T.
Looks like it needs some more work:)
Here is quick test:

rtl_test  
Found 2 device(s):
  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle
  1:  ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
usb_open error -4
Failed to open rtlsdr device #0.

dmesg part:
ugen2 at uhub1 port 6 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 2
ugen3 at uhub1 port 1 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 3



Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Federico Schwindt-2
On Sat, Apr 13, 2013 at 2:52 AM, Zoran Ivanić <[hidden email]> wrote:

> On Fri, Apr 12, 2013 at 10:58:11PM +0100, Stuart Henderson wrote:
>> I thought I'd write a port for this while I wait for my dongle to arrive
>> and thought I'd send it out in case anyone wants to give it a try.
>> No idea if it works on OpenBSD as-is or if it needs more work :)
>
> I have two dongles, with E4000 and with R820T.
> Looks like it needs some more work:)
> Here is quick test:
>
> rtl_test
> Found 2 device(s):
>   0:  ezcap USB 2.0 DVB-T/DAB/FM dongle
>   1:  ezcap USB 2.0 DVB-T/DAB/FM dongle
>
> Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
> usb_open error -4
> Failed to open rtlsdr device #0.
>
> dmesg part:
> ugen2 at uhub1 port 6 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 2
> ugen3 at uhub1 port 1 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 3

You need to create the entries in /dev. Only ugen0 and ugen1 are
created by default.

f.-

Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Stuart Henderson
On 2013/04/13 13:00, Federico Schwindt wrote:

> On Sat, Apr 13, 2013 at 2:52 AM, Zoran Ivanić <[hidden email]> wrote:
> > On Fri, Apr 12, 2013 at 10:58:11PM +0100, Stuart Henderson wrote:
> >> I thought I'd write a port for this while I wait for my dongle to arrive
> >> and thought I'd send it out in case anyone wants to give it a try.
> >> No idea if it works on OpenBSD as-is or if it needs more work :)
> >
> > I have two dongles, with E4000 and with R820T.
> > Looks like it needs some more work:)
> > Here is quick test:
> >
> > rtl_test
> > Found 2 device(s):
> >   0:  ezcap USB 2.0 DVB-T/DAB/FM dongle
> >   1:  ezcap USB 2.0 DVB-T/DAB/FM dongle
> >
> > Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
> > usb_open error -4
> > Failed to open rtlsdr device #0.
> >
> > dmesg part:
> > ugen2 at uhub1 port 6 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 2
> > ugen3 at uhub1 port 1 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 3
>
> You need to create the entries in /dev. Only ugen0 and ugen1 are
> created by default.

Updated port in http://junkpile.org/rtl-sdr.1.tgz, this prints textual
error messages if libusb_open() fails, and adds a printf for the
LIBUSB_ERROR_NO_DEVICE case as was already done for LIBUSB_ERROR_ACCESS.


Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Jona Joachim
In reply to this post by Stuart Henderson
On 2013-04-12, Stuart Henderson <[hidden email]> wrote:
>
> --5L6AZ1aJH5mDrqCQ
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> I thought I'd write a port for this while I wait for my dongle to arrive
> and thought I'd send it out in case anyone wants to give it a try.
> No idea if it works on OpenBSD as-is or if it needs more work :)

It actually seems to work pretty well:

ugen2 at uhub0 port 2 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 2

asterix% rtl_test -t
Found 1 device(s):
  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0
21.5 24.0 29.0 34.0 42.0
Benchmarking E4000 PLL...
[E4K] PLL not locked for 52000000 Hz!
[E4K] PLL not locked for 2222000000 Hz!
[E4K] PLL not locked for 1112000000 Hz!
[E4K] PLL not locked for 1248000000 Hz!
E4K range: 53 to 2221 MHz
E4K L-band gap: 1112 to 1248 MHz

asterix% uname -a
OpenBSD asterix.my.domain 5.3 GENERIC.MP#60 amd64

I was able to capture samples but I don't know yet how to exploit them.
Are you aware for example of a way to play FM radio samples?

Best regards,
Jona

Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Zoran Ivanić
On Sun, Apr 14, 2013 at 04:09:49PM +0000, Jona Joachim wrote:

> On 2013-04-12, Stuart Henderson <[hidden email]> wrote:
> >
> > --5L6AZ1aJH5mDrqCQ
> > Content-Type: text/plain; charset=us-ascii
> > Content-Disposition: inline
> >
> > I thought I'd write a port for this while I wait for my dongle to arrive
> > and thought I'd send it out in case anyone wants to give it a try.
> > No idea if it works on OpenBSD as-is or if it needs more work :)
>
> It actually seems to work pretty well:
>
> ugen2 at uhub0 port 2 "Realtek RTL2838UHIDIR" rev 2.00/1.00 addr 2
>
> asterix% rtl_test -t
> Found 1 device(s):
>   0:  ezcap USB 2.0 DVB-T/DAB/FM dongle
>
> Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
> Found Elonics E4000 tuner
> Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0
> 21.5 24.0 29.0 34.0 42.0
> Benchmarking E4000 PLL...
> [E4K] PLL not locked for 52000000 Hz!
> [E4K] PLL not locked for 2222000000 Hz!
> [E4K] PLL not locked for 1112000000 Hz!
> [E4K] PLL not locked for 1248000000 Hz!
> E4K range: 53 to 2221 MHz
> E4K L-band gap: 1112 to 1248 MHz
>
> asterix% uname -a
> OpenBSD asterix.my.domain 5.3 GENERIC.MP#60 amd64
>
> I was able to capture samples but I don't know yet how to exploit them.
> Are you aware for example of a way to play FM radio samples?
>
Here are some examples:
http://kmkeen.com/rtl-demod-guide/index.html,
but i rtl_fm coredumps:

rtl_fm -W -f 98.2M
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000009

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
Oversampling input by: 2x.
Oversampling output by: 4x.
Buffer size: 6.02ms
Tuned to 98556000 Hz.
Sampling at 1360000 Hz.
Output at 32000 Hz.
Exact sample rate is: 1360000.050439 Hz
Tuner gain set to automatic.
Abort trap (core dumped)
-----------------------------------------------------------------------
gdb /usr/local/bin/rtl_fm rtl_fm.core  
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "amd64-unknown-openbsd5.3"...
Core was generated by `rtl_fm'.
Program terminated with signal 6, Aborted.
Reading symbols from /usr/lib/libpthread.so.17.0...done.
Loaded symbols for /usr/lib/libpthread.so.17.0
Loaded symbols for /usr/local/bin/rtl_fm
Reading symbols from /usr/local/lib/librtlsdr.so.0.0...done.
Loaded symbols for /usr/local/lib/librtlsdr.so.0.0
Reading symbols from /usr/local/lib/libusb-1.0.so.1.0...done.
Loaded symbols for /usr/local/lib/libusb-1.0.so.1.0
Symbols already loaded for /usr/lib/libpthread.so.17.0
Reading symbols from /usr/lib/libm.so.8.0...done.
Loaded symbols for /usr/lib/libm.so.8.0
Reading symbols from /usr/lib/libc.so.67.0...done.
Loaded symbols for /usr/lib/libc.so.67.0
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  0x00001f104264a9da in kill () at <stdin>:2
2       <stdin>: No such file or directory.
        in <stdin>
(gdb) bt
#0  0x00001f104264a9da in kill () at <stdin>:2
#1  0x00001f10426ae2ca in abort () at
/usr/src/lib/libc/stdlib/abort.c:70
#2  0x00001f1048d9a8a5 in pthread_mutex_unlock (mutexp=Variable "mutexp"
is not available.
) at /usr/src/lib/librthread/rthread_sync.c:218
#3  0x00001f0e3f1029d6 in full_demod (fm=0x7f7fffdfab70) at
/usr/ports/pobj/rtl-sdr-0.20130412/rtl-sdr-0.20130412/src/rtl_fm.c:583
#4  0x00001f0e3f102bb4 in demod_thread_fn (arg=Variable "arg" is not
available.
) at
/usr/ports/pobj/rtl-sdr-0.20130412/rtl-sdr-0.20130412/src/rtl_fm.c:641
#5  0x00001f1048d9913e in _rthread_start (v=Variable "v" is not
available.
) at /usr/src/lib/librthread/rthread.c:122
#6  0x00001f10426363bb in __tfork_thread () at
/usr/src/lib/libc/arch/amd64/sys/tfork_thread.S:75
Cannot access memory at address 0x1f1049225000
-----------------------------------------------------------------------
Another thing im not sure about is tuned frequency and ctrl+c doesn't
work:
rtl_sdr capture1.bin -s 1.8e6 -f 98.2M
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000013

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Rafael Micro R820T tuner
Tuned to 100000000 Hz.
Reading samples in async mode...
^CSignal caught, exiting!
^CSignal caught, exiting!
^CSignal caught, exiting!
Hangup
-----------------------------------------------------------------------
Dumping eprom seems to work:
rtl_eeprom -r E4000-Edump.bin
Found 1 device(s):
  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner

Current configuration:
__________________________________________
Vendor ID:              0x0bda
Product ID:             0x2838
Manufacturer:           Realtek
Product:                RTL2838UHIDIR
Serial number:          00000009
Serial number enabled:  yes
IR endpoint enabled:    yes
Remote wakeup enabled:  no
__________________________________________

Dump to E4000-Edump.bin successful.
-----------------------------------------------------------------------
hexdump EE4000-dump.bin                                      
0000000    3228    0bda    2838    16a5    1012    5203    6500    6100
0000010    6c00    7400    6500    6b00    1c00    5203    5400    4c00
0000020    3200    3800    3300    3800    5500    4800    4900    4400
0000030    4900    5200    1200    3003    3000    3000    3000    3000
0000040    3000    3000    3900    0000    0000    0000    0200    0000
0000050    0000    0000    0000    0000    0000    0000    0000    0000
*
0000080    ffff    ffff    ffff    ffff    ffff    ffff    ffff    ffff
*
0000100
-----------------------------------------------------------------------
Lower sampling frequency seems to work better than default 2048000:
rtl_test -s 1e6
Found 1 device(s):
  0:  ezcap USB 2.0 DVB-T/DAB/FM dongle

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Elonics E4000 tuner
Supported gain values (14): -1.0 1.5 4.0 6.5 9.0 11.5 14.0 16.5 19.0
21.5 24.0 29.0 34.0 42.0
Exact sample rate is: 1000000.026491 Hz

Info: This tool will continuously read from the device, and report if
samples get lost. If you observe no further output, everything is fine.

Reading samples in async mode...
^CSignal caught, exiting!
^CSignal caught, exiting!
^CSignal caught, exiting!
Hangup

That's so far:)

Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Stuart Henderson
On 2013/04/14 19:01, Zoran Ivanić wrote:
> Here are some examples:
> http://kmkeen.com/rtl-demod-guide/index.html,
> but i rtl_fm coredumps:
>
> rtl_fm -W -f 98.2M
..snip..
> (gdb) bt
> #0  0x00001f104264a9da in kill () at <stdin>:2
> #1  0x00001f10426ae2ca in abort () at
> /usr/src/lib/libc/stdlib/abort.c:70
> #2  0x00001f1048d9a8a5 in pthread_mutex_unlock (mutexp=Variable "mutexp"
> is not available.
> ) at /usr/src/lib/librthread/rthread_sync.c:218

The version in the attached tar.gz will stop it abort()ing here
but it's a bit dirty. No hardware to test it myself yet though.


rtl-sdr.tgz (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Stuart Henderson
ok so I have some hardware now. bulk transfers with asynchronous
events don't work via libusb yet (mglocker has been looking at this) but
when used in synchronous mode this is doing something which looks kind-of
correct.

I need to make some comparisons with non-OpenBSD machines to
see if it it's really working though; I'm in a bit of a radio black
hole and the crappy stock aerial I'm currently using don't make it
easy to tell what's working and what isn't ;)

attached tar.gz (to unpack in /usr/ports/mystuff/comms) has these 3 ports:

py-rtlsdr - python library making librtlsdr functions available from python.
includes a demo "waterfall" program (which requires newer py-matplotlib
from openbsd-wip), dependency on matplotlib not enforced for this as it's
mostly intended as a library.

rtlsdr-scanner: scanner program making use of above library -
this one does work with -current py-matplotlib.

updated rtl-sdr port: for now, remove programs which can *only* use
async mode.


rtl-sdr-ports.tgz (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Stuart Henderson
On 2013/04/20 11:24, Stuart Henderson wrote:

> ok so I have some hardware now. bulk transfers with asynchronous
> events don't work via libusb yet (mglocker has been looking at this) but
> when used in synchronous mode this is doing something which looks kind-of
> correct.
>
> I need to make some comparisons with non-OpenBSD machines to
> see if it it's really working though; I'm in a bit of a radio black
> hole and the crappy stock aerial I'm currently using don't make it
> easy to tell what's working and what isn't ;)
>
> attached tar.gz (to unpack in /usr/ports/mystuff/comms) has these 3 ports:
>
> py-rtlsdr - python library making librtlsdr functions available from python.
> includes a demo "waterfall" program (which requires newer py-matplotlib
> from openbsd-wip), dependency on matplotlib not enforced for this as it's
> mostly intended as a library.
>
> rtlsdr-scanner: scanner program making use of above library -
> this one does work with -current py-matplotlib.
>
> updated rtl-sdr port: for now, remove programs which can *only* use
> async mode.


so... given the limitations, this definitely works:

http://junkpile.org/rtlscanner.png

any OKs to import these?

http://junkpile.org/rtl-sdr-ports.tgz

also FLdigi while I'm at it? (sent previously; copy in
http://junkpile.org/fldigi.tgz)





Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Martin Pieuchot-2
On 20/04/13(Sat) 13:08, Stuart Henderson wrote:

> On 2013/04/20 11:24, Stuart Henderson wrote:
> > ok so I have some hardware now. bulk transfers with asynchronous
> > events don't work via libusb yet (mglocker has been looking at this) but
> > when used in synchronous mode this is doing something which looks kind-of
> > correct.
> >
> > I need to make some comparisons with non-OpenBSD machines to
> > see if it it's really working though; I'm in a bit of a radio black
> > hole and the crappy stock aerial I'm currently using don't make it
> > easy to tell what's working and what isn't ;)
> >
> > attached tar.gz (to unpack in /usr/ports/mystuff/comms) has these 3 ports:
> >
> > py-rtlsdr - python library making librtlsdr functions available from python.
> > includes a demo "waterfall" program (which requires newer py-matplotlib
> > from openbsd-wip), dependency on matplotlib not enforced for this as it's
> > mostly intended as a library.
> >
> > rtlsdr-scanner: scanner program making use of above library -
> > this one does work with -current py-matplotlib.
> >
> > updated rtl-sdr port: for now, remove programs which can *only* use
> > async mode.
>
>
> so... given the limitations, this definitely works:
>
> http://junkpile.org/rtlscanner.png
>
> any OKs to import these?
>
> http://junkpile.org/rtl-sdr-ports.tgz

I've seen by looking at the code that there's a "-S" flag to use libusb
in a synchronous fashion. Does it work better when you use this flag? If
so, do you think it would make any sense to make it the default on
OpenBSD and add a comment about our current status of asynchronous
transfer submission?

M.

Reply | Threaded
Open this post in threaded view
|

Re: tests invited: rtl-sdr

Stuart Henderson-6
On 2013/04/21 12:10, Martin Pieuchot wrote:

> On 20/04/13(Sat) 13:08, Stuart Henderson wrote:
> > On 2013/04/20 11:24, Stuart Henderson wrote:
> > > ok so I have some hardware now. bulk transfers with asynchronous
> > > events don't work via libusb yet (mglocker has been looking at this) but
> > > when used in synchronous mode this is doing something which looks kind-of
> > > correct.
> > >
> > > I need to make some comparisons with non-OpenBSD machines to
> > > see if it it's really working though; I'm in a bit of a radio black
> > > hole and the crappy stock aerial I'm currently using don't make it
> > > easy to tell what's working and what isn't ;)
> > >
> > > attached tar.gz (to unpack in /usr/ports/mystuff/comms) has these 3 ports:
> > >
> > > py-rtlsdr - python library making librtlsdr functions available from python.
> > > includes a demo "waterfall" program (which requires newer py-matplotlib
> > > from openbsd-wip), dependency on matplotlib not enforced for this as it's
> > > mostly intended as a library.
> > >
> > > rtlsdr-scanner: scanner program making use of above library -
> > > this one does work with -current py-matplotlib.
> > >
> > > updated rtl-sdr port: for now, remove programs which can *only* use
> > > async mode.
> >
> >
> > so... given the limitations, this definitely works:
> >
> > http://junkpile.org/rtlscanner.png
> >
> > any OKs to import these?
> >
> > http://junkpile.org/rtl-sdr-ports.tgz
>
> I've seen by looking at the code that there's a "-S" flag to use libusb
> in a synchronous fashion. Does it work better when you use this flag? If
> so, do you think it would make any sense to make it the default on
> OpenBSD and add a comment about our current status of asynchronous
> transfer submission?
This is what I talk about in DESCR, I hadn't thought of changing the
default but that makes sense. Updated rtl_sdr port attached to do this
and mention it in DESCR. I've also disabled rtl_tcp as that doesn't
have an option to use asynchronous mode.


rtl-sdr.tgz (3K) Download Attachment