Skip to content

A Go wrapper for librtlsdr (a driver for Realtek RTL2832U based SDR's)

License

Notifications You must be signed in to change notification settings

jpoirier/gortlsdr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gortlsdr version Build Status Godoc reference Go Report Card BSD3 License

Description

gortlsdr is a simple Go interface to devices supported by the RTL-SDR project, which turns certain USB DVB-T dongles employing the Realtek RTL2832U chipset into a low-cost, general purpose software-defined radio receiver. It wraps all the functions in the librtlsdr library (including asynchronous read support).

Supported Platforms:

  • Linux
  • OS X
  • Windows (with a little work)

Installation

Dependencies

Usage

All functions in librtlsdr are accessible from the gortlsdr package:

go get -u github.com/jpoirier/gortlsdr

Example

See the eample.go file:

go run example.go

Windows

If you don't want to build the librtlsdr and libusb dependencies from source you can use the librtlsdr pre-built package, which includes libusb, but you're restricted to building a 32-bit gortlsdr library.

Building gortlsdr on Windows:

  • Download and install git.

  • Download and install the Go tools. Create a "go-pkgs" directory-your user folder is a good location-and add a GOPATH variable to your system environment, where GOPATH is set to the go-pkgs path, e.g. GOPATH=c:\users\jpoirier\go-pkgs.

  • Download the pre-built rtl-sdr library and unzip it, e.g. to your user folder. Note the path to the header files and the *.dll files in the x32 folder.

  • Download gortlsdr, but don't install the package:

        go get -d github.com/jpoirier/gortlsdr
    
  • Set CFLAGS and LDFLAGS in rtlsdr.go. Open the rtlsdr.go file in an editor, it'll be in go-pkgs\src\github.com\jpoirier\gortlsdr, and set the following two windows specific flags shown below, but with the correct paths from your system. CFLAGS points to the header files and LDFLAGS to the *.dll files:

        cgo windows CFLAGS: -IC:/Users/jpoirier/rtlsdr
        cgo windows LDFLAGS: -lrtlsdr -LC:/Users/jpoirier/rtlsdr/x32
    
  • Build gortlsdr:

        go install github.com/jpoirier/gortlsdr
    
  • Insert the DVB-T/DAB/FM dongle into a USB port, open a shell window in go-pkgs\src\github.com\jpoirier\gortlsdr and run the example program: go run example.go. Note, the pre-built rtl-sdr package contains several test executables as well.

Credit

Todo

-joe