├── .github └── workflows │ └── c-cpp.yml ├── .gitignore ├── .travis.yml ├── AUTHORS ├── CMakeLists.txt ├── COPYING ├── Doxyfile.in ├── Makefile.am ├── README.md ├── README.rtlfm_cmdfile ├── README.rtlsdr_rpc ├── README_improvements.md ├── cmake ├── Modules │ ├── FindLibUSB.cmake │ ├── FindThreads.cmake │ └── Version.cmake └── cmake_uninstall.cmake.in ├── configure.ac ├── contrib └── jenkins.sh ├── cross_build_mingw32.sh ├── cross_build_mingw64.sh ├── debian ├── .gitignore ├── README.Debian ├── changelog ├── compat ├── control ├── copyright ├── copyright-scan-patterns.yml ├── debianize_armhf ├── debianize_x32 ├── debianize_x64 ├── heatmap.py ├── librtlsdr-dev.dirs ├── librtlsdr-dev.install ├── librtlsdr0.dirs ├── librtlsdr0.install ├── librtlsdr0.maintscript ├── librtlsdr0.metainfo.xml ├── librtlsdr0.udev ├── rtl-sdr-blacklist.conf ├── rtl-sdr.dirs ├── rtl-sdr.examples ├── rtl-sdr.install ├── rtl-sdr.manpages ├── rtl_adsb.1 ├── rtl_eeprom.1 ├── rtl_fm.1 ├── rtl_power.1 ├── rtl_sdr.1 ├── rtl_tcp.1 ├── rtl_test.1 ├── rules ├── source │ └── format └── watch ├── git-version-gen ├── include ├── CMakeLists.txt ├── Makefile.am ├── controlThread.h ├── reg_field.h ├── rtl-sdr.h ├── rtl-sdr_export.h ├── rtl_tcp.h ├── rtlsdr_i2c.h ├── rtlsdr_rpc.h ├── rtlsdr_rpc_msg.h ├── tuner_e4k.h ├── tuner_fc0012.h ├── tuner_fc0013.h ├── tuner_fc2580.h └── tuner_r82xx.h ├── install-blacklist.sh ├── librtlsdr.pc.in ├── m4 └── .gitignore ├── mingw-w32-i686.cmake ├── mingw-w64-x64_64.cmake ├── protocol_rtl_tcp.txt ├── rtl-sdr.rules ├── rtlsdr-blacklist.conf ├── src ├── CMakeLists.txt ├── Makefile.am ├── controlThread.c ├── convenience │ ├── convenience.c │ ├── convenience.h │ ├── rtl_convenience.c │ ├── rtl_convenience.h │ ├── wavehdr.h │ ├── waveread.c │ ├── waveread.h │ ├── wavewrite.c │ └── wavewrite.h ├── getopt │ ├── getopt.c │ └── getopt.h ├── librtlsdr.c ├── rtl_adsb.c ├── rtl_app_ver.h.in ├── rtl_biast.c ├── rtl_eeprom.c ├── rtl_fm.c ├── rtl_ir.c ├── rtl_power.c ├── rtl_raw2wav.c ├── rtl_rpcd.c ├── rtl_sdr.c ├── rtl_tcp.c ├── rtl_test.c ├── rtl_udp.c ├── rtl_wavestat.c ├── rtl_wavestream.c ├── rtlsdr.rc.in ├── rtlsdr_rpc.c ├── rtlsdr_rpc_msg.c ├── tuner_e4k.c ├── tuner_fc0012.c ├── tuner_fc0013.c ├── tuner_fc2580.c └── tuner_r82xx.c └── win32-qtcreator ├── CMakeLists.txt └── README.txt /.github/workflows/c-cpp.yml: -------------------------------------------------------------------------------- 1 | name: C/C++ CI 2 | 3 | on: 4 | push: 5 | branches: [ master, development ] 6 | pull_request: 7 | branches: [ master, development ] 8 | 9 | jobs: 10 | build_ubuntu-amd64_latest: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: prerequisites 16 | # pre-installed on ubuntu-1804: build-essential, git 2.28.0, cmake 3.10/3.17, make 17 | # pre-installed: clang 6.0 / 8 / 9, gcc/++ 7.5.0/8.4.0/9.3.0 18 | run: sudo apt -qq update && sudo apt -yqq install libusb-1.0-0-dev 19 | - name: cmake_make 20 | run: mkdir build && cmake -S . -B build && cd build && make 21 | - name: compress 22 | run: tar zcvf librtlsdr_build_ubuntu-amd64_latest.tar.gz --directory=build/src --exclude=CMakeFiles --exclude=*.cmake --exclude=Makefile --exclude=rtl_app_ver.h . 23 | - name: 'Upload Artifact' 24 | uses: actions/upload-artifact@v2 25 | with: 26 | name: ubuntu_latest_build 27 | path: librtlsdr_build_ubuntu-amd64_latest.tar.gz 28 | 29 | build_macos_latest: 30 | runs-on: macos-latest 31 | 32 | steps: 33 | - uses: actions/checkout@v2 34 | #- name: prerequisites 35 | # pre-installed on macos-10.15: git 2.28.0, cmake 3.18.2, libusb 1.0.23 36 | # pre-installed: clang/LLVM 10.0.1, gcc/++ 8.4.0/9.3.0 37 | # run: brew install libusb 38 | - name: cmake_make 39 | run: mkdir build && cmake -S . -B build && cd build && make 40 | - name: compress 41 | run: tar zcvf librtlsdr_build_macos-latest.tar.gz --directory=build/src --exclude=CMakeFiles --exclude=*.cmake --exclude=Makefile --exclude=rtl_app_ver.h . 42 | - name: 'Upload Artifact' 43 | uses: actions/upload-artifact@v2 44 | with: 45 | name: macos_latest_build 46 | path: librtlsdr_build_macos-latest.tar.gz 47 | 48 | cross_build_win32_win64_latest: 49 | runs-on: ubuntu-20.04 50 | 51 | steps: 52 | - uses: actions/checkout@v2 53 | - name: prerequisites 54 | run: sudo apt -qq update && sudo apt -yqq install gcc-mingw-w64 55 | - name: build_w32_static 56 | run: bash ./cross_build_mingw32.sh static -DLINK_RTLTOOLS_AGAINST_STATIC_LIB=ON 57 | - name: build_w32_static_udpsrv 58 | run: bash ./cross_build_mingw32.sh static_udpsrv -DLINK_RTLTOOLS_AGAINST_STATIC_LIB=ON -DPROVIDE_UDP_SERVER=ON 59 | - name: build_w32_dlldep 60 | run: bash ./cross_build_mingw32.sh dlldep 61 | - name: build_w32_dlldep_udpsrv 62 | run: bash ./cross_build_mingw32.sh dlldep_udpsrv -DPROVIDE_UDP_SERVER=ON 63 | 64 | - name: build_w64_static 65 | run: bash ./cross_build_mingw64.sh static -DLINK_RTLTOOLS_AGAINST_STATIC_LIB=ON 66 | - name: build_w64_static_udpsrv 67 | run: bash ./cross_build_mingw64.sh static_udpsrv -DLINK_RTLTOOLS_AGAINST_STATIC_LIB=ON -DPROVIDE_UDP_SERVER=ON 68 | - name: build_w64_dlldep 69 | run: bash ./cross_build_mingw64.sh dlldep 70 | - name: build_w64_dlldep_udpsrv 71 | run: bash ./cross_build_mingw64.sh dlldep_udpsrv -DPROVIDE_UDP_SERVER=ON 72 | 73 | - name: 'upload w32 static artifact' 74 | uses: actions/upload-artifact@v2 75 | with: 76 | name: rtlsdr-bin-w32_static 77 | path: rtlsdr-bin-w32_static/bin/ 78 | - name: 'upload w32 static_udpsrv artifact' 79 | uses: actions/upload-artifact@v2 80 | with: 81 | name: rtlsdr-bin-w32_static_udpsrv 82 | path: rtlsdr-bin-w32_static_udpsrv/bin/ 83 | - name: 'upload w32 dlldep artifact' 84 | uses: actions/upload-artifact@v2 85 | with: 86 | name: rtlsdr-bin-w32_dlldep 87 | path: rtlsdr-bin-w32_dlldep/bin/ 88 | - name: 'upload w32 dlldep_udpsrv artifact' 89 | uses: actions/upload-artifact@v2 90 | with: 91 | name: rtlsdr-bin-w32_dlldep_udpsrv 92 | path: rtlsdr-bin-w32_dlldep_udpsrv/bin/ 93 | 94 | - name: 'upload w64 static artifact' 95 | uses: actions/upload-artifact@v2 96 | with: 97 | name: rtlsdr-bin-w64_static 98 | path: rtlsdr-bin-w64_static/bin/ 99 | - name: 'upload w64 static_udpsrv artifact' 100 | uses: actions/upload-artifact@v2 101 | with: 102 | name: rtlsdr-bin-w64_static_udpsrv 103 | path: rtlsdr-bin-w64_static_udpsrv/bin/ 104 | - name: 'upload w64 dlldep artifact' 105 | uses: actions/upload-artifact@v2 106 | with: 107 | name: rtlsdr-bin-w64_dlldep 108 | path: rtlsdr-bin-w64_dlldep/bin/ 109 | - name: 'upload w64 dlldep_udpsrv artifact' 110 | uses: actions/upload-artifact@v2 111 | with: 112 | name: rtlsdr-bin-w64_dlldep_udpsrv 113 | path: rtlsdr-bin-w64_dlldep_udpsrv/bin/ 114 | 115 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | Makefile.in 3 | .deps 4 | .libs 5 | *.o 6 | *.lo 7 | *.la 8 | *.pc 9 | aclocal.m4 10 | acinclude.m4 11 | aminclude.am 12 | m4/*.m4 13 | autom4te.cache 14 | config.h* 15 | config.sub 16 | config.log 17 | config.status 18 | config.guess 19 | configure 20 | depcomp 21 | missing 22 | ltmain.sh 23 | install-sh 24 | stamp-h1 25 | libtool 26 | Doxyfile 27 | 28 | .tarball-version 29 | .version 30 | 31 | .*.swp 32 | 33 | doc/ 34 | 35 | src/rtl_sdr 36 | src/rtl_tcp 37 | 38 | CMakeCache.txt 39 | */CMakeFiles 40 | CMakeFiles 41 | build 42 | 43 | **/*.o 44 | **/*.so* 45 | **/*.a 46 | src/rtl_adsb 47 | src/rtl_eeprom 48 | src/rtl_fm 49 | src/rtl_ir 50 | src/rtl_power 51 | src/rtl_rpcd 52 | src/rtl_test 53 | 54 | debianize/*.deb 55 | .cproject 56 | .project 57 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | compiler: 3 | - gcc 4 | - clang 5 | 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install -qq libusb-1.0-0-dev 9 | 10 | script: cmake . && make && sudo make install 11 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Steve Markgraf 2 | Dimitri Stolnikov 3 | Hoernchen 4 | Kyle Keen 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6 2 | ACLOCAL_AMFLAGS = -I m4 3 | 4 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 5 | SUBDIRS = include src 6 | 7 | pkgconfigdir = $(libdir)/pkgconfig 8 | pkgconfig_DATA = librtlsdr.pc 9 | 10 | BUILT_SOURCES = $(top_srcdir)/.version 11 | $(top_srcdir)/.version: 12 | echo $(VERSION) > $@-t && mv $@-t $@ 13 | dist-hook: 14 | echo $(VERSION) > $(distdir)/.tarball-version 15 | 16 | install-udev-rules: 17 | $(INSTALL_DATA) rtl-sdr.rules /etc/udev/rules.d 18 | 19 | uninstall-udev-rules: 20 | rm -rf /etc/udev/rules.d/rtl-sdr.rules 21 | 22 | EXTRA_DIST = git-version-gen .version 23 | 24 | if HAVE_DOXYGEN 25 | 26 | pkgdocdir=$(docdir)/$(PACKAGE)-$(VERSION) 27 | doc_htmldir=$(pkgdocdir)/html 28 | 29 | doc_html_DATA = $(top_builddir)/doc/html.tar 30 | 31 | $(doc_html_DATA): $(top_builddir)/doc/html/index.html 32 | cd $(top_builddir)/doc && tar cf html.tar html 33 | 34 | $(top_builddir)/doc/html/index.html: $(SOURCES) Doxyfile 35 | @rm -rf doc 36 | mkdir -p doc 37 | $(DOXYGEN) Doxyfile 38 | 39 | install-data-hook: 40 | cd $(DESTDIR)$(doc_htmldir) && tar xf html.tar --strip-components 1 && rm -f html.tar 41 | 42 | uninstall-hook: 43 | rm -rf $(DESTDIR)/$(doc_htmldir) 44 | 45 | DX_CLEAN = doc/{html,latex}/* doc/html.tar 46 | 47 | endif 48 | 49 | MOSTLYCLEANFILES = $(DX_CLEAN) 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![librtlsdr version](https://img.shields.io/github/tag/librtlsdr/librtlsdr.svg?style=flat&label=librtlsdr)](https://github.com/librtlsdr/librtlsdr/releases) 2 | [![GPLv2 License](http://img.shields.io/badge/license-GPLv2-brightgreen.svg)](https://tldrlegal.com/license/gnu-general-public-license-v2) 3 | 4 | # Description 5 | 6 | rtl-sdr turns your Realtek RTL2832 based DVB dongle into a SDR receiver 7 | 8 | 9 | # New enhancements and features in this version 10 | 11 | Many different developments have been taken in this release. For an overview, see [improvements](README_improvements.md) 12 | 13 | # Build / Install (on debian/ubuntu) 14 | 15 | ## prerequisites 16 | development tools have to be installed: 17 | ``` 18 | sudo apt-get install build-essential cmake git 19 | ``` 20 | 21 | install the libusb-1.0 development package:: 22 | ``` 23 | sudo apt-get install libusb-dev libusb-1.0-0-dev 24 | ``` 25 | 26 | ## retrieve the sources - right branch 27 | 28 | ``` 29 | git clone https://github.com/librtlsdr/librtlsdr.git 30 | ``` 31 | 32 | in case you want the *development* branch, e.g. for testing or preparing patches: 33 | ``` 34 | cd librtlsdr 35 | git checkout development 36 | ``` 37 | 38 | by default, you should have the *master* branch, in doubt: 39 | ``` 40 | cd librtlsdr 41 | git status 42 | git checkout master 43 | ``` 44 | 45 | ## build 46 | run cmake and start compilation. cmake will accept some options, e.g. 47 | * `-DINSTALL_UDEV_RULES=ON`, default is `OFF` 48 | * `-DDETACH_KERNEL_DRIVER=ON`, default is `OFF` 49 | * `-DPROVIDE_UDP_SERVER=ON`, default is `OFF` 50 | * `-DWITH_RPC=ON`, default is `OFF` 51 | * `-DLINK_RTLTOOLS_AGAINST_STATIC_LIB=ON`, default is `OFF` 52 | * `-DRTL_STATIC_BUILD=OFF`, default is `ON`: for MINGW on WIN32 53 | 54 | all cmake options are optional 55 | 56 | ``` 57 | mkdir build && cd build 58 | cmake ../ -DINSTALL_UDEV_RULES=ON 59 | make 60 | ``` 61 | 62 | ## install 63 | setup into prefix, usually will require `sudo`: 64 | ``` 65 | sudo make install 66 | sudo ldconfig 67 | ``` 68 | 69 | # Development builds / binaries 70 | 71 | [GitHub Actions](https://github.com/librtlsdr/librtlsdr/actions) is used for development builds - for Linux (x86), MacOS and Windows x86 32/64. 72 | Cross-builds for Windows from a Linux machine: see [cross_build_mingw32.sh](cross_build_mingw32.sh) or [cross_build_mingw64.sh](cross_build_mingw64.sh) 73 | 74 | # For more information see: 75 | 76 | http://superkuh.com/rtlsdr.html 77 | 78 | https://osmocom.org/projects/rtl-sdr/wiki/Rtl-sdr 79 | 80 | 81 | # Setup for SDR only use - without DVB compatibility: 82 | 83 | - a special USB vendor/product id got reserved at http://pid.codes/ : 0x1209/0x2832 84 | - for such devices the linux kernel's DVB modules are not loaded automatically, 85 | thus can be used without blacklisting *dvb_usb_rtl28xxu* below /etc/modprobe.d/ 86 | - this allows to use a second RTL dongle for use with DVB in parallel 87 | - the IDs can be programmed with '`rtl_eeprom -n`' or '`rtl_eeprom -g realtek_sdr`' 88 | - for permanent blacklisting you might check/call following from the clone git directory 89 | ```./install-blacklist.sh``` 90 | 91 | 92 | # Contributing 93 | 94 | Pull requests are always welcome but please make changes to, and pull request from, the development branch. 95 | 96 | ## Initial setup: 97 | 98 | - fork the librtlsdr repo via GitHub 99 | - clone your fork locally and cd to the cloned repo's folder 100 | - add the upstream development repo: 101 | * `git remote add upstream git@github.com:librtlsdr/librtlsdr.git` 102 | - track the development branch: 103 | * `git branch --track development origin/development` 104 | 105 | ## Normal workflow: 106 | 107 | - checkout the development branch and make your changes 108 | - commit your changes 109 | - sync your local development branch with the upstream development branch: 110 | * `git fetch upstream` 111 | * `git merge upstream/development` 112 | - push your commit/s to your forked repo 113 | - do a pull request via GitHub 114 | -------------------------------------------------------------------------------- /README.rtlfm_cmdfile: -------------------------------------------------------------------------------- 1 | 2 | rtl_fm now has option '-C' for a command file, from which a list of frequencies are read. 3 | So it's similar to using a frequency range, as with "-f 118M:137M:25k" 4 | The difference is, that you can parametrize one frequency per line together with 5 | - the tuner gain 6 | - condition for triggering 7 | - measurement duration 8 | and a command to execute. 9 | Lines starting with '#' are skipped / interpreted as comments. 10 | Parameters a seperated by comma. 11 | 12 | Here's an example: 13 | --- 14 | # freq in Hz or special keyword, gain in dB, trig_crit (in/out/lt/gt), trig_level, trig_tolerance, #meas, #blocks, trigger_command 15 | # windows: rtl_fm -f 105.2m -E rdc -w 350k -s 200k -m 2.2m -B 200000 -C cmdfile.csv -n -v 16 | # rtl_fm -f 105.2m -E rdc -w 350k -s 200k -m 2.2m -W 4 -B 10000 -C cmdfile.csv -n -v 17 | # linux: ./rtl_fm -f 105.2m -E rdc -w 350k -s 200k -m 2.2m -B 200000 -C cmdfile.csv -n -v 18 | # 19 | # windows command examples: 20 | # cmd.exe, /C echo hello world 21 | # cmd.exe, /C start notepad 22 | # calc.exe 23 | # 24 | # linux examples: 25 | # ssmtp 26 | # sendxmpp 27 | ## for piping some message to ssmtp or sendxmpp you'll need to write small scripts 28 | 29 | # 'adcmax' keyword in first column activates measurement of max adc value at capture rate to determine optimum gain and avoid oversteering 30 | # 'adcrms' keyword activates rms calculation at capture rate. for usual it's similar to adcmax. there are differences in case of oversteering 31 | # activate verbose output (option '-v') to get the output. The maximum possible sample value is 128. 32 | # You should have approx. 6 dB headroom to allow measuring stronger signals, that means measured baseline values should be below 64. 33 | # An the other side you'll want to measure weaker signals, so the measured baseline value should be above a minimum of approx 8 or 16. 34 | adcmax, 35 | adcrms, 36 | 100.7m, 30, in, 0, 1, 10, 100, 37 | 33.0m, 20,out,60, 3, 10, 400, /home/odroid/test/simple.sh, frq !freq! gain !gain! measured !mlevel! tenth dB !crit! { !reflevel! +/- !reftol! tenth dB } 38 | # now check for optimal gain in some steps, which should be done per frequency!: 39 | 100.7m, 0, gt, 400, 1, 1, 100, 40 | 100.7m, 3, gt, 400, 1, 1, 100, 41 | 100.7m, 6, gt, 400, 1, 1, 100, 42 | 100.7m, 12, gt, 400, 1, 1, 100, 43 | 100.7m, 18, gt, 400, 1, 1, 100, 44 | 45 | --- 46 | 47 | * first frequency is 100.7 MHz, tuned with ~ 30 dB tuner gain; 48 | condition is 'in' { 0 +/- 1 } dB, 49 | with 10 measurements, averaging the rms level in dB. 50 | Each single measurement is processed after decimation of block/buffer-size many samples (see option -W). 51 | The resulting number of decimated samples might get too small to allow a reliable measurement. 52 | This number also depends on the capture rate: ensure minimum capture rate with option '-m'. This is also important for reducing aliases. 53 | Check the output 'block length after decimation is ... samples'! 54 | If condition for measured level is true, then a command can be triggered, which is executed in background. 55 | Then, a next trigger for this frequency is blocked for 100 measurements. 56 | There is nothing triggered for 100.7 MHz. 57 | 58 | * 2nd frequency is 33.0 MHz, tuned with ~ 20 dB tuner gain; 59 | condition is 'out' { 60 +/- 3 } dB, 60 | with 10 measurements. 61 | That means, the trigger is activated when averaged level is below 57 dB or above 63 dB. 62 | Next trigger for this frequency is blocked for 400 measurements. 63 | Triggered command is the shell script '/home/odroid/test/simple.sh', 64 | with the arguments 'frq !freq! gain !gain! measured !mlevel! tenth dB !crit! { !reflevel! +/- !reftol! tenth dB }'. 65 | You can use following keywords in the arguments, which need to be free standing!: 66 | - !freq! 67 | current frequency in Hz 68 | 69 | - !gain! 70 | current tuner gain in tenth dB to allow easier evaluation from scripts. 71 | 72 | - !mlevel! 73 | average measured level in tenth dB 74 | 75 | - !crit! 76 | one of "in", "out", "<" or ">" for the tested condition 77 | 78 | - !reflevel! 79 | condition's reference level in tenth dB 80 | 81 | - !reftol! 82 | condition's reference tolerance in tenth dB 83 | 84 | 85 | Application might be monitoring of some stations 86 | and triggering a notification, e.g. via ssmtp or sendxmpp, 87 | when a stations power level is below it's expected value. 88 | 89 | Another application might be triggering a recording with a second RTL dongle. 90 | 91 | 92 | Send comments, suggestions or reports to 93 | Hayati Ayguen 94 | 95 | -------------------------------------------------------------------------------- /README.rtlsdr_rpc: -------------------------------------------------------------------------------- 1 | This implementation of librtlsdr makes remote dongles 2 | appear to the local software as if they were on the 3 | same computer. It works by forwarding librtlsdr calls 4 | to the remote computer over TCP. 5 | 6 | It allows one to use existing tools without modifying 7 | them. Also, it allows a developer to use the same API 8 | no matter weither the dongle is local or distant. 9 | 10 | To use it, one must compile and install the library 11 | with CMAKE the usual way. Note that you may need to 12 | uninstall the existing librtlsdr, as people reported 13 | runtime errors due to conflicting installs. 14 | 15 | Then, a server (called rtl_rpcd) must be run on the 16 | remote location. 17 | 18 | In my case, the dongle is in a beagle bone black is 19 | at address 192.168.0.43: 20 | beagleboneblack #> ./rtl_rpcd 21 | 22 | Then, the existing tool (for instance rtlizer) can be 23 | run on the local computer using: 24 | RTLSDR_RPC_IS_ENABLED=1 RTLSDR_RPC_SERV_ADDR=192.168.0.43 \ 25 | rtlizer 26 | 27 | This implementation still has some limitations, but 28 | works well in most cases. Please report any bug to 29 | texane@gmail.com 30 | 31 | Also, note that the latest version of libusb should be 32 | used as librtlsdr crashed when used with older version 33 | (esp. the rtlsdr_read_async routine): 34 | https://github.com/libusb/libusb.git 35 | 36 | list of known working software: 37 | rtl_fm 38 | rtl_power 39 | rtlsdr-waterfall 40 | rtlizer 41 | gnuradio-companion 42 | cubicsdr 43 | gqrx 44 | linrad 45 | -------------------------------------------------------------------------------- /cmake/Modules/FindLibUSB.cmake: -------------------------------------------------------------------------------- 1 | if(NOT LIBUSB_FOUND) 2 | pkg_check_modules (LIBUSB_PKG libusb-1.0) 3 | find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h 4 | PATHS 5 | ${LIBUSB_PKG_INCLUDE_DIRS} 6 | /usr/include/libusb-1.0 7 | /usr/include 8 | /usr/local/include 9 | ) 10 | 11 | #standard library name for libusb-1.0 12 | set(libusb1_library_names usb-1.0 libusb-1.0) 13 | 14 | #libusb-1.0 compatible library on freebsd 15 | if((CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") OR (CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")) 16 | list(APPEND libusb1_library_names usb) 17 | endif() 18 | 19 | find_library(LIBUSB_LIBRARIES 20 | NAMES ${libusb1_library_names} 21 | PATHS 22 | ${LIBUSB_PKG_LIBRARY_DIRS} 23 | /usr/lib 24 | /usr/local/lib 25 | ) 26 | 27 | include(CheckFunctionExists) 28 | if(LIBUSB_INCLUDE_DIRS) 29 | set(CMAKE_REQUIRED_INCLUDES ${LIBUSB_INCLUDE_DIRS}) 30 | endif() 31 | if(LIBUSB_LIBRARIES) 32 | set(CMAKE_REQUIRED_LIBRARIES ${LIBUSB_LIBRARIES}) 33 | endif() 34 | 35 | CHECK_FUNCTION_EXISTS("libusb_handle_events_timeout_completed" HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 36 | if(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 37 | add_definitions(-DHAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED=1) 38 | endif(HAVE_LIBUSB_HANDLE_EVENTS_TIMEOUT_COMPLETED) 39 | 40 | CHECK_FUNCTION_EXISTS("libusb_error_name" HAVE_LIBUSB_ERROR_NAME) 41 | if(HAVE_LIBUSB_ERROR_NAME) 42 | add_definitions(-DHAVE_LIBUSB_ERROR_NAME=1) 43 | endif(HAVE_LIBUSB_ERROR_NAME) 44 | 45 | if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 46 | set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found") 47 | message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}") 48 | else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 49 | set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found") 50 | message(STATUS "libusb-1.0 not found.") 51 | endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 52 | 53 | mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) 54 | 55 | endif(NOT LIBUSB_FOUND) 56 | -------------------------------------------------------------------------------- /cmake/Modules/Version.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2013 OSMOCOM Project 2 | # 3 | # This file is part of rtl-sdr 4 | # 5 | # rtl-sdr is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # rtl-sdr is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with rtl-sdr; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | if(DEFINED __INCLUDED_VERSION_CMAKE) 21 | return() 22 | endif() 23 | set(__INCLUDED_VERSION_CMAKE TRUE) 24 | 25 | # VERSION_INFO_* variables must be provided by user 26 | set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) 27 | set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION}) 28 | set(PATCH_VERSION ${VERSION_INFO_PATCH_VERSION}) 29 | 30 | ######################################################################## 31 | # Extract the version string from git describe. 32 | ######################################################################## 33 | find_package(Git QUIET) 34 | 35 | if(GIT_FOUND AND EXISTS ${PROJECT_SOURCE_DIR}/.git) 36 | message(STATUS "Extracting version information from git describe...") 37 | execute_process( 38 | COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=4 --long 39 | OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE 40 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 41 | ) 42 | else() 43 | set(GIT_DESCRIBE "v${MAJOR_VERSION}.${MINOR_VERSION}.x-xxx-xunknown") 44 | endif() 45 | 46 | ######################################################################## 47 | # Use the logic below to set the version constants 48 | ######################################################################## 49 | if("${PATCH_VERSION}" STREQUAL "git") 50 | # VERSION: 3.6git-xxx-gxxxxxxxx 51 | # LIBVER: 3.6git 52 | set(VERSION "${GIT_DESCRIBE}") 53 | set(LIBVER "${MAJOR_VERSION}.${MINOR_VERSION}${PATCH_VERSION}") 54 | else() 55 | # This is a numbered release. 56 | # VERSION: 3.6.1 57 | # LIBVER: 3.6.1 58 | set(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") 59 | set(LIBVER "${VERSION}") 60 | endif() 61 | -------------------------------------------------------------------------------- /cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_INIT([librtlsdr], 2 | m4_esyscmd([./git-version-gen .tarball-version]), 3 | [osmocom-sdr@lists.osmocom.org]) 4 | 5 | AM_INIT_AUTOMAKE([dist-bzip2]) 6 | 7 | dnl kernel style compile messages 8 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 9 | 10 | dnl checks for programs 11 | AC_PROG_MAKE_SET 12 | AC_PROG_CC 13 | AC_PROG_INSTALL 14 | AM_PROG_CC_C_O 15 | LT_INIT 16 | AC_PROG_LIBTOOL 17 | 18 | PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0) 19 | LIBS="$LIBS $LIBUSB_LIBS" 20 | CFLAGS="$CFLAGS $LIBUSB_CFLAGS" 21 | 22 | AC_PATH_PROG(DOXYGEN,doxygen,false) 23 | AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false) 24 | 25 | AC_CONFIG_MACRO_DIR([m4]) 26 | 27 | dnl checks for header files 28 | AC_HEADER_STDC 29 | AC_CHECK_HEADERS(sys/types.h) 30 | AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([pthread.h required])]) 31 | 32 | # pc variables 33 | AC_SUBST(RTLSDR_PC_LIBS,["$LIBS"]) 34 | AC_SUBST(RTLSDR_PC_CFLAGS,["$CFLAGS"]) 35 | 36 | dnl checks for required libraries 37 | dnl pthreads 38 | AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"]) 39 | 40 | dnl libmath (for rtl_fm) 41 | AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"]) 42 | 43 | dnl libmath (for rtl_adsb) 44 | AC_CHECK_LIB(m, sqrt, [LIBS="$LIBS -lm"]) 45 | 46 | dnl libmath (for rtl_power) 47 | AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"]) 48 | 49 | dnl librealtime (for rtl_test) 50 | AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"]) 51 | 52 | AC_ARG_ENABLE(sanitize, 53 | [AS_HELP_STRING([--enable-sanitize], [Compile with address sanitizer enabled], )], 54 | [sanitize=$enableval], [sanitize="no"]) 55 | if test x"$sanitize" = x"yes" 56 | then 57 | CFLAGS="$CFLAGS -fsanitize=address -fsanitize=undefined" 58 | CPPFLAGS="$CPPFLAGS -fsanitize=address -fsanitize=undefined" 59 | fi 60 | 61 | AC_ARG_ENABLE(werror, 62 | [AS_HELP_STRING( 63 | [--enable-werror], 64 | [Turn all compiler warnings into errors, with exceptions: 65 | a) deprecation (allow upstream to mark deprecation without breaking builds); 66 | b) "#warning" pragmas (allow to remind ourselves of errors without breaking builds) 67 | ] 68 | )], 69 | [werror=$enableval], [werror="no"]) 70 | if test x"$werror" = x"yes" 71 | then 72 | WERROR_FLAGS="-Werror" 73 | WERROR_FLAGS+=" -Wno-error=deprecated -Wno-error=deprecated-declarations" 74 | WERROR_FLAGS+=" -Wno-error=cpp" # "#warning" 75 | CFLAGS="$CFLAGS $WERROR_FLAGS" 76 | CPPFLAGS="$CPPFLAGS $WERROR_FLAGS" 77 | fi 78 | 79 | # The following test is taken from WebKit's webkit.m4 80 | saved_CFLAGS="$CFLAGS" 81 | CFLAGS="$CFLAGS -fvisibility=hidden " 82 | AC_MSG_CHECKING([if ${CC} supports -fvisibility=hidden]) 83 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], 84 | [ AC_MSG_RESULT([yes]) 85 | SYMBOL_VISIBILITY="-fvisibility=hidden"], 86 | AC_MSG_RESULT([no])) 87 | CFLAGS="$saved_CFLAGS" 88 | AC_SUBST(SYMBOL_VISIBILITY) 89 | 90 | AC_MSG_CHECKING(whether compiler understands -Wall) 91 | old_CFLAGS="$CFLAGS" 92 | CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-unused -Wsign-compare -Wdeclaration-after-statement" 93 | AC_TRY_COMPILE([],[], 94 | AC_MSG_RESULT(yes), 95 | AC_MSG_RESULT(no) 96 | CFLAGS="$old_CFLAGS") 97 | 98 | AC_ARG_ENABLE(driver-detach, 99 | [ --enable-driver-detach Enable detaching of kernel driver (disabled by default)], 100 | [if test x$enableval = xyes; then 101 | CFLAGS="$CFLAGS -DDETACH_KERNEL_DRIVER" 102 | fi]) 103 | 104 | dnl Generate the output 105 | AC_CONFIG_HEADER(config.h) 106 | 107 | AC_OUTPUT( 108 | librtlsdr.pc 109 | include/Makefile 110 | src/Makefile 111 | Makefile 112 | Doxyfile 113 | ) 114 | -------------------------------------------------------------------------------- /contrib/jenkins.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # jenkins build helper script for openbsc. This is how we build on jenkins.osmocom.org 3 | 4 | if ! [ -x "$(command -v osmo-build-dep.sh)" ]; then 5 | echo "Error: We need to have scripts/osmo-deps.sh from http://git.osmocom.org/osmo-ci/ in PATH !" 6 | exit 2 7 | fi 8 | 9 | 10 | set -ex 11 | 12 | base="$PWD" 13 | deps="$base/deps" 14 | inst="$deps/install" 15 | export deps inst 16 | 17 | osmo-clean-workspace.sh 18 | 19 | mkdir "$deps" || true 20 | 21 | set +x 22 | echo 23 | echo 24 | echo 25 | echo " =============================== rtl-sdr ===============================" 26 | echo 27 | set -x 28 | 29 | cd "$base" 30 | autoreconf --install --force 31 | ./configure --enable-sanitize --enable-werror 32 | $MAKE $PARALLEL_MAKE 33 | LD_LIBRARY_PATH="$inst/lib" $MAKE check \ 34 | || cat-testlogs.sh 35 | LD_LIBRARY_PATH="$inst/lib" \ 36 | DISTCHECK_CONFIGURE_FLAGS="--enable-werror" \ 37 | $MAKE distcheck \ 38 | || cat-testlogs.sh 39 | 40 | osmo-clean-workspace.sh 41 | -------------------------------------------------------------------------------- /cross_build_mingw32.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # requires debian/ubuntu packages: zip gcc-mingw-w64 4 | 5 | REPO_DIR=$(pwd) 6 | 7 | if [ -z "$1" ]; then 8 | echo "usage: $0 " 9 | exit 1 10 | fi 11 | 12 | ZIP_POST="$1" 13 | shift 14 | 15 | CROSS="i686-w64-mingw32" 16 | WN="w32" 17 | TOOLCHAIN="mingw-w32-i686.cmake" 18 | 19 | # libusb 20 | if /bin/true; then 21 | cd ${REPO_DIR} && rm -rf libusb_${WN} 22 | cd ${REPO_DIR} && git clone --branch v1.0.23 https://github.com/libusb/libusb.git libusb_${WN} 23 | echo -e "\n\n********************************************************" 24 | echo "start build of libusb_${WN}" 25 | cd ${REPO_DIR}/libusb_${WN} && ./bootstrap.sh && \ 26 | CC=${CROSS}-gcc \ 27 | AR=${CROSS}-ar \ 28 | RANLIB=${CROSS}-ranlib \ 29 | ./configure --prefix=${REPO_DIR}/mingw_libusb_${WN} --host=${CROSS} --disable-shared && \ 30 | make && make install 31 | echo -e "\n\nlisting of ${REPO_DIR}/mingw_libusb_${WN}" 32 | ls -alh ${REPO_DIR}/mingw_libusb_${WN} 33 | echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/include" 34 | ls -alh ${REPO_DIR}/mingw_libusb_${WN}/include 35 | echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/lib" 36 | ls -alh ${REPO_DIR}/mingw_libusb_${WN}/lib 37 | echo -e "\n" 38 | fi 39 | 40 | # librtlsdr 41 | if /bin/true; then 42 | cd ${REPO_DIR} && rm -rf build_${WN} 43 | echo -e "\n\n********************************************************" 44 | echo "start build of librtlsdr_${WN}" 45 | mkdir ${REPO_DIR}/build_${WN} && cd ${REPO_DIR}/build_${WN} && \ 46 | cmake -DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/${TOOLCHAIN} \ 47 | -DCMAKE_INSTALL_PREFIX=${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST} \ 48 | -DRTL_STATIC_BUILD=ON "$@" \ 49 | -DLIBUSB_INCLUDE_DIR=${REPO_DIR}/mingw_libusb_${WN}/include/libusb-1.0 \ 50 | -DLIBUSB_LIBRARIES=${REPO_DIR}/mingw_libusb_${WN}/lib/libusb-1.0.a \ 51 | ../ && \ 52 | make && make install 53 | md5sum ${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/* >${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/md5sums.txt 54 | sha1sum ${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/* >${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/sha1sums.txt 55 | fi 56 | 57 | -------------------------------------------------------------------------------- /cross_build_mingw64.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # requires debian/ubuntu packages: zip gcc-mingw-w64 4 | 5 | REPO_DIR=$(pwd) 6 | 7 | if [ -z "$1" ]; then 8 | echo "usage: $0 " 9 | exit 1 10 | fi 11 | 12 | ZIP_POST="$1" 13 | shift 14 | 15 | CROSS="x86_64-w64-mingw32" 16 | WN="w64" 17 | TOOLCHAIN="mingw-w64-x64_64.cmake" 18 | 19 | # libusb 20 | if /bin/true; then 21 | cd ${REPO_DIR} && rm -rf libusb_${WN} 22 | cd ${REPO_DIR} && git clone --branch v1.0.23 https://github.com/libusb/libusb.git libusb_${WN} 23 | echo -e "\n\n********************************************************" 24 | echo "start build of libusb_${WN}" 25 | cd ${REPO_DIR}/libusb_${WN} && ./bootstrap.sh && \ 26 | CC=${CROSS}-gcc \ 27 | AR=${CROSS}-ar \ 28 | RANLIB=${CROSS}-ranlib \ 29 | ./configure --prefix=${REPO_DIR}/mingw_libusb_${WN} --host=${CROSS} --disable-shared && \ 30 | make && make install 31 | echo -e "\n\nlisting of ${REPO_DIR}/mingw_libusb_${WN}" 32 | ls -alh ${REPO_DIR}/mingw_libusb_${WN} 33 | echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/include" 34 | ls -alh ${REPO_DIR}/mingw_libusb_${WN}/include 35 | echo -e "\nlisting of ${REPO_DIR}/mingw_libusb_${WN}/lib" 36 | ls -alh ${REPO_DIR}/mingw_libusb_${WN}/lib 37 | echo -e "\n" 38 | fi 39 | 40 | # librtlsdr 41 | if /bin/true; then 42 | cd ${REPO_DIR} && rm -rf build_${WN} 43 | echo -e "\n\n********************************************************" 44 | echo "start build of librtlsdr_${WN}" 45 | mkdir ${REPO_DIR}/build_${WN} && cd ${REPO_DIR}/build_${WN} && \ 46 | cmake -DCMAKE_TOOLCHAIN_FILE=${REPO_DIR}/${TOOLCHAIN} \ 47 | -DCMAKE_INSTALL_PREFIX=${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST} \ 48 | -DRTL_STATIC_BUILD=ON "$@" \ 49 | -DLIBUSB_INCLUDE_DIR=${REPO_DIR}/mingw_libusb_${WN}/include/libusb-1.0 \ 50 | -DLIBUSB_LIBRARIES=${REPO_DIR}/mingw_libusb_${WN}/lib/libusb-1.0.a \ 51 | ../ && \ 52 | make && make install 53 | md5sum ${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/* >${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/md5sums.txt 54 | sha1sum ${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/* >${REPO_DIR}/rtlsdr-bin-${WN}_${ZIP_POST}/bin/sha1sums.txt 55 | fi 56 | 57 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | *.deb 2 | -------------------------------------------------------------------------------- /debian/README.Debian: -------------------------------------------------------------------------------- 1 | rtl-sdr for Debian 2 | ------------------- 3 | 4 | In the beginning Antti Palosaari noticed that some digital video 5 | receiver tuners can be turned into a cheap software defined radio. 6 | 7 | Since there is also support in the Linux kernel to use these devices 8 | as digital video receivers, by default the hardware will be claimed 9 | by Linux keernel drivers for that purpose. 10 | 11 | Having these rtl-sdr packages installed likely means that these 12 | devices should be available for the alternate software defined 13 | radio use. 14 | 15 | The librtlsdr0 package in Debian has configuration files to 16 | help manage the conflicting uses: 17 | 18 | 1. Blacklists DVB-T kernel modules provided by the Linux kernel 19 | ------------------------------------------------------------------- 20 | 21 | Config file: 22 | /etc/modprobe.d/librtlsdr-blacklist.conf 23 | 24 | contains lines to blacklist dvb_usb_rtl28xxu, e4000 and rtl2832 25 | kernel modules. 26 | 27 | Should you wish to use a device via the Linux video receiver software 28 | while still having the librtlsdr0 package installed you may edit 29 | this file. (Placing a # at the beginning os a line makes it a comment.) 30 | 31 | Then unplug/plug the USB stick. 32 | 33 | Not that if rtl-sdr applications are then run, they will complain about 34 | failing to open the device. In that case, restore the blacklist and 35 | unplug/plug the USB stick. 36 | 37 | If librtlsdr-blacklist.conf does not exist, then rtl-sdr was built 38 | with the DETACH_KERNEL_DRIVER option. 39 | 40 | 2. Permissions 41 | -------------- 42 | 43 | Devices are available to users in the plugdev group. 44 | 45 | The librtlsdr0 package installs these default rules: 46 | /lib/udev/rules.d/60-librtlsdr0.rules 47 | 48 | If you have permissions issues, you may override these values 49 | with your own rules in /etc: 50 | 51 | /etc/udev/rules.d/60-librtlsdr0.rules 52 | 53 | After editing udev rules, run as root: 54 | udevadm control --reload-rules 55 | 56 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | rtl-sdr (0.7git) unstable; urgency=medium 2 | 3 | * Accumulated changes from librtlsdr community 4 | 5 | -- Karl Semich <0xloem@gmail.com> Wed, 03 Oct 2018 15:09:44 +0000 6 | 7 | rtl-sdr (0.6git) unstable; urgency=medium 8 | 9 | * New upstream release 10 | 11 | -- Harald Welte Sun, 06 Jun 2018 15:09:42 +0200 12 | 13 | rtl-sdr (0.5.4-1) unstable; urgency=medium 14 | 15 | * New upstream release 16 | * update to v0.5.4-3-ga854ae8 17 | use USB zero-copy transfers if possible 18 | 19 | -- A. Maitland Bottoms Sat, 12 May 2018 16:49:43 -0400 20 | 21 | rtl-sdr (0.5.3-14) unstable; urgency=medium 22 | 23 | * update to v0.5.3-20-g4520f00 (Closes: #892974) 24 | * minimal ipv6 support (Closes: #870804) 25 | * VCS to salsa 26 | * AppStream metadata.xml 27 | 28 | -- A. Maitland Bottoms Mon, 16 Apr 2018 20:45:53 -0400 29 | 30 | rtl-sdr (0.5.3-13) unstable; urgency=medium 31 | 32 | * build with libusb-1.0-0-dev stub on hurd-i386 33 | * initial ipv6 support for rtl_tcp... 34 | 35 | -- A. Maitland Bottoms Thu, 23 Nov 2017 15:59:40 -0500 36 | 37 | rtl-sdr (0.5.3-12) unstable; urgency=medium 38 | 39 | * add new HanfTek dongle 40 | * Bias T support (Closes: #854378, #842249) 41 | 42 | -- A. Maitland Bottoms Wed, 23 Aug 2017 23:31:27 -0400 43 | 44 | rtl-sdr (0.5.3-11) unstable; urgency=medium 45 | 46 | * correct invocation of rm_conffile (Thanks Chris!) (Closes: #838161) 47 | * drop uploaders line on advice of MIA team. (Closes: #836590) 48 | 49 | -- A. Maitland Bottoms Sat, 08 Oct 2016 11:17:47 -0400 50 | 51 | rtl-sdr (0.5.3-10) unstable; urgency=medium 52 | 53 | * remove rtl-sdr-blacklist.conf on upgrade. Thanks Bob! (Closes: #829517) 54 | 55 | -- A. Maitland Bottoms Sat, 09 Jul 2016 23:38:24 -0400 56 | 57 | rtl-sdr (0.5.3-9) unstable; urgency=medium 58 | 59 | * Edit of debian/librtlsdr0.udev in 0.5.3-8 was a no-op. Real fix 60 | done to debian/patches/use-udev-uaccess-rules. (Closes: #825073) 61 | 62 | -- A. Maitland Bottoms Wed, 25 May 2016 17:19:57 -0400 63 | 64 | rtl-sdr (0.5.3-8) unstable; urgency=high 65 | 66 | * Fix syntax errors for systemd-udevd in udev rules (Closes: #825073) 67 | 68 | -- A. Maitland Bottoms Tue, 24 May 2016 21:08:50 -0400 69 | 70 | rtl-sdr (0.5.3-7) unstable; urgency=medium 71 | 72 | * better udev rules (more like camera devices in libgphoto2-6) 73 | 74 | -- A. Maitland Bottoms Tue, 10 May 2016 19:20:27 -0400 75 | 76 | rtl-sdr (0.5.3-6) unstable; urgency=medium 77 | 78 | * Use ENV{ID_SOFTWARE_RADIO}=1 in udev rules (Closes: #823089) 79 | * Enable DETACH_KERNEL_DRIVER (Closes: 823022) 80 | * Make myself maintainer so I get the bug reports 81 | 82 | -- A. Maitland Bottoms Sun, 08 May 2016 12:12:13 -0400 83 | 84 | rtl-sdr (0.5.3-5) unstable; urgency=medium 85 | 86 | * Add watch fiule 87 | * place rtl-sdr -n comm section (Closes: #758077) 88 | * improve-librtlsdr-pc-file (Closes: #784912) 89 | * improve-scanning-range-parsing (LP: #1469478) 90 | 91 | -- A. Maitland Bottoms Sun, 23 Aug 2015 10:35:42 -0400 92 | 93 | rtl-sdr (0.5.3-4) unstable; urgency=low 94 | 95 | * Update to v0.5.3-12-ge3c03f7 96 | 97 | -- A. Maitland Bottoms Sat, 08 Aug 2015 23:43:54 -0400 98 | 99 | rtl-sdr (0.5.3-3) unstable; urgency=low 100 | 101 | * Update to v0.5.3-5-g6ee5573 102 | lib: handle events after canceling transfers 103 | lib: change default number of transfers to 15 104 | rtl_tcp: make all global variables static 105 | 106 | -- A. Maitland Bottoms Sun, 13 Apr 2014 10:48:49 -0400 107 | 108 | rtl-sdr (0.5.3-2) unstable; urgency=low 109 | 110 | * Upstream: lib: only print to stderr in tuner_r82xx_set_pll() 111 | * Update man pages (New -M (modulation) and -E (option) and ppm setting) 112 | * Have librtlsdr0 also install a blacklist for linux video drivers 113 | 114 | -- A. Maitland Bottoms Sat, 08 Feb 2014 22:40:06 -0500 115 | 116 | rtl-sdr (0.5.3-1) unstable; urgency=low 117 | 118 | * New upstream git tag release 119 | 120 | -- A. Maitland Bottoms Thu, 06 Feb 2014 20:45:38 -0500 121 | 122 | rtl-sdr (0.5.2.7.3ab6-1~bpo70+1) wheezy-backports; urgency=low 123 | 124 | * Rebuild for wheezy-backports. 125 | 126 | -- A. Maitland Bottoms Tue, 21 Jan 2014 19:34:16 -0500 127 | 128 | rtl-sdr (0.5.2.7.3ab6-1) unstable; urgency=low 129 | 130 | * New upstream snapshot 131 | 132 | -- A. Maitland Bottoms Sun, 29 Dec 2013 21:37:19 -0500 133 | 134 | rtl-sdr (0.5.1.14.360d-1~wheezy) stable; urgency=low 135 | 136 | * New upstream snapshot 137 | * GNU Radio LiveDVD 2013-1110 138 | 139 | -- A. Maitland Bottoms Mon, 11 Nov 2013 12:46:00 -0500 140 | 141 | rtl-sdr (0.5.0.4.4914-2) unstable; urgency=low 142 | 143 | * Use kfreebsd libusb 144 | 145 | -- A. Maitland Bottoms Fri, 01 Nov 2013 17:16:42 -0400 146 | 147 | rtl-sdr (0.5.0.4.4914-1) stable; urgency=low 148 | 149 | * New upstream snapshot (Closes: #701018). 150 | * Match GNU Radio live distribution version 151 | * Sponsored upload 152 | 153 | -- A. Maitland Bottoms Sat, 28 Sep 2013 16:55:08 -0400 154 | 155 | rtl-sdr (0.5.0+git20130715-1) unstable; urgency=low 156 | 157 | * Initial release (Closes: #701018). 158 | 159 | -- Adam Cécile (Le_Vert) Mon, 15 Jul 2013 15:51:05 +0200 160 | 161 | librtlsdr (0.0git3198f14-1) unstable; urgency=low 162 | 163 | * New upstream git 164 | 165 | -- A. Maitland Bottoms Mon, 14 May 2012 20:28:18 -0400 166 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: rtl-sdr 2 | Section: comm 3 | Priority: optional 4 | Maintainer: A. Maitland Bottoms 5 | Build-Depends: cmake, 6 | debhelper (>= 9.0.0~), 7 | libusb-1.0-0-dev [linux-any], 8 | libusb-dev [hurd-i386], 9 | libusb2-dev [kfreebsd-any] 10 | Standards-Version: 4.1.4 11 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 12 | Vcs-Browser: https://salsa.debian.org/bottoms/pkg-rtl-sdr 13 | Vcs-Git: https://salsa.debian.org/bottoms/pkg-rtl-sdr.git 14 | 15 | Package: librtlsdr-dev 16 | Section: libdevel 17 | Architecture: any 18 | Pre-Depends: ${misc:Pre-Depends} 19 | Depends: librtlsdr0 (= ${binary:Version}), 20 | libusb-1.0-0-dev [!kfreebsd-any], 21 | libusb2-dev [kfreebsd-any], 22 | ${misc:Depends} 23 | Description: Software defined radio receiver for Realtek RTL2832U (development) 24 | rtl-sdr is a software defined radio (SDR) receiver software for certain 25 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 26 | . 27 | This package contains development files. 28 | 29 | Package: librtlsdr0 30 | Section: libs 31 | Architecture: any 32 | Pre-Depends: ${misc:Pre-Depends} 33 | Depends: ${misc:Depends}, ${shlibs:Depends} 34 | Multi-Arch: same 35 | Description: Software defined radio receiver for Realtek RTL2832U (library) 36 | rtl-sdr is a software defined radio (SDR) receiver software for certain 37 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 38 | . 39 | This package contains the shared library. 40 | 41 | Package: rtl-sdr 42 | Architecture: any 43 | Depends: librtlsdr0 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} 44 | Description: Software defined radio receiver for Realtek RTL2832U (tools) 45 | rtl-sdr is a software defined radio (SDR) receiver software for certain 46 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 47 | . 48 | This package contains a set of command line utilities: 49 | * rtl_adsb: a simple ADS-B decoder for RTL2832 based DVB-T receivers 50 | * rtl_eeprom: an EEPROM programming tool for RTL2832 based DVB-T receivers 51 | * rtl_fm: a narrow band FM demodulator for RTL2832 based DVB-T receivers 52 | * rtl_sdr: an I/Q recorder for RTL2832 based DVB-T receivers 53 | * rtl_tcp: an I/Q spectrum server for RTL2832 based DVB-T receivers 54 | * rtl_test: a benchmark tool for RTL2832 based DVB-T receivers 55 | -------------------------------------------------------------------------------- /debian/copyright-scan-patterns.yml: -------------------------------------------------------------------------------- 1 | ignore : 2 | suffixes : 3 | - in 4 | -------------------------------------------------------------------------------- /debian/debianize_armhf: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" 4 | 5 | G_REV=`git rev-parse --short=8 HEAD` 6 | DATE=`date +"%Y%m%d%H%M%S"` 7 | #VERSION="0.5.3-git+${DATE}.${G_REV}~$1" 8 | VERSION=`git describe | cut -dv -f2` 9 | # 10 | # librtlsdr0 11 | # 12 | 13 | rm -fr /tmp/librtlsdr0/ 14 | mkdir -p /tmp/librtlsdr0/ 15 | mkdir -p /tmp/librtlsdr0/usr/lib/arm-linux-gnueabihf/ 16 | mkdir -p /tmp/librtlsdr0/DEBIAN 17 | 18 | cat <<- EOF > /tmp/librtlsdr0/DEBIAN/control 19 | Package: librtlsdr0 20 | Source: rtl-sdr 21 | Version: ${VERSION} 22 | Architecture: armhf 23 | Maintainer: Lucas Teske 24 | Pre-Depends: multiarch-support 25 | Depends: libc6 (>= 2.14), libusb-1.0-0 (>= 2:1.0.9) 26 | Section: libs 27 | Priority: extra 28 | Multi-Arch: same 29 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 30 | Description: Software defined radio receiver for Realtek RTL2832U (library) 31 | rtl-sdr is a software defined radio (SDR) receiver software for certain 32 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 33 | . 34 | This package contains the shared library. 35 | EOF 36 | 37 | DEB_PKG="librtlsdr0_${VERSION}_armhf.deb" 38 | 39 | cp -rf ${REPO_DIR}/build/src/lib*so* /tmp/librtlsdr0/usr/lib/arm-linux-gnueabihf/ 40 | dpkg-deb -b /tmp/librtlsdr0/ ./${DEB_PKG} 41 | 42 | echo ${DEB_PKG} 43 | 44 | # 45 | # rtl-sdr 46 | # 47 | 48 | rm -fr /tmp/rtl-sdr/ 49 | mkdir -p /tmp/rtl-sdr/ 50 | mkdir -p /tmp/rtl-sdr/usr/bin/ 51 | mkdir -p /tmp/rtl-sdr/DEBIAN 52 | 53 | cat <<- EOF > /tmp/rtl-sdr/DEBIAN/control 54 | Package: rtl-sdr 55 | Version: ${VERSION} 56 | Architecture: armhf 57 | Maintainer: Lucas Teske 58 | Depends: librtlsdr0 (= ${VERSION}), libc6 (>= 2.15) 59 | Section: libs 60 | Priority: extra 61 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 62 | Description: Software defined radio receiver for Realtek RTL2832U (tools) 63 | rtl-sdr is a software defined radio (SDR) receiver software for certain 64 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 65 | . 66 | This package contains a set of command line utilities: 67 | * rtl_adsb: a simple ADS-B decoder for RTL2832 based DVB-T receivers 68 | * rtl_eeprom: an EEPROM programming tool for RTL2832 based DVB-T receivers 69 | * rtl_fm: a narrow band FM demodulator for RTL2832 based DVB-T receivers 70 | * rtl_sdr: an I/Q recorder for RTL2832 based DVB-T receivers 71 | * rtl_tcp: an I/Q spectrum server for RTL2832 based DVB-T receivers 72 | * rtl_test: a benchmark tool for RTL2832 based DVB-T receivers 73 | 74 | 75 | EOF 76 | 77 | DEB_PKG="rtl-sdr_${VERSION}_armhf.deb" 78 | 79 | cp -rf ${REPO_DIR}/build/src/rtl_* /tmp/rtl-sdr/usr/bin/ 80 | dpkg-deb -b /tmp/rtl-sdr/ ./${DEB_PKG} 81 | 82 | echo ${DEB_PKG} 83 | 84 | 85 | # 86 | # librtlsdr-dev 87 | # 88 | 89 | rm -fr /tmp/librtlsdr-dev/ 90 | mkdir -p /tmp/librtlsdr-dev/ 91 | mkdir -p /tmp/librtlsdr-dev/usr/include 92 | mkdir -p /tmp/librtlsdr-dev/usr/lib/pkgconfig 93 | mkdir -p /tmp/librtlsdr-dev/DEBIAN 94 | 95 | cat <<- EOF > /tmp/librtlsdr-dev/DEBIAN/control 96 | Package: librtlsdr-dev 97 | Source: rtl-sdr 98 | Version: ${VERSION} 99 | Architecture: armhf 100 | Maintainer: Lucas Teske 101 | Pre-Depends: multiarch-support 102 | Depends: librtlsdr0 (= ${VERSION}) 103 | Section: libdevel 104 | Priority: extra 105 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 106 | Description: Software defined radio receiver for Realtek RTL2832U (development files) 107 | rtl-sdr is a software defined radio (SDR) receiver software for certain 108 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 109 | . 110 | This package contains development files. 111 | 112 | EOF 113 | 114 | DEB_PKG="librtlsdr-dev_${VERSION}_armhf.deb" 115 | 116 | cp -rf ${REPO_DIR}/include/*.h /tmp/librtlsdr-dev/usr/include 117 | cp ${REPO_DIR}/build/librtlsdr.pc /tmp/librtlsdr-dev/usr/lib/pkgconfig/ 118 | dpkg-deb -b /tmp/librtlsdr-dev/ ./${DEB_PKG} 119 | 120 | echo ${DEB_PKG} -------------------------------------------------------------------------------- /debian/debianize_x32: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" 4 | 5 | G_REV=`git rev-parse --short=8 HEAD` 6 | DATE=`date +"%Y%m%d%H%M%S"` 7 | #VERSION="0.5.3-git+${DATE}.${G_REV}~$1" 8 | VERSION=`git describe | cut -dv -f2` 9 | # 10 | # librtlsdr0 11 | # 12 | 13 | rm -fr /tmp/librtlsdr0/ 14 | mkdir -p /tmp/librtlsdr0/ 15 | mkdir -p /tmp/librtlsdr0/usr/lib/i386-linux-gnu/ 16 | mkdir -p /tmp/librtlsdr0/DEBIAN 17 | 18 | cat <<- EOF > /tmp/librtlsdr0/DEBIAN/control 19 | Package: librtlsdr0 20 | Source: rtl-sdr 21 | Version: ${VERSION} 22 | Architecture: i386 23 | Maintainer: Lucas Teske 24 | Pre-Depends: multiarch-support 25 | Depends: libc6 (>= 2.14), libusb-1.0-0 (>= 2:1.0.9) 26 | Section: libs 27 | Priority: extra 28 | Multi-Arch: same 29 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 30 | Description: Software defined radio receiver for Realtek RTL2832U (library) 31 | rtl-sdr is a software defined radio (SDR) receiver software for certain 32 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 33 | . 34 | This package contains the shared library. 35 | EOF 36 | 37 | DEB_PKG="librtlsdr0_${VERSION}_i386.deb" 38 | 39 | cp -rf ${REPO_DIR}/build/src/lib*so* /tmp/librtlsdr0/usr/lib/i386-linux-gnu/ 40 | dpkg-deb -b /tmp/librtlsdr0/ ./${DEB_PKG} 41 | 42 | echo ${DEB_PKG} 43 | 44 | # 45 | # rtl-sdr 46 | # 47 | 48 | rm -fr /tmp/rtl-sdr/ 49 | mkdir -p /tmp/rtl-sdr/ 50 | mkdir -p /tmp/rtl-sdr/usr/bin/ 51 | mkdir -p /tmp/rtl-sdr/DEBIAN 52 | 53 | cat <<- EOF > /tmp/rtl-sdr/DEBIAN/control 54 | Package: rtl-sdr 55 | Version: ${VERSION} 56 | Architecture: i386 57 | Maintainer: Lucas Teske 58 | Depends: librtlsdr0 (= ${VERSION}), libc6 (>= 2.15) 59 | Section: libs 60 | Priority: extra 61 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 62 | Description: Software defined radio receiver for Realtek RTL2832U (tools) 63 | rtl-sdr is a software defined radio (SDR) receiver software for certain 64 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 65 | . 66 | This package contains a set of command line utilities: 67 | * rtl_adsb: a simple ADS-B decoder for RTL2832 based DVB-T receivers 68 | * rtl_eeprom: an EEPROM programming tool for RTL2832 based DVB-T receivers 69 | * rtl_fm: a narrow band FM demodulator for RTL2832 based DVB-T receivers 70 | * rtl_sdr: an I/Q recorder for RTL2832 based DVB-T receivers 71 | * rtl_tcp: an I/Q spectrum server for RTL2832 based DVB-T receivers 72 | * rtl_test: a benchmark tool for RTL2832 based DVB-T receivers 73 | 74 | 75 | EOF 76 | 77 | DEB_PKG="rtl-sdr_${VERSION}_i386.deb" 78 | 79 | cp -rf ${REPO_DIR}/build/src/rtl_* /tmp/rtl-sdr/usr/bin/ 80 | dpkg-deb -b /tmp/rtl-sdr/ ./${DEB_PKG} 81 | 82 | echo ${DEB_PKG} 83 | 84 | 85 | # 86 | # librtlsdr-dev 87 | # 88 | 89 | rm -fr /tmp/librtlsdr-dev/ 90 | mkdir -p /tmp/librtlsdr-dev/ 91 | mkdir -p /tmp/librtlsdr-dev/usr/include 92 | mkdir -p /tmp/librtlsdr-dev/usr/lib/pkgconfig 93 | mkdir -p /tmp/librtlsdr-dev/DEBIAN 94 | 95 | cat <<- EOF > /tmp/librtlsdr-dev/DEBIAN/control 96 | Package: librtlsdr-dev 97 | Source: rtl-sdr 98 | Version: ${VERSION} 99 | Architecture: i386 100 | Maintainer: Lucas Teske 101 | Pre-Depends: multiarch-support 102 | Depends: librtlsdr0 (= ${VERSION}) 103 | Section: libdevel 104 | Priority: extra 105 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 106 | Description: Software defined radio receiver for Realtek RTL2832U (development files) 107 | rtl-sdr is a software defined radio (SDR) receiver software for certain 108 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 109 | . 110 | This package contains development files. 111 | 112 | EOF 113 | 114 | DEB_PKG="librtlsdr-dev_${VERSION}_i386.deb" 115 | 116 | cp -rf ${REPO_DIR}/include/*.h /tmp/librtlsdr-dev/usr/include 117 | cp ${REPO_DIR}/build/librtlsdr.pc /tmp/librtlsdr-dev/usr/lib/pkgconfig/ 118 | dpkg-deb -b /tmp/librtlsdr-dev/ ./${DEB_PKG} 119 | 120 | echo ${DEB_PKG} -------------------------------------------------------------------------------- /debian/debianize_x64: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../" 4 | 5 | G_REV=`git rev-parse --short=8 HEAD` 6 | DATE=`date +"%Y%m%d%H%M%S"` 7 | #VERSION="0.5.3-git+${DATE}.${G_REV}~$1" 8 | VERSION=`git describe | cut -dv -f2` 9 | # 10 | # librtlsdr0 11 | # 12 | 13 | rm -fr /tmp/librtlsdr0/ 14 | mkdir -p /tmp/librtlsdr0/ 15 | mkdir -p /tmp/librtlsdr0/usr/lib/x86_64-linux-gnu/ 16 | mkdir -p /tmp/librtlsdr0/DEBIAN 17 | 18 | cat <<- EOF > /tmp/librtlsdr0/DEBIAN/control 19 | Package: librtlsdr0 20 | Source: rtl-sdr 21 | Version: ${VERSION} 22 | Architecture: amd64 23 | Maintainer: Lucas Teske 24 | Pre-Depends: multiarch-support 25 | Depends: libc6 (>= 2.14), libusb-1.0-0 (>= 2:1.0.9) 26 | Section: libs 27 | Priority: extra 28 | Multi-Arch: same 29 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 30 | Description: Software defined radio receiver for Realtek RTL2832U (library) 31 | rtl-sdr is a software defined radio (SDR) receiver software for certain 32 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 33 | . 34 | This package contains the shared library. 35 | EOF 36 | 37 | DEB_PKG="librtlsdr0_${VERSION}_amd64.deb" 38 | 39 | cp -rf ${REPO_DIR}/build/src/lib*so* /tmp/librtlsdr0/usr/lib/x86_64-linux-gnu/ 40 | dpkg-deb -b /tmp/librtlsdr0/ ./${DEB_PKG} 41 | 42 | echo ${DEB_PKG} 43 | 44 | # 45 | # rtl-sdr 46 | # 47 | 48 | rm -fr /tmp/rtl-sdr/ 49 | mkdir -p /tmp/rtl-sdr/ 50 | mkdir -p /tmp/rtl-sdr/usr/bin/ 51 | mkdir -p /tmp/rtl-sdr/DEBIAN 52 | 53 | cat <<- EOF > /tmp/rtl-sdr/DEBIAN/control 54 | Package: rtl-sdr 55 | Version: ${VERSION} 56 | Architecture: amd64 57 | Maintainer: Lucas Teske 58 | Depends: librtlsdr0 (= ${VERSION}), libc6 (>= 2.15) 59 | Section: libs 60 | Priority: extra 61 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 62 | Description: Software defined radio receiver for Realtek RTL2832U (tools) 63 | rtl-sdr is a software defined radio (SDR) receiver software for certain 64 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 65 | . 66 | This package contains a set of command line utilities: 67 | * rtl_adsb: a simple ADS-B decoder for RTL2832 based DVB-T receivers 68 | * rtl_eeprom: an EEPROM programming tool for RTL2832 based DVB-T receivers 69 | * rtl_fm: a narrow band FM demodulator for RTL2832 based DVB-T receivers 70 | * rtl_sdr: an I/Q recorder for RTL2832 based DVB-T receivers 71 | * rtl_tcp: an I/Q spectrum server for RTL2832 based DVB-T receivers 72 | * rtl_test: a benchmark tool for RTL2832 based DVB-T receivers 73 | 74 | 75 | EOF 76 | 77 | DEB_PKG="rtl-sdr_${VERSION}_amd64.deb" 78 | 79 | cp -rf ${REPO_DIR}/build/src/rtl_* /tmp/rtl-sdr/usr/bin/ 80 | dpkg-deb -b /tmp/rtl-sdr/ ./${DEB_PKG} 81 | 82 | echo ${DEB_PKG} 83 | 84 | 85 | # 86 | # librtlsdr-dev 87 | # 88 | 89 | rm -fr /tmp/librtlsdr-dev/ 90 | mkdir -p /tmp/librtlsdr-dev/ 91 | mkdir -p /tmp/librtlsdr-dev/usr/include 92 | mkdir -p /tmp/librtlsdr-dev/usr/lib/pkgconfig 93 | mkdir -p /tmp/librtlsdr-dev/DEBIAN 94 | 95 | cat <<- EOF > /tmp/librtlsdr-dev/DEBIAN/control 96 | Package: librtlsdr-dev 97 | Source: rtl-sdr 98 | Version: ${VERSION} 99 | Architecture: amd64 100 | Maintainer: Lucas Teske 101 | Pre-Depends: multiarch-support 102 | Depends: librtlsdr0 (= ${VERSION}) 103 | Section: libdevel 104 | Priority: extra 105 | Homepage: http://sdr.osmocom.org/trac/wiki/rtl-sdr 106 | Description: Software defined radio receiver for Realtek RTL2832U (development files) 107 | rtl-sdr is a software defined radio (SDR) receiver software for certain 108 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 109 | . 110 | This package contains development files. 111 | 112 | EOF 113 | 114 | DEB_PKG="librtlsdr-dev_${VERSION}_amd64.deb" 115 | 116 | cp -rf ${REPO_DIR}/include/*.h /tmp/librtlsdr-dev/usr/include 117 | cp ${REPO_DIR}/build/librtlsdr.pc /tmp/librtlsdr-dev/usr/lib/pkgconfig/ 118 | dpkg-deb -b /tmp/librtlsdr-dev/ ./${DEB_PKG} 119 | 120 | echo ${DEB_PKG} -------------------------------------------------------------------------------- /debian/heatmap.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python2 2 | 3 | from PIL import Image, ImageDraw, ImageFont 4 | import sys, gzip, math, colorsys, datetime 5 | from collections import defaultdict 6 | from itertools import * 7 | 8 | # todo: matplotlib powered --interactive 9 | # arbitrary freq marker spacing 10 | 11 | path = sys.argv[1] 12 | output = sys.argv[2] 13 | 14 | raw_data = lambda: open(path) 15 | if path.endswith('.gz'): 16 | raw_data = lambda: gzip.open(path, 'rb') 17 | 18 | def frange(start, stop, step): 19 | i = 0 20 | while (i*step + start <= stop): 21 | yield i*step + start 22 | i += 1 23 | 24 | print("loading") 25 | 26 | freqs = set() 27 | f_cache = set() 28 | times = set() 29 | labels = set() 30 | min_z = 0 31 | max_z = -100 32 | start, stop = None, None 33 | for line in raw_data(): 34 | line = [s.strip() for s in line.strip().split(',')] 35 | line = [line[0], line[1]] + [float(s) for s in line[2:] if s] 36 | 37 | low = line[2] 38 | high = line[3] 39 | step = line[4] 40 | f_key = (int(low), int(high), step) 41 | if f_key not in f_cache: 42 | freqs.update(list(frange(int(low), int(high), step))) 43 | freqs.add(high) 44 | labels.add(low) 45 | f_cache.add(f_key) 46 | 47 | t = line[0] + ' ' + line[1] 48 | times.add(t) 49 | 50 | zs = line[6:] 51 | min_z = min(min_z, min(z for z in zs if not math.isinf(z))) 52 | max_z = max(max_z, max(zs)) 53 | 54 | if start is None: 55 | start = datetime.datetime.strptime(line[0] + ' ' + line[1], '%Y-%m-%d %H:%M:%S') 56 | stop = datetime.datetime.strptime(line[0] + ' ' + line[1], '%Y-%m-%d %H:%M:%S') 57 | 58 | freqs = list(sorted(list(freqs))) 59 | times = list(sorted(list(times))) 60 | labels = list(sorted(list(labels))) 61 | 62 | if len(labels) == 1: 63 | delta = (max(freqs) - min(freqs)) / (len(freqs) / 500) 64 | delta = round(delta / 10**int(math.log10(delta))) * 10**int(math.log10(delta)) 65 | delta = int(delta) 66 | lower = int(math.ceil(min(freqs) / delta) * delta) 67 | labels = list(range(lower, int(max(freqs)), delta)) 68 | 69 | print("x: %i, y: %i, z: (%f, %f)" % (len(freqs), len(times), min_z, max_z)) 70 | 71 | def rgb2(z): 72 | g = (z - min_z) / (max_z - min_z) 73 | return (int(g*255), int(g*255), 50) 74 | 75 | def rgb3(z): 76 | g = (z - min_z) / (max_z - min_z) 77 | c = colorsys.hsv_to_rgb(0.65-(g-0.08), 1, 0.2+g) 78 | return (int(c[0]*256),int(c[1]*256),int(c[2]*256)) 79 | 80 | print("drawing") 81 | img = Image.new("RGB", (len(freqs), len(times))) 82 | pix = img.load() 83 | x_size = img.size[0] 84 | for line in raw_data(): 85 | line = [s.strip() for s in line.strip().split(',')] 86 | line = [line[0], line[1]] + [float(s) for s in line[2:] if s] 87 | t = line[0] + ' ' + line[1] 88 | if t not in times: 89 | continue # happens with live files 90 | y = times.index(t) 91 | low = line[2] 92 | high = line[3] 93 | step = line[4] 94 | x_start = freqs.index(low) 95 | for i in range(len(line[6:])): 96 | x = x_start + i 97 | if x >= x_size: 98 | continue 99 | z = line[6+i] 100 | # fast check for nan/-inf 101 | if not z >= min_z: 102 | z = min_z 103 | pix[x,y] = rgb2(z) 104 | 105 | print("labeling") 106 | draw = ImageDraw.Draw(img) 107 | font = ImageFont.load_default() 108 | pixel_width = step 109 | for label in labels: 110 | y = 10 111 | #x = freqs.index(label) 112 | x = int((label-min(freqs)) / pixel_width) 113 | s = '%.3fMHz' % (label/1000000.0) 114 | draw.text((x, y), s, font=font, fill='white') 115 | 116 | duration = stop - start 117 | duration = duration.seconds 118 | pixel_height = duration / len(times) 119 | hours = int(duration / 3600) 120 | minutes = int((duration - 3600*hours) / 60) 121 | draw.text((2, img.size[1] - 45), 'Duration: %i:%02i' % (hours, minutes), font=font, fill='white') 122 | draw.text((2, img.size[1] - 35), 'Range: %.2fMHz - %.2fMHz' % (min(freqs)/1e6, max(freqs)/1e6), font=font, fill='white') 123 | draw.text((2, img.size[1] - 25), 'Pixel: %.2fHz x %is' % (pixel_width, int(round(pixel_height))), font=font, fill='white') 124 | draw.text((2, img.size[1] - 15), 'Started: {0}'.format(start), font=font, fill='white') 125 | # bin size 126 | 127 | print("saving") 128 | img.save(output) 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /debian/librtlsdr-dev.dirs: -------------------------------------------------------------------------------- 1 | usr/lib 2 | usr/include 3 | -------------------------------------------------------------------------------- /debian/librtlsdr-dev.install: -------------------------------------------------------------------------------- 1 | usr/include/* 2 | usr/lib/*/lib*.a 3 | usr/lib/*/lib*.so 4 | usr/lib/*/pkgconfig/* 5 | -------------------------------------------------------------------------------- /debian/librtlsdr0.dirs: -------------------------------------------------------------------------------- 1 | etc/modprobe.d 2 | usr/lib 3 | -------------------------------------------------------------------------------- /debian/librtlsdr0.install: -------------------------------------------------------------------------------- 1 | usr/lib/*/lib*.so.* 2 | debian/librtlsdr0.metainfo.xml usr/share/metainfo 3 | -------------------------------------------------------------------------------- /debian/librtlsdr0.maintscript: -------------------------------------------------------------------------------- 1 | rm_conffile /etc/modprobe.d/rtl-sdr-blacklist.conf 0.5.3-10~ 2 | -------------------------------------------------------------------------------- /debian/librtlsdr0.metainfo.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | librtlsdr0 4 | GPL-2+ 5 | librtlsdr0 6 | Control of rtl-sdr radio receiver 7 | 8 |

