使用rtl-usb接收无线电

来源:互联网 发布:Mac air怎么下steam 编辑:程序博客网 时间:2024/05/21 09:32

准备:

1. 硬件:RTL-SDR R820T2 TUNER,某宝上30左右一个

2. CentOS


1. 下载RTL-SDR软件

git clone git://git.osmocom.org/rtl-sdr.git

2. 编译&安装

$cd cmake$cmake ..$make install

增加/etc/modprobe.d/no-rtl.conf

blacklist dvb_usb_rtl28xxublacklist rtl2832blacklist rtl2830

3. 接收FM广播

$rtl_fm -f 955e5 -M wbfm -s 480k -r 48000 - | aplay -r 48k -f S16_LE


4. 复位USB接口

#include <stdio.h>#include <fcntl.h>#include <errno.h>#include <sys/ioctl.h>#include <linux/usbdevice_fs.h>void main(int argc, char **argv){        const char *filename;        int fd;        filename = argv[1];        fd = open(filename, O_WRONLY);        ioctl(fd, USBDEVFS_RESET, 0);        close(fd);        return;}

[root@dev sdr]# gcc -o reset reset.c reset.c: In function ‘main’:reset.c:13:2: warning: implicit declaration of function ‘close’ [-Wimplicit-function-declaration]  close(fd);  ^[root@dev sdr]# lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 001 Device 002: ID 0e0f:000b VMware, Inc. Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual MouseBus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB HubBus 002 Device 004: ID 0e0f:0008 VMware, Inc. Bus 001 Device 003: ID 0bda:2838 Realtek Semiconductor Corp. RTL2838 DVB-T[root@dev sdr]# ./reset /dev/bus/usb/001/003 [root@dev sdr]# 

5. 接收飞机飞行数据

git clone https://github.com/antirez/dump1090.gitexport PKG_CONFIG_PATH=/root/sources/sdr/rtl-sdr/rtl-sdr/cmake/make./dump1090 --interactive

参考:

http://www.rtlsdr.org

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

http://www.evil0x.com/posts/6401.html

http://www.cnblogs.com/k1two2/p/5758136.html

0 0