红联Linux门户
Linux帮助

使用rtl-usb接收无线电

发布时间:2017-01-29 09:52:39来源:linux网站作者:哦布斯
准备:
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_rtl28xxu  
blacklist rtl2832  
blacklist 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]# lsusb  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub  
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub  
Bus 001 Device 002: ID 0e0f:000b VMware, Inc.   
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse  
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub  
Bus 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.git  
export PKG_CONFIG_PATH=/root/sources/sdr/rtl-sdr/rtl-sdr/cmake/  
make  
./dump1090 --interactive
 
本文永久更新地址:http://www.linuxdiyf.com/linux/28012.html