9 | rtl-sdr is a software defined radio (SDR) receiver software for certain 10 | low-cost DVB-T/DAB(+) USB dongles based on the Realtek RTL2832U chip. 11 |

12 |
13 | 14 | usb:v0BDAp2832d* 15 | usb:v0BDAp2838d* 16 | usb:v0413p6680d* 17 | usb:v0413p6F0Fd* 18 | usb:v0458p707Fd* 19 | usb:v0CCDp00A9d* 20 | usb:v0CCDp00B3d* 21 | usb:v0CCDp00B4d* 22 | usb:v0CCDp00B5d* 23 | usb:v0CCDp00B7d* 24 | usb:v0CCDp00B8d* 25 | usb:v0CCDp00B9d* 26 | usb:v0CCDp00C0d* 27 | usb:v0CCDp00C6d* 28 | usb:v0CCDp00D3d* 29 | usb:v0CCDp00D7d* 30 | usb:v0CCDp00E0d* 31 | usb:v1554p5020d* 32 | usb:v15F4p0131d* 33 | usb:v15F4p0133d* 34 | usb:v185Bp0620d* 35 | usb:v185Bp0650d* 36 | usb:v185Bp0680d* 37 | usb:v1B80pD393d* 38 | usb:v1B80pD394d* 39 | usb:v1B80pD395d* 40 | usb:v1B80pD397d* 41 | usb:v1B80pD398d* 42 | usb:v1B80pD39Dd* 43 | usb:v1B80pD3A4d* 44 | usb:v1B80pD3A8d* 45 | usb:v1B80pD3AFd* 46 | usb:v1B80pD3B0d* 47 | usb:v1D19p1101d* 48 | usb:v1D19p1102d* 49 | usb:v1D19p1103d* 50 | usb:v1D19p1104d* 51 | usb:v1F4DpA803d* 52 | usb:v1F4DpB803d* 53 | usb:v1F4DpC803d* 54 | usb:v1F4DpD286d* 55 | usb:v1F4DpD803d* 56 | 57 |
58 | -------------------------------------------------------------------------------- /debian/librtlsdr0.udev: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012-2013 Osmocom rtl-sdr project 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | 18 | # original RTL2832U vid/pid (hama nano, for example) 19 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", MODE:="0666" 20 | 21 | # RTL2832U OEM vid/pid, e.g. ezcap EzTV668 (E4000), Newsky TV28T (E4000/R820T) etc. 22 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666" 23 | 24 | # DigitalNow Quad DVB-T PCI-E card (4x FC0012?) 25 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6680", MODE:="0666" 26 | 27 | # Leadtek WinFast DTV Dongle mini D (FC0012) 28 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6f0f", MODE:="0666" 29 | 30 | # Genius TVGo DVB-T03 USB dongle (Ver. B) 31 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0458", ATTRS{idProduct}=="707f", MODE:="0666" 32 | 33 | # Terratec Cinergy T Stick Black (rev 1) (FC0012) 34 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00a9", MODE:="0666" 35 | 36 | # Terratec NOXON rev 1 (FC0013) 37 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b3", MODE:="0666" 38 | 39 | # Terratec Deutschlandradio DAB Stick (FC0013) 40 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b4", MODE:="0666" 41 | 42 | # Terratec NOXON DAB Stick - Radio Energy (FC0013) 43 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b5", MODE:="0666" 44 | 45 | # Terratec Media Broadcast DAB Stick (FC0013) 46 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b7", MODE:="0666" 47 | 48 | # Terratec BR DAB Stick (FC0013) 49 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b8", MODE:="0666" 50 | 51 | # Terratec WDR DAB Stick (FC0013) 52 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b9", MODE:="0666" 53 | 54 | # Terratec MuellerVerlag DAB Stick (FC0013) 55 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c0", MODE:="0666" 56 | 57 | # Terratec Fraunhofer DAB Stick (FC0013) 58 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c6", MODE:="0666" 59 | 60 | # Terratec Cinergy T Stick RC (Rev.3) (E4000) 61 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", MODE:="0666" 62 | 63 | # Terratec T Stick PLUS (E4000) 64 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666" 65 | 66 | # Terratec NOXON rev 2 (E4000) 67 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="0666" 68 | 69 | # PixelView PV-DT235U(RN) (FC0012) 70 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666" 71 | 72 | # Astrometa DVB-T/DVB-T2 (R828D) 73 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666" 74 | 75 | # HanfTek DAB+FM+DVB-T 76 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0133", MODE:="0666" 77 | 78 | # Compro Videomate U620F (E4000) 79 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666" 80 | 81 | # Compro Videomate U650F (E4000) 82 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666" 83 | 84 | # Compro Videomate U680F (E4000) 85 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0680", MODE:="0666" 86 | 87 | # GIGABYTE GT-U7300 (FC0012) 88 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d393", MODE:="0666" 89 | 90 | # DIKOM USB-DVBT HD 91 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d394", MODE:="0666" 92 | 93 | # Peak 102569AGPK (FC0012) 94 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d395", MODE:="0666" 95 | 96 | # KWorld KW-UB450-T USB DVB-T Pico TV (TUA9001) 97 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d397", MODE:="0666" 98 | 99 | # Zaapa ZT-MINDVBZP (FC0012) 100 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d398", MODE:="0666" 101 | 102 | # SVEON STV20 DVB-T USB & FM (FC0012) 103 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d39d", MODE:="0666" 104 | 105 | # Twintech UT-40 (FC0013) 106 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a4", MODE:="0666" 107 | 108 | # ASUS U3100MINI_PLUS_V2 (FC0013) 109 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a8", MODE:="0666" 110 | 111 | # SVEON STV27 DVB-T USB & FM (FC0013) 112 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3af", MODE:="0666" 113 | 114 | # SVEON STV21 DVB-T USB & FM 115 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3b0", MODE:="0666" 116 | 117 | # Dexatek DK DVB-T Dongle (Logilink VG0002A) (FC2580) 118 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1101", MODE:="0666" 119 | 120 | # Dexatek DK DVB-T Dongle (MSI DigiVox mini II V3.0) 121 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1102", MODE:="0666" 122 | 123 | # Dexatek DK 5217 DVB-T Dongle (FC2580) 124 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1103", MODE:="0666" 125 | 126 | # MSI DigiVox Micro HD (FC2580) 127 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1104", MODE:="0666" 128 | 129 | # Sweex DVB-T USB (FC0012) 130 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="a803", MODE:="0666" 131 | 132 | # GTek T803 (FC0012) 133 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="b803", MODE:="0666" 134 | 135 | # Lifeview LV5TDeluxe (FC0012) 136 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="c803", MODE:="0666" 137 | 138 | # MyGica TD312 (FC0012) 139 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d286", MODE:="0666" 140 | 141 | # PROlectrix DV107669 (FC0012) 142 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d803", MODE:="0666" 143 | -------------------------------------------------------------------------------- /debian/rtl-sdr-blacklist.conf: -------------------------------------------------------------------------------- 1 | # This system has librtlsdr0 installed in order to 2 | # use digital video broadcast receivers as generic 3 | # software defined radios. 4 | blacklist dvb_usb_rtl28xxu 5 | blacklist e4000 6 | blacklist rtl2832 7 | -------------------------------------------------------------------------------- /debian/rtl-sdr.dirs: -------------------------------------------------------------------------------- 1 | usr/bin 2 | -------------------------------------------------------------------------------- /debian/rtl-sdr.examples: -------------------------------------------------------------------------------- 1 | debian/heatmap.py 2 | -------------------------------------------------------------------------------- /debian/rtl-sdr.install: -------------------------------------------------------------------------------- 1 | usr/bin/* 2 | -------------------------------------------------------------------------------- /debian/rtl-sdr.manpages: -------------------------------------------------------------------------------- 1 | debian/rtl_adsb.1 2 | debian/rtl_eeprom.1 3 | debian/rtl_fm.1 4 | debian/rtl_power.1 5 | debian/rtl_sdr.1 6 | debian/rtl_tcp.1 7 | debian/rtl_test.1 8 | -------------------------------------------------------------------------------- /debian/rtl_adsb.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_adsb" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl_adsb \- a simple ADS-B decoder 4 | .SH DESCRIPTION 5 | Uses a re-purposed DVB-T receiver as a software defined 6 | radio to receive and decode ADS-B data. Written by Kyle Keen 7 | and incorporated in the osmocom rtl-sdr project. 8 | .LP 9 | Automatic dependent surveillance-broadcast, ADS-B, consists 10 | of position and other status data transmitted by aircraft 11 | in support of air traffic control in order to improve safety 12 | of flight. 13 | .LP 14 | Much software is available for the RTL2832. Most of the user-level 15 | packages rely on the librtlsdr library which comes as part of the 16 | rtl-sdr codebase. This codebase contains both the library itself and 17 | also a number of command line tools such as rtl_test, rtl_sdr, 18 | rtl_tcp, and rtl_fm. These command line tools use the library to test 19 | for the existence of RTL2832 devices and to perform basic data 20 | transfer functions to and from the device. 21 | .LP 22 | Because most of the RTL2832 devices are connected using USB, the 23 | librtlsdr library depends on the libusb library to communicate with 24 | the device. 25 | .SH USAGE 26 | With a suitable antenna for receiving the 1090 MHz signal attached 27 | to the rtl-sdr supported device, this program will output the 28 | data decoded from that signal. 29 | .SH SYNOPSIS 30 | .B rtl_adsb [-R] [-g gain] [-p ppm] [output file] 31 | .SH OPTIONS 32 | .IP "-d device_index (default: 0)" 33 | .IP "-V verbove output (default: off)" 34 | .IP "-S show short frames (default: off)" 35 | .IP "-Q quality (0: no sanity checks, 0.5: half bit, 1: one bit (default), 2: two bits)" 36 | .IP "-e allowed_errors (default: 5)" 37 | .IP "-g tuner_gain (default: automatic)" 38 | .IP "-p ppm_error (default: 0)" 39 | .IP tfilename 40 | (a '-' dumps samples to stdout) 41 | (omitting the filename also uses stdout) 42 | .SH EXAMPLES 43 | .IP "Streaming with netcat:" 44 | rtl_adsb | netcat -lp 8080 45 | 46 | while true; do rtl_adsb | nc -lp 8080; done 47 | .IP "Streaming with socat:" 48 | rtl_adsb | socat -u - TCP4:sdrsharp.com:47806 49 | .SH SEE ALSO 50 | RTL-SDR wiki documentation: 51 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 52 | .LP 53 | Other rtl-sdr programs: 54 | .sp 55 | rtl_eeprom(1), rtl_fm(1), rtl_sdr(1), rtl_tcp(1), rtl_test(1) 56 | .SH AUTHOR 57 | This manual page was written by Maitland Bottoms 58 | for the Debian project (but may be used by others). 59 | .SH COPYRIGHT 60 | Copyright (c) 2013 A. Maitland Bottoms 61 | .LP 62 | This program is free software: you can redistribute it and/or modify 63 | it under the terms of the GNU General Public License as published by 64 | the Free Software Foundation, either version 2 of the License, or 65 | (at your option) any later version. 66 | .LP 67 | This program is distributed in the hope that it will be useful, 68 | but WITHOUT ANY WARRANTY; without even the implied warranty of 69 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 70 | GNU General Public License for more details. 71 | -------------------------------------------------------------------------------- /debian/rtl_eeprom.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_eeprom" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl-eeprom \- EEPROM programming tool for RTL2832 based DVB-T receivers 4 | .SH DESCRIPTION 5 | Dumps configuration and also writes EEPROM configuration. 6 | Written by Steve Markgraf and incorporated in the osmocom rtl-sdr project. 7 | .LP 8 | Use at your own risk, especially -w! 9 | .LP 10 | Much software is available for the RTL2832. Most of the user-level 11 | packages rely on the librtlsdr library which comes as part of the 12 | rtl-sdr codebase. This codebase contains both the library itself and 13 | also a number of command line tools such as rtl_test, rtl_sdr, 14 | rtl_tcp, and rtl_fm. These command line tools use the library to test 15 | for the existence of RTL2832 devices and to perform basic data 16 | transfer functions to and from the device. 17 | .LP 18 | Because most of the RTL2832 devices are connected using USB, the 19 | librtlsdr library depends on the libusb library to communicate with 20 | the device. 21 | .SH USAGE 22 | Writing bad information to the EEPROM will make your 23 | device useless. 24 | .SH SYNOPSIS 25 | .B rtl_eeprom [OPTIONS] 26 | .SH OPTIONS 27 | .IP "-d device_index (default: 0)" 28 | .IP "-m set manufacturer string" 29 | .IP "-p set product string" 30 | .IP "-s set serial number string" 31 | .IP "-i <0,1> disable/enable IR-endpoint" 32 | .IP "-g generate default config and write to device" 33 | can be one of: 34 | realtek Realtek default (as without EEPROM) 35 | realtek_oem Realtek default OEM with EEPROM 36 | noxon Terratec NOXON DAB Stick 37 | terratec_black Terratec T Stick Black 38 | terratec_plus Terratec T Stick+ (DVB-T/DAB) 39 | .IP "-w write dumped file to device" 40 | .IP "-r dump EEPROM to file" 41 | .IP "-h display this help text" 42 | .LP 43 | Use on your own risk, especially -w! 44 | .SH SEE ALSO 45 | RTL-SDR wiki documentation: 46 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 47 | .LP 48 | Other rtl-sdr programs: 49 | .sp 50 | rtl_adsb(1), rtl_fm(1), rtl_sdr(1), rtl_tcp(1), rtl_test(1) 51 | .SH AUTHOR 52 | This manual page was written by Maitland Bottoms 53 | for the Debian project (but may be used by others). 54 | .SH COPYRIGHT 55 | Copyright (c) 2013 A. Maitland Bottoms 56 | .LP 57 | This program is free software: you can redistribute it and/or modify 58 | it under the terms of the GNU General Public License as published by 59 | the Free Software Foundation, either version 2 of the License, or 60 | (at your option) any later version. 61 | .LP 62 | This program is distributed in the hope that it will be useful, 63 | but WITHOUT ANY WARRANTY; without even the implied warranty of 64 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 65 | GNU General Public License for more details. 66 | -------------------------------------------------------------------------------- /debian/rtl_fm.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_adsb" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl_fm \- a simple FM demodulator for RTL2832 based DVB-T receivers 4 | .SH DESCRIPTION 5 | Uses a re-purposed DVB-T receiver as a software defined 6 | radio to receive narrow band FM signals and demodulate 7 | to audio. Written for and incorporated in the osmocom rtl-sdr project. 8 | .LP 9 | Narrowband FM is commonly used by public service agencies and 10 | commercial dispatch operations in the VHF and UHF bands. 11 | Also can demodulate Wideband FM, as found in the 88-108 MHz FM 12 | broadcast band. 13 | Experimental options include AM, LSB, USB and DSB demodulation. 14 | .LP 15 | Much software is available for the RTL2832. Most of the user-level 16 | packages rely on the librtlsdr library which comes as part of the 17 | rtl-sdr codebase. This codebase contains both the library itself and 18 | also a number of command line tools such as rtl_test, rtl_sdr, 19 | rtl_tcp, and rtl_fm. These command line tools use the library to test 20 | for the existence of RTL2832 devices and to perform basic data 21 | transfer functions to and from the device. 22 | .LP 23 | Because most of the RTL2832 devices are connected using USB, the 24 | librtlsdr library depends on the libusb library to communicate with 25 | the device. 26 | .SH USAGE 27 | With a suitable antenna for receiving the signal attached 28 | to the rtl-sdr supported device, this program will output the 29 | digital audio data decoded from that signal. The data can be 30 | listened to by piping to Sox or aplay applications to play the 31 | stream on the computer sound card. 32 | .SH SYNOPSIS 33 | .B rtl_fm [-f freq] [-options] [filename] 34 | .SH OPTIONS 35 | .IP "-f frequency_to_tune_to [Hz]" 36 | use multiple -f for scanning, (requires squelch) 37 | ranges supported, -f 118M:137M:25k 38 | .IP "[-M modulation (default: fm)]" 39 | fm, wbfm, raw, am, usb, lsb 40 | wbfm == -M fm -s 170k -o 4 -A fast -r 32k -l 0 -E deemp 41 | raw mode outputs 2x16 bit IQ pairs 42 | .IP "-s sample_rate (default: 24k)" 43 | .IP "-d device_index (default: 0)" 44 | .IP "-g tuner_gain (default: automatic)" 45 | .IP "-l squelch_level (default: 0/off)" 46 | .IP "-o oversampling (default: 1, 4 recommended)" 47 | for fm squelch is inverted 48 | .IP "[-o oversampling (default: 1, 4 recommended)]" 49 | .IP "-p ppm_error (default: 0)" 50 | .IP "[-E enable_option (default: none)]" 51 | use multiple -E to enable multiple options 52 | edge: enable lower edge tuning 53 | dc: enable dc blocking filter 54 | deemp: enable de-emphasis filter 55 | direct: enable direct sampling 56 | offset: enable offset tuning 57 | .IP "filename ('-' means stdout)" 58 | omitting the filename also uses stdout 59 | .SH Experimental options 60 | .IP "[-r resample_rate (default: none / same as -s)]" 61 | .IP "[-t squelch_delay (default: 10)]" 62 | +values will mute/scan, -values will exit 63 | .IP "[-F fir_size (default: off)]" 64 | enables low-leakage downsample filter 65 | size can be 0 or 9. 0 has bad roll off 66 | .IP "-A std/fast/lut choose atan math (default: std)" 67 | .IP filename 68 | (a '-' dumps samples to stdout) 69 | (omitting the filename also uses stdout) 70 | .SH EXAMPLES 71 | Produces signed 16 bit ints, use Sox or aplay to hear them. 72 | .IP "rtl_fm ... - | play -t raw -r 24k -es -b 16 -c 1 -V1 -" 73 | | aplay -r 24k -f S16_LE -t raw -c 1 74 | -M wbfm | play -r 32k ... 75 | .IP "rtl_fm ... -s 22050 - | multimon -t raw /dev/stdin" 76 | .SH SEE ALSO 77 | RTL-SDR wiki documentation: 78 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 79 | .LP 80 | Rtl_fm Guide: 81 | .B http://kmkeen.com/rtl-demod-guide/ 82 | .LP 83 | .sp 84 | sox(1), play(1), aplay(1) 85 | .LP 86 | Other rtl-sdr programs: 87 | .sp 88 | rtl_adsb(1), rtl_eeprom(1), rtl_sdr(1), rtl_tcp(1), rtl_test(1) 89 | .SH AUTHOR 90 | This manual page was written by Maitland Bottoms 91 | for the Debian project (but may be used by others). 92 | .SH COPYRIGHT 93 | Copyright (c) 2013 A. Maitland Bottoms 94 | .LP 95 | This program is free software: you can redistribute it and/or modify 96 | it under the terms of the GNU General Public License as published by 97 | the Free Software Foundation, either version 2 of the License, or 98 | (at your option) any later version. 99 | .LP 100 | This program is distributed in the hope that it will be useful, 101 | but WITHOUT ANY WARRANTY; without even the implied warranty of 102 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 103 | GNU General Public License for more details. 104 | -------------------------------------------------------------------------------- /debian/rtl_power.1: -------------------------------------------------------------------------------- 1 | .TH rtl_power: "1" "0.5.1" RTL_SDR "User Commands" 2 | .SH NAME 3 | rtl_power: \- wideband spectrum monitor utility 4 | .SH DESCRIPTION 5 | Uses a re-purposed DVB-T receiver as a software defined 6 | radio to receive signals in I/Q data form. Written for 7 | and incorporated in the osmocom rtl-sdr project. 8 | .SH USAGE 9 | rtl_power, a simple FFT logger for RTL2832 based DVB\-T receivers 10 | .PP 11 | This tool gathers signal data over a very wide area of the frequency spectrum, 12 | and then that data can be used to find active areas of the spectrum. 13 | .PP 14 | Use: rtl_power \fB\-f\fR freq_range [\-options] [filename] 15 | .HP 16 | \fB\-f\fR lower:upper:bin_size [Hz] 17 | .IP 18 | (bin size is a maximum, smaller more convenient bins 19 | .TP 20 | will be used. 21 | valid range 1Hz \- 2.8MHz) 22 | .IP 23 | [\-i integration_interval (default: 10 seconds)] 24 | .IP 25 | (buggy if a full sweep takes longer than the interval) 26 | .IP 27 | [\-1 enables single\-shot mode (default: off)] 28 | [\-e exit_timer (default: off/0)] 29 | [\-d device_index (default: 0)] 30 | [\-g tuner_gain (default: automatic)] 31 | [\-p ppm_error (default: 0)] 32 | filename (a '\-' dumps samples to stdout) 33 | .IP 34 | (omitting the filename also uses stdout) 35 | .SS "Experimental options:" 36 | .IP 37 | [\-w window (default: rectangle)] 38 | .IP 39 | (hamming, blackman, blackman\-harris, hann\-poisson, bartlett, youssef) 40 | .IP 41 | [\-c crop_percent (default: 0%, recommended: 20%\-50%)] 42 | .IP 43 | (discards data at the edges, 100% discards everything) 44 | (has no effect for bins larger than 1MHz) 45 | .IP 46 | [\-F fir_size (default: disabled)] 47 | .IP 48 | (enables low\-leakage downsample filter, 49 | .TP 50 | fir_size can be 0 or 9. 51 | 0 has bad roll off, 52 | .IP 53 | try with '\-c 50%') 54 | .IP 55 | [\-P enables peak hold (default: off)] 56 | [\-D enable direct sampling (default: off)] 57 | [\-O enable offset tuning (default: off)] 58 | .SS "CSV FFT output columns:" 59 | .IP 60 | date, time, Hz low, Hz high, Hz step, samples, dbm, dbm, ... 61 | .SH EXAMPLES 62 | .IP 63 | rtl_power \fB\-f\fR 88M:108M:125k fm_stations.csv 64 | .IP 65 | (creates 160 bins across the FM band, 66 | .IP 67 | individual stations should be visible) 68 | .IP 69 | rtl_power \fB\-f\fR 100M:1G:1M \fB\-i\fR 5m \fB\-1\fR survey.csv 70 | .IP 71 | (a five minute low res scan of nearly everything) 72 | .IP 73 | rtl_power \fB\-f\fR ... \fB\-i\fR 15m \fB\-1\fR log.csv 74 | .IP 75 | (integrate for 15 minutes and exit afterwards) 76 | .IP 77 | rtl_power \fB\-f\fR ... \fB\-e\fR 1h | gzip > log.csv.gz 78 | .IP 79 | (collect data for one hour and compress it on the fly) 80 | .SS "Convert CSV to a waterfall graphic with:" 81 | .IP 82 | http://kmkeen.com/tmp/heatmap.py.txt 83 | .PP 84 | rtl_power, a simple FFT logger for RTL2832 based DVB\-T receivers 85 | .PP 86 | Use: rtl_power \fB\-f\fR freq_range [\-options] [filename] 87 | .HP 88 | \fB\-f\fR lower:upper:bin_size [Hz] 89 | .IP 90 | (bin size is a maximum, smaller more convenient bins 91 | .TP 92 | will be used. 93 | valid range 1Hz \- 2.8MHz) 94 | .IP 95 | [\-i integration_interval (default: 10 seconds)] 96 | .IP 97 | (buggy if a full sweep takes longer than the interval) 98 | .IP 99 | [\-1 enables single\-shot mode (default: off)] 100 | [\-e exit_timer (default: off/0)] 101 | [\-d device_index (default: 0)] 102 | [\-g tuner_gain (default: automatic)] 103 | [\-p ppm_error (default: 0)] 104 | filename (a '\-' dumps samples to stdout) 105 | .IP 106 | (omitting the filename also uses stdout) 107 | .SS "Experimental options:" 108 | .IP 109 | [\-w window (default: rectangle)] 110 | .IP 111 | (hamming, blackman, blackman\-harris, hann\-poisson, bartlett, youssef) 112 | .IP 113 | [\-c crop_percent (default: 0%, recommended: 20%\-50%)] 114 | .IP 115 | (discards data at the edges, 100% discards everything) 116 | (has no effect for bins larger than 1MHz) 117 | .IP 118 | [\-F fir_size (default: disabled)] 119 | .IP 120 | (enables low\-leakage downsample filter, 121 | .TP 122 | fir_size can be 0 or 9. 123 | 0 has bad roll off, 124 | .IP 125 | try with '\-c 50%') 126 | .IP 127 | [\-P enables peak hold (default: off)] 128 | [\-D enable direct sampling (default: off)] 129 | [\-O enable offset tuning (default: off)] 130 | .SS "CSV FFT output columns:" 131 | .IP 132 | date, time, Hz low, Hz high, Hz step, samples, dbm, dbm, ... 133 | .IP 134 | rtl_power \fB\-f\fR 88M:108M:125k fm_stations.csv 135 | .IP 136 | (creates 160 bins across the FM band, 137 | .IP 138 | individual stations should be visible) 139 | .IP 140 | rtl_power \fB\-f\fR 100M:1G:1M \fB\-i\fR 5m \fB\-1\fR survey.csv 141 | .IP 142 | (a five minute low res scan of nearly everything) 143 | .IP 144 | rtl_power \fB\-f\fR ... \fB\-i\fR 15m \fB\-1\fR log.csv 145 | .IP 146 | (integrate for 15 minutes and exit afterwards) 147 | .IP 148 | rtl_power \fB\-f\fR ... \fB\-e\fR 1h | gzip > log.csv.gz 149 | .IP 150 | (collect data for one hour and compress it on the fly) 151 | .SS "Convert CSV to a waterfall graphic with:" 152 | .IP 153 | http://kmkeen.com/tmp/heatmap.py.txt 154 | .SH "SEE ALSO" 155 | .LP 156 | RTL-SDR wiki documentation: 157 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 158 | .LP 159 | Other rtl-sdr programs: 160 | .sp 161 | rtl_adsb(1), rtl_eeprom(1), rtl_fm(1), rtl_sdr(1), rtl_tcp(1), rtl_test(1) 162 | .SH AUTHOR 163 | This manual page was written by Maitland Bottoms 164 | for the Debian project (but may be used by others). 165 | .SH COPYRIGHT 166 | Copyright (c) 2013 A. Maitland Bottoms 167 | .LP 168 | This program is free software: you can redistribute it and/or modify 169 | it under the terms of the GNU General Public License as published by 170 | the Free Software Foundation, either version 2 of the License, or 171 | (at your option) any later version. 172 | .LP 173 | This program is distributed in the hope that it will be useful, 174 | but WITHOUT ANY WARRANTY; without even the implied warranty of 175 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 176 | GNU General Public License for more details. 177 | -------------------------------------------------------------------------------- /debian/rtl_sdr.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_sdr" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl-sdr \- an I/Q recorder for RTL2832 based DVB-T receivers 4 | .SH DESCRIPTION 5 | Uses a re-purposed DVB-T receiver as a software defined 6 | radio to receive signals in I/Q data form. Written for 7 | and incorporated in the osmocom rtl-sdr project. 8 | .LP 9 | In-Phase and Quadrature Phase data can faithfully represent 10 | all of the information in a band of frequencies centered 11 | on a carrier signal frequency. 12 | .LP 13 | Much software is available for the RTL2832. Most of the user-level 14 | packages rely on the librtlsdr library which comes as part of the 15 | rtl-sdr codebase. This codebase contains both the library itself and 16 | also a number of command line tools such as rtl_test, rtl_sdr, 17 | rtl_tcp, and rtl_fm. These command line tools use the library to test 18 | for the existence of RTL2832 devices and to perform basic data 19 | transfer functions to and from the device. 20 | .LP 21 | Because most of the RTL2832 devices are connected using USB, the 22 | librtlsdr library depends on the libusb library to communicate with 23 | the device. 24 | .SH USAGE 25 | This program captures information from a band of frequencies 26 | and outputs the data in a form useful to other software radio 27 | programs. 28 | .SH SYNOPSIS 29 | .B rtl_adsb [-f freq] [OPTIONS] [output file] 30 | .SH OPTIONS 31 | .IP "-f frequency_to_tune_to [Hz]" 32 | .IP "-s samplerate (default: 2048000 Hz)" 33 | .IP "-d device_index (default: 0)" 34 | .IP "-g gain (default: 0 for auto)" 35 | .IP "-p ppm_error (default: 0)" 36 | .IP "-b output_block_size (default: 16 * 16384)" 37 | .IP "-n number of samples to read (default: 0, infinite)" 38 | .IP "-S force sync output (default: async)" 39 | .IP tfilename 40 | (a '-' dumps samples to stdout) 41 | .SH EXAMPLES 42 | .IP "Example: To tune to 392.0 MHz, and set the sample-rate to 1.8 MS/s, use:" 43 | ./rtl_sdr /tmp/capture.bin -s 1.8e6 -f 392e6 44 | .LP 45 | to record samples to a file or to forward the data to a fifo. 46 | .LP 47 | If the device can't be opened, make sure you have the appropriate 48 | rights to access the device (install udev-rules from the repository, 49 | or run it as root). 50 | .SH SEE ALSO 51 | gnuradio(1) 52 | .LP 53 | RTL-SDR wiki documentation: 54 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 55 | .LP 56 | Other rtl-sdr programs: 57 | .sp 58 | rtl_adsb(1), rtl_eeprom(1), rtl_fm(1), rtl_power(1), rtl_tcp(1), rtl_test(1) 59 | .SH AUTHOR 60 | This manual page was written by Maitland Bottoms 61 | for the Debian project (but may be used by others). 62 | .SH COPYRIGHT 63 | Copyright (c) 2013 A. Maitland Bottoms 64 | .LP 65 | This program is free software: you can redistribute it and/or modify 66 | it under the terms of the GNU General Public License as published by 67 | the Free Software Foundation, either version 2 of the License, or 68 | (at your option) any later version. 69 | .LP 70 | This program is distributed in the hope that it will be useful, 71 | but WITHOUT ANY WARRANTY; without even the implied warranty of 72 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 73 | GNU General Public License for more details. 74 | -------------------------------------------------------------------------------- /debian/rtl_tcp.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_tcp" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl_tcp \- an I/Q spectrum server for RTL2832 based DVB-T receivers 4 | .SH DESCRIPTION 5 | Uses a re-purposed DVB-T receiver as a software defined 6 | radio to receive and send I/Q data via TCP network to another 7 | demodulation, decoding or logging apllication. Written for 8 | and incorporated into the osmocom rtl-sdr project. 9 | .LP 10 | Much software is available for the RTL2832. Most of the user-level 11 | packages rely on the librtlsdr library which comes as part of the 12 | rtl-sdr codebase. This codebase contains both the library itself and 13 | also a number of command line tools such as rtl_test, rtl_sdr, 14 | rtl_tcp, and rtl_fm. These command line tools use the library to test 15 | for the existence of RTL2832 devices and to perform basic data 16 | transfer functions to and from the device. 17 | .LP 18 | Because most of the RTL2832 devices are connected using USB, the 19 | librtlsdr library depends on the libusb library to communicate with 20 | the device. 21 | .SH USAGE 22 | Run this program on a machine with an rtl-sdr supported 23 | device connected and it will provide I/Q data to other applications 24 | via TCP/IP. 25 | .SH SYNOPSIS 26 | .B rtl_tcp [OPTIONS] 27 | .SH OPTIONS 28 | .IP "-a listen address" 29 | .IP "-p listen port (default: 1234)" 30 | .IP "-f frequency to tune to [Hz]" 31 | .IP "-g gain (default: 0 for auto)" 32 | .IP "-s samplerate in Hz (default: 2048000 Hz)" 33 | .IP "-b number of buffers (default: 32, set by library)" 34 | .IP "-n max number of linked list buffers to keep (default: 500)" 35 | .IP "-d device_index (default: 0)" 36 | .IP "-P ppm_error (default: 0)" 37 | .SH Example: 38 | .IP "rtl_tcp -a 10.0.0.2 [-p listen port (default: 1234)]" 39 | Found 1 device(s). 40 | Found Elonics E4000 tuner 41 | Using Generic RTL2832U (e.g. hama nano) 42 | Tuned to 100000000 Hz. 43 | listening... 44 | .LP 45 | Use the device argument 'rtl_tcp=10.0.0.2:1234' in OsmoSDR (gr-osmosdr) source 46 | to receive samples in GRC and control rtl_tcp parameters (frequency, gain, ...). 47 | .LP 48 | use the rtl_tcp=... device argument in gr-osmosdr source to receive 49 | the samples in GRC and control the rtl settings remotely. 50 | .LP 51 | This application has been successfully crosscompiled for ARM and MIPS 52 | devices and is providing IQ data in a networked ADS-B setup at a rate 53 | of 2.4MSps. The gr-osmosdr source is being used together with an 54 | optimized gr-air-modes version (see Known Apps below). It is also 55 | available as a package in OpenWRT. 56 | .LP 57 | A use case is described ​https://sites.google.com/site/embrtlsdr/ 58 | .SH SEE ALSO 59 | gnuradio(1) 60 | .LP 61 | RTL-SDR wiki documentation: 62 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 63 | .LP 64 | Other rtl-sdr programs: 65 | .sp 66 | rtl_adsb(1), rtl_eeprom(1), rtl_fm(1), rtl_sdr(1), rtl_test(1) 67 | .SH AUTHOR 68 | This manual page was written by Maitland Bottoms 69 | for the Debian project (but may be used by others). 70 | .SH COPYRIGHT 71 | Copyright (c) 2013 A. Maitland Bottoms 72 | .LP 73 | This program is free software: you can redistribute it and/or modify 74 | it under the terms of the GNU General Public License as published by 75 | the Free Software Foundation, either version 2 of the License, or 76 | (at your option) any later version. 77 | .LP 78 | This program is distributed in the hope that it will be useful, 79 | but WITHOUT ANY WARRANTY; without even the implied warranty of 80 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 81 | GNU General Public License for more details. 82 | -------------------------------------------------------------------------------- /debian/rtl_test.1: -------------------------------------------------------------------------------- 1 | .TH "rtl_test" 1 "0.5.0" RTL-SDR "User Commands" 2 | .SH NAME 3 | rtl_test \- a benchmark tool for RTL2832 based DVB-T receivers 4 | .SH DESCRIPTION 5 | Test tuning range and functional sample rates of your device 6 | on your system. 7 | Uses a re-purposed DVB-T receiver as a software defined 8 | radio. Written for and incorporated into the osmocom rtl-sdr project. 9 | .LP 10 | Much software is available for the RTL2832. Most of the user-level 11 | packages rely on the librtlsdr library which comes as part of the 12 | rtl-sdr codebase. This codebase contains both the library itself and 13 | also a number of command line tools such as rtl_test, rtl_sdr, 14 | rtl_tcp, and rtl_fm. These command line tools use the library to test 15 | for the existence of RTL2832 devices and to perform basic data 16 | transfer functions to and from the device. 17 | .LP 18 | Because most of the RTL2832 devices are connected using USB, the 19 | librtlsdr library depends on the libusb library to communicate with 20 | the device. 21 | .SH SYNOPSIS 22 | .B rtl_test [OPTIONS] 23 | .SH OPTIONS 24 | .IP "-s samplerate (default: 2048000 Hz)" 25 | .IP "-d device_index (default: 0)" 26 | .IP "-t enable Elonics E4000 tuner benchmark]" 27 | .IP "-p enable PPM error measurement" 28 | .IP "-b output_block_size (default: 16 * 16384)" 29 | .IP "-S force sync output (default: async)" 30 | .SH EXAMPLES 31 | .IP "To check the possible tuning range (may heavily vary by some MHz depending on device and temperature), call" 32 | rtl_test -t 33 | .IP "To check the maximum samplerate possible on your machine, type (change the rate down until no sample loss occurs):" 34 | rtl_test -s 3.2e6 35 | .LP 36 | A samplerate of 2.4e6 is known to work even over tcp connections (see 37 | rtl_tcp above). A sample rate of 2.88e6 may work without lost samples 38 | but this may depend on your PC/Laptop's host interface. 39 | .SH SEE ALSO 40 | RTL-SDR wiki documentation: 41 | .B http://sdr.osmocom.org/trac/wiki/rtl-sdr 42 | .LP 43 | Other rtl-sdr programs: 44 | .sp 45 | rtl_adsb(1), rtl_eeprom(1), rtl_fm(1), rtl_sdr(1), rtl_tcp(1) 46 | .SH AUTHOR 47 | This manual page was written by Maitland Bottoms 48 | for the Debian project (but may be used by others). 49 | .SH COPYRIGHT 50 | Copyright (c) 2013 A. Maitland Bottoms 51 | .LP 52 | This program is free software: you can redistribute it and/or modify 53 | it under the terms of the GNU General Public License as published by 54 | the Free Software Foundation, either version 2 of the License, or 55 | (at your option) any later version. 56 | .LP 57 | This program is distributed in the hope that it will be useful, 58 | but WITHOUT ANY WARRANTY; without even the implied warranty of 59 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 60 | GNU General Public License for more details. 61 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) 3 | export DEB_HOST_MULTIARCH 4 | 5 | %: 6 | dh $@ 7 | 8 | override_dh_auto_configure: debian/librtlsdr0.udev 9 | dh_auto_configure -- -DLIB_INSTALL_DIR=lib/$(DEB_HOST_MULTIARCH) -DDETACH_KERNEL_DRIVER=ON 10 | 11 | debian/librtlsdr0.udev: rtl-sdr.rules 12 | cp -p rtl-sdr.rules debian/librtlsdr0.udev 13 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=4 2 | opts="mode=git, gitmode=full, pgpmode=none" \ 3 | git://git.osmocom.org/rtl-sdr.git \ 4 | refs/tags/v([\d\.]+) debian uupdate 5 | -------------------------------------------------------------------------------- /git-version-gen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Print a version string. 3 | scriptversion=2010-01-28.01 4 | 5 | # Copyright (C) 2007-2010 Free Software Foundation, Inc. 6 | # 7 | # This program is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU General Public License as published by 9 | # the Free Software Foundation; either version 3 of the License, or 10 | # (at your option) any later version. 11 | # 12 | # This program is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU General Public License 18 | # along with this program. If not, see . 19 | 20 | # This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/. 21 | # It may be run two ways: 22 | # - from a git repository in which the "git describe" command below 23 | # produces useful output (thus requiring at least one signed tag) 24 | # - from a non-git-repo directory containing a .tarball-version file, which 25 | # presumes this script is invoked like "./git-version-gen .tarball-version". 26 | 27 | # In order to use intra-version strings in your project, you will need two 28 | # separate generated version string files: 29 | # 30 | # .tarball-version - present only in a distribution tarball, and not in 31 | # a checked-out repository. Created with contents that were learned at 32 | # the last time autoconf was run, and used by git-version-gen. Must not 33 | # be present in either $(srcdir) or $(builddir) for git-version-gen to 34 | # give accurate answers during normal development with a checked out tree, 35 | # but must be present in a tarball when there is no version control system. 36 | # Therefore, it cannot be used in any dependencies. GNUmakefile has 37 | # hooks to force a reconfigure at distribution time to get the value 38 | # correct, without penalizing normal development with extra reconfigures. 39 | # 40 | # .version - present in a checked-out repository and in a distribution 41 | # tarball. Usable in dependencies, particularly for files that don't 42 | # want to depend on config.h but do want to track version changes. 43 | # Delete this file prior to any autoconf run where you want to rebuild 44 | # files to pick up a version string change; and leave it stale to 45 | # minimize rebuild time after unrelated changes to configure sources. 46 | # 47 | # It is probably wise to add these two files to .gitignore, so that you 48 | # don't accidentally commit either generated file. 49 | # 50 | # Use the following line in your configure.ac, so that $(VERSION) will 51 | # automatically be up-to-date each time configure is run (and note that 52 | # since configure.ac no longer includes a version string, Makefile rules 53 | # should not depend on configure.ac for version updates). 54 | # 55 | # AC_INIT([GNU project], 56 | # m4_esyscmd([build-aux/git-version-gen .tarball-version]), 57 | # [bug-project@example]) 58 | # 59 | # Then use the following lines in your Makefile.am, so that .version 60 | # will be present for dependencies, and so that .tarball-version will 61 | # exist in distribution tarballs. 62 | # 63 | # BUILT_SOURCES = $(top_srcdir)/.version 64 | # $(top_srcdir)/.version: 65 | # echo $(VERSION) > $@-t && mv $@-t $@ 66 | # dist-hook: 67 | # echo $(VERSION) > $(distdir)/.tarball-version 68 | 69 | case $# in 70 | 1) ;; 71 | *) echo 1>&2 "Usage: $0 \$srcdir/.tarball-version"; exit 1;; 72 | esac 73 | 74 | tarball_version_file=$1 75 | nl=' 76 | ' 77 | 78 | # First see if there is a tarball-only version file. 79 | # then try "git describe", then default. 80 | if test -f $tarball_version_file 81 | then 82 | v=`cat $tarball_version_file` || exit 1 83 | case $v in 84 | *$nl*) v= ;; # reject multi-line output 85 | [0-9]*) ;; 86 | *) v= ;; 87 | esac 88 | test -z "$v" \ 89 | && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2 90 | fi 91 | 92 | if test -n "$v" 93 | then 94 | : # use $v 95 | elif 96 | v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \ 97 | || git describe --abbrev=4 HEAD 2>/dev/null` \ 98 | && case $v in 99 | [0-9]*) ;; 100 | v[0-9]*) ;; 101 | *) (exit 1) ;; 102 | esac 103 | then 104 | # Is this a new git that lists number of commits since the last 105 | # tag or the previous older version that did not? 106 | # Newer: v6.10-77-g0f8faeb 107 | # Older: v6.10-g0f8faeb 108 | case $v in 109 | *-*-*) : git describe is okay three part flavor ;; 110 | *-*) 111 | : git describe is older two part flavor 112 | # Recreate the number of commits and rewrite such that the 113 | # result is the same as if we were using the newer version 114 | # of git describe. 115 | vtag=`echo "$v" | sed 's/-.*//'` 116 | numcommits=`git rev-list "$vtag"..HEAD | wc -l` 117 | v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`; 118 | ;; 119 | esac 120 | 121 | # Change the first '-' to a '.', so version-comparing tools work properly. 122 | # Remove the "g" in git describe's output string, to save a byte. 123 | v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`; 124 | else 125 | v=UNKNOWN 126 | fi 127 | 128 | v=`echo "$v" |sed 's/^v//'` 129 | 130 | # Don't declare a version "dirty" merely because a time stamp has changed. 131 | git status > /dev/null 2>&1 132 | 133 | dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty= 134 | case "$dirty" in 135 | '') ;; 136 | *) # Append the suffix only if there isn't one already. 137 | case $v in 138 | *-dirty) ;; 139 | *) v="$v-dirty" ;; 140 | esac ;; 141 | esac 142 | 143 | # Omit the trailing newline, so that m4_esyscmd can use the result directly. 144 | echo "$v" | tr -d '\012' 145 | 146 | # Local variables: 147 | # eval: (add-hook 'write-file-hooks 'time-stamp) 148 | # time-stamp-start: "scriptversion=" 149 | # time-stamp-format: "%:y-%02m-%02d.%02H" 150 | # time-stamp-end: "$" 151 | # End: 152 | -------------------------------------------------------------------------------- /include/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 OSMOCOM Project 2 | # 3 | # This file is part of rtl-sdr 4 | # 5 | # GNU Radio is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 3, or (at your option) 8 | # any later version. 9 | # 10 | # GNU Radio is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with GNU Radio; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | ######################################################################## 21 | # Install public header files 22 | ######################################################################## 23 | install(FILES 24 | rtl-sdr.h 25 | rtl_tcp.h 26 | rtl-sdr_export.h 27 | DESTINATION include 28 | ) 29 | -------------------------------------------------------------------------------- /include/Makefile.am: -------------------------------------------------------------------------------- 1 | rtlsdr_HEADERS = rtl-sdr.h rtl-sdr_export.h 2 | 3 | noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r82xx.h 4 | 5 | rtlsdrdir = $(includedir) 6 | -------------------------------------------------------------------------------- /include/controlThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2019 <> 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef __RTL_CONTROL_THREAD_H 20 | #define __RTL_CONTROL_THREAD_H 21 | 22 | #ifdef __cplusplus 23 | extern "C" { 24 | #endif 25 | 26 | typedef struct 27 | { 28 | rtlsdr_dev_t *dev; 29 | int port; 30 | int wait; 31 | int report_i2c; 32 | char *addr; 33 | int* pDoExit; 34 | } 35 | ctrl_thread_data_t; 36 | void *ctrl_thread_fn(void *arg); 37 | 38 | #ifdef __cplusplus 39 | } 40 | #endif 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /include/reg_field.h: -------------------------------------------------------------------------------- 1 | #ifndef _REG_FIELD_H 2 | #define _REG_FIELD_H 3 | 4 | #include 5 | #include 6 | 7 | enum cmd_op { 8 | CMD_OP_GET = (1 << 0), 9 | CMD_OP_SET = (1 << 1), 10 | CMD_OP_EXEC = (1 << 2), 11 | }; 12 | 13 | enum pstate { 14 | ST_IN_CMD, 15 | ST_IN_ARG, 16 | }; 17 | 18 | struct strbuf { 19 | uint8_t idx; 20 | char buf[32]; 21 | }; 22 | 23 | struct cmd_state { 24 | struct strbuf cmd; 25 | struct strbuf arg; 26 | enum pstate state; 27 | void (*out)(const char *format, va_list ap); 28 | }; 29 | 30 | struct cmd { 31 | const char *cmd; 32 | uint32_t ops; 33 | int (*cb)(struct cmd_state *cs, enum cmd_op op, const char *cmd, 34 | int argc, char **argv); 35 | const char *help; 36 | }; 37 | 38 | /* structure describing a field in a register */ 39 | struct reg_field { 40 | uint8_t reg; 41 | uint8_t shift; 42 | uint8_t width; 43 | }; 44 | 45 | struct reg_field_ops { 46 | const struct reg_field *fields; 47 | const char **field_names; 48 | uint32_t num_fields; 49 | void *data; 50 | int (*write_cb)(void *data, uint32_t reg, uint32_t val); 51 | uint32_t (*read_cb)(void *data, uint32_t reg); 52 | }; 53 | 54 | uint32_t reg_field_read(struct reg_field_ops *ops, struct reg_field *field); 55 | int reg_field_write(struct reg_field_ops *ops, struct reg_field *field, uint32_t val); 56 | int reg_field_cmd(struct cmd_state *cs, enum cmd_op op, 57 | const char *cmd, int argc, char **argv, 58 | struct reg_field_ops *ops); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /include/rtl-sdr_export.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2012 by Hoernchen 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 2 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | #ifndef RTLSDR_EXPORT_H 20 | #define RTLSDR_EXPORT_H 21 | 22 | #if defined __GNUC__ 23 | # if __GNUC__ >= 4 24 | # define __SDR_EXPORT __attribute__((visibility("default"))) 25 | # define __SDR_IMPORT __attribute__((visibility("default"))) 26 | # else 27 | # define __SDR_EXPORT 28 | # define __SDR_IMPORT 29 | # endif 30 | #elif _MSC_VER 31 | # define __SDR_EXPORT __declspec(dllexport) 32 | # define __SDR_IMPORT __declspec(dllimport) 33 | #else 34 | # define __SDR_EXPORT 35 | # define __SDR_IMPORT 36 | #endif 37 | 38 | #ifndef rtlsdr_STATIC 39 | # ifdef rtlsdr_EXPORTS 40 | # define RTLSDR_API __SDR_EXPORT 41 | # else 42 | # define RTLSDR_API __SDR_IMPORT 43 | # endif 44 | #else 45 | #define RTLSDR_API 46 | #endif 47 | #endif /* RTLSDR_EXPORT_H */ 48 | -------------------------------------------------------------------------------- /include/rtl_tcp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2012-2013 by Steve Markgraf 4 | * Copyright (C) 2012 by Dimitri Stolnikov 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __RTL_TCP_H 21 | #define __RTL_TCP_H 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /*! 28 | * This enum defines the possible commands in rtl_tcp 29 | * commands 0x01..0x0E are compatible to osmocom's rtlsdr 30 | * see https://github.com/osmocom/rtl-sdr/blob/master/src/rtl_tcp.c 31 | * commands >= 0x40 are extensions 32 | */ 33 | enum RTL_TCP_COMMANDS { 34 | SET_FREQUENCY = 0x01, /* sets frequency - amending hi word of SET_FREQ_HI32 if present */ 35 | SET_FREQ_HI32 = 0x56, /* in addition to SET_FREQUENCY */ 36 | SET_SAMPLE_RATE = 0x02, 37 | SET_GAIN_MODE = 0x03, 38 | SET_GAIN = 0x04, 39 | SET_FREQUENCY_CORRECTION = 0x05, 40 | SET_IF_STAGE = 0x06, 41 | SET_TEST_MODE = 0x07, 42 | SET_AGC_MODE = 0x08, 43 | SET_DIRECT_SAMPLING = 0x09, 44 | SET_OFFSET_TUNING = 0x0A, 45 | SET_RTL_CRYSTAL = 0x0B, 46 | SET_TUNER_CRYSTAL = 0x0C, 47 | SET_TUNER_GAIN_BY_INDEX = 0x0D, 48 | #if 1 49 | /* development branch since 2018-10-03 */ 50 | SET_BIAS_TEE = 0x0E, 51 | SET_TUNER_BANDWIDTH = 0x40, 52 | #else 53 | /* prev code - used in ExtIO - to build compatible rtl_tcp.exe */ 54 | SET_TUNER_BANDWIDTH = 0x0E, 55 | SET_BIAS_TEE = 0x0F 56 | #endif 57 | UDP_ESTABLISH = 0x41, 58 | UDP_TERMINATE = 0x42, 59 | SET_I2C_TUNER_REGISTER = 0x43, /* for experiments: 32 bit data word: 60 | * 31 .. 20: register (12 bits) 61 | * 19 .. 12: mask (8 bits) 62 | * 11 .. 0: data (12 bits) */ 63 | SET_I2C_TUNER_OVERRIDE = 0x44, /* encoding as with SET_I2C_TUNER_REGISTER 64 | * data (bits 11 .. 0) > 255 removes override */ 65 | SET_TUNER_BW_IF_CENTER = 0x45, /* freq from SET_FREQUENCY stays in center; 66 | * the bandwidth (from SET_TUNER_BANDWIDTH) 67 | * is set to be centered at given IF frequency */ 68 | SET_TUNER_IF_MODE = 0x46, /* set tuner IF mode - or gain */ 69 | SET_SIDEBAND = 0x47, /* Mixer Sideband for R820T */ 70 | REPORT_I2C_REGS = 0x48, /* perodically report I2C registers 71 | * - if reverse channel is enabled */ 72 | 73 | GPIO_SET_OUTPUT_MODE = 0x49, /* rtlsdr_set_gpio_output() */ 74 | GPIO_SET_INPUT_MODE = 0x50, /* rtlsdr_set_gpio_input() */ 75 | GPIO_GET_IO_STATUS = 0x51, /* rtlsdr_set_gpio_status() */ 76 | GPIO_WRITE_PIN = 0x52, /* rtlsdr_set_gpio_output() and rtlsdr_set_gpio_bit() */ 77 | GPIO_READ_PIN = 0x53, /* rtlsdr_get_gpio_bit() */ 78 | GPIO_GET_BYTE = 0x54, /* rtlsdr_get_gpio_byte() */ 79 | 80 | IS_TUNER_PLL_LOCKED = 0x55, /* rtlsdr_is_tuner_PLL_locked() */ 81 | 82 | /* SET_FREQ_HI32 = 0x56, * rtlsdr_set_center_freq64() */ 83 | }; 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /include/rtlsdr_i2c.h: -------------------------------------------------------------------------------- 1 | #ifndef __I2C_H 2 | #define __I2C_H 3 | 4 | uint32_t rtlsdr_get_tuner_clock(void *dev); 5 | int rtlsdr_i2c_write_fn(void *dev, uint8_t addr, uint8_t *buf, int len); 6 | int rtlsdr_i2c_read_fn(void *dev, uint8_t addr, uint8_t *buf, int len); 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /include/rtlsdr_rpc.h: -------------------------------------------------------------------------------- 1 | #ifndef RTLSDR_RPC_H_INCLUDED 2 | #define RTLSDR_RPC_H_INCLUDED 3 | 4 | 5 | #include 6 | 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | typedef void (*rtlsdr_rpc_read_async_cb_t) 13 | (unsigned char*, uint32_t, void*); 14 | 15 | uint32_t rtlsdr_rpc_get_device_count(void); 16 | 17 | const char* rtlsdr_rpc_get_device_name 18 | (uint32_t nidex); 19 | 20 | int rtlsdr_rpc_get_device_usb_strings 21 | (uint32_t index, char* manufact, char* product, char* serial); 22 | 23 | int rtlsdr_rpc_get_index_by_serial 24 | (const char* serial); 25 | 26 | int rtlsdr_rpc_open 27 | (void** dev, uint32_t index); 28 | 29 | int rtlsdr_rpc_close 30 | (void* dev); 31 | 32 | int rtlsdr_rpc_set_xtal_freq 33 | (void* dev, uint32_t rtl_freq, uint32_t tuner_freq); 34 | 35 | int rtlsdr_rpc_get_xtal_freq 36 | (void* dev, uint32_t* rtl_freq, uint32_t* tuner_freq); 37 | 38 | int rtlsdr_rpc_get_usb_strings 39 | (void* dev, char* manufact, char* product, char* serial); 40 | 41 | int rtlsdr_rpc_write_eeprom 42 | (void* dev, uint8_t* data, uint8_t offset, uint16_t len); 43 | 44 | int rtlsdr_rpc_read_eeprom 45 | (void* dev, uint8_t* data, uint8_t offset, uint16_t len); 46 | 47 | int rtlsdr_rpc_set_center_freq 48 | (void* dev, uint32_t freq); 49 | 50 | uint32_t rtlsdr_rpc_get_center_freq 51 | (void* dev); 52 | 53 | int rtlsdr_rpc_set_freq_correction 54 | (void* dev, int ppm); 55 | 56 | int rtlsdr_rpc_get_freq_correction 57 | (void *dev); 58 | 59 | int rtlsdr_rpc_get_tuner_type 60 | (void* dev); 61 | 62 | int rtlsdr_rpc_get_tuner_gains 63 | (void* dev, int* gainsp); 64 | 65 | int rtlsdr_rpc_set_tuner_gain 66 | (void *dev, int gain); 67 | 68 | int rtlsdr_rpc_get_tuner_gain 69 | (void* dev); 70 | 71 | int rtlsdr_rpc_set_tuner_if_gain 72 | (void* dev, int stage, int gain); 73 | 74 | int rtlsdr_rpc_set_tuner_gain_mode 75 | (void* dev, int manual); 76 | 77 | int rtlsdr_rpc_set_and_get_tuner_bandwidth 78 | (void* devp, uint32_t bw, uint32_t *applied_bw, int apply_bw); 79 | 80 | int rtlsdr_rpc_set_sample_rate 81 | (void* dev, uint32_t rate); 82 | 83 | uint32_t rtlsdr_rpc_get_sample_rate 84 | (void* dev); 85 | 86 | int rtlsdr_rpc_set_testmode 87 | (void* dev, int on); 88 | 89 | int rtlsdr_rpc_set_agc_mode 90 | (void* dev, int on); 91 | 92 | int rtlsdr_rpc_set_direct_sampling 93 | (void* dev, int on); 94 | 95 | int rtlsdr_rpc_get_direct_sampling 96 | (void* dev); 97 | 98 | int rtlsdr_rpc_set_offset_tuning 99 | (void* dev, int on); 100 | 101 | int rtlsdr_rpc_get_offset_tuning 102 | (void* dev); 103 | 104 | int rtlsdr_rpc_reset_buffer 105 | (void* dev); 106 | 107 | int rtlsdr_rpc_read_sync 108 | (void* dev, void* buf, int len, int* n_read); 109 | 110 | int rtlsdr_rpc_wait_async 111 | (void* dev, rtlsdr_rpc_read_async_cb_t cb, void* ctx); 112 | 113 | int rtlsdr_rpc_read_async 114 | (void* dev, rtlsdr_rpc_read_async_cb_t cb, void* ctx, uint32_t buf_num, uint32_t buf_len); 115 | 116 | int rtlsdr_rpc_cancel_async 117 | (void* dev); 118 | 119 | unsigned int rtlsdr_rpc_is_enabled(void); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | 126 | #endif /* RTLSDR_RPC_H_INCLUDED */ 127 | -------------------------------------------------------------------------------- /include/rtlsdr_rpc_msg.h: -------------------------------------------------------------------------------- 1 | #ifndef RTLSDR_RPC_MSG_H_INCLUDED 2 | #define RTLSDR_RPC_MSG_H_INCLUDED 3 | 4 | 5 | #include 6 | #include 7 | 8 | typedef enum 9 | { 10 | RTLSDR_RPC_OP_GET_DEVICE_COUNT = 0, 11 | RTLSDR_RPC_OP_GET_DEVICE_NAME, 12 | RTLSDR_RPC_OP_GET_DEVICE_USB_STRINGS, 13 | RTLSDR_RPC_OP_GET_INDEX_BY_SERIAL, 14 | RTLSDR_RPC_OP_OPEN, 15 | RTLSDR_RPC_OP_CLOSE, 16 | RTLSDR_RPC_OP_SET_XTAL_FREQ, 17 | RTLSDR_RPC_OP_GET_XTAL_FREQ, 18 | RTLSDR_RPC_OP_GET_USB_STRINGS, 19 | RTLSDR_RPC_OP_WRITE_EEPROM, 20 | RTLSDR_RPC_OP_READ_EEPROM, 21 | RTLSDR_RPC_OP_SET_CENTER_FREQ, 22 | RTLSDR_RPC_OP_GET_CENTER_FREQ, 23 | RTLSDR_RPC_OP_SET_FREQ_CORRECTION, 24 | RTLSDR_RPC_OP_GET_FREQ_CORRECTION, 25 | RTLSDR_RPC_OP_GET_TUNER_TYPE, 26 | RTLSDR_RPC_OP_GET_TUNER_GAINS, 27 | RTLSDR_RPC_OP_SET_TUNER_GAIN, 28 | RTLSDR_RPC_OP_GET_TUNER_GAIN, 29 | RTLSDR_RPC_OP_SET_TUNER_IF_GAIN, 30 | RTLSDR_RPC_OP_SET_TUNER_GAIN_MODE, 31 | RTLSDR_RPC_OP_SET_GET_TUNER_BW, 32 | RTLSDR_RPC_OP_SET_SAMPLE_RATE, 33 | RTLSDR_RPC_OP_GET_SAMPLE_RATE, 34 | RTLSDR_RPC_OP_SET_TESTMODE, 35 | RTLSDR_RPC_OP_SET_AGC_MODE, 36 | RTLSDR_RPC_OP_SET_DIRECT_SAMPLING, 37 | RTLSDR_RPC_OP_GET_DIRECT_SAMPLING, 38 | RTLSDR_RPC_OP_SET_OFFSET_TUNING, 39 | RTLSDR_RPC_OP_GET_OFFSET_TUNING, 40 | RTLSDR_RPC_OP_RESET_BUFFER, 41 | RTLSDR_RPC_OP_READ_SYNC, 42 | RTLSDR_RPC_OP_WAIT_ASYNC, 43 | RTLSDR_RPC_OP_READ_ASYNC, 44 | RTLSDR_RPC_OP_CANCEL_ASYNC, 45 | 46 | /* non api operations */ 47 | RTLSDR_RPC_OP_EVENT_STATE, 48 | 49 | RTLSDR_RPC_OP_INVALID 50 | } rtlsdr_rpc_op_t; 51 | 52 | typedef struct 53 | { 54 | /* raw network format */ 55 | uint32_t size; 56 | uint8_t op; 57 | uint8_t id; 58 | uint32_t err; 59 | uint8_t data[1]; 60 | } __attribute__((packed)) rtlsdr_rpc_fmt_t; 61 | 62 | typedef struct 63 | { 64 | size_t off; 65 | size_t size; 66 | uint8_t* fmt; 67 | } rtlsdr_rpc_msg_t; 68 | 69 | int rtlsdr_rpc_msg_init(rtlsdr_rpc_msg_t*, size_t); 70 | int rtlsdr_rpc_msg_fini(rtlsdr_rpc_msg_t*); 71 | void rtlsdr_rpc_msg_reset(rtlsdr_rpc_msg_t*); 72 | int rtlsdr_rpc_msg_realloc(rtlsdr_rpc_msg_t*, size_t); 73 | 74 | void rtlsdr_rpc_msg_set_size(rtlsdr_rpc_msg_t*, size_t); 75 | size_t rtlsdr_rpc_msg_get_size(const rtlsdr_rpc_msg_t*); 76 | void rtlsdr_rpc_msg_set_op(rtlsdr_rpc_msg_t*, rtlsdr_rpc_op_t); 77 | rtlsdr_rpc_op_t rtlsdr_rpc_msg_get_op(const rtlsdr_rpc_msg_t*); 78 | void rtlsdr_rpc_msg_set_id(rtlsdr_rpc_msg_t*, uint8_t); 79 | uint8_t rtlsdr_rpc_msg_get_id(const rtlsdr_rpc_msg_t*); 80 | void rtlsdr_rpc_msg_set_err(rtlsdr_rpc_msg_t*, int); 81 | int rtlsdr_rpc_msg_get_err(const rtlsdr_rpc_msg_t*); 82 | 83 | int rtlsdr_rpc_msg_push_int32(rtlsdr_rpc_msg_t*, int32_t); 84 | int rtlsdr_rpc_msg_push_uint32(rtlsdr_rpc_msg_t*, uint32_t); 85 | void rtlsdr_rpc_msg_push_uint32_safe(rtlsdr_rpc_msg_t*, uint32_t); 86 | int rtlsdr_rpc_msg_push_str(rtlsdr_rpc_msg_t*, const char*); 87 | int rtlsdr_rpc_msg_push_buf(rtlsdr_rpc_msg_t*, const uint8_t*, size_t); 88 | void rtlsdr_rpc_msg_skip_safe(rtlsdr_rpc_msg_t*, size_t); 89 | int rtlsdr_rpc_msg_pop_int32(rtlsdr_rpc_msg_t*, int32_t*); 90 | int rtlsdr_rpc_msg_pop_uint32(rtlsdr_rpc_msg_t*, uint32_t*); 91 | int rtlsdr_rpc_msg_pop_str(rtlsdr_rpc_msg_t*, const char**); 92 | int rtlsdr_rpc_msg_pop_buf(rtlsdr_rpc_msg_t*, const uint8_t**, size_t*); 93 | 94 | 95 | #endif /* RTLSDR_RPC_MSG_H_INCLUDED */ 96 | -------------------------------------------------------------------------------- /include/tuner_e4k.h: -------------------------------------------------------------------------------- 1 | #ifndef _E4K_TUNER_H 2 | #define _E4K_TUNER_H 3 | 4 | /* 5 | * Elonics E4000 tuner driver 6 | * 7 | * (C) 2011-2012 by Harald Welte 8 | * (C) 2012 by Sylvain Munaut 9 | * (C) 2012 by Hoernchen 10 | * 11 | * All Rights Reserved 12 | * 13 | * This program is free software; you can redistribute it and/or modify 14 | * it under the terms of the GNU General Public License as published by 15 | * the Free Software Foundation; either version 2 of the License, or 16 | * (at your option) any later version. 17 | * 18 | * This program is distributed in the hope that it will be useful, 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 | * GNU General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with this program. If not, see . 25 | */ 26 | 27 | #define E4K_I2C_ADDR 0xc8 28 | #define E4K_CHECK_ADDR 0x02 29 | #define E4K_CHECK_VAL 0x40 30 | 31 | enum e4k_reg { 32 | E4K_REG_MASTER1 = 0x00, 33 | E4K_REG_MASTER2 = 0x01, 34 | E4K_REG_MASTER3 = 0x02, 35 | E4K_REG_MASTER4 = 0x03, 36 | E4K_REG_MASTER5 = 0x04, 37 | E4K_REG_CLK_INP = 0x05, 38 | E4K_REG_REF_CLK = 0x06, 39 | E4K_REG_SYNTH1 = 0x07, 40 | E4K_REG_SYNTH2 = 0x08, 41 | E4K_REG_SYNTH3 = 0x09, 42 | E4K_REG_SYNTH4 = 0x0a, 43 | E4K_REG_SYNTH5 = 0x0b, 44 | E4K_REG_SYNTH6 = 0x0c, 45 | E4K_REG_SYNTH7 = 0x0d, 46 | E4K_REG_SYNTH8 = 0x0e, 47 | E4K_REG_SYNTH9 = 0x0f, 48 | E4K_REG_FILT1 = 0x10, 49 | E4K_REG_FILT2 = 0x11, 50 | E4K_REG_FILT3 = 0x12, 51 | // gap 52 | E4K_REG_GAIN1 = 0x14, 53 | E4K_REG_GAIN2 = 0x15, 54 | E4K_REG_GAIN3 = 0x16, 55 | E4K_REG_GAIN4 = 0x17, 56 | // gap 57 | E4K_REG_AGC1 = 0x1a, 58 | E4K_REG_AGC2 = 0x1b, 59 | E4K_REG_AGC3 = 0x1c, 60 | E4K_REG_AGC4 = 0x1d, 61 | E4K_REG_AGC5 = 0x1e, 62 | E4K_REG_AGC6 = 0x1f, 63 | E4K_REG_AGC7 = 0x20, 64 | E4K_REG_AGC8 = 0x21, 65 | // gap 66 | E4K_REG_AGC11 = 0x24, 67 | E4K_REG_AGC12 = 0x25, 68 | // gap 69 | E4K_REG_DC1 = 0x29, 70 | E4K_REG_DC2 = 0x2a, 71 | E4K_REG_DC3 = 0x2b, 72 | E4K_REG_DC4 = 0x2c, 73 | E4K_REG_DC5 = 0x2d, 74 | E4K_REG_DC6 = 0x2e, 75 | E4K_REG_DC7 = 0x2f, 76 | E4K_REG_DC8 = 0x30, 77 | // gap 78 | E4K_REG_QLUT0 = 0x50, 79 | E4K_REG_QLUT1 = 0x51, 80 | E4K_REG_QLUT2 = 0x52, 81 | E4K_REG_QLUT3 = 0x53, 82 | // gap 83 | E4K_REG_ILUT0 = 0x60, 84 | E4K_REG_ILUT1 = 0x61, 85 | E4K_REG_ILUT2 = 0x62, 86 | E4K_REG_ILUT3 = 0x63, 87 | // gap 88 | E4K_REG_DCTIME1 = 0x70, 89 | E4K_REG_DCTIME2 = 0x71, 90 | E4K_REG_DCTIME3 = 0x72, 91 | E4K_REG_DCTIME4 = 0x73, 92 | E4K_REG_PWM1 = 0x74, 93 | E4K_REG_PWM2 = 0x75, 94 | E4K_REG_PWM3 = 0x76, 95 | E4K_REG_PWM4 = 0x77, 96 | E4K_REG_BIAS = 0x78, 97 | E4K_REG_CLKOUT_PWDN = 0x7a, 98 | E4K_REG_CHFILT_CALIB = 0x7b, 99 | E4K_REG_I2C_REG_ADDR = 0x7d, 100 | // FIXME 101 | }; 102 | 103 | #define E4K_MASTER1_RESET (1 << 0) 104 | #define E4K_MASTER1_NORM_STBY (1 << 1) 105 | #define E4K_MASTER1_POR_DET (1 << 2) 106 | 107 | #define E4K_SYNTH1_PLL_LOCK (1 << 0) 108 | #define E4K_SYNTH1_BAND_SHIF 1 109 | 110 | #define E4K_SYNTH7_3PHASE_EN (1 << 3) 111 | 112 | #define E4K_SYNTH8_VCOCAL_UPD (1 << 2) 113 | 114 | #define E4K_FILT3_DISABLE (1 << 5) 115 | 116 | #define E4K_AGC1_LIN_MODE (1 << 4) 117 | #define E4K_AGC1_LNA_UPDATE (1 << 5) 118 | #define E4K_AGC1_LNA_G_LOW (1 << 6) 119 | #define E4K_AGC1_LNA_G_HIGH (1 << 7) 120 | 121 | #define E4K_AGC6_LNA_CAL_REQ (1 << 4) 122 | 123 | #define E4K_AGC7_MIX_GAIN_AUTO (1 << 0) 124 | #define E4K_AGC7_GAIN_STEP_5dB (1 << 5) 125 | 126 | #define E4K_AGC8_SENS_LIN_AUTO (1 << 0) 127 | 128 | #define E4K_AGC11_LNA_GAIN_ENH (1 << 0) 129 | 130 | #define E4K_DC1_CAL_REQ (1 << 0) 131 | 132 | #define E4K_DC5_I_LUT_EN (1 << 0) 133 | #define E4K_DC5_Q_LUT_EN (1 << 1) 134 | #define E4K_DC5_RANGE_DET_EN (1 << 2) 135 | #define E4K_DC5_RANGE_EN (1 << 3) 136 | #define E4K_DC5_TIMEVAR_EN (1 << 4) 137 | 138 | #define E4K_CLKOUT_DISABLE 0x96 139 | 140 | #define E4K_CHFCALIB_CMD (1 << 0) 141 | 142 | #define E4K_AGC1_MOD_MASK 0xF 143 | 144 | enum e4k_agc_mode { 145 | E4K_AGC_MOD_SERIAL = 0x0, 146 | E4K_AGC_MOD_IF_PWM_LNA_SERIAL = 0x1, 147 | E4K_AGC_MOD_IF_PWM_LNA_AUTONL = 0x2, 148 | E4K_AGC_MOD_IF_PWM_LNA_SUPERV = 0x3, 149 | E4K_AGC_MOD_IF_SERIAL_LNA_PWM = 0x4, 150 | E4K_AGC_MOD_IF_PWM_LNA_PWM = 0x5, 151 | E4K_AGC_MOD_IF_DIG_LNA_SERIAL = 0x6, 152 | E4K_AGC_MOD_IF_DIG_LNA_AUTON = 0x7, 153 | E4K_AGC_MOD_IF_DIG_LNA_SUPERV = 0x8, 154 | E4K_AGC_MOD_IF_SERIAL_LNA_AUTON = 0x9, 155 | E4K_AGC_MOD_IF_SERIAL_LNA_SUPERV = 0xa, 156 | }; 157 | 158 | enum e4k_band { 159 | E4K_BAND_VHF2 = 0, 160 | E4K_BAND_VHF3 = 1, 161 | E4K_BAND_UHF = 2, 162 | E4K_BAND_L = 3, 163 | }; 164 | 165 | enum e4k_mixer_filter_bw { 166 | E4K_F_MIX_BW_27M = 0, 167 | E4K_F_MIX_BW_4M6 = 8, 168 | E4K_F_MIX_BW_4M2 = 9, 169 | E4K_F_MIX_BW_3M8 = 10, 170 | E4K_F_MIX_BW_3M4 = 11, 171 | E4K_F_MIX_BW_3M = 12, 172 | E4K_F_MIX_BW_2M7 = 13, 173 | E4K_F_MIX_BW_2M3 = 14, 174 | E4K_F_MIX_BW_1M9 = 15, 175 | }; 176 | 177 | enum e4k_if_filter { 178 | E4K_IF_FILTER_MIX, 179 | E4K_IF_FILTER_CHAN, 180 | E4K_IF_FILTER_RC 181 | }; 182 | struct e4k_pll_params { 183 | uint32_t fosc; 184 | uint32_t intended_flo; 185 | uint32_t flo; 186 | uint16_t x; 187 | uint8_t z; 188 | uint8_t r; 189 | uint8_t r_idx; 190 | uint8_t threephase; 191 | }; 192 | 193 | struct e4k_state { 194 | void *i2c_dev; 195 | uint8_t i2c_addr; 196 | enum e4k_band band; 197 | struct e4k_pll_params vco; 198 | void *rtl_dev; 199 | }; 200 | 201 | int e4k_init(struct e4k_state *e4k); 202 | int e4k_standby(struct e4k_state *e4k, int enable); 203 | int e4k_if_gain_set(struct e4k_state *e4k, uint8_t stage, int8_t value); 204 | int e4k_mixer_gain_set(struct e4k_state *e4k, int8_t value); 205 | int e4k_commonmode_set(struct e4k_state *e4k, int8_t value); 206 | int e4k_tune_freq(struct e4k_state *e4k, uint32_t freq); 207 | int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p); 208 | uint32_t e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t intended_flo); 209 | int e4k_if_filter_bw_get(struct e4k_state *e4k, enum e4k_if_filter filter); 210 | int e4k_if_filter_bw_set(struct e4k_state *e4k, enum e4k_if_filter filter, 211 | uint32_t bandwidth); 212 | int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on); 213 | int e4k_rf_filter_set(struct e4k_state *e4k); 214 | 215 | int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange); 216 | int e4k_dc_offset_calibrate(struct e4k_state *e4k); 217 | int e4k_dc_offset_gen_table(struct e4k_state *e4k); 218 | 219 | int e4k_set_lna_gain(struct e4k_state *e4k, int32_t gain); 220 | int e4k_enable_manual_gain(struct e4k_state *e4k, uint8_t manual); 221 | int e4k_set_enh_gain(struct e4k_state *e4k, int32_t gain); 222 | #endif /* _E4K_TUNER_H */ 223 | -------------------------------------------------------------------------------- /include/tuner_fc0012.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fitipower FC0012 tuner driver 3 | * 4 | * Copyright (C) 2012 Hans-Frieder Vogt 5 | * 6 | * modified for use in librtlsdr 7 | * Copyright (C) 2012 Steve Markgraf 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #ifndef _FC0012_H_ 26 | #define _FC0012_H_ 27 | 28 | #define FC0012_I2C_ADDR 0xc6 29 | #define FC0012_CHECK_ADDR 0x00 30 | #define FC0012_CHECK_VAL 0xa1 31 | 32 | int fc0012_init(void *dev); 33 | int fc0012_set_params(void *dev, uint32_t freq, uint32_t bandwidth); 34 | int fc0012_set_gain(void *dev, int gain); 35 | int fc0012_set_i2c_register(void *dev, unsigned i2c_register, unsigned data); 36 | int fc0012_get_i2c_register(void *dev, unsigned char* data, int len); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /include/tuner_fc0013.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Fitipower FC0013 tuner driver 3 | * 4 | * Copyright (C) 2012 Hans-Frieder Vogt 5 | * 6 | * modified for use in librtlsdr 7 | * Copyright (C) 2012 Steve Markgraf 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 22 | * 23 | */ 24 | 25 | #ifndef _FC0013_H_ 26 | #define _FC0013_H_ 27 | 28 | #define FC0013_I2C_ADDR 0xc6 29 | #define FC0013_CHECK_ADDR 0x00 30 | #define FC0013_CHECK_VAL 0xa3 31 | 32 | int fc0013_init(void *dev); 33 | int fc0013_set_params(void *dev, uint32_t freq, uint32_t bandwidth); 34 | int fc0013_set_gain_mode(void *dev, int manual); 35 | int fc0013_set_lna_gain(void *dev, int gain); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /include/tuner_fc2580.h: -------------------------------------------------------------------------------- 1 | #ifndef __TUNER_FC2580_H 2 | #define __TUNER_FC2580_H 3 | 4 | #define BORDER_FREQ 2600000 /* 2.6GHz : The border frequency which determines whether Low VCO or High VCO is used */ 5 | #define USE_EXT_CLK 0 /* 0 : Use internal XTAL Oscillator / 1 : Use External Clock input */ 6 | #define OFS_RSSI 57 7 | 8 | #define FC2580_I2C_ADDR 0xac 9 | #define FC2580_CHECK_ADDR 0x01 10 | #define FC2580_CHECK_VAL 0x56 11 | 12 | /* 16.384 MHz (at least on the Logilink VG0002A) */ 13 | #define FC2580_XTAL_FREQ 16384000 14 | 15 | typedef enum { 16 | FC2580_UHF_BAND, 17 | FC2580_L_BAND, 18 | FC2580_VHF_BAND, 19 | FC2580_NO_BAND 20 | } fc2580_band_type; 21 | 22 | typedef enum { 23 | FC2580_FCI_FAIL, 24 | FC2580_FCI_SUCCESS 25 | } fc2580_fci_result_type; 26 | 27 | enum FUNCTION_STATUS 28 | { 29 | FUNCTION_SUCCESS, 30 | FUNCTION_ERROR, 31 | }; 32 | 33 | extern void fc2580_wait_msec(void *pTuner, int a); 34 | 35 | fc2580_fci_result_type fc2580_i2c_write(void *pTuner, unsigned char reg, unsigned char val); 36 | fc2580_fci_result_type fc2580_i2c_read(void *pTuner, unsigned char reg, unsigned char *read_data); 37 | 38 | /*============================================================================== 39 | fc2580 initial setting 40 | 41 | This function is a generic function which gets called to initialize 42 | 43 | fc2580 in DVB-H mode or L-Band TDMB mode 44 | 45 | 46 | 47 | ifagc_mode 48 | type : integer 49 | 1 : Internal AGC 50 | 2 : Voltage Control Mode 51 | 52 | ==============================================================================*/ 53 | fc2580_fci_result_type fc2580_set_init(void *pTuner, int ifagc_mode, unsigned int freq_xtal ); 54 | 55 | /*============================================================================== 56 | fc2580 frequency setting 57 | 58 | This function is a generic function which gets called to change LO Frequency 59 | 60 | of fc2580 in DVB-H mode or L-Band TDMB mode 61 | 62 | 63 | 64 | f_lo 65 | Value of target LO Frequency in 'kHz' unit 66 | ex) 2.6GHz = 2600000 67 | 68 | ==============================================================================*/ 69 | fc2580_fci_result_type fc2580_set_freq(void *pTuner, unsigned int f_lo, unsigned int freq_xtal ); 70 | 71 | 72 | /*============================================================================== 73 | fc2580 filter BW setting 74 | 75 | This function is a generic function which gets called to change Bandwidth 76 | 77 | frequency of fc2580's channel selection filter 78 | 79 | 80 | 81 | filter_bw 82 | 1 : 1.53MHz(TDMB) 83 | 6 : 6MHz 84 | 7 : 7MHz 85 | 8 : 7.8MHz 86 | 87 | 88 | ==============================================================================*/ 89 | fc2580_fci_result_type fc2580_set_filter( void *pTuner, unsigned char filter_bw, unsigned int freq_xtal ); 90 | 91 | // The following context is FC2580 tuner API source code 92 | // Definitions 93 | 94 | // AGC mode 95 | enum FC2580_AGC_MODE 96 | { 97 | FC2580_AGC_INTERNAL = 1, 98 | FC2580_AGC_EXTERNAL = 2, 99 | }; 100 | 101 | 102 | // Bandwidth mode 103 | enum FC2580_BANDWIDTH_MODE 104 | { 105 | FC2580_BANDWIDTH_1530000HZ = 1, 106 | FC2580_BANDWIDTH_6000000HZ = 6, 107 | FC2580_BANDWIDTH_7000000HZ = 7, 108 | FC2580_BANDWIDTH_8000000HZ = 8, 109 | }; 110 | 111 | // Manipulaing functions 112 | int 113 | fc2580_Initialize( 114 | void *pTuner 115 | ); 116 | 117 | int 118 | fc2580_SetRfFreqHz( 119 | void *pTuner, 120 | unsigned long RfFreqHz 121 | ); 122 | 123 | // Extra manipulaing functions 124 | int 125 | fc2580_SetBandwidthMode( 126 | void *pTuner, 127 | int BandwidthMode 128 | ); 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /include/tuner_r82xx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Rafael Micro R820T/R828D driver 3 | * 4 | * Copyright (C) 2013 Mauro Carvalho Chehab 5 | * Copyright (C) 2013 Steve Markgraf 6 | * 7 | * This driver is a heavily modified version of the driver found in the 8 | * Linux kernel: 9 | * http://git.linuxtv.org/linux-2.6.git/history/HEAD:/drivers/media/tuners/r820t.c 10 | * 11 | * This program is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU General Public License as published by 13 | * the Free Software Foundation, either version 2 of the License, or 14 | * (at your option) any later version. 15 | * 16 | * This program is distributed in the hope that it will be useful, 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | * GNU General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with this program. If not, see . 23 | */ 24 | 25 | #ifndef R82XX_H 26 | #define R82XX_H 27 | 28 | #define R820T_I2C_ADDR 0x34 29 | #define R828D_I2C_ADDR 0x74 30 | #define R828D_XTAL_FREQ 16000000 31 | 32 | #define R82XX_CHECK_ADDR 0x00 33 | #define R82XX_CHECK_VAL 0x69 34 | 35 | #define R82XX_IF_FREQ 3570000 36 | 37 | #define REG_SHADOW_START 5 38 | #define NUM_REGS 32 39 | #define NUM_IMR 5 40 | #define IMR_TRIAL 9 41 | 42 | #define VER_NUM 49 43 | 44 | #define USE_R82XX_ENV_VARS 0 45 | 46 | enum r82xx_chip { 47 | CHIP_R820T, 48 | CHIP_R620D, 49 | CHIP_R828D, 50 | CHIP_R828, 51 | CHIP_R828S, 52 | CHIP_R820C, 53 | }; 54 | 55 | enum r82xx_tuner_type { 56 | TUNER_RADIO = 1, 57 | TUNER_ANALOG_TV, 58 | TUNER_DIGITAL_TV 59 | }; 60 | 61 | enum r82xx_xtal_cap_value { 62 | XTAL_LOW_CAP_30P = 0, 63 | XTAL_LOW_CAP_20P, 64 | XTAL_LOW_CAP_10P, 65 | XTAL_LOW_CAP_0P, 66 | XTAL_HIGH_CAP_0P 67 | }; 68 | 69 | struct r82xx_config { 70 | uint8_t i2c_addr; 71 | uint8_t vco_curr_min; /* VCO min/max current for R18/0x12 bits [7:5] in 0 .. 7. use 0xff for default */ 72 | uint8_t vco_curr_max; /* value is inverted: programmed is 7-value, that 0 is lowest current */ 73 | uint8_t vco_algo; 74 | int harmonic; 75 | uint32_t xtal; 76 | enum r82xx_chip rafael_chip; 77 | unsigned int max_i2c_msg_len; 78 | int use_predetect; 79 | int verbose; 80 | }; 81 | 82 | struct r82xx_priv { 83 | struct r82xx_config *cfg; 84 | 85 | uint8_t regs[NUM_REGS]; 86 | uint8_t buf[NUM_REGS + 1]; 87 | uint8_t override_data[NUM_REGS]; 88 | uint8_t override_mask[NUM_REGS]; 89 | enum r82xx_xtal_cap_value xtal_cap_sel; 90 | uint16_t pll; /* kHz */ 91 | uint64_t rf_freq; /* frequency from r82xx_set_freq() */ 92 | uint32_t int_freq; /* if frequency at which to deliver towards RTL2832U */ 93 | int32_t if_band_center_freq; /* frequency relative to zero IF, 94 | * on which the band center shall be positioned */ 95 | uint8_t fil_cal_code; 96 | uint8_t input; 97 | uint8_t last_vco_curr; 98 | int has_lock; 99 | int tuner_pll_set; 100 | int tuner_harmonic; 101 | int init_done; 102 | int sideband; 103 | int disable_dither; 104 | 105 | /* Store current mode */ 106 | uint32_t delsys; 107 | enum r82xx_tuner_type type; 108 | uint32_t bw; /* in MHz */ 109 | void *rtl_dev; 110 | 111 | int last_if_mode; 112 | int last_manual_gain; 113 | int last_extended_mode; 114 | int last_LNA_value; 115 | int last_Mixer_value; 116 | int last_VGA_value; 117 | 118 | #if USE_R82XX_ENV_VARS 119 | /* store some environment variables */ 120 | int printI2C; 121 | unsigned int filterCenter; 122 | unsigned int haveR9, valR9; 123 | unsigned int haveR10L, valR10L; 124 | unsigned int haveR10H, valR10H; 125 | unsigned int haveR11L, valR11L; 126 | unsigned int haveR11H, valR11H; 127 | unsigned int haveR13L, valR13L; 128 | unsigned int haveR13H, valR13H; 129 | unsigned int haveR14L, valR14L; 130 | unsigned int haveR14H, valR14H; 131 | unsigned int haveR30H, valR30H; 132 | unsigned int haveR30L, valR30L; 133 | #endif 134 | }; 135 | 136 | struct r82xx_freq_range { 137 | uint32_t freq; 138 | uint8_t open_d; 139 | uint8_t rf_mux_ploy; 140 | uint8_t tf_c; 141 | uint8_t xtal_cap20p; 142 | uint8_t xtal_cap10p; 143 | uint8_t xtal_cap0p; 144 | }; 145 | 146 | enum r82xx_delivery_system { 147 | SYS_UNDEFINED, 148 | SYS_DVBT, 149 | SYS_DVBT2, 150 | SYS_ISDBT, 151 | }; 152 | 153 | int r82xx_standby(struct r82xx_priv *priv); 154 | int r82xx_init(struct r82xx_priv *priv); 155 | int r82xx_set_freq(struct r82xx_priv *priv, uint32_t freq); 156 | int r82xx_set_freq64(struct r82xx_priv *priv, uint64_t freq); 157 | int r82xx_is_tuner_locked(struct r82xx_priv *priv); 158 | int r82xx_set_gain(struct r82xx_priv *priv, int set_manual_gain, int gain, int extended_mode, int lna_gain, int mixer_gain, int vga_gain, int *rtl_vga_control); 159 | int r82xx_get_rf_gain(struct r82xx_priv *priv); 160 | int r82xx_get_if_gain(struct r82xx_priv *priv); 161 | 162 | int r82xx_set_if_mode(struct r82xx_priv *priv, int if_mode, int *rtl_vga_control); 163 | 164 | int r82xx_set_i2c_register(struct r82xx_priv *priv, unsigned i2c_register, unsigned data, unsigned mask); 165 | int r82xx_get_i2c_register(struct r82xx_priv *priv, unsigned char* data, int len); 166 | int r82xx_set_i2c_override(struct r82xx_priv *priv, unsigned i2c_register, unsigned data, unsigned mask); 167 | 168 | int r82xx_set_bandwidth(struct r82xx_priv *priv, int bandwidth, uint32_t rate, uint32_t * applied_bw, int apply); 169 | int r82xx_set_bw_center(struct r82xx_priv *priv, int32_t if_band_center_freq); 170 | /* Mixer Sideband: 0: lower, 1: upper */ 171 | int r82xx_set_sideband(struct r82xx_priv *priv, int sideband); 172 | int r82xx_get_sideband(struct r82xx_priv *priv); 173 | /* should rtlsdr flip the spectrum? */ 174 | int r82xx_flip_rtl_sideband(struct r82xx_priv *priv); 175 | int r82xx_set_dither(struct r82xx_priv *priv, int dither); 176 | 177 | int r82xx_read_cache_reg(struct r82xx_priv *priv, int reg); 178 | int r82xx_write_reg_mask(struct r82xx_priv *priv, uint8_t reg, uint8_t val,uint8_t bit_mask); 179 | int r82xx_write_reg_mask_ext(struct r82xx_priv *priv, uint8_t reg, uint8_t val, uint8_t bit_mask, const char * func_name); 180 | 181 | int rtlsdr_check_dongle_model(void *dev, char *manufact_check, char *product_check); 182 | 183 | #endif 184 | 185 | -------------------------------------------------------------------------------- /install-blacklist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | BLACKLIST_FN="" 4 | if [ -f /etc/modprobe.d/rtlsdr-blacklist.conf ]; then 5 | BLACKLIST_FN="rtlsdr-blacklist.conf" 6 | echo "found /etc/modprobe.d/${BLACKLIST_FN}" 7 | elif [ -f /etc/modprobe.d/blacklist-rtl8xxxu.conf ]; then 8 | BLACKLIST_FN="blacklist-rtl8xxxu.conf" 9 | echo "found /etc/modprobe.d/${BLACKLIST_FN}" 10 | elif [ -f /etc/modprobe.d/raspi-blacklist.conf ]; then 11 | BLACKLIST_FN="raspi-blacklist.conf" 12 | echo "found /etc/modprobe.d/${BLACKLIST_FN}" 13 | else 14 | BLACKLIST_FN="rtlsdr-blacklist.conf" 15 | echo "could not find existing blacklist. will use /etc/modprobe.d/${BLACKLIST_FN}" 16 | fi 17 | 18 | if [ -f /etc/modprobe.d/${BLACKLIST_FN} ]; then 19 | cat /etc/modprobe.d/${BLACKLIST_FN} rtlsdr-blacklist.conf | sort | uniq >/dev/shm/${BLACKLIST_FN} 20 | cp /dev/shm/${BLACKLIST_FN} /etc/modprobe.d/${BLACKLIST_FN} 21 | echo "updated /etc/modprobe.d/${BLACKLIST_FN} ; reboot to apply" 22 | else 23 | cp rtlsdr-blacklist.conf /etc/modprobe.d/${BLACKLIST_FN} 24 | echo "created /etc/modprobe.d/${BLACKLIST_FN} ; reboot to apply" 25 | fi 26 | 27 | -------------------------------------------------------------------------------- /librtlsdr.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: RTL-SDR Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Cflags: -I${includedir}/ @RTLSDR_PC_CFLAGS@ 10 | Libs: -L${libdir} -lrtlsdr -lusb-1.0 11 | Libs.private: @RTLSDR_PC_LIBS@ 12 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | /libtool.m4 2 | /lt*.m4 3 | -------------------------------------------------------------------------------- /mingw-w32-i686.cmake: -------------------------------------------------------------------------------- 1 | # Sample toolchain file for building for Windows from an Ubuntu Linux system. 2 | # 3 | # Typical usage: 4 | # *) install cross compiler: `sudo apt-get install mingw-w64` 5 | # *) cd build 6 | # *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w32-i686.cmake .. 7 | # 8 | # build for Windows' 32 bit architecture 9 | 10 | set(CMAKE_SYSTEM_NAME Windows) 11 | set(TOOLCHAIN_PREFIX i686-w64-mingw32) 12 | 13 | # cross compilers to use for C, C++ and Fortran 14 | set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) 15 | set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) 16 | set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) 17 | 18 | # target environment on the build host system 19 | set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) 20 | 21 | # modify default behavior of FIND_XXX() commands 22 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 25 | -------------------------------------------------------------------------------- /mingw-w64-x64_64.cmake: -------------------------------------------------------------------------------- 1 | # Sample toolchain file for building for Windows from an Ubuntu Linux system. 2 | # 3 | # Typical usage: 4 | # *) install cross compiler: `sudo apt-get install mingw-w64` 5 | # *) cd build 6 | # *) cmake -DCMAKE_TOOLCHAIN_FILE=~/mingw-w64-x86_64.cmake .. 7 | # 8 | # build for Windows' 64 bit architecture 9 | 10 | set(CMAKE_SYSTEM_NAME Windows) 11 | set(TOOLCHAIN_PREFIX x86_64-w64-mingw32) 12 | 13 | # cross compilers to use for C, C++ and Fortran 14 | set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) 15 | set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) 16 | set(CMAKE_RC_COMPILER ${TOOLCHAIN_PREFIX}-windres) 17 | 18 | # target environment on the build host system 19 | set(CMAKE_FIND_ROOT_PATH /usr/${TOOLCHAIN_PREFIX}) 20 | 21 | # modify default behavior of FIND_XXX() commands 22 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 25 | -------------------------------------------------------------------------------- /protocol_rtl_tcp.txt: -------------------------------------------------------------------------------- 1 | 2 | The command protocol of rtl_tcp is on port 1234 (by default): 3 | ============================================================= 4 | 5 | Commands are directed from a client application towards rtl_tcp. 6 | 7 | Each command consists of 2 fields: 8 | 9 | 1- command_id: value of enum RTL_TCP_COMMANDS, defined in rtl_tcp.h. 10 | This element is an unsigned character, starting at offset 0 11 | with length: 1 byte. 12 | 13 | 2- parameter: depends on the command id, 14 | e.g. is a frequency for SET_FREQUENCY. 15 | This element is a (signed or unsigned) 32 bit integer, 16 | starting at offset 1 with length: 4 bytes. 17 | 18 | Both fields are in Network Byte Order (Big Endian). 19 | Size of one command is 3 bytes, without padding. 20 | 21 | 22 | Reverse direction on command connection: 23 | ======================================== 24 | 25 | With accepting a connection, rtl_tcp initially transmits some dongle_info. 26 | 27 | The dongle_info consists of 3 fields: 28 | 29 | 1- magic string: identifies the rtl_tcp protocol. The value is "RTL0". 30 | This element is a fixed size string, starting at offset 0 31 | with length 4 bytes. 32 | 33 | 2- tuner type: identifies the tuner chip built in the controlled RTL-SDR model, 34 | e.g. E4000 or R820T or R820T2. 35 | This element is an unsigned 32 bit integer, starting at offset 4 36 | with length: 4 bytes. 37 | 38 | 3- tuner gain count: reports the number of available gain values, 39 | necessary for the command SET_TUNER_GAIN_BY_INDEX. 40 | This element is an unsigned 32 bit integer, starting at offset 8 41 | with length: 4 bytes. 42 | 43 | Both fields are in Network Byte Order (Big Endian). 44 | Size of one dongle_info is 12 bytes, without padding. 45 | 46 | 47 | After that initial dongle_info, from offset 12 byte, just raw I/Q data is transferred. 48 | For each I/Q frame, in the commanded samplerate, I and Q values are transferred, 49 | each as unsigned 8 bit sample. Thus one I/Q-frame is 2 bytes, each frame 1 byte. 50 | 51 | 52 | 53 | Response channel: 54 | ================= 55 | The command channel does not allow specific response on commands. 56 | This is why an additional response channel got necessary. 57 | rtl_tcp now offers an additional tcp server "response" channel, 58 | by default, on the next port as the command protocol. 59 | Thus, by default on port 1235. 60 | 61 | 62 | Each response from rtl_tcp to the client consists of 3 fields: 63 | 64 | 1- command_id: references the command, which generated this response. 65 | It's value is also the enum RTL_TCP_COMMANDS, defined in rtl_tcp.h. 66 | This element is an unsigned character, starting at offset 0 67 | with length: 1 byte. 68 | 69 | 2- length_of_content: defines the number of bytes following this field at offset 3. 70 | The length is necessary to allow responses with different lengths. 71 | This element is an unsigned 16 bit integer, starting at offset 1 72 | with length: 2 bytes. 0 is interpreted as 65536! 73 | It is strongly recommended to limit the response to 32768 bytes in total. 74 | 75 | 3- content: the content is command specific and might contain up to 65536 bytes. 76 | The content starts at offset 3. 77 | 78 | 79 | All fields are in Network Byte Order (Big Endian). 80 | Size of one response is (3 + length_of_content), without padding. 81 | 82 | -------------------------------------------------------------------------------- /rtl-sdr.rules: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012-2013 Osmocom rtl-sdr project 3 | # 4 | # This program is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program. If not, see . 16 | # 17 | 18 | # original RTL2832U vid/pid (hama nano, for example) 19 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", MODE:="0666" 20 | 21 | # modified RTL2832U vid/pid .. not known to dvb modules 22 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="2832", MODE:="0666" 23 | 24 | # RTL2832U OEM vid/pid, e.g. ezcap EzTV668 (E4000), Newsky TV28T (E4000/R820T) etc. 25 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666" 26 | 27 | # DigitalNow Quad DVB-T PCI-E card (4x FC0012?) 28 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6680", MODE:="0666" 29 | 30 | # Leadtek WinFast DTV Dongle mini D (FC0012) 31 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0413", ATTRS{idProduct}=="6f0f", MODE:="0666" 32 | 33 | # Genius TVGo DVB-T03 USB dongle (Ver. B) 34 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0458", ATTRS{idProduct}=="707f", MODE:="0666" 35 | 36 | # Terratec Cinergy T Stick Black (rev 1) (FC0012) 37 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00a9", MODE:="0666" 38 | 39 | # Terratec NOXON rev 1 (FC0013) 40 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b3", MODE:="0666" 41 | 42 | # Terratec Deutschlandradio DAB Stick (FC0013) 43 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b4", MODE:="0666" 44 | 45 | # Terratec NOXON DAB Stick - Radio Energy (FC0013) 46 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b5", MODE:="0666" 47 | 48 | # Terratec Media Broadcast DAB Stick (FC0013) 49 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b7", MODE:="0666" 50 | 51 | # Terratec BR DAB Stick (FC0013) 52 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b8", MODE:="0666" 53 | 54 | # Terratec WDR DAB Stick (FC0013) 55 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b9", MODE:="0666" 56 | 57 | # Terratec MuellerVerlag DAB Stick (FC0013) 58 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c0", MODE:="0666" 59 | 60 | # Terratec Fraunhofer DAB Stick (FC0013) 61 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c6", MODE:="0666" 62 | 63 | # Terratec Cinergy T Stick RC (Rev.3) (E4000) 64 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", MODE:="0666" 65 | 66 | # Terratec T Stick PLUS (E4000) 67 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666" 68 | 69 | # Terratec NOXON rev 2 (E4000) 70 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="0666" 71 | 72 | # PixelView PV-DT235U(RN) (FC0012) 73 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666" 74 | 75 | # Astrometa DVB-T/DVB-T2 (R828D) 76 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0131", MODE:="0666" 77 | 78 | # HanfTek DAB+FM+DVB-T 79 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="15f4", ATTRS{idProduct}=="0133", MODE:="0666" 80 | 81 | # Compro Videomate U620F (E4000) 82 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666" 83 | 84 | # Compro Videomate U650F (E4000) 85 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666" 86 | 87 | # Compro Videomate U680F (E4000) 88 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0680", MODE:="0666" 89 | 90 | # GIGABYTE GT-U7300 (FC0012) 91 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d393", MODE:="0666" 92 | 93 | # DIKOM USB-DVBT HD 94 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d394", MODE:="0666" 95 | 96 | # Peak 102569AGPK (FC0012) 97 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d395", MODE:="0666" 98 | 99 | # KWorld KW-UB450-T USB DVB-T Pico TV (TUA9001) 100 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d397", MODE:="0666" 101 | 102 | # Zaapa ZT-MINDVBZP (FC0012) 103 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d398", MODE:="0666" 104 | 105 | # SVEON STV20 DVB-T USB & FM (FC0012) 106 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d39d", MODE:="0666" 107 | 108 | # Twintech UT-40 (FC0013) 109 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a4", MODE:="0666" 110 | 111 | # ASUS U3100MINI_PLUS_V2 (FC0013) 112 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a8", MODE:="0666" 113 | 114 | # SVEON STV27 DVB-T USB & FM (FC0013) 115 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3af", MODE:="0666" 116 | 117 | # SVEON STV21 DVB-T USB & FM 118 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3b0", MODE:="0666" 119 | 120 | # Dexatek DK DVB-T Dongle (Logilink VG0002A) (FC2580) 121 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1101", MODE:="0666" 122 | 123 | # Dexatek DK DVB-T Dongle (MSI DigiVox mini II V3.0) 124 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1102", MODE:="0666" 125 | 126 | # Dexatek DK 5217 DVB-T Dongle (FC2580) 127 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1103", MODE:="0666" 128 | 129 | # MSI DigiVox Micro HD (FC2580) 130 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1104", MODE:="0666" 131 | 132 | # Sweex DVB-T USB (FC0012) 133 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="a803", MODE:="0666" 134 | 135 | # GTek T803 (FC0012) 136 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="b803", MODE:="0666" 137 | 138 | # Lifeview LV5TDeluxe (FC0012) 139 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="c803", MODE:="0666" 140 | 141 | # MyGica TD312 (FC0012) 142 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d286", MODE:="0666" 143 | 144 | # PROlectrix DV107669 (FC0012) 145 | SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d803", MODE:="0666" 146 | -------------------------------------------------------------------------------- /rtlsdr-blacklist.conf: -------------------------------------------------------------------------------- 1 | blacklist dvb_usb_rtl28xxu 2 | blacklist dvb_usb_v2 3 | blacklist rtl_2830 4 | blacklist rtl_2832 5 | blacklist r820t 6 | blacklist rtl8xxxu 7 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | # This is _NOT_ the library release version, it's an API version. 2 | # Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification 3 | LIBVERSION=0:5:0 4 | 5 | AUTOMAKE_OPTIONS = subdir-objects 6 | INCLUDES = $(all_includes) -I$(top_srcdir)/include 7 | noinst_HEADERS = convenience/convenience.h 8 | AM_CFLAGS = ${CFLAGS} -fPIC ${SYMBOL_VISIBILITY} 9 | 10 | lib_LTLIBRARIES = librtlsdr.la 11 | 12 | librtlsdr_la_SOURCES = librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r82xx.c rtlsdr_rpc.c rtlsdr_rpc_msg.c 13 | librtlsdr_la_LDFLAGS = -version-info $(LIBVERSION) 14 | 15 | bin_PROGRAMS = rtl_sdr rtl_tcp rtl_test rtl_fm rtl_ir rtl_eeprom rtl_adsb rtl_power rtl_rpcd 16 | 17 | rtl_sdr_SOURCES = rtl_sdr.c convenience/convenience.c 18 | rtl_sdr_LDADD = librtlsdr.la 19 | 20 | rtl_tcp_SOURCES = rtl_tcp.c convenience/convenience.c 21 | rtl_tcp_LDADD = librtlsdr.la 22 | 23 | rtl_test_SOURCES = rtl_test.c convenience/convenience.c 24 | rtl_test_LDADD = librtlsdr.la $(LIBM) 25 | 26 | rtl_fm_SOURCES = rtl_fm.c convenience/convenience.c 27 | rtl_fm_LDADD = librtlsdr.la $(LIBM) 28 | 29 | rtl_ir_SOURCES = rtl_ir.c convenience/convenience.c 30 | rtl_ir_LDADD = librtlsdr.la $(LIBM) 31 | 32 | rtl_eeprom_SOURCES = rtl_eeprom.c convenience/convenience.c 33 | rtl_eeprom_LDADD = librtlsdr.la $(LIBM) 34 | 35 | rtl_adsb_SOURCES = rtl_adsb.c convenience/convenience.c 36 | rtl_adsb_LDADD = librtlsdr.la $(LIBM) 37 | 38 | rtl_power_SOURCES = rtl_power.c convenience/convenience.c 39 | rtl_power_LDADD = librtlsdr.la $(LIBM) 40 | 41 | rtl_rpcd_SOURCES = rtl_rpcd.c rtlsdr_rpc_msg.c convenience/convenience.c 42 | rtl_rpcd_LDADD = librtlsdr.la 43 | -------------------------------------------------------------------------------- /src/controlThread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2012 by Steve Markgraf 4 | * Copyright (C) 2012-2013 by Hoernchen 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef _WIN32 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #else 36 | #include 37 | #include "getopt/getopt.h" 38 | #define usleep(x) Sleep(x/1000) 39 | #endif 40 | 41 | #ifdef NEED_PTHREADS_WORKARROUND 42 | #define HAVE_STRUCT_TIMESPEC 43 | #endif 44 | #include 45 | 46 | #include "rtl-sdr.h" 47 | #include "rtl_tcp.h" 48 | #include "controlThread.h" 49 | #include "convenience/convenience.h" 50 | #include "convenience/rtl_convenience.h" 51 | 52 | #include "tuner_r82xx.h" 53 | 54 | #ifdef _WIN32 55 | #pragma comment(lib, "ws2_32.lib") 56 | 57 | typedef int socklen_t; 58 | 59 | #else 60 | #define closesocket close 61 | #define SOCKADDR struct sockaddr 62 | #define SOCKET int 63 | #define SOCKET_ERROR -1 64 | #endif 65 | 66 | /* we need a message id in the protocol: 1st 2 byte (little endian) == message id */ 67 | #define USE_MSGID_IN_PROTOCOL 1 68 | 69 | #define NUM_I2C_REGISTERS 32 70 | #define TX_BUF_LEN (NUM_I2C_REGISTERS +4) //2 len, 1 head, 1 tail 71 | 72 | 73 | ctrl_thread_data_t ctrl_thread_data; 74 | 75 | void *ctrl_thread_fn(void *arg) 76 | { 77 | unsigned char reg_values [NUM_I2C_REGISTERS]; 78 | #if USE_MSGID_IN_PROTOCOL 79 | unsigned char txbuf [2+2 +1+NUM_I2C_REGISTERS+1]; //2 type, 2 length, 1 head, 1 tail 80 | #else 81 | unsigned char txbuf [NUM_I2C_REGISTERS+4]; //2 length, 1 head, 1 tail 82 | #endif 83 | int r = 1; 84 | struct timeval tv = { 1,0 }; 85 | struct linger ling = { 1,0 }; 86 | SOCKET listensocket; 87 | SOCKET controlSocket; 88 | int haveControlSocket = 0; 89 | struct sockaddr_in local, remote; 90 | socklen_t rlen; 91 | 92 | int error = 0; 93 | int ret = 0, len, result; 94 | fd_set connfds; 95 | fd_set writefds; 96 | int bytesleft, bytessent, index; 97 | 98 | ctrl_thread_data_t *data = (ctrl_thread_data_t *)arg; 99 | 100 | rtlsdr_dev_t *dev = data->dev; 101 | int port = data->port; 102 | int wait = data->wait; 103 | int report_i2c = data->report_i2c; 104 | char *addr = data->addr; 105 | int* do_exit = data->pDoExit; 106 | u_long blockmode = 1; 107 | int retval; 108 | 109 | 110 | memset(reg_values, 0, NUM_I2C_REGISTERS); 111 | 112 | memset(&local, 0, sizeof(local)); 113 | local.sin_family = AF_INET; 114 | local.sin_port = htons(port); 115 | local.sin_addr.s_addr = inet_addr(addr); 116 | 117 | listensocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 118 | 119 | setsockopt(listensocket, SOL_SOCKET, SO_REUSEADDR, (char *)&r, sizeof(int)); 120 | setsockopt(listensocket, SOL_SOCKET, SO_LINGER, (char *)&ling, sizeof(ling)); 121 | retval = bind(listensocket, (struct sockaddr *)&local, sizeof(local)); 122 | if (retval == SOCKET_ERROR) 123 | error = 1; 124 | #ifdef _WIN32 125 | ioctlsocket(listensocket, FIONBIO, &blockmode); 126 | #else 127 | r = fcntl(listensocket, F_GETFL, 0); 128 | r = fcntl(listensocket, F_SETFL, r | O_NONBLOCK); 129 | #endif 130 | 131 | while (1) { 132 | printf("listening on Control port %d...\n", port); 133 | retval = listen(listensocket, 1); 134 | if (retval == SOCKET_ERROR) 135 | error = 1; 136 | while (1) { 137 | FD_ZERO(&connfds); 138 | FD_SET(listensocket, &connfds); 139 | tv.tv_sec = 1; 140 | tv.tv_usec = 0; 141 | r = select(listensocket + 1, &connfds, NULL, NULL, &tv); 142 | if (*do_exit) { 143 | goto close; 144 | } 145 | else if (r) { 146 | rlen = sizeof(remote); 147 | controlSocket = accept(listensocket, (struct sockaddr *)&remote, &rlen); 148 | haveControlSocket = 1; 149 | break; 150 | } 151 | } 152 | 153 | setsockopt(controlSocket, SOL_SOCKET, SO_LINGER, (char *)&ling, sizeof(ling)); 154 | 155 | printf("Control client accepted!\n"); 156 | usleep(5000000); 157 | 158 | while (1) { 159 | 160 | /* check if i2c reporting is to be (de)activated */ 161 | if ( report_i2c && !data->report_i2c ) 162 | report_i2c = 0; 163 | else if ( !report_i2c && data->report_i2c ) 164 | report_i2c = 1; 165 | 166 | /* @TODO: check if something else has to be transmitted */ 167 | 168 | if ( !report_i2c ) 169 | goto sleep; 170 | 171 | result = rtlsdr_get_tuner_i2c_register(dev, reg_values, NUM_I2C_REGISTERS); 172 | /* printf("rtlsdr_get_tuner_i2c_register\n"); */ 173 | memset(txbuf, 0, TX_BUF_LEN); 174 | if (result) 175 | goto sleep; 176 | 177 | /* Little Endian */ 178 | len = 0; 179 | /* we need some message id: use enum RTL_TCP_COMMANDS */ 180 | #if USE_MSGID_IN_PROTOCOL 181 | txbuf[len++] = REPORT_I2C_REGS & 0x0FF; 182 | txbuf[len++] = (REPORT_I2C_REGS >> 8) & 0x0FF; 183 | /* following message length in Little Endian */ 184 | txbuf[len++] = TX_BUF_LEN - 2 - 2; /* sub message id and length field */ 185 | #else 186 | txbuf[len++] = TX_BUF_LEN - 2; /* sub message id and length field */ 187 | #endif 188 | txbuf[len++] = 0; 189 | 190 | /* now the message contents */ 191 | txbuf[len++] = 0x55; /* @CS: do we need this? */ 192 | memcpy(&txbuf[len], reg_values, NUM_I2C_REGISTERS); 193 | txbuf[TX_BUF_LEN - 1] = 0xaa; /* @CS: do we need this? */ 194 | len = sizeof(txbuf); 195 | 196 | /* now start (possibly blocking) transmission */ 197 | bytessent = 0; 198 | bytesleft = len; 199 | index = 0; 200 | 201 | while (bytesleft > 0) { 202 | FD_ZERO(&writefds); 203 | FD_SET(controlSocket, &writefds); 204 | tv.tv_sec = 1; 205 | tv.tv_usec = 0; 206 | r = select(controlSocket + 1, NULL, &writefds, NULL, &tv); 207 | if (r) { 208 | bytessent = send(controlSocket, &txbuf[index], bytesleft, 0); 209 | bytesleft -= bytessent; 210 | index += bytessent; 211 | } 212 | if (bytessent == SOCKET_ERROR || *do_exit) { 213 | goto close; 214 | } 215 | } 216 | sleep: 217 | usleep(wait); 218 | } 219 | close: 220 | if (haveControlSocket) 221 | closesocket(controlSocket); 222 | if (*do_exit) 223 | { 224 | closesocket(listensocket); 225 | printf("Control Thread terminates\n"); 226 | break; 227 | } 228 | } 229 | return 0; 230 | } 231 | 232 | -------------------------------------------------------------------------------- /src/convenience/convenience.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by Kyle Keen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | /* a collection of user friendly tools 19 | * todo: use strtol for more flexible int parsing 20 | * */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifndef _WIN32 30 | #include 31 | #include 32 | #else 33 | #include 34 | #include 35 | #include 36 | #include 37 | #define _USE_MATH_DEFINES 38 | #endif 39 | 40 | #include 41 | 42 | 43 | double atofs(char *s) 44 | /* standard suffixes */ 45 | { 46 | char last; 47 | int len; 48 | double suff = 1.0; 49 | len = strlen(s); 50 | /* allow formatting spaces from .csv command file */ 51 | while ( len > 1 && isspace(s[len-1]) ) --len; 52 | last = s[len-1]; 53 | s[len-1] = '\0'; 54 | switch (last) { 55 | case 'g': 56 | case 'G': 57 | suff *= 1e3; 58 | /* fall-through */ 59 | case 'm': 60 | case 'M': 61 | suff *= 1e3; 62 | /* fall-through */ 63 | case 'k': 64 | case 'K': 65 | suff *= 1e3; 66 | suff *= atof(s); 67 | s[len-1] = last; 68 | return suff; 69 | } 70 | s[len-1] = last; 71 | return atof(s); 72 | } 73 | 74 | double atoft(char *s) 75 | /* time suffixes, returns seconds */ 76 | { 77 | char last; 78 | int len; 79 | double suff = 1.0; 80 | len = strlen(s); 81 | last = s[len-1]; 82 | s[len-1] = '\0'; 83 | switch (last) { 84 | case 'h': 85 | case 'H': 86 | suff *= 60; 87 | /* fall-through */ 88 | case 'm': 89 | case 'M': 90 | suff *= 60; 91 | /* fall-through */ 92 | case 's': 93 | case 'S': 94 | suff *= atof(s); 95 | s[len-1] = last; 96 | return suff; 97 | } 98 | s[len-1] = last; 99 | return atof(s); 100 | } 101 | 102 | double atofp(char *s) 103 | /* percent suffixes */ 104 | { 105 | char last; 106 | int len; 107 | double suff = 1.0; 108 | len = strlen(s); 109 | last = s[len-1]; 110 | s[len-1] = '\0'; 111 | switch (last) { 112 | case '%': 113 | suff *= 0.01; 114 | suff *= atof(s); 115 | s[len-1] = last; 116 | return suff; 117 | } 118 | s[len-1] = last; 119 | return atof(s); 120 | } 121 | 122 | 123 | static struct tm * str_to_tm( const char * str, struct tm * t, double * fraction ) { 124 | char b[16]; 125 | int k, v; 126 | /* 0 1 2 */ 127 | /* 01234567890123456789012 */ 128 | /* 2019-09-15T01:53:20.234 - mostly ISO 8601 */ 129 | 130 | *fraction = 0.0; 131 | t->tm_sec = 0; 132 | t->tm_min = 0; 133 | t->tm_hour = 0; 134 | t->tm_mday = 1; 135 | t->tm_mon = 0; 136 | t->tm_year = 0; 137 | t->tm_wday = 0; 138 | t->tm_yday = 0; 139 | t->tm_isdst = -1; 140 | 141 | /* date */ 142 | if ( (str[4] == '-' || str[4] == '/') && str[4] == str[7] ) { 143 | /* year */ 144 | b[4] = 0; for ( k = 0; k < 4; ++k ) b[k] = str[k]; 145 | v = atoi(b); 146 | t->tm_year = v - 1900; 147 | /* month */ 148 | b[2] = 0; for ( k = 0; k < 2; ++k ) b[k] = str[5+k]; 149 | v = atoi(b); 150 | if (v < 1 || v > 12) 151 | return NULL; 152 | t->tm_mon = v - 1; 153 | /* day */ 154 | b[2] = 0; for ( k = 0; k < 2; ++k ) b[k] = str[8+k]; 155 | v = atoi(b); 156 | if (v < 1 || v > 31) 157 | return NULL; 158 | t->tm_mday = v; 159 | } else 160 | return NULL; 161 | 162 | if (str[10] == 0 ) 163 | return t; 164 | 165 | /* time */ 166 | if ( str[10] != 'T' && str[10] != ' ' && str[10] != '_' ) 167 | return NULL; 168 | if ( (str[13] == ':' || str[13] == '/') && str[13] == str[16] ) { 169 | /* hour */ 170 | b[2] = 0; for ( k = 0; k < 2; ++k ) b[k] = str[11+k]; 171 | v = atoi(b); 172 | if (v < 0 || v > 23) 173 | return NULL; 174 | t->tm_hour = v; 175 | /* minute */ 176 | b[2] = 0; for ( k = 0; k < 2; ++k ) b[k] = str[14+k]; 177 | v = atoi(b); 178 | if (v < 0 || v > 59) 179 | return NULL; 180 | t->tm_min = v; 181 | /* second */ 182 | b[2] = 0; for ( k = 0; k < 2; ++k ) b[k] = str[17+k]; 183 | v = atoi(b); 184 | if (v < 0 || v > 61) 185 | return NULL; 186 | t->tm_sec = v; 187 | } else 188 | return NULL; 189 | 190 | if (str[19] == 0 ) 191 | return t; 192 | 193 | /* fraction */ 194 | if ( str[19] == '.' || str[19] == ',' ) { 195 | for ( k = 0; k < 16; ++k ) b[k] = 0; 196 | strcpy(b, "0."); 197 | strncpy(&b[2], &str[20], 12); 198 | *fraction = atof(b); 199 | return t; 200 | } 201 | 202 | /* return t anyway .. without fraction */ 203 | return t; 204 | } 205 | 206 | 207 | time_t utctimestr_to_time(const char * str, double * fraction) { 208 | struct tm t; 209 | struct tm *p; 210 | #ifdef _WIN32 211 | struct tm gtm; 212 | struct tm ltm; 213 | time_t nt; 214 | time_t gt; 215 | time_t lt; 216 | #endif 217 | p = str_to_tm( str, &t, fraction ); 218 | if (!p) 219 | return 0; 220 | p->tm_isdst = 0; 221 | #ifndef _WIN32 222 | return timegm(p); 223 | #else 224 | #ifdef _MSC_VER 225 | return _mkgmtime(p); 226 | #else 227 | /* workaround missing mkgmtime on mingw */ 228 | nt = mktime(p); 229 | gtm = *gmtime(&nt); 230 | ltm = *localtime(&nt); 231 | gt = mktime(>m); 232 | lt = mktime(<m); 233 | assert( nt == gt ); 234 | nt += ( lt - gt ); 235 | return nt; 236 | #endif 237 | #endif 238 | } 239 | 240 | 241 | time_t localtimestr_to_time(const char * str, double * fraction) { 242 | struct tm t; 243 | struct tm *p; 244 | 245 | p = str_to_tm( str, &t, fraction ); 246 | 247 | if (!p) 248 | return 0; 249 | #ifndef _WIN32 250 | return timelocal(p); 251 | #else 252 | return mktime(p); 253 | #endif 254 | } 255 | 256 | 257 | 258 | #ifndef _WIN32 259 | 260 | void executeInBackground( char * file, char * args, char * searchStr[], char * replaceStr[] ) 261 | { 262 | pid_t pid; 263 | char * argv[256] = { NULL }; 264 | int k, argc = 0; 265 | argv[argc++] = file; 266 | if (args) { 267 | argv[argc] = strtok(args, " "); 268 | while (argc < 256 && argv[argc]) { 269 | argv[++argc] = strtok(NULL, " "); 270 | for (k=0; argv[argc] && searchStr && replaceStr && searchStr[k] && replaceStr[k]; k++) { 271 | if (!strcmp(argv[argc], searchStr[k])) { 272 | argv[argc] = replaceStr[k]; 273 | break; 274 | } 275 | } 276 | } 277 | } 278 | 279 | pid = fork(); 280 | switch (pid) 281 | { 282 | case -1: 283 | /* Fork() has failed */ 284 | fprintf(stderr, "error: fork for '%s' failed!\n", file); 285 | break; 286 | case 0: 287 | execvp(file, argv); 288 | fprintf(stderr, "error: execv of '%s' from within fork failed!\n", file); 289 | exit(10); 290 | break; 291 | default: 292 | /* This is processed by the parent */ 293 | break; 294 | } 295 | } 296 | 297 | #else 298 | 299 | void executeInBackground( char * file, char * args, char * searchStr[], char * replaceStr[] ) 300 | { 301 | char * argv[256] = { NULL }; 302 | int k, argc = 0; 303 | argv[argc++] = file; 304 | if (args) { 305 | argv[argc] = strtok(args, " \t"); 306 | while (argc < 256 && argv[argc]) { 307 | argv[++argc] = strtok(NULL, " \t"); 308 | for (k=0; argv[argc] && searchStr && replaceStr && searchStr[k] && replaceStr[k]; k++) { 309 | if (!strcmp(argv[argc], searchStr[k])) { 310 | argv[argc] = replaceStr[k]; 311 | break; 312 | } 313 | } 314 | } 315 | } 316 | 317 | spawnvp(P_NOWAIT, file, argv); 318 | } 319 | 320 | #endif 321 | 322 | 323 | // vim: tabstop=8:softtabstop=8:shiftwidth=8:noexpandtab 324 | -------------------------------------------------------------------------------- /src/convenience/convenience.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by Kyle Keen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __CONVENIENCE_H 18 | #define __CONVENIENCE_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* a collection of user friendly tools */ 29 | 30 | /*! 31 | * Convert standard suffixes (k, M, G) to double 32 | * 33 | * \param s a string to be parsed 34 | * \return double 35 | */ 36 | 37 | double atofs(char *s); 38 | 39 | /*! 40 | * Convert time suffixes (s, m, h) to double 41 | * 42 | * \param s a string to be parsed 43 | * \return seconds as double 44 | */ 45 | 46 | double atoft(char *s); 47 | 48 | /*! 49 | * Convert percent suffixe (%) to double 50 | * 51 | * \param s a string to be parsed 52 | * \return double 53 | */ 54 | 55 | double atofp(char *s); 56 | 57 | 58 | time_t utctimestr_to_time(const char * str, double * fraction); 59 | time_t localtimestr_to_time(const char * str, double * fraction); 60 | 61 | 62 | void executeInBackground( char * file, char * args, char * searchStr[], char * replaceStr[] ); 63 | 64 | 65 | #ifdef __cplusplus 66 | } 67 | #endif 68 | 69 | #endif /*__CONVENIENCE_H*/ 70 | -------------------------------------------------------------------------------- /src/convenience/rtl_convenience.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 by Kyle Keen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __RTL_CONVENIENCE_H 18 | #define __RTL_CONVENIENCE_H 19 | 20 | #include 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* a collection of user friendly tools */ 28 | 29 | /*! 30 | * Find nearest supported gain 31 | * 32 | * \param dev the device handle given by rtlsdr_open() 33 | * \param target_gain in tenths of a dB 34 | * \return 0 on success 35 | */ 36 | 37 | int nearest_gain(rtlsdr_dev_t *dev, int target_gain); 38 | 39 | /*! 40 | * Set device frequency and report status on stderr 41 | * 42 | * \param dev the device handle given by rtlsdr_open() 43 | * \param frequency in Hz 44 | * \return 0 on success 45 | */ 46 | 47 | int verbose_set_frequency(rtlsdr_dev_t *dev, uint64_t frequency); 48 | 49 | /*! 50 | * Set device sample rate and report status on stderr 51 | * 52 | * \param dev the device handle given by rtlsdr_open() 53 | * \param samp_rate in samples/second 54 | * \return 0 on success 55 | */ 56 | 57 | int verbose_set_sample_rate(rtlsdr_dev_t *dev, uint32_t samp_rate); 58 | 59 | /*! 60 | * Set device bandwidth and report status on stderr 61 | * 62 | * \param dev the device handle given by rtlsdr_open() 63 | * \param frequency in Hz 64 | * \return 0 on success 65 | */ 66 | 67 | int verbose_set_bandwidth(rtlsdr_dev_t *dev, uint32_t bandwidth); 68 | 69 | 70 | /*! 71 | * Enable or disable the direct sampling mode and report status on stderr 72 | * 73 | * \param dev the device handle given by rtlsdr_open() 74 | * \param on 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled 75 | * \return 0 on success 76 | */ 77 | 78 | int verbose_direct_sampling(rtlsdr_dev_t *dev, int on); 79 | 80 | /*! 81 | * Enable offset tuning and report status on stderr 82 | * 83 | * \param dev the device handle given by rtlsdr_open() 84 | * \return 0 on success 85 | */ 86 | 87 | int verbose_offset_tuning(rtlsdr_dev_t *dev); 88 | 89 | /*! 90 | * Enable auto gain and report status on stderr 91 | * 92 | * \param dev the device handle given by rtlsdr_open() 93 | * \return 0 on success 94 | */ 95 | 96 | int verbose_auto_gain(rtlsdr_dev_t *dev); 97 | 98 | /*! 99 | * Set tuner gain and report status on stderr 100 | * 101 | * \param dev the device handle given by rtlsdr_open() 102 | * \param gain in tenths of a dB 103 | * \return 0 on success 104 | */ 105 | 106 | int verbose_gain_set(rtlsdr_dev_t *dev, int gain); 107 | 108 | /*! 109 | * Set the frequency correction value for the device and report status on stderr. 110 | * 111 | * \param dev the device handle given by rtlsdr_open() 112 | * \param ppm_error correction value in parts per million (ppm) 113 | * \return 0 on success 114 | */ 115 | 116 | int verbose_ppm_set(rtlsdr_dev_t *dev, int ppm_error); 117 | 118 | /*! 119 | * Reset buffer 120 | * 121 | * \param dev the device handle given by rtlsdr_open() 122 | * \return 0 on success 123 | */ 124 | 125 | int verbose_reset_buffer(rtlsdr_dev_t *dev); 126 | 127 | /*! 128 | * Find the closest matching device. 129 | * 130 | * \param s a string to be parsed 131 | * \return dev_index int, -1 on error 132 | */ 133 | 134 | int verbose_device_search(char *s); 135 | 136 | 137 | #ifdef __cplusplus 138 | } 139 | #endif 140 | 141 | #endif /*__RTL_CONVENIENCE_H*/ 142 | -------------------------------------------------------------------------------- /src/convenience/wavehdr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 by Hayati Ayguen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #ifndef __WAVEHDR_H 19 | #define __WAVEHDR_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | #pragma pack(push) 26 | #pragma pack(1) 27 | 28 | typedef struct 29 | { 30 | char ID[4]; 31 | uint32_t size; 32 | } chunk_hdr; 33 | 34 | typedef struct 35 | { 36 | uint16_t wYear; /* 1601 through 30827 */ 37 | uint16_t wMonth; /* 1..12 */ 38 | uint16_t wDayOfWeek; /* 0 .. 6: 0 == Sunday, .., 6 == Saturday */ 39 | uint16_t wDay; /* 1 .. 31 */ 40 | uint16_t wHour; /* 0 .. 23 */ 41 | uint16_t wMinute; /* 0 .. 59 */ 42 | uint16_t wSecond; /* 0 .. 59 */ 43 | uint16_t wMilliseconds; /* 0 .. 999 */ 44 | } Wind_SystemTime; 45 | 46 | 47 | typedef struct 48 | { 49 | /* RIFF header */ 50 | chunk_hdr hdr; /* ID == "RIFF" string, size == full filesize - 8 bytes (maybe with some byte missing...) */ 51 | char waveID[4]; /* "WAVE" string */ 52 | } riff_chunk; 53 | 54 | typedef struct 55 | { 56 | /* FMT header */ 57 | chunk_hdr hdr; /* ID == "fmt " */ 58 | int16_t wFormatTag; 59 | int16_t nChannels; 60 | int32_t nSamplesPerSec; 61 | int32_t nAvgBytesPerSec; 62 | int16_t nBlockAlign; 63 | int16_t nBitsPerSample; 64 | } fmt_chunk; 65 | 66 | typedef struct 67 | { 68 | /* auxi header - used by SpectraVue / rfspace / HDSDR / ELAD FDM .. */ 69 | chunk_hdr hdr; /* ="auxi" (chunk rfspace) */ 70 | Wind_SystemTime StartTime; 71 | Wind_SystemTime StopTime; 72 | uint32_t centerFreq; /* receiver center frequency */ 73 | uint32_t ADsamplerate; /* A/D sample frequency before downsampling */ 74 | uint32_t IFFrequency; /* IF freq if an external down converter is used */ 75 | uint32_t Bandwidth; /* displayable BW if you want to limit the display to less than Nyquist band */ 76 | int32_t IQOffset; /* DC offset of the I and Q channels in 1/1000's of a count */ 77 | int32_t Unused2; 78 | int32_t Unused3; 79 | int32_t Unused4; 80 | int32_t Unused5; 81 | } auxi_chunk; 82 | 83 | typedef struct 84 | { 85 | /* DATA header */ 86 | chunk_hdr hdr; /* ="data" */ 87 | } data_chunk; 88 | 89 | typedef struct 90 | { 91 | riff_chunk r; 92 | fmt_chunk f; 93 | auxi_chunk a; 94 | data_chunk d; 95 | } waveFileHeader; 96 | 97 | #pragma pack(pop) 98 | 99 | #endif /* __WAVEHDR_H */ 100 | 101 | // vim: tabstop=8:softtabstop=8:shiftwidth=8:noexpandtab 102 | 103 | -------------------------------------------------------------------------------- /src/convenience/waveread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 by Hayati Ayguen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __WAVEREAD_H 18 | #define __WAVEREAD_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | 29 | int waveReadHeader(FILE * f, uint32_t *samplerate, uint32_t *freq, int *bitsPerSample, int *numChannels 30 | , uint32_t *nFrames, int16_t *formatTag, int verbosity); 31 | int waveReadFrames(FILE* f, void * vpData, size_t numFrames, int needCleanData, size_t *numRead); 32 | int waveReadSamples(FILE* f, void * vpData, size_t numSamples, int needCleanData, size_t *numRead); /* returns 0, when no errors occured */ 33 | void waveGetStartTime(time_t *tim, double *fraction); 34 | void waveGetStopTime(time_t *tim, double *fraction); 35 | 36 | #ifdef __cplusplus 37 | } 38 | #endif 39 | 40 | #endif /*__WAVEREAD_H*/ 41 | -------------------------------------------------------------------------------- /src/convenience/wavewrite.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 by Hayati Ayguen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | 18 | #include "wavewrite.h" 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #ifndef _WIN32 27 | #include 28 | #include 29 | #else 30 | #include 31 | #include 32 | #include 33 | #include 34 | #define _USE_MATH_DEFINES 35 | #endif 36 | 37 | #include 38 | 39 | #include "wavehdr.h" 40 | 41 | static waveFileHeader waveHdr; 42 | 43 | static uint32_t waveDataSize = 0; 44 | int waveHdrStarted = 0; 45 | 46 | #ifdef _WIN32 47 | int gettimeofday(struct timeval *tv, void* ignored) 48 | { 49 | FILETIME ft; 50 | unsigned __int64 tmp = 0; 51 | if (NULL != tv) { 52 | GetSystemTimeAsFileTime(&ft); 53 | tmp |= ft.dwHighDateTime; 54 | tmp <<= 32; 55 | tmp |= ft.dwLowDateTime; 56 | tmp /= 10; 57 | #ifdef _MSC_VER 58 | tmp -= 11644473600000000Ui64; 59 | #else 60 | tmp -= 11644473600000000ULL; 61 | #endif 62 | tv->tv_sec = (long)(tmp / 1000000UL); 63 | tv->tv_usec = (long)(tmp % 1000000UL); 64 | } 65 | return 0; 66 | } 67 | #endif 68 | 69 | static void waveSetCurrTime(Wind_SystemTime *p) 70 | { 71 | struct timeval tv; 72 | struct tm t; 73 | 74 | gettimeofday(&tv, NULL); 75 | p->wMilliseconds = tv.tv_usec / 1000; 76 | 77 | #ifdef _WIN32 78 | t = *gmtime(&tv.tv_sec); 79 | #else 80 | gmtime_r(&tv.tv_sec, &t); 81 | #endif 82 | 83 | p->wYear = t.tm_year + 1900; /* 1601 through 30827 */ 84 | p->wMonth = t.tm_mon + 1; /* 1..12 */ 85 | p->wDayOfWeek = t.tm_wday; /* 0 .. 6: 0 == Sunday, .., 6 == Saturday */ 86 | p->wDay = t.tm_mday; /* 1 .. 31 */ 87 | p->wHour = t.tm_hour; /* 0 .. 23 */ 88 | p->wMinute = t.tm_min; /* 0 .. 59 */ 89 | p->wSecond = t.tm_sec; /* 0 .. 59 */ 90 | } 91 | 92 | static void waveSetStartTimeInt(time_t tim, double fraction, Wind_SystemTime *p) 93 | { 94 | struct tm t = *gmtime( &tim ); 95 | p->wYear = t.tm_year + 1900; /* 1601 through 30827 */ 96 | p->wMonth = t.tm_mon + 1; /* 1..12 */ 97 | p->wDayOfWeek = t.tm_wday; /* 0 .. 6: 0 == Sunday, .., 6 == Saturday */ 98 | p->wDay = t.tm_mday; /* 1 .. 31 */ 99 | p->wHour = t.tm_hour; /* 0 .. 23 */ 100 | p->wMinute = t.tm_min; /* 0 .. 59 */ 101 | p->wSecond = t.tm_sec; /* 0 .. 59 */ 102 | p->wMilliseconds = (int)( fraction * 1000.0 ); 103 | if (p->wMilliseconds >= 1000) 104 | p->wMilliseconds = 999; 105 | } 106 | 107 | void waveSetStartTime(time_t tim, double fraction) 108 | { 109 | waveSetStartTimeInt(tim, fraction, &waveHdr.a.StartTime ); 110 | waveHdr.a.StopTime = waveHdr.a.StartTime; /* to fix */ 111 | } 112 | 113 | 114 | void wavePrepareHeader(unsigned samplerate, unsigned freq, int bitsPerSample, int numChannels) 115 | { 116 | int bytesPerSample = bitsPerSample / 8; 117 | int bytesPerFrame = bytesPerSample * numChannels; 118 | 119 | memcpy( waveHdr.r.hdr.ID, "RIFF", 4 ); 120 | waveHdr.r.hdr.size = sizeof(waveFileHeader) - 8; /* to fix */ 121 | memcpy( waveHdr.r.waveID, "WAVE", 4 ); 122 | 123 | memcpy( waveHdr.f.hdr.ID, "fmt ", 4 ); 124 | waveHdr.f.hdr.size = 16; 125 | waveHdr.f.wFormatTag = 1; /* PCM */ 126 | waveHdr.f.nChannels = numChannels; /* I and Q channels */ 127 | waveHdr.f.nSamplesPerSec = samplerate; 128 | waveHdr.f.nAvgBytesPerSec = samplerate * bytesPerFrame; 129 | waveHdr.f.nBlockAlign = waveHdr.f.nChannels; 130 | waveHdr.f.nBitsPerSample = bitsPerSample; 131 | 132 | memcpy( waveHdr.a.hdr.ID, "auxi", 4 ); 133 | waveHdr.a.hdr.size = 2 * sizeof(Wind_SystemTime) + 9 * sizeof(int32_t); /* = 2 * 16 + 9 * 4 = 68 */ 134 | waveSetCurrTime( &waveHdr.a.StartTime ); 135 | waveHdr.a.StopTime = waveHdr.a.StartTime; /* to fix */ 136 | waveHdr.a.centerFreq = freq; 137 | waveHdr.a.ADsamplerate = samplerate; 138 | waveHdr.a.IFFrequency = 0; 139 | waveHdr.a.Bandwidth = 0; 140 | waveHdr.a.IQOffset = 0; 141 | waveHdr.a.Unused2 = 0; 142 | waveHdr.a.Unused3 = 0; 143 | waveHdr.a.Unused4 = 0; 144 | waveHdr.a.Unused5 = 0; 145 | 146 | memcpy( waveHdr.d.hdr.ID, "data", 4 ); 147 | waveHdr.d.hdr.size = 0; /* to fix later */ 148 | waveDataSize = 0; 149 | } 150 | 151 | void waveWriteHeader(unsigned samplerate, unsigned freq, int bitsPerSample, int numChannels, FILE * f) 152 | { 153 | if (f != stdout) { 154 | assert( !waveHdrStarted ); 155 | wavePrepareHeader(samplerate, freq, bitsPerSample, numChannels); 156 | fwrite(&waveHdr, sizeof(waveFileHeader), 1, f); 157 | waveHdrStarted = 1; 158 | } 159 | } 160 | 161 | int waveWriteSamples(FILE* f, void * vpData, size_t numSamples, int needCleanData) 162 | { 163 | size_t nw; 164 | switch (waveHdr.f.nBitsPerSample) 165 | { 166 | case 0: 167 | default: 168 | return 1; 169 | case 8: 170 | /* no endian conversion needed for single bytes */ 171 | nw = fwrite(vpData, sizeof(uint8_t), numSamples, f); 172 | waveDataSize += sizeof(uint8_t) * numSamples; 173 | return (nw == numSamples) ? 0 : 1; 174 | case 16: 175 | /* TODO: endian conversion needed */ 176 | nw = fwrite(vpData, sizeof(int16_t), numSamples, f); 177 | waveDataSize += sizeof(int16_t) * numSamples; 178 | if ( needCleanData ) 179 | { 180 | /* TODO: convert back endianness */ 181 | } 182 | return (nw == numSamples) ? 0 : 1; 183 | } 184 | } 185 | 186 | int waveWriteFrames(FILE* f, void * vpData, size_t numFrames, int needCleanData) 187 | { 188 | size_t nw; 189 | switch (waveHdr.f.nBitsPerSample) 190 | { 191 | case 0: 192 | default: 193 | return 1; 194 | case 8: 195 | /* no endian conversion needed for single bytes */ 196 | nw = fwrite(vpData, waveHdr.f.nChannels * sizeof(uint8_t), numFrames, f); 197 | waveDataSize += waveHdr.f.nChannels * sizeof(uint8_t) * numFrames; 198 | return (nw == numFrames) ? 0 : 1; 199 | case 16: 200 | /* TODO: endian conversion needed */ 201 | nw = fwrite(vpData, waveHdr.f.nChannels * sizeof(int16_t), numFrames, f); 202 | waveDataSize += waveHdr.f.nChannels * sizeof(int16_t) * numFrames; 203 | if ( needCleanData ) 204 | { 205 | /* TODO: convert back endianness */ 206 | } 207 | return (nw == numFrames) ? 0 : 1; 208 | } 209 | } 210 | 211 | 212 | int waveFinalizeHeader(FILE * f) 213 | { 214 | if (f != stdout) { 215 | assert( waveHdrStarted ); 216 | waveSetCurrTime( &waveHdr.a.StopTime ); 217 | waveHdr.d.hdr.size = waveDataSize; 218 | waveHdr.r.hdr.size += waveDataSize; 219 | /* fprintf(stderr, "waveFinalizeHeader(): datasize = %d\n", waveHdr.dataSize); */ 220 | waveHdrStarted = 0; 221 | if ( fseek(f, 0, SEEK_SET) ) 222 | return 1; 223 | if ( 1 != fwrite(&waveHdr, sizeof(waveFileHeader), 1, f) ) 224 | return 1; 225 | /* fprintf(stderr, "waveFinalizeHeader(): success writing header\n"); */ 226 | return 0; 227 | } 228 | return 1; 229 | } 230 | 231 | // vim: tabstop=8:softtabstop=8:shiftwidth=8:noexpandtab 232 | -------------------------------------------------------------------------------- /src/convenience/wavewrite.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 by Hayati Ayguen 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation, either version 2 of the License, or 7 | * (at your option) any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program. If not, see . 16 | */ 17 | #ifndef __WAVEWRITE_H 18 | #define __WAVEWRITE_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | extern int waveHdrStarted; 29 | 30 | /*! 31 | * helper functions to write and finalize wave headers 32 | * with compatibility to some SDR programs - showing frequency: 33 | * raw sample data still have to be written by caller to FILE*. 34 | * call waveWriteHeader() before writing anything to to file 35 | * and call waveFinalizeHeader() afterwards, 36 | * stdout/stderr can't be used, because seek to begin isn't possible. 37 | * 38 | */ 39 | 40 | void waveWriteHeader(unsigned samplerate, unsigned freq, int bitsPerSample, int numChannels, FILE * f); 41 | 42 | /* waveWriteFrames() writes (numFrames * numChannels) samples 43 | * waveWriteSamples() 44 | * both return 0, when no errors occured 45 | */ 46 | int waveWriteFrames(FILE* f, void * vpData, size_t numFrames, int needCleanData); 47 | int waveWriteSamples(FILE* f, void * vpData, size_t numSamples, int needCleanData); /* returns 0, when no errors occured */ 48 | void waveSetStartTime(time_t t, double fraction); 49 | int waveFinalizeHeader(FILE * f); /* returns 0, when no errors occured */ 50 | 51 | #ifdef __cplusplus 52 | } 53 | #endif 54 | 55 | #endif /*__WAVEWRITE_H*/ 56 | -------------------------------------------------------------------------------- /src/getopt/getopt.h: -------------------------------------------------------------------------------- 1 | /* Declarations for getopt. 2 | Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. 3 | This file is part of the GNU C Library. 4 | 5 | The GNU C Library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Lesser General Public 7 | License as published by the Free Software Foundation; either 8 | version 2.1 of the License, or (at your option) any later version. 9 | 10 | The GNU C Library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Lesser General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public 16 | License along with the GNU C Library; if not, write to the Free 17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 | 02111-1307 USA. */ 19 | 20 | #ifndef _GETOPT_H 21 | 22 | #ifndef __need_getopt 23 | # define _GETOPT_H 1 24 | #endif 25 | 26 | /* If __GNU_LIBRARY__ is not already defined, either we are being used 27 | standalone, or this is the first header included in the source file. 28 | If we are being used with glibc, we need to include , but 29 | that does not exist if we are standalone. So: if __GNU_LIBRARY__ is 30 | not defined, include , which will pull in for us 31 | if it's from glibc. (Why ctype.h? It's guaranteed to exist and it 32 | doesn't flood the namespace with stuff the way some other headers do.) */ 33 | #if !defined __GNU_LIBRARY__ 34 | # include 35 | #endif 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | 41 | /* For communication from `getopt' to the caller. 42 | When `getopt' finds an option that takes an argument, 43 | the argument value is returned here. 44 | Also, when `ordering' is RETURN_IN_ORDER, 45 | each non-option ARGV-element is returned here. */ 46 | 47 | extern char *optarg; 48 | 49 | /* Index in ARGV of the next element to be scanned. 50 | This is used for communication to and from the caller 51 | and for communication between successive calls to `getopt'. 52 | 53 | On entry to `getopt', zero means this is the first call; initialize. 54 | 55 | When `getopt' returns -1, this is the index of the first of the 56 | non-option elements that the caller should itself scan. 57 | 58 | Otherwise, `optind' communicates from one call to the next 59 | how much of ARGV has been scanned so far. */ 60 | 61 | extern int optind; 62 | 63 | /* Callers store zero here to inhibit the error message `getopt' prints 64 | for unrecognized options. */ 65 | 66 | extern int opterr; 67 | 68 | /* Set to an option character which was unrecognized. */ 69 | 70 | extern int optopt; 71 | 72 | #ifndef __need_getopt 73 | /* Describe the long-named options requested by the application. 74 | The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector 75 | of `struct option' terminated by an element containing a name which is 76 | zero. 77 | 78 | The field `has_arg' is: 79 | no_argument (or 0) if the option does not take an argument, 80 | required_argument (or 1) if the option requires an argument, 81 | optional_argument (or 2) if the option takes an optional argument. 82 | 83 | If the field `flag' is not NULL, it points to a variable that is set 84 | to the value given in the field `val' when the option is found, but 85 | left unchanged if the option is not found. 86 | 87 | To have a long-named option do something other than set an `int' to 88 | a compiled-in constant, such as set a value from `optarg', set the 89 | option's `flag' field to zero and its `val' field to a nonzero 90 | value (the equivalent single-letter option character, if there is 91 | one). For long options that have a zero `flag' field, `getopt' 92 | returns the contents of the `val' field. */ 93 | 94 | struct option 95 | { 96 | # if (defined __STDC__ && __STDC__) || defined __cplusplus 97 | const char *name; 98 | # else 99 | char *name; 100 | # endif 101 | /* has_arg can't be an enum because some compilers complain about 102 | type mismatches in all the code that assumes it is an int. */ 103 | int has_arg; 104 | int *flag; 105 | int val; 106 | }; 107 | 108 | /* Names for the values of the `has_arg' field of `struct option'. */ 109 | 110 | # define no_argument 0 111 | # define required_argument 1 112 | # define optional_argument 2 113 | #endif /* need getopt */ 114 | 115 | 116 | /* Get definitions and prototypes for functions to process the 117 | arguments in ARGV (ARGC of them, minus the program name) for 118 | options given in OPTS. 119 | 120 | Return the option character from OPTS just read. Return -1 when 121 | there are no more options. For unrecognized options, or options 122 | missing arguments, `optopt' is set to the option letter, and '?' is 123 | returned. 124 | 125 | The OPTS string is a list of characters which are recognized option 126 | letters, optionally followed by colons, specifying that that letter 127 | takes an argument, to be placed in `optarg'. 128 | 129 | If a letter in OPTS is followed by two colons, its argument is 130 | optional. This behavior is specific to the GNU `getopt'. 131 | 132 | The argument `--' causes premature termination of argument 133 | scanning, explicitly telling `getopt' that there are no more 134 | options. 135 | 136 | If OPTS begins with `--', then non-option arguments are treated as 137 | arguments to the option '\0'. This behavior is specific to the GNU 138 | `getopt'. */ 139 | 140 | #if (defined __STDC__ && __STDC__) || defined __cplusplus 141 | # ifdef __GNU_LIBRARY__ 142 | /* Many other libraries have conflicting prototypes for getopt, with 143 | differences in the consts, in stdlib.h. To avoid compilation 144 | errors, only prototype getopt for the GNU C library. */ 145 | extern int getopt (int __argc, char *const *__argv, const char *__shortopts); 146 | # else /* not __GNU_LIBRARY__ */ 147 | extern int getopt (); 148 | # endif /* __GNU_LIBRARY__ */ 149 | 150 | # ifndef __need_getopt 151 | extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, 152 | const struct option *__longopts, int *__longind); 153 | extern int getopt_long_only (int __argc, char *const *__argv, 154 | const char *__shortopts, 155 | const struct option *__longopts, int *__longind); 156 | 157 | /* Internal only. Users should not call this directly. */ 158 | extern int _getopt_internal (int __argc, char *const *__argv, 159 | const char *__shortopts, 160 | const struct option *__longopts, int *__longind, 161 | int __long_only); 162 | # endif 163 | #else /* not __STDC__ */ 164 | extern int getopt (); 165 | # ifndef __need_getopt 166 | extern int getopt_long (); 167 | extern int getopt_long_only (); 168 | 169 | extern int _getopt_internal (); 170 | # endif 171 | #endif /* __STDC__ */ 172 | 173 | #ifdef __cplusplus 174 | } 175 | #endif 176 | 177 | /* Make sure we later can get all the definitions and declarations. */ 178 | #undef __need_getopt 179 | 180 | #endif /* getopt.h */ 181 | -------------------------------------------------------------------------------- /src/rtl_app_ver.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __RTL_APP_VER_H 2 | #define __RTL_APP_VER_H 3 | 4 | #define APP_VER_MAJOR @MAJOR_VERSION@ 5 | #define APP_VER_MINOR @MINOR_VERSION@ 6 | #define APP_VER_ID "github.com/librtlsdr" 7 | 8 | #define VER_TO_STRING(x) #x 9 | #define VAL_VER_TO_STR(x) VER_TO_STRING(x) 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /src/rtl_biast.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * rtl_biast, tool to set bias tee gpio output 4 | * Copyright (C) 2012 by Steve Markgraf 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifndef _WIN32 25 | #include 26 | #else 27 | #include 28 | #include "getopt/getopt.h" 29 | #endif 30 | 31 | #include 32 | #include 33 | #include "convenience/convenience.h" 34 | #include "convenience/rtl_convenience.h" 35 | 36 | static rtlsdr_dev_t *dev = NULL; 37 | 38 | void usage(void) 39 | { 40 | fprintf(stderr, 41 | "rtl_biast, a tool for switching the RTL-SDR.com\n" 42 | "bias tee or any GPIO ON and OFF. Example to activate\n" 43 | "the bias tee: rtl_biast -d 0 -b 1\n" 44 | "Any GPIO: rtl_biast -d 0 -g 1 -b 1\n" 45 | "rtl_biast version %d.%d %s (%s)\n" 46 | "rtl-sdr library %d.%d %s\n\n", 47 | APP_VER_MAJOR, APP_VER_MINOR, APP_VER_ID, __DATE__, 48 | rtlsdr_get_version() >>16, rtlsdr_get_version() & 0xFFFF, 49 | rtlsdr_get_ver_id() ); 50 | fprintf(stderr, 51 | "Usage:\trtl_biast [-options]\n" 52 | "\t[-d device_index (default: 0)]\n" 53 | "\t[-g GPIO select (default: 0)]\n" 54 | "\t[-b set write bias_on (default: 0, in output mode)]\n" 55 | "\t[-r read pin (in input mode)]\n" 56 | "\t[-w write pin (in output mode)]\n" 57 | "\t[-s read all GPIO pins status (0 = write, 1 = read ?? )]\n" 58 | "\t[-R read all GPIO pins ?? ]\n"); 59 | exit(1); 60 | } 61 | 62 | int main(int argc, char **argv) 63 | { 64 | int i, r, opt, val; 65 | int dev_index = 0; 66 | int dev_given = 0; 67 | int write_pin_given = 0; 68 | int read_pin_given = 0; 69 | int read_all_given = 0; 70 | int req_status = 0; 71 | uint32_t bias_on = 0; 72 | int gpio_pin = 0; 73 | int device_count; 74 | 75 | while ((opt = getopt(argc, argv, "d:b:w:g:srRh?")) != -1) { 76 | switch (opt) { 77 | case 'd': 78 | dev_index = verbose_device_search(optarg); 79 | dev_given = 1; 80 | break; 81 | case 'b': 82 | case 'w': 83 | bias_on = atoi(optarg); 84 | write_pin_given = 1; 85 | break; 86 | case 'g': 87 | gpio_pin = atoi(optarg); 88 | break; 89 | case 'r': 90 | read_pin_given = 1; 91 | break; 92 | case 'R': 93 | read_all_given = 1; 94 | break; 95 | case 's': 96 | req_status = 1; 97 | break; 98 | default: 99 | usage(); 100 | break; 101 | } 102 | } 103 | 104 | if (!dev_given) { 105 | dev_index = verbose_device_search("0"); 106 | } 107 | 108 | if (dev_index < 0) { 109 | exit(1); 110 | } 111 | 112 | r = rtlsdr_open(&dev, dev_index); 113 | if (r < 0) 114 | { 115 | fprintf(stderr, "error opening device with index %d\n", dev_index); 116 | return -r; 117 | } 118 | 119 | if (write_pin_given) 120 | { 121 | r = rtlsdr_set_bias_tee_gpio(dev, gpio_pin, bias_on); 122 | if (r < 0) 123 | fprintf(stderr, "error setting value %d on pin %d\n", bias_on, gpio_pin); 124 | } 125 | 126 | else if (read_pin_given) 127 | { 128 | r = rtlsdr_set_gpio_input(dev, gpio_pin); 129 | if (r < 0) 130 | fprintf(stderr, "error configuring pin %d to input\n", gpio_pin); 131 | 132 | r = rtlsdr_get_gpio_bit(dev, gpio_pin, &val); 133 | if (r < 0) 134 | fprintf(stderr, "error reading value for pin %d\n", gpio_pin); 135 | else 136 | printf("value %d at pin %d\n", val, gpio_pin); 137 | } 138 | 139 | else if (read_all_given) 140 | { 141 | r = rtlsdr_get_gpio_byte(dev, &val); 142 | if (r < 0) 143 | fprintf(stderr, "error reading value for all pins\n"); 144 | else 145 | { 146 | printf("GPIO 0x%02x = bin ", val); 147 | for (gpio_pin = 7; gpio_pin >= 4; --gpio_pin) 148 | printf("%d", ((val >> gpio_pin) & 1)); 149 | printf(" "); 150 | for (gpio_pin = 3; gpio_pin >= 0; --gpio_pin) 151 | printf("%d", ((val >> gpio_pin) & 1)); 152 | printf("\n"); 153 | } 154 | } 155 | 156 | else if (req_status) 157 | { 158 | r = rtlsdr_set_gpio_status(dev, &val); 159 | if (r < 0) 160 | fprintf(stderr, "error reading status for all pins\n"); 161 | else 162 | { 163 | printf("STATUS 0x%02x = bin ", val); 164 | for (gpio_pin = 7; gpio_pin >= 4; --gpio_pin) 165 | printf("%d", ((val >> gpio_pin) & 1)); 166 | printf(" "); 167 | for (gpio_pin = 3; gpio_pin >= 0; --gpio_pin) 168 | printf("%d", ((val >> gpio_pin) & 1)); 169 | printf("\n"); 170 | } 171 | } 172 | 173 | else 174 | { 175 | usage(); 176 | r = -1; 177 | } 178 | 179 | exit: 180 | /* 181 | * Note - rtlsdr_close() in this tree does not clear the bias tee 182 | * GPIO line, so it leaves the bias tee enabled if a client program 183 | * doesn't explictly disable it. 184 | * 185 | * If that behaviour changes then another rtlsdr_close() will be 186 | * needed that takes some extension flags, and one of them should 187 | * be to either explicitly close the biast or leave it alone. 188 | */ 189 | rtlsdr_close(dev); 190 | 191 | return r >= 0 ? r : -r; 192 | } 193 | -------------------------------------------------------------------------------- /src/rtl_ir.c: -------------------------------------------------------------------------------- 1 | /* 2 | * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver 3 | * Copyright (C) 2009 Antti Palosaari 4 | * Copyright (C) 2011 Antti Palosaari 5 | * Copyright (C) 2012 Thomas Mair 6 | * Copyright (C) 2012 by Steve Markgraf 7 | * Copyright (C) 2012 by Hoernchen 8 | * Copyright (C) 2012 by Kyle Keen 9 | * Copyright (C) 2013 by Elias Oenal 10 | * Copyright (C) 2016 by Robert X. Seger 11 | * 12 | * This program is free software: you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation, either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program. If not, see . 24 | */ 25 | 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #ifndef _WIN32 34 | #include 35 | #else 36 | #include 37 | #include 38 | #include 39 | #include "getopt/getopt.h" 40 | #define usleep(x) Sleep(x/1000) 41 | #if defined(_MSC_VER) && (_MSC_VER < 1800) 42 | #define round(x) (x > 0.0 ? floor(x + 0.5): ceil(x - 0.5)) 43 | #endif 44 | #define _USE_MATH_DEFINES 45 | #endif 46 | 47 | #include 48 | #include 49 | 50 | #include 51 | #include 52 | #include "convenience/convenience.h" 53 | #include "convenience/rtl_convenience.h" 54 | 55 | static volatile int do_exit = 0; 56 | 57 | struct dongle_state 58 | { 59 | int exit_flag; 60 | rtlsdr_dev_t *dev; 61 | int dev_index; 62 | }; 63 | 64 | void dongle_init(struct dongle_state *s) 65 | { 66 | memset(s, 0, sizeof(struct dongle_state)); 67 | } 68 | 69 | struct dongle_state dongle; 70 | 71 | void usage(void) 72 | { 73 | fprintf(stderr, 74 | "rtl_ir, display received IR signals\n" 75 | "rtl_ir version %d.%d %s (%s)\n" 76 | "rtl-sdr library %d.%d %s\n\n", 77 | APP_VER_MAJOR, APP_VER_MINOR, APP_VER_ID, __DATE__, 78 | rtlsdr_get_version() >>16, rtlsdr_get_version() & 0xFFFF, 79 | rtlsdr_get_ver_id() ); 80 | fprintf(stderr, 81 | "Usage:\trtl_ir [-options]\n" 82 | "\t[-d device_index (default: 0)]\n" 83 | "\t[-w wait_usec]\tDelay to wait before each iteration (10000)\n" 84 | "\t[-c max_count]\tMaximum number of loop iterations (0)\n" 85 | "\t[-b]\tDisplay output in binary (default), pulse=1, space=0; each 20 usec\n" 86 | "\t[-t]\tDisplay output in text format\n" 87 | "\t[-x]\tDisplay output in raw packed bytes, MSB=pulse/space, 7LSB=duration*20 usec\n" 88 | "\t[-h]\tHelp\n" 89 | ); 90 | exit(1); 91 | } 92 | 93 | #ifdef _WIN32 94 | BOOL WINAPI 95 | sighandler(int signum) 96 | { 97 | if (CTRL_C_EVENT == signum) { 98 | fprintf(stderr, "Signal caught, exiting!\n"); 99 | do_exit = 1; 100 | rtlsdr_cancel_async(dongle.dev); 101 | return TRUE; 102 | } 103 | return FALSE; 104 | } 105 | #else 106 | static void sighandler(int signum) 107 | { 108 | fprintf(stderr, "Signal caught, exiting!\n"); 109 | do_exit = 1; 110 | rtlsdr_cancel_async(dongle.dev); 111 | } 112 | #endif 113 | 114 | 115 | int main(int argc, char **argv) { 116 | #ifndef _WIN32 117 | struct sigaction sigact; 118 | #endif 119 | int r, opt; 120 | int i, j; 121 | int dev_given = 0; 122 | unsigned int wait_usec = 100000; 123 | int max_count = 0, iteration_count = 0; 124 | int output_binary = 0, output_text = 0, output_packed = 0; 125 | uint8_t buf[128] = { 0 }; 126 | 127 | dongle_init(&dongle); 128 | 129 | while ((opt = getopt(argc, argv, "d:c:w:btxh")) != -1) { 130 | switch (opt) { 131 | case 'd': 132 | dongle.dev_index = verbose_device_search(optarg); 133 | dev_given = 1; 134 | break; 135 | case 'w': 136 | wait_usec = atoi(optarg); 137 | break; 138 | case 'c': 139 | max_count = atoi(optarg); 140 | break; 141 | case 'b': 142 | output_binary = 1; 143 | break; 144 | case 't': 145 | output_text = 1; 146 | break; 147 | case 'x': 148 | output_packed = 1; 149 | break; 150 | case 'h': 151 | default: 152 | usage(); 153 | break; 154 | } 155 | } 156 | 157 | if (dongle.dev_index < 0) { 158 | exit(1); 159 | } 160 | 161 | r = rtlsdr_open(&dongle.dev, (uint32_t)dongle.dev_index); 162 | if (r < 0) { 163 | fprintf(stderr, "Failed to open rtlsdr device #%d.\n", dongle.dev_index); 164 | exit(1); 165 | } 166 | #ifndef _WIN32 167 | sigact.sa_handler = sighandler; 168 | sigemptyset(&sigact.sa_mask); 169 | sigact.sa_flags = 0; 170 | sigaction(SIGINT, &sigact, NULL); 171 | sigaction(SIGTERM, &sigact, NULL); 172 | sigaction(SIGQUIT, &sigact, NULL); 173 | sigaction(SIGPIPE, &sigact, NULL); 174 | #else 175 | SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE ); 176 | #endif 177 | 178 | verbose_reset_buffer(dongle.dev); 179 | 180 | if (!output_binary && !output_text && !output_packed) 181 | output_binary = 1; 182 | 183 | while (!do_exit) { 184 | usleep(wait_usec); 185 | 186 | r = rtlsdr_ir_query(dongle.dev, buf, sizeof(buf)); 187 | if (r < 0) { 188 | fprintf(stderr, "rtlsdr_ir_query failed: %d\n", r); 189 | } 190 | 191 | for (i = 0; i < r; i++) { 192 | int pulse = buf[i] >> 7; 193 | int duration = buf[i] & 0x7f; 194 | 195 | if (output_text) { 196 | printf("pulse %d, duration %d usec\n", pulse, duration * 20); 197 | } 198 | 199 | if (output_binary) { 200 | for (j = 0; j < duration; ++j) { 201 | printf("%d", pulse); 202 | } 203 | } 204 | 205 | if (output_packed) { 206 | putchar(buf[i]); 207 | } 208 | } 209 | if (r != 0) printf("\n"); 210 | fflush(stdout); 211 | 212 | if (max_count != 0 && ++iteration_count >= max_count) do_exit = 1; 213 | } 214 | 215 | if (do_exit) { 216 | fprintf(stderr, "\nUser cancel, exiting...\n");} 217 | else { 218 | fprintf(stderr, "\nLibrary error %d, exiting...\n", r);} 219 | 220 | rtlsdr_cancel_async(dongle.dev); 221 | 222 | rtlsdr_close(dongle.dev); 223 | return r >= 0 ? r : -r; 224 | 225 | return 0; 226 | } 227 | -------------------------------------------------------------------------------- /src/rtlsdr.rc.in: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | VS_VERSION_INFO VERSIONINFO 5 | FILEVERSION 0,0,0,0 6 | PRODUCTVERSION 0,0,0,0 7 | FILEFLAGSMASK 0x3fL 8 | #ifndef NDEBUG 9 | FILEFLAGS 0x0L 10 | #else 11 | FILEFLAGS 0x1L 12 | #endif 13 | FILEOS VOS__WINDOWS32 14 | FILETYPE VFT_DLL 15 | FILESUBTYPE VFT2_DRV_INSTALLABLE 16 | BEGIN 17 | BLOCK "StringFileInfo" 18 | BEGIN 19 | BLOCK "040904b0" 20 | BEGIN 21 | VALUE "FileDescription", "osmocom rtl-sdr" 22 | VALUE "FileVersion", "@VERSION@" 23 | VALUE "InternalName", "rtl-sdr.dll" 24 | VALUE "LegalCopyright", "Licensed under GPLv2" 25 | VALUE "OriginalFilename", "rtl-sdr.dll" 26 | VALUE "ProductName", "github.com/librtlsdr/librtlsdr" 27 | VALUE "ProductVersion", "@VERSION@" 28 | END 29 | END 30 | BLOCK "VarFileInfo" 31 | BEGIN 32 | VALUE "Translation", 0x409, 1200 33 | END 34 | END 35 | -------------------------------------------------------------------------------- /src/rtlsdr_rpc_msg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "rtlsdr_rpc_msg.h" 6 | 7 | #if 1 8 | #include 9 | #define PRINTF(__s, ...) fprintf(stderr, __s, ##__VA_ARGS__) 10 | #define TRACE() PRINTF("[t] %s,%u\n", __FILE__, __LINE__) 11 | #define ERROR() PRINTF("[e] %s,%u\n", __FILE__, __LINE__) 12 | #else 13 | #define TRACE() 14 | #define ERROR() 15 | #define PRINTF(...) 16 | #endif 17 | 18 | 19 | int rtlsdr_rpc_msg_init(rtlsdr_rpc_msg_t* msg, size_t data_size) 20 | { 21 | size_t fmt_size; 22 | 23 | if (data_size == 0) data_size = 64; 24 | 25 | fmt_size = offsetof(rtlsdr_rpc_fmt_t, data) + data_size; 26 | msg->fmt = malloc(fmt_size); 27 | if (msg->fmt == NULL) return -1; 28 | 29 | msg->off = offsetof(rtlsdr_rpc_fmt_t, data); 30 | msg->size = fmt_size; 31 | 32 | return 0; 33 | } 34 | 35 | int rtlsdr_rpc_msg_fini(rtlsdr_rpc_msg_t* msg) 36 | { 37 | free(msg->fmt); 38 | return 0; 39 | } 40 | 41 | void rtlsdr_rpc_msg_reset(rtlsdr_rpc_msg_t* msg) 42 | { 43 | msg->off = offsetof(rtlsdr_rpc_fmt_t, data); 44 | } 45 | 46 | int rtlsdr_rpc_msg_realloc(rtlsdr_rpc_msg_t* msg, size_t size) 47 | { 48 | uint8_t* new_fmt; 49 | 50 | if (msg->size >= size) return 0; 51 | 52 | new_fmt = malloc(size); 53 | if (new_fmt == NULL) return -1; 54 | 55 | memcpy(new_fmt, msg->fmt, msg->off); 56 | free(msg->fmt); 57 | msg->fmt = new_fmt; 58 | msg->size = size; 59 | 60 | return 0; 61 | } 62 | 63 | static int check_size(const rtlsdr_rpc_msg_t* msg, size_t size) 64 | { 65 | if ((msg->off + size) > msg->size) return -1; 66 | return 0; 67 | } 68 | 69 | static int check_size_or_realloc(rtlsdr_rpc_msg_t* msg, size_t size) 70 | { 71 | uint8_t* new_fmt; 72 | size_t new_size; 73 | 74 | if (check_size(msg, size) == 0) return 0; 75 | 76 | new_size = (msg->off + size + 256) & ~(256 - 1); 77 | new_fmt = malloc(new_size); 78 | if (new_fmt == NULL) return -1; 79 | 80 | memcpy(new_fmt, msg->fmt, msg->off); 81 | free(msg->fmt); 82 | 83 | msg->fmt = new_fmt; 84 | msg->size = new_size; 85 | 86 | return 0; 87 | } 88 | 89 | static int pop_uint32(rtlsdr_rpc_msg_t* msg, uint32_t* x) 90 | { 91 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 92 | #error "unsupported endianness" 93 | #endif 94 | 95 | if (check_size(msg, sizeof(uint32_t))) return -1; 96 | *x = *(const uint32_t*)(msg->fmt + msg->off); 97 | msg->off += sizeof(uint32_t); 98 | return 0; 99 | } 100 | 101 | static void push_mem_safe(rtlsdr_rpc_msg_t* msg, const uint8_t* x, size_t n) 102 | { 103 | memcpy(msg->fmt + msg->off, x, n); 104 | msg->off += n; 105 | } 106 | 107 | static void push_uint32_safe(rtlsdr_rpc_msg_t* msg, uint32_t x) 108 | { 109 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 110 | #error "unsupported endianness" 111 | #endif 112 | 113 | push_mem_safe(msg, (const uint8_t*)&x, sizeof(uint32_t)); 114 | } 115 | 116 | int rtlsdr_rpc_msg_push_int32(rtlsdr_rpc_msg_t* msg, int x) 117 | { 118 | if (check_size_or_realloc(msg, sizeof(x))) return -1; 119 | push_uint32_safe(msg, (uint32_t)x); 120 | return 0; 121 | } 122 | 123 | int rtlsdr_rpc_msg_push_uint32(rtlsdr_rpc_msg_t* msg, uint32_t x) 124 | { 125 | if (check_size_or_realloc(msg, sizeof(x))) return -1; 126 | push_uint32_safe(msg, x); 127 | return 0; 128 | } 129 | 130 | void rtlsdr_rpc_msg_push_uint32_safe(rtlsdr_rpc_msg_t* msg, uint32_t x) 131 | { 132 | push_uint32_safe(msg, x); 133 | } 134 | 135 | int rtlsdr_rpc_msg_push_str(rtlsdr_rpc_msg_t* msg, const char* s) 136 | { 137 | if (check_size_or_realloc(msg, strlen(s) + 1)) return -1; 138 | push_mem_safe(msg, (const uint8_t*)s, strlen(s) + 1); 139 | return 0; 140 | } 141 | 142 | int rtlsdr_rpc_msg_push_buf(rtlsdr_rpc_msg_t* msg, const uint8_t* buf, size_t size) 143 | { 144 | size_t total_size = sizeof(uint32_t) + size; 145 | if (check_size_or_realloc(msg, total_size)) return -1; 146 | push_uint32_safe(msg, (uint32_t)size); 147 | push_mem_safe(msg, buf, size); 148 | return 0; 149 | } 150 | 151 | void rtlsdr_rpc_msg_skip_safe(rtlsdr_rpc_msg_t* msg, size_t size) 152 | { 153 | msg->off += size; 154 | } 155 | 156 | int rtlsdr_rpc_msg_pop_int32(rtlsdr_rpc_msg_t* msg, int32_t* x) 157 | { 158 | return pop_uint32(msg, (uint32_t*)x); 159 | } 160 | 161 | int rtlsdr_rpc_msg_pop_uint32(rtlsdr_rpc_msg_t* msg, uint32_t* x) 162 | { 163 | return pop_uint32(msg, x); 164 | } 165 | 166 | int rtlsdr_rpc_msg_pop_str(rtlsdr_rpc_msg_t* msg, const char** s) 167 | { 168 | size_t i; 169 | 170 | *s = (const char*)(msg->fmt + msg->off); 171 | 172 | for (i = msg->off; i != msg->size; ++i) 173 | { 174 | if (msg->fmt[i] == 0) 175 | { 176 | msg->off = i + 1; 177 | return 0; 178 | } 179 | } 180 | 181 | return -1; 182 | } 183 | 184 | int rtlsdr_rpc_msg_pop_buf 185 | (rtlsdr_rpc_msg_t* msg, const uint8_t** buf, size_t* size) 186 | { 187 | uint32_t x; 188 | 189 | if (pop_uint32(msg, &x)) return -1; 190 | if ((msg->off + x) > msg->size) return -1; 191 | 192 | *buf = (const uint8_t*)(msg->fmt + msg->off); 193 | msg->off += x; 194 | 195 | *size = (size_t)x; 196 | 197 | return 0; 198 | } 199 | 200 | static void put_uint8(void* p, uint8_t x) 201 | { 202 | memcpy(p, (const void*)&x, sizeof(x)); 203 | } 204 | 205 | static void put_uint16(void* p, uint16_t x) 206 | { 207 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 208 | #error "unsupported endianness" 209 | #endif 210 | 211 | memcpy(p, (const void*)&x, sizeof(x)); 212 | } 213 | 214 | static void put_uint32(void* p, uint32_t x) 215 | { 216 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 217 | #error "unsupported endianness" 218 | #endif 219 | 220 | memcpy(p, (const void*)&x, sizeof(x)); 221 | } 222 | 223 | static uint8_t get_uint8(const void* p) 224 | { 225 | uint8_t x; 226 | memcpy((void*)&x, p, sizeof(x)); 227 | return x; 228 | } 229 | 230 | static uint16_t get_uint16(const void* p) 231 | { 232 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 233 | #error "unsupported endianness" 234 | #endif 235 | 236 | uint16_t x; 237 | memcpy((void*)&x, p, sizeof(x)); 238 | return x; 239 | } 240 | 241 | static uint32_t get_uint32(const void* p) 242 | { 243 | #if (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 244 | #error "unsupported endianness" 245 | #endif 246 | 247 | uint32_t x; 248 | memcpy((void*)&x, p, sizeof(x)); 249 | return x; 250 | } 251 | 252 | void rtlsdr_rpc_msg_set_size(rtlsdr_rpc_msg_t* msg, size_t size) 253 | { 254 | rtlsdr_rpc_fmt_t* const fmt = (rtlsdr_rpc_fmt_t*)msg->fmt; 255 | put_uint32(&fmt->size, (uint32_t)size); 256 | } 257 | 258 | size_t rtlsdr_rpc_msg_get_size(const rtlsdr_rpc_msg_t* msg) 259 | { 260 | const rtlsdr_rpc_fmt_t* const fmt = (const rtlsdr_rpc_fmt_t*)msg->fmt; 261 | return (size_t)get_uint32(&fmt->size); 262 | } 263 | 264 | void rtlsdr_rpc_msg_set_op(rtlsdr_rpc_msg_t* msg, rtlsdr_rpc_op_t op) 265 | { 266 | rtlsdr_rpc_fmt_t* const fmt = (rtlsdr_rpc_fmt_t*)msg->fmt; 267 | put_uint8(&fmt->op, (uint8_t)op); 268 | } 269 | 270 | rtlsdr_rpc_op_t rtlsdr_rpc_msg_get_op(const rtlsdr_rpc_msg_t* msg) 271 | { 272 | const rtlsdr_rpc_fmt_t* const fmt = (const rtlsdr_rpc_fmt_t*)msg->fmt; 273 | return (rtlsdr_rpc_op_t)get_uint8(&fmt->op); 274 | } 275 | 276 | void rtlsdr_rpc_msg_set_id(rtlsdr_rpc_msg_t* msg, uint8_t id) 277 | { 278 | rtlsdr_rpc_fmt_t* const fmt = (rtlsdr_rpc_fmt_t*)msg->fmt; 279 | put_uint16(&fmt->id, id); 280 | } 281 | 282 | uint8_t rtlsdr_rpc_msg_get_id(const rtlsdr_rpc_msg_t* msg) 283 | { 284 | const rtlsdr_rpc_fmt_t* const fmt = (const rtlsdr_rpc_fmt_t*)msg->fmt; 285 | return get_uint8(&fmt->id); 286 | } 287 | 288 | void rtlsdr_rpc_msg_set_err(rtlsdr_rpc_msg_t* msg, int err) 289 | { 290 | rtlsdr_rpc_fmt_t* const fmt = (rtlsdr_rpc_fmt_t*)msg->fmt; 291 | put_uint32(&fmt->err, (uint32_t)err); 292 | } 293 | 294 | int rtlsdr_rpc_msg_get_err(const rtlsdr_rpc_msg_t* msg) 295 | { 296 | const rtlsdr_rpc_fmt_t* const fmt = (const rtlsdr_rpc_fmt_t*)msg->fmt; 297 | return (int)get_uint32(&fmt->err); 298 | } 299 | -------------------------------------------------------------------------------- /win32-qtcreator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(rtlsdr) 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | # created and tested with 5 | # Qt 5.6.1 for Windows 32-bit (MinGW 4.9.2) from 6 | # https://www.qt.io/download-open-source/#section-2 7 | # 8 | # and QtCreator 4.1.0 9 | # 10 | # and LibUSB 1.0.20 from 11 | # https://sourceforge.net/projects/libusb/files/ 12 | # libusb-1.0.20.7z 13 | # 14 | 15 | # edit this path 16 | SET( LIBUSBBASE C:/src/_foreign/libusb-1.0.20 ) 17 | 18 | OPTION(RTL_FULL_STATIC_BUILD "Build rtl-tools fully static." ON) 19 | 20 | if(RTL_FULL_STATIC_BUILD) 21 | if (WIN32) 22 | if(MINGW) 23 | # Special MINGW stuff here 24 | # see https://cmake.org/pipermail/cmake/2012-September/051970.html 25 | # see http://stackoverflow.com/questions/13768515/how-to-do-static-linking-of-libwinpthread-1-dll-in-mingw 26 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc") 27 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++") 28 | set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -static -static-libgcc -s") 29 | set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS} -static -static-libgcc -static-libstdc++ -s") 30 | endif() 31 | endif() 32 | endif() 33 | 34 | 35 | add_definitions( -DWIN32 -D_WIN32 -DNDEBUG ) 36 | 37 | include_directories( 38 | ../include 39 | ${LIBUSBBASE}/include/libusb-1.0 40 | ) 41 | 42 | SET( LIBUSB ${LIBUSBBASE}/MinGW32/static/libusb-1.0.a ) 43 | 44 | SET( SOCKLIBS ws2_32 wsock32 ) 45 | 46 | SET( RTLLIBFILES 47 | ../include/rtl_tcp.h 48 | ../include/reg_field.h 49 | ../include/rtlsdr_i2c.h 50 | 51 | ../src/convenience/convenience.c 52 | ../src/convenience/convenience.h 53 | ../src/convenience/wavewrite.c 54 | ../src/convenience/wavewrite.h 55 | 56 | ../src/getopt/getopt.c 57 | ../src/getopt/getopt.h 58 | 59 | ../include/rtl-sdr_export.h 60 | ../include/rtl-sdr.h 61 | ../src/librtlsdr.c 62 | 63 | ../include/tuner_e4k.h 64 | ../src/tuner_e4k.c 65 | 66 | ../include/tuner_fc0012.h 67 | ../src/tuner_fc0012.c 68 | 69 | ../include/tuner_fc0013.h 70 | ../src/tuner_fc0013.c 71 | 72 | ../include/tuner_fc2580.h 73 | ../src/tuner_fc2580.c 74 | 75 | ../include/tuner_r82xx.h 76 | ../src/tuner_r82xx.c 77 | ) 78 | 79 | add_executable( rtl_test ../src/rtl_test.c ${RTLLIBFILES} ) 80 | target_link_libraries( rtl_test ${LIBUSB} ) 81 | 82 | add_executable( rtl_fm ../src/rtl_fm.c ${RTLLIBFILES} ) 83 | target_link_libraries( rtl_fm ${LIBUSB} ) 84 | 85 | add_executable( rtl_tcp ../src/rtl_tcp.c ${RTLLIBFILES} ) 86 | target_link_libraries( rtl_tcp ${LIBUSB} ${SOCKLIBS} ) 87 | 88 | add_executable( rtl_udp ../src/rtl_udp.c ${RTLLIBFILES} ) 89 | target_link_libraries( rtl_udp ${LIBUSB} ${SOCKLIBS} ) 90 | 91 | add_executable( rtl_sdr ../src/rtl_sdr.c ${RTLLIBFILES} ) 92 | target_link_libraries( rtl_sdr ${LIBUSB} ) 93 | 94 | add_executable( rtl_adsb ../src/rtl_adsb.c ${RTLLIBFILES} ) 95 | target_link_libraries( rtl_adsb ${LIBUSB} ) 96 | 97 | add_executable( rtl_power ../src/rtl_power.c ${RTLLIBFILES} ) 98 | target_link_libraries( rtl_power ${LIBUSB} ) 99 | 100 | add_executable( rtl_ir ../src/rtl_ir.c ${RTLLIBFILES} ) 101 | target_link_libraries( rtl_ir ${LIBUSB} ) 102 | 103 | add_executable( rtl_eeprom ../src/rtl_eeprom.c ${RTLLIBFILES} ) 104 | target_link_libraries( rtl_eeprom ${LIBUSB} ) 105 | 106 | if (NOT WIN32) 107 | # errors at compilation with MinGW, e.g. missing include sys/select.h 108 | add_executable( rtl_rpcd ../src/rtl_rpcd.c ../src/rtlsdr_rpc_msg.c ${RTLLIBFILES} ) 109 | target_link_libraries( rtl_rpcd ${LIBUSB} ) 110 | endif() 111 | 112 | -------------------------------------------------------------------------------- /win32-qtcreator/README.txt: -------------------------------------------------------------------------------- 1 | 2 | there is an outdated "How to compile new releases of librtlsdr (and tools) on Windows" at 3 | https://www.reddit.com/r/RTLSDR/comments/uce3e/how_to_compile_new_releases_of_librtlsdr_and/ 4 | unfortunately the link to the CMakeLists.txt is broken! 5 | 6 | so, i needed to find another solution .. 7 | 8 | 9 | 1) aquire and install Qt 5.5.x for Windows 32-bit (MinGW 4.9.2) from 10 | https://www.qt.io/download-open-source/#section-2 11 | 12 | 2) aquire and install QtCreator 4.0.x 13 | from same site as 1) 14 | probably this step is not necessary and you can use the qtcreator IDE from 1) 15 | 16 | 3) aquire LibUSB 1.0.20 from 17 | https://sourceforge.net/projects/libusb/files/ 18 | last tested: libusb-1.0.20.7z 19 | 20 | and place the file at C:/src/_foreign/libusb-1.0.20 21 | 22 | or replace LIBUSBBASE path in CMakeLists.txt 23 | 24 | 4) start qtcreator and open the (modified) CMakeLists.txt 25 | configure compiler/environment and compile 26 | 27 | 28 | the resulting executables have no other dependencies than libwinpthread-1.dll 29 | from the MINGW system at C:\Qt\Qt5.5.1\Tools\mingw492_32\bin\ 30 | or C:\Qt\Qt5.5.1\5.5\mingw492_32\bin 31 | 32 | ======================================================================= 33 | 34 | opening main CMakeLists.txt in root (above win32-qtcreator) with above QT 5.5/qtcreator 35 | 36 | set RTL_STATIC_BUILD = ON 37 | set LIBUSB_FOUND = TRUE 38 | set LIBUSB_INCLUDE_DIR = C:/src/_foreign/libusb-1.0.20/include/libusb-1.0 39 | set LIBUSB_LIBRARIES = C:/src/_foreign/libusb-1.0.20/MinGW32/static/libusb-1.0.a 40 | set THREADS_PTHREADS_INCLUDE_DIR = C:/Qt/Qt5.6.1/Tools/mingw492_32/i686-w64-mingw32/include 41 | set THREADS_PTHREADS_WIN32_LIBRARY = C:/Qt/Qt5.6.1/Tools/mingw492_32/i686-w64-mingw32/lib/libwinpthread.a 42 | 43 | the resulting executables have no other dependencies, except the freshly built librtlsdr.dll 44 | --------------------------------------------------------------------------------