Browse Source

removed rtl-sdr files and modified CMake and autotools configurations

Helge Weissig 5 years ago
parent
commit
50cfd95da1

+ 2 - 4
.gitignore

@@ -17,6 +17,7 @@ config.log
 config.status
 config.guess
 configure
+compile
 depcomp
 missing
 ltmain.sh
@@ -24,7 +25,7 @@ install-sh
 stamp-h1
 libtool
 Doxyfile
-build
+.dirstamp
 
 .tarball-version
 .version
@@ -37,9 +38,6 @@ src/rtl_sdr
 src/rtl_tcp
 
 CMakeCache.txt
-*/CMakeFiles
-CMakeFiles
-*.cmake
 
 build/
 .cproject

+ 20 - 4
AUTHORS

@@ -1,4 +1,20 @@
-Steve Markgraf <steve@steve-m.de>
-Dimitri Stolnikov <horiz0n@gmx.net>
-Hoernchen <la@tfc-server.de>
-Kyle Keen <keenerd@gmail.com>
+Benjamin Larsson <benjamin@southpole.se>
+Sven Killig <sven@killig.de>
+Benjamin Larsson <banan@ludd.ltu.se>
+rct <rct+github@r-t.org>
+johan <johan@E6410>
+Thomas Kerpe <toke@toke.de>
+Jens Jensen <zerog2k@yahoo.com>
+Sven <sonic@sonic-VGN-Z41WD-B.(none)>
+Martin Hauke <mardnh@gmx.de>
+magellannh <pi@raspberrypi.(none)>
+jules69350 <julien.sangouard@gmail.com>
+arantius <arantius@gmail.com>
+andreaaizza <andrea@andreaaizza.com>
+Trueffelwurm <jens@trueffelwurm.de>
+Tomasz Brzezina <tombrz@Bonawentura.brzezina.pl>
+Paul F-Y <pbfy00@gmail.com>
+Corné van Strien <github@atilas.nl>
+Baruch Even <baruch@ev-en.org>
+Andrea <andrea@andreaaizza.com>
+Helge Weissig <helgew@grajagan.org>

+ 11 - 64
CMakeLists.txt

@@ -1,13 +1,4 @@
-# Copyright 2012 OSMOCOM Project
-#
-# This file is part of rtl-sdr
-#
-# GNU Radio is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3, or (at your option)
-# any later version.
-#
-# GNU Radio is distributed in the hope that it will be useful,
+# rtl_433 is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
@@ -22,7 +13,9 @@
 # Project setup
 ########################################################################
 cmake_minimum_required(VERSION 2.6)
-project(rtlsdr C)
+project(rtl433 C)
+set (rtl433_VERSION_MAJOR 1)
+set (rtl433_VERSION_MINOR 0)
 
 #select the release build type by default to get optimization flags
 if(NOT CMAKE_BUILD_TYPE)
@@ -50,32 +43,16 @@ endif()
 # Find build dependencies
 ########################################################################
 find_package(PkgConfig)
-find_package(LibUSB)
-set(THREADS_USE_PTHREADS_WIN32 true)
-find_package(Threads)
+find_package(LibRTLSDR)
 
-if(NOT LIBUSB_FOUND)
-    message(FATAL_ERROR "LibUSB 1.0 required to compile rtl-sdr")
-endif()
-if(NOT THREADS_FOUND)
-    message(FATAL_ERROR "pthreads(-win32) required to compile rtl-sdr")
-endif()
 ########################################################################
 # Setup the include and linker paths
 ########################################################################
 include_directories(
     ${CMAKE_SOURCE_DIR}/include
-    ${LIBUSB_INCLUDE_DIR}
-    ${THREADS_PTHREADS_INCLUDE_DIR}
+	${LIBRTLSDR_INCLUDE_DIRS}
 )
 
-#link_directories(
-#    ...
-#)
-
-# Set component parameters
-#set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE)
-
 ########################################################################
 # Create uninstall target
 ########################################################################
@@ -88,45 +65,20 @@ add_custom_target(uninstall
     ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
 )
 
-########################################################################
-# Install udev rules
-########################################################################
-option(INSTALL_UDEV_RULES "Install udev rules for RTL-SDR" OFF)
-if (INSTALL_UDEV_RULES)
-    install (
-        FILES rtl-sdr.rules
-        DESTINATION "/etc/udev/rules.d"
-        COMPONENT "udev"
-        )
-else (INSTALL_UDEV_RULES)
-    message (STATUS "Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON")
-endif (INSTALL_UDEV_RULES)
-
 ########################################################################
 # Add subdirectories
 ########################################################################
 add_subdirectory(include)
 add_subdirectory(src)
 
-########################################################################
-# Create Pkg Config File
-########################################################################
-FOREACH(inc ${LIBUSB_INCLUDE_DIR})
-    LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}")
-ENDFOREACH(inc)
-
-FOREACH(lib ${LIBUSB_LIBRARY_DIRS})
-    LIST(APPEND RTLSDR_PC_LIBS "-L${lib}")
-ENDFOREACH(lib)
-
 # use space-separation format for the pc file
-STRING(REPLACE ";" " " RTLSDR_PC_CFLAGS "${RTLSDR_PC_CFLAGS}")
-STRING(REPLACE ";" " " RTLSDR_PC_LIBS "${RTLSDR_PC_LIBS}")
+STRING(REPLACE ";" " " RTL433_PC_CFLAGS "${RTL433_PC_CFLAGS}")
+STRING(REPLACE ";" " " RTL433_PC_LIBS "${RTL433_PC_LIBS}")
 
 # unset these vars to avoid hard-coded paths to cross environment
 IF(CMAKE_CROSSCOMPILING)
-    UNSET(RTLSDR_PC_CFLAGS)
-    UNSET(RTLSDR_PC_LIBS)
+    UNSET(RTL433_PC_CFLAGS)
+    UNSET(RTL433_PC_LIBS)
 ENDIF(CMAKE_CROSSCOMPILING)
 
 set(prefix ${CMAKE_INSTALL_PREFIX})
@@ -134,12 +86,7 @@ set(exec_prefix \${prefix})
 set(libdir \${exec_prefix}/lib)
 set(includedir \${prefix}/include)
 
-CONFIGURE_FILE(
-    ${CMAKE_CURRENT_SOURCE_DIR}/librtlsdr.pc.in
-    ${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc
-@ONLY)
-
 INSTALL(
-    FILES ${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc
+    FILES
     DESTINATION lib/pkgconfig
 )

+ 2 - 2
Doxyfile.in

@@ -25,7 +25,7 @@ DOXYFILE_ENCODING      = UTF-8
 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded
 # by quotes) that should identify the project.
 
-PROJECT_NAME           = librtlsdr
+PROJECT_NAME           = rtl433
 
 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
 # This could be handy for archiving the generated documentation or
@@ -37,7 +37,7 @@ PROJECT_NUMBER         = @VERSION@
 # for a project that appears at the top of each page and should give viewer
 # a quick idea about the purpose of the project. Keep the description short.
 
-PROJECT_BRIEF          = "RTL-SDR library"
+PROJECT_BRIEF          = "RTL-433 utility"
 
 # With the PROJECT_LOGO tag one can specify an logo or icon that is
 # included in the documentation. The maximum height of the logo should not

+ 1 - 7
Makefile.am

@@ -5,7 +5,7 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/include
 SUBDIRS = include src
 
 pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = librtlsdr.pc
+pkgconfig_DATA = rtl433.pc
 
 BUILT_SOURCES = $(top_srcdir)/.version
 $(top_srcdir)/.version:
@@ -13,12 +13,6 @@ $(top_srcdir)/.version:
 dist-hook:
 	echo $(VERSION) > $(distdir)/.tarball-version
 
-install-udev-rules:
-	$(INSTALL_DATA) rtl-sdr.rules /etc/udev/rules.d
-
-uninstall-udev-rules:
-	rm -rf /etc/udev/rules.d/rtl-sdr.rules
-
 EXTRA_DIST = git-version-gen
 
 if HAVE_DOXYGEN

+ 28 - 0
cmake/Modules/FindLibRTLSDR.cmake

@@ -0,0 +1,28 @@
+INCLUDE(FindPkgConfig)
+if(NOT LIBRTLSDR_FOUND)
+  pkg_check_modules (LIBRTLSDR_PKG librtlsdr)
+  find_path(LIBRTLSDR_INCLUDE_DIRS NAMES rtl-sdr.h
+    PATHS
+    ${LIBRTLSDR_PKG_INCLUDE_DIRS}
+    /usr/include
+    /usr/local/include
+  )
+
+  find_library(LIBRTLSDR_LIBRARIES NAMES rtlsdr
+    PATHS
+    ${LIBRTLSDR_PKG_LIBRARY_DIRS}
+    /usr/lib
+    /usr/local/lib
+  )
+
+if(LIBRTLSDR_INCLUDE_DIRS AND LIBRTLSDR_LIBRARIES)
+  set(LIBRTLSDR_FOUND TRUE CACHE INTERNAL "librtlsdr found")
+  message(STATUS "Found librtlsdr: ${LIBRTLSDR_INCLUDE_DIRS}, ${LIBRTLSDR_LIBRARIES}")
+else(LIBRTLSDR_INCLUDE_DIRS AND LIBRTLSDR_LIBRARIES)
+  set(LIBRTLSDR_FOUND FALSE CACHE INTERNAL "librtlsdr found")
+  message(STATUS "librtlsdr not found.")
+endif(LIBRTLSDR_INCLUDE_DIRS AND LIBRTLSDR_LIBRARIES)
+
+mark_as_advanced(LIBRTLSDR_LIBRARIES LIBRTLSDR_INCLUDE_DIRS)
+
+endif(NOT LIBRTLSDR_FOUND)

+ 0 - 28
cmake/Modules/FindLibUSB.cmake

@@ -1,28 +0,0 @@
-if(NOT LIBUSB_FOUND)
-  pkg_check_modules (LIBUSB_PKG libusb-1.0)
-  find_path(LIBUSB_INCLUDE_DIR NAMES libusb.h
-    PATHS
-    ${LIBUSB_PKG_INCLUDE_DIRS}
-    /usr/include/libusb-1.0
-    /usr/include
-    /usr/local/include
-  )
-
-  find_library(LIBUSB_LIBRARIES NAMES usb-1.0
-    PATHS
-    ${LIBUSB_PKG_LIBRARY_DIRS}
-    /usr/lib
-    /usr/local/lib
-  )
-
-if(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
-  set(LIBUSB_FOUND TRUE CACHE INTERNAL "libusb-1.0 found")
-  message(STATUS "Found libusb-1.0: ${LIBUSB_INCLUDE_DIR}, ${LIBUSB_LIBRARIES}")
-else(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
-  set(LIBUSB_FOUND FALSE CACHE INTERNAL "libusb-1.0 found")
-  message(STATUS "libusb-1.0 not found.")
-endif(LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES)
-
-mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES)
-
-endif(NOT LIBUSB_FOUND)

+ 0 - 246
cmake/Modules/FindThreads.cmake

@@ -1,246 +0,0 @@
-# Updated FindThreads.cmake that supports pthread-win32
-# Downloaded from http://www.vtk.org/Bug/bug_view_advanced_page.php?bug_id=6399
-
-# - This module determines the thread library of the system.
-#
-# The following variables are set
-#  CMAKE_THREAD_LIBS_INIT     - the thread library
-#  CMAKE_USE_SPROC_INIT       - are we using sproc?
-#  CMAKE_USE_WIN32_THREADS_INIT - using WIN32 threads?
-#  CMAKE_USE_PTHREADS_INIT    - are we using pthreads
-#  CMAKE_HP_PTHREADS_INIT     - are we using hp pthreads
-#
-# If use of pthreads-win32 is desired, the following variables
-# can be set.
-#
-#  THREADS_USE_PTHREADS_WIN32 -
-#    Setting this to true searches for the pthreads-win32
-#    port (since CMake 2.8.0)
-#
-#  THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME
-#      C  = no exceptions (default)
-#         (NOTE: This is the default scheme on most POSIX thread
-#          implementations and what you should probably be using)
-#      CE = C++ Exception Handling
-#      SE = Structure Exception Handling (MSVC only)
-#      (NOTE: Changing this option from the default may affect
-#       the portability of your application.  See pthreads-win32
-#       documentation for more details.)
-#
-#======================================================
-# Example usage where threading library
-# is provided by the system:
-#
-#   find_package(Threads REQUIRED)
-#   add_executable(foo foo.cc)
-#   target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT})
-#
-# Example usage if pthreads-win32 is desired on Windows
-# or a system provided thread library:
-#
-#   set(THREADS_USE_PTHREADS_WIN32 true)
-#   find_package(Threads REQUIRED)
-#   include_directories(${THREADS_PTHREADS_INCLUDE_DIR})
-#
-#   add_executable(foo foo.cc)
-#   target_link_libraries(foo ${CMAKE_THREAD_LIBS_INIT})
-#
-
-INCLUDE (CheckIncludeFiles)
-INCLUDE (CheckLibraryExists)
-SET(Threads_FOUND FALSE)
-
-IF(WIN32 AND NOT CYGWIN AND THREADS_USE_PTHREADS_WIN32)
-  SET(_Threads_ptwin32 true)
-ENDIF()
-
-# Do we have sproc?
-IF(CMAKE_SYSTEM MATCHES IRIX)
-  CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h"  CMAKE_HAVE_SPROC_H)
-ENDIF()
-
-IF(CMAKE_HAVE_SPROC_H)
-  # We have sproc
-  SET(CMAKE_USE_SPROC_INIT 1)
-
-ELSEIF(_Threads_ptwin32)
-
-  IF(NOT DEFINED THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME)
-    # Assign the default scheme
-    SET(THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME "C")
-  ELSE()
-    # Validate the scheme specified by the user
-    IF(NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "C" AND
-       NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "CE" AND
-       NOT THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
-         MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed")
-    ENDIF()
-    IF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
-      MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC")
-    ENDIF(NOT MSVC AND THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME STREQUAL "SE")
-  ENDIF()
-
-  FIND_PATH(THREADS_PTHREADS_INCLUDE_DIR pthread.h)
-
-  # Determine the library filename
-  IF(MSVC)
-    SET(_Threads_pthreads_libname
-        pthreadV${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2)
-  ELSEIF(MINGW)
-    SET(_Threads_pthreads_libname
-        pthreadG${THREADS_PTHREADS_WIN32_EXCEPTION_SCHEME}2)
-  ELSE()
-    MESSAGE(FATAL_ERROR "This should never happen")
-  ENDIF()
-
-  # Use the include path to help find the library if possible
-  SET(_Threads_lib_paths "")
-  IF(THREADS_PTHREADS_INCLUDE_DIR)
-     GET_FILENAME_COMPONENT(_Threads_root_dir
-                            ${THREADS_PTHREADS_INCLUDE_DIR} PATH)
-     SET(_Threads_lib_paths ${_Threads_root_dir}/lib)
-  ENDIF()
-  FIND_LIBRARY(THREADS_PTHREADS_WIN32_LIBRARY
-               NAMES ${_Threads_pthreads_libname}
-               PATHS ${_Threads_lib_paths}
-               DOC "The Portable Threads Library for Win32"
-               NO_SYSTEM_PATH
-               )
-
-  IF(THREADS_PTHREADS_INCLUDE_DIR AND THREADS_PTHREADS_WIN32_LIBRARY)
-    MARK_AS_ADVANCED(THREADS_PTHREADS_INCLUDE_DIR)
-    SET(CMAKE_THREAD_LIBS_INIT ${THREADS_PTHREADS_WIN32_LIBRARY})
-    SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-    SET(Threads_FOUND TRUE)
-  ENDIF()
-
-  MARK_AS_ADVANCED(THREADS_PTHREADS_WIN32_LIBRARY)
-
-ELSE()
-  # Do we have pthreads?
-  CHECK_INCLUDE_FILES("pthread.h" CMAKE_HAVE_PTHREAD_H)
-  IF(CMAKE_HAVE_PTHREAD_H)
-
-    #
-    # We have pthread.h
-    # Let's check for the library now.
-    #
-    SET(CMAKE_HAVE_THREADS_LIBRARY)
-    IF(NOT THREADS_HAVE_PTHREAD_ARG)
-
-      # Do we have -lpthreads
-      CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
-      IF(CMAKE_HAVE_PTHREADS_CREATE)
-        SET(CMAKE_THREAD_LIBS_INIT "-lpthreads")
-        SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-        SET(Threads_FOUND TRUE)
-      ENDIF()
-
-      # Ok, how about -lpthread
-      CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
-      IF(CMAKE_HAVE_PTHREAD_CREATE)
-        SET(CMAKE_THREAD_LIBS_INIT "-lpthread")
-        SET(Threads_FOUND TRUE)
-        SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-      ENDIF()
-
-      IF(CMAKE_SYSTEM MATCHES "SunOS.*")
-        # On sun also check for -lthread
-        CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
-        IF(CMAKE_HAVE_THR_CREATE)
-          SET(CMAKE_THREAD_LIBS_INIT "-lthread")
-          SET(CMAKE_HAVE_THREADS_LIBRARY 1)
-          SET(Threads_FOUND TRUE)
-        ENDIF()
-      ENDIF(CMAKE_SYSTEM MATCHES "SunOS.*")
-
-    ENDIF(NOT THREADS_HAVE_PTHREAD_ARG)
-
-    IF(NOT CMAKE_HAVE_THREADS_LIBRARY)
-      # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
-      IF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
-        MESSAGE(STATUS "Check if compiler accepts -pthread")
-        TRY_RUN(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
-          ${CMAKE_BINARY_DIR}
-          ${CMAKE_ROOT}/Modules/CheckForPthreads.c
-          CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
-          COMPILE_OUTPUT_VARIABLE OUTPUT)
-
-        IF(THREADS_HAVE_PTHREAD_ARG)
-          IF(THREADS_PTHREAD_ARG MATCHES "^2$")
-            SET(Threads_FOUND TRUE)
-            MESSAGE(STATUS "Check if compiler accepts -pthread - yes")
-          ELSE()
-            MESSAGE(STATUS "Check if compiler accepts -pthread - no")
-            FILE(APPEND
-              ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-              "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
-          ENDIF()
-        ELSE()
-          MESSAGE(STATUS "Check if compiler accepts -pthread - no")
-          FILE(APPEND
-            ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-            "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
-        ENDIF()
-
-      ENDIF("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
-
-      IF(THREADS_HAVE_PTHREAD_ARG)
-        SET(Threads_FOUND TRUE)
-        SET(CMAKE_THREAD_LIBS_INIT "-pthread")
-      ENDIF()
-
-    ENDIF(NOT CMAKE_HAVE_THREADS_LIBRARY)
-  ENDIF(CMAKE_HAVE_PTHREAD_H)
-ENDIF()
-
-IF(CMAKE_THREAD_LIBS_INIT)
-  SET(CMAKE_USE_PTHREADS_INIT 1)
-  SET(Threads_FOUND TRUE)
-ENDIF()
-
-IF(CMAKE_SYSTEM MATCHES "Windows"
-   AND NOT THREADS_USE_PTHREADS_WIN32)
-  SET(CMAKE_USE_WIN32_THREADS_INIT 1)
-  SET(Threads_FOUND TRUE)
-ENDIF()
-
-IF(CMAKE_USE_PTHREADS_INIT)
-  IF(CMAKE_SYSTEM MATCHES "HP-UX-*")
-    # Use libcma if it exists and can be used.  It provides more
-    # symbols than the plain pthread library.  CMA threads
-    # have actually been deprecated:
-    #   http://docs.hp.com/en/B3920-90091/ch12s03.html#d0e11395
-    #   http://docs.hp.com/en/947/d8.html
-    # but we need to maintain compatibility here.
-    # The CMAKE_HP_PTHREADS setting actually indicates whether CMA threads
-    # are available.
-    CHECK_LIBRARY_EXISTS(cma pthread_attr_create "" CMAKE_HAVE_HP_CMA)
-    IF(CMAKE_HAVE_HP_CMA)
-      SET(CMAKE_THREAD_LIBS_INIT "-lcma")
-      SET(CMAKE_HP_PTHREADS_INIT 1)
-      SET(Threads_FOUND TRUE)
-    ENDIF(CMAKE_HAVE_HP_CMA)
-    SET(CMAKE_USE_PTHREADS_INIT 1)
-  ENDIF()
-
-  IF(CMAKE_SYSTEM MATCHES "OSF1-V*")
-    SET(CMAKE_USE_PTHREADS_INIT 0)
-    SET(CMAKE_THREAD_LIBS_INIT )
-  ENDIF()
-
-  IF(CMAKE_SYSTEM MATCHES "CYGWIN_NT*")
-    SET(CMAKE_USE_PTHREADS_INIT 1)
-    SET(Threads_FOUND TRUE)
-    SET(CMAKE_THREAD_LIBS_INIT )
-    SET(CMAKE_USE_WIN32_THREADS_INIT 0)
-  ENDIF()
-ENDIF(CMAKE_USE_PTHREADS_INIT)
-
-INCLUDE(FindPackageHandleStandardArgs)
-IF(_Threads_ptwin32)
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG
-    THREADS_PTHREADS_WIN32_LIBRARY THREADS_PTHREADS_INCLUDE_DIR)
-ELSE()
-  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
-ENDIF()

+ 7 - 19
configure.ac

@@ -1,8 +1,8 @@
-AC_INIT([librtlsdr],
+AC_INIT([rtl433],
         m4_esyscmd([./git-version-gen .tarball-version]),
-        [osmocom-sdr@lists.osmocom.org])
+        [rtl_433@googlegroups.com])
 
-AM_INIT_AUTOMAKE([dist-bzip2])
+AM_INIT_AUTOMAKE([dist-bzip2 subdir-objects])
 
 dnl kernel style compile messages
 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -14,9 +14,9 @@ AC_PROG_INSTALL
 LT_INIT
 AC_PROG_LIBTOOL
 
-PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0)
-LIBS="$LIBS $LIBUSB_LIBS"
-CFLAGS="$CFLAGS $LIBUSB_CFLAGS"
+PKG_CHECK_MODULES(LIBRTLSDR, librtlsdr)
+LIBS="$LIBS $LIBRTLSDR_LIBS"
+CFLAGS="$CFLAGS $LIBRTLSDR_CFLAGS"
 
 AC_PATH_PROG(DOXYGEN,doxygen,false)
 AM_CONDITIONAL(HAVE_DOXYGEN, test $DOXYGEN != false)
@@ -26,24 +26,12 @@ AC_CONFIG_MACRO_DIR([m4])
 dnl checks for header files
 AC_HEADER_STDC
 AC_CHECK_HEADERS(sys/types.h)
-AC_CHECK_HEADERS(pthread.h,, [AC_MSG_ERROR([pthread.h required])])
 
 # pc variables
 AC_SUBST(RTLSDR_PC_LIBS,["$LIBS"])
 AC_SUBST(RTLSDR_PC_CFLAGS,["$CFLAGS"])
 
 dnl checks for required libraries
-dnl pthreads
-AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"])
-
-dnl libmath (for rtl_fm)
-AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"])
-
-dnl libmath (for rtl_adsb)
-AC_CHECK_LIB(m, sqrt, [LIBS="$LIBS -lm"])
-
-dnl librealtime (for rtl_test)
-AC_CHECK_LIB(rt, clock_gettime, [LIBS="$LIBS -lrt"])
 
 # The following test is taken from WebKit's webkit.m4
 saved_CFLAGS="$CFLAGS"
@@ -68,7 +56,7 @@ dnl Generate the output
 AM_CONFIG_HEADER(config.h)
 
 AC_OUTPUT(
-	librtlsdr.pc
+	rtl433.pc
 	include/Makefile
 	src/Makefile
 	Makefile

+ 2 - 2
include/CMakeLists.txt

@@ -21,7 +21,7 @@
 # Install public header files
 ########################################################################
 install(FILES
-    rtl-sdr.h
-    rtl-sdr_export.h
+    rtl_433.h
+    rtl_433_devices.h
     DESTINATION include
 )

+ 2 - 4
include/Makefile.am

@@ -1,5 +1,3 @@
-rtlsdr_HEADERS = rtl-sdr.h rtl-sdr_export.h
+rtl433_HEADERS = rtl_433.h rtl_433_devices.h
 
-noinst_HEADERS = reg_field.h rtlsdr_i2c.h tuner_e4k.h tuner_fc0012.h tuner_fc0013.h tuner_fc2580.h tuner_r820t.h
-
-rtlsdrdir = $(includedir)
+rtl433dir = $(includedir)

+ 0 - 60
include/reg_field.h

@@ -1,60 +0,0 @@
-#ifndef _REG_FIELD_H
-#define _REG_FIELD_H
-
-#include <stdint.h>
-#include <stdarg.h>
-
-enum cmd_op {
-	CMD_OP_GET	= (1 << 0),
-	CMD_OP_SET	= (1 << 1),
-	CMD_OP_EXEC	= (1 << 2),
-};
-
-enum pstate {
-	ST_IN_CMD,
-	ST_IN_ARG,
-};
-
-struct strbuf {
-	uint8_t idx;
-	char buf[32];
-};
-
-struct cmd_state {
-	struct strbuf cmd;
-	struct strbuf arg;
-	enum pstate state;
-	void (*out)(const char *format, va_list ap);
-};
-
-struct cmd {
-	const char *cmd;
-	uint32_t ops;
-	int (*cb)(struct cmd_state *cs, enum cmd_op op, const char *cmd,
-		  int argc, char **argv);
-	const char *help;
-};
-
-/* structure describing a field in a register */
-struct reg_field {
-	uint8_t reg;
-	uint8_t shift;
-	uint8_t width;
-};
-
-struct reg_field_ops {
-	const struct reg_field *fields;
-	const char **field_names;
-	uint32_t num_fields;
-	void *data;
-	int (*write_cb)(void *data, uint32_t reg, uint32_t val);
-	uint32_t (*read_cb)(void *data, uint32_t reg);
-};
-
-uint32_t reg_field_read(struct reg_field_ops *ops, struct reg_field *field);
-int reg_field_write(struct reg_field_ops *ops, struct reg_field *field, uint32_t val);
-int reg_field_cmd(struct cmd_state *cs, enum cmd_op op,
-		  const char *cmd, int argc, char **argv,
-		  struct reg_field_ops *ops);
-
-#endif

+ 0 - 366
include/rtl-sdr.h

@@ -1,366 +0,0 @@
-/*
- * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
- * Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
- * Copyright (C) 2012 by Dimitri Stolnikov <horiz0n@gmx.net>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __RTL_SDR_H
-#define __RTL_SDR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <rtl-sdr_export.h>
-
-typedef struct rtlsdr_dev rtlsdr_dev_t;
-
-RTLSDR_API uint32_t rtlsdr_get_device_count(void);
-
-RTLSDR_API const char* rtlsdr_get_device_name(uint32_t index);
-
-/*!
- * Get USB device strings.
- *
- * NOTE: The string arguments must provide space for up to 256 bytes.
- *
- * \param index the device index
- * \param manufact manufacturer name, may be NULL
- * \param product product name, may be NULL
- * \param serial serial number, may be NULL
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_get_device_usb_strings(uint32_t index,
-					     char *manufact,
-					     char *product,
-					     char *serial);
-
-/*!
- * Get device index by USB serial string descriptor.
- *
- * \param serial serial string of the device
- * \return device index of first device where the name matched
- * \return -1 if name is NULL
- * \return -2 if no devices were found at all
- * \return -3 if devices were found, but none with matching name
- */
-RTLSDR_API int rtlsdr_get_index_by_serial(const char *serial);
-
-RTLSDR_API int rtlsdr_open(rtlsdr_dev_t **dev, uint32_t index);
-
-RTLSDR_API int rtlsdr_close(rtlsdr_dev_t *dev);
-
-/* configuration functions */
-
-/*!
- * Set crystal oscillator frequencies used for the RTL2832 and the tuner IC.
- *
- * Usually both ICs use the same clock. Changing the clock may make sense if
- * you are applying an external clock to the tuner or to compensate the
- * frequency (and samplerate) error caused by the original (cheap) crystal.
- *
- * NOTE: Call this function only if you fully understand the implications.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param rtl_freq frequency value used to clock the RTL2832 in Hz
- * \param tuner_freq frequency value used to clock the tuner IC in Hz
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_xtal_freq(rtlsdr_dev_t *dev, uint32_t rtl_freq,
-				    uint32_t tuner_freq);
-
-/*!
- * Get crystal oscillator frequencies used for the RTL2832 and the tuner IC.
- *
- * Usually both ICs use the same clock.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param rtl_freq frequency value used to clock the RTL2832 in Hz
- * \param tuner_freq frequency value used to clock the tuner IC in Hz
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_get_xtal_freq(rtlsdr_dev_t *dev, uint32_t *rtl_freq,
-				    uint32_t *tuner_freq);
-
-/*!
- * Get USB device strings.
- *
- * NOTE: The string arguments must provide space for up to 256 bytes.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param manufact manufacturer name, may be NULL
- * \param product product name, may be NULL
- * \param serial serial number, may be NULL
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_get_usb_strings(rtlsdr_dev_t *dev, char *manufact,
-				      char *product, char *serial);
-
-/*!
- * Write the device EEPROM
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param data buffer of data to be written
- * \param offset address where the data should be written
- * \param len length of the data
- * \return 0 on success
- * \return -1 if device handle is invalid
- * \return -2 if EEPROM size is exceeded
- * \return -3 if no EEPROM was found
- */
-
-RTLSDR_API int rtlsdr_write_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
-				  uint8_t offset, uint16_t len);
-
-/*!
- * Read the device EEPROM
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param data buffer where the data should be written
- * \param offset address where the data should be read from
- * \param len length of the data
- * \return 0 on success
- * \return -1 if device handle is invalid
- * \return -2 if EEPROM size is exceeded
- * \return -3 if no EEPROM was found
- */
-
-RTLSDR_API int rtlsdr_read_eeprom(rtlsdr_dev_t *dev, uint8_t *data,
-				  uint8_t offset, uint16_t len);
-
-RTLSDR_API int rtlsdr_set_center_freq(rtlsdr_dev_t *dev, uint32_t freq);
-
-/*!
- * Get actual frequency the device is tuned to.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return 0 on error, frequency in Hz otherwise
- */
-RTLSDR_API uint32_t rtlsdr_get_center_freq(rtlsdr_dev_t *dev);
-
-/*!
- * Set the frequency correction value for the device.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param ppm correction value in parts per million (ppm)
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_freq_correction(rtlsdr_dev_t *dev, int ppm);
-
-/*!
- * Get actual frequency correction value of the device.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return correction value in parts per million (ppm)
- */
-RTLSDR_API int rtlsdr_get_freq_correction(rtlsdr_dev_t *dev);
-
-enum rtlsdr_tuner {
-	RTLSDR_TUNER_UNKNOWN = 0,
-	RTLSDR_TUNER_E4000,
-	RTLSDR_TUNER_FC0012,
-	RTLSDR_TUNER_FC0013,
-	RTLSDR_TUNER_FC2580,
-	RTLSDR_TUNER_R820T
-};
-
-/*!
- * Get the tuner type.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return RTLSDR_TUNER_UNKNOWN on error, tuner type otherwise
- */
-RTLSDR_API enum rtlsdr_tuner rtlsdr_get_tuner_type(rtlsdr_dev_t *dev);
-
-/*!
- * Get a list of gains supported by the tuner.
- *
- * NOTE: The gains argument must be preallocated by the caller. If NULL is
- * being given instead, the number of available gain values will be returned.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param gains array of gain values. In tenths of a dB, 115 means 11.5 dB.
- * \return <= 0 on error, number of available (returned) gain values otherwise
- */
-RTLSDR_API int rtlsdr_get_tuner_gains(rtlsdr_dev_t *dev, int *gains);
-
-/*!
- * Set the gain for the device.
- * Manual gain mode must be enabled for this to work.
- *
- * Valid gain values (in tenths of a dB) for the E4000 tuner:
- * -10, 15, 40, 65, 90, 115, 140, 165, 190,
- * 215, 240, 290, 340, 420, 430, 450, 470, 490
- *
- * Valid gain values may be queried with \ref rtlsdr_get_tuner_gains function.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param gain in tenths of a dB, 115 means 11.5 dB.
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_tuner_gain(rtlsdr_dev_t *dev, int gain);
-
-/*!
- * Get actual gain the device is configured to.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return 0 on error, gain in tenths of a dB, 115 means 11.5 dB.
- */
-RTLSDR_API int rtlsdr_get_tuner_gain(rtlsdr_dev_t *dev);
-
-/*!
- * Set the intermediate frequency gain for the device.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param stage intermediate frequency gain stage number (1 to 6 for E4000)
- * \param gain in tenths of a dB, -30 means -3.0 dB.
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_tuner_if_gain(rtlsdr_dev_t *dev, int stage, int gain);
-
-/*!
- * Set the gain mode (automatic/manual) for the device.
- * Manual gain mode must be enabled for the gain setter function to work.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param manual gain mode, 1 means manual gain mode shall be enabled.
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_tuner_gain_mode(rtlsdr_dev_t *dev, int manual);
-
-/* this will select the baseband filters according to the requested sample rate */
-RTLSDR_API int rtlsdr_set_sample_rate(rtlsdr_dev_t *dev, uint32_t rate);
-
-/*!
- * Get actual sample rate the device is configured to.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return 0 on error, sample rate in Hz otherwise
- */
-RTLSDR_API uint32_t rtlsdr_get_sample_rate(rtlsdr_dev_t *dev);
-
-/*!
- * Enable test mode that returns an 8 bit counter instead of the samples.
- * The counter is generated inside the RTL2832.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param test mode, 1 means enabled, 0 disabled
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_testmode(rtlsdr_dev_t *dev, int on);
-
-/*!
- * Enable or disable the internal digital AGC of the RTL2832.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param digital AGC mode, 1 means enabled, 0 disabled
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_agc_mode(rtlsdr_dev_t *dev, int on);
-
-/*!
- * Enable or disable the direct sampling mode. When enabled, the IF mode
- * of the RTL2832 is activated, and rtlsdr_set_center_freq() will control
- * the IF-frequency of the DDC, which can be used to tune from 0 to 28.8 MHz
- * (xtal frequency of the RTL2832).
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param on 0 means disabled, 1 I-ADC input enabled, 2 Q-ADC input enabled
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_direct_sampling(rtlsdr_dev_t *dev, int on);
-
-/*!
- * Get state of the direct sampling mode
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return -1 on error, 0 means disabled, 1 I-ADC input enabled
- *	    2 Q-ADC input enabled
- */
-RTLSDR_API int rtlsdr_get_direct_sampling(rtlsdr_dev_t *dev);
-
-/*!
- * Enable or disable offset tuning for zero-IF tuners, which allows to avoid
- * problems caused by the DC offset of the ADCs and 1/f noise.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param on 0 means disabled, 1 enabled
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_set_offset_tuning(rtlsdr_dev_t *dev, int on);
-
-/*!
- * Get state of the offset tuning mode
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return -1 on error, 0 means disabled, 1 enabled
- */
-RTLSDR_API int rtlsdr_get_offset_tuning(rtlsdr_dev_t *dev);
-
-/* streaming functions */
-
-RTLSDR_API int rtlsdr_reset_buffer(rtlsdr_dev_t *dev);
-
-RTLSDR_API int rtlsdr_read_sync(rtlsdr_dev_t *dev, void *buf, int len, int *n_read);
-
-typedef void(*rtlsdr_read_async_cb_t)(unsigned char *buf, uint32_t len, void *ctx);
-
-/*!
- * Read samples from the device asynchronously. This function will block until
- * it is being canceled using rtlsdr_cancel_async()
- *
- * NOTE: This function is deprecated and is subject for removal.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param cb callback function to return received samples
- * \param ctx user specific context to pass via the callback function
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_wait_async(rtlsdr_dev_t *dev, rtlsdr_read_async_cb_t cb, void *ctx);
-
-/*!
- * Read samples from the device asynchronously. This function will block until
- * it is being canceled using rtlsdr_cancel_async()
- *
- * \param dev the device handle given by rtlsdr_open()
- * \param cb callback function to return received samples
- * \param ctx user specific context to pass via the callback function
- * \param buf_num optional buffer count, buf_num * buf_len = overall buffer size
- *		  set to 0 for default buffer count (32)
- * \param buf_len optional buffer length, must be multiple of 512,
- *		  set to 0 for default buffer length (16 * 32 * 512)
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_read_async(rtlsdr_dev_t *dev,
-				 rtlsdr_read_async_cb_t cb,
-				 void *ctx,
-				 uint32_t buf_num,
-				 uint32_t buf_len);
-
-/*!
- * Cancel all pending asynchronous operations on the device.
- *
- * \param dev the device handle given by rtlsdr_open()
- * \return 0 on success
- */
-RTLSDR_API int rtlsdr_cancel_async(rtlsdr_dev_t *dev);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __RTL_SDR_H */

+ 0 - 47
include/rtl-sdr_export.h

@@ -1,47 +0,0 @@
-/*
- * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
- * Copyright (C) 2012 by Hoernchen <la@tfc-server.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef RTLSDR_EXPORT_H
-#define RTLSDR_EXPORT_H
-
-#if defined __GNUC__
-#  if __GNUC__ >= 4
-#    define __SDR_EXPORT   __attribute__((visibility("default")))
-#    define __SDR_IMPORT   __attribute__((visibility("default")))
-#  else
-#    define __SDR_EXPORT
-#    define __SDR_IMPORT
-#  endif
-#elif _MSC_VER
-#  define __SDR_EXPORT     __declspec(dllexport)
-#  define __SDR_IMPORT     __declspec(dllimport)
-#else
-#  define __SDR_EXPORT
-#  define __SDR_IMPORT
-#endif
-
-#ifndef rtlsdr_STATIC
-#	ifdef rtlsdr_EXPORTS
-#	define RTLSDR_API __SDR_EXPORT
-#	else
-#	define RTLSDR_API __SDR_IMPORT
-#	endif
-#else
-#define RTLSDR_API
-#endif
-#endif /* RTLSDR_EXPORT_H */

+ 0 - 8
include/rtlsdr_i2c.h

@@ -1,8 +0,0 @@
-#ifndef __I2C_H
-#define __I2C_H
-
-uint32_t rtlsdr_get_tuner_clock(void *dev);
-int rtlsdr_i2c_write_fn(void *dev, uint8_t addr, uint8_t *buf, int len);
-int rtlsdr_i2c_read_fn(void *dev, uint8_t addr, uint8_t *buf, int len);
-
-#endif

+ 0 - 224
include/tuner_e4k.h

@@ -1,224 +0,0 @@
-#ifndef _E4K_TUNER_H
-#define _E4K_TUNER_H
-
-/*
- * Elonics E4000 tuner driver
- *
- * (C) 2011-2012 by Harald Welte <laforge@gnumonks.org>
- * (C) 2012 by Sylvain Munaut <tnt@246tNt.com>
- * (C) 2012 by Hoernchen <la@tfc-server.de>
- *
- * All Rights Reserved
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define E4K_I2C_ADDR	0xc8
-#define E4K_CHECK_ADDR	0x02
-#define E4K_CHECK_VAL	0x40
-
-enum e4k_reg {
-	E4K_REG_MASTER1		= 0x00,
-	E4K_REG_MASTER2		= 0x01,
-	E4K_REG_MASTER3		= 0x02,
-	E4K_REG_MASTER4		= 0x03,
-	E4K_REG_MASTER5		= 0x04,
-	E4K_REG_CLK_INP		= 0x05,
-	E4K_REG_REF_CLK		= 0x06,
-	E4K_REG_SYNTH1		= 0x07,
-	E4K_REG_SYNTH2		= 0x08,
-	E4K_REG_SYNTH3		= 0x09,
-	E4K_REG_SYNTH4		= 0x0a,
-	E4K_REG_SYNTH5		= 0x0b,
-	E4K_REG_SYNTH6		= 0x0c,
-	E4K_REG_SYNTH7		= 0x0d,
-	E4K_REG_SYNTH8		= 0x0e,
-	E4K_REG_SYNTH9		= 0x0f,
-	E4K_REG_FILT1		= 0x10,
-	E4K_REG_FILT2		= 0x11,
-	E4K_REG_FILT3		= 0x12,
-	// gap
-	E4K_REG_GAIN1		= 0x14,
-	E4K_REG_GAIN2		= 0x15,
-	E4K_REG_GAIN3		= 0x16,
-	E4K_REG_GAIN4		= 0x17,
-	// gap
-	E4K_REG_AGC1		= 0x1a,
-	E4K_REG_AGC2		= 0x1b,
-	E4K_REG_AGC3		= 0x1c,
-	E4K_REG_AGC4		= 0x1d,
-	E4K_REG_AGC5		= 0x1e,
-	E4K_REG_AGC6		= 0x1f,
-	E4K_REG_AGC7		= 0x20,
-	E4K_REG_AGC8		= 0x21,
-	// gap
-	E4K_REG_AGC11		= 0x24,
-	E4K_REG_AGC12		= 0x25,
-	// gap
-	E4K_REG_DC1		= 0x29,
-	E4K_REG_DC2		= 0x2a,
-	E4K_REG_DC3		= 0x2b,
-	E4K_REG_DC4		= 0x2c,
-	E4K_REG_DC5		= 0x2d,
-	E4K_REG_DC6		= 0x2e,
-	E4K_REG_DC7		= 0x2f,
-	E4K_REG_DC8		= 0x30,
-	// gap
-	E4K_REG_QLUT0		= 0x50,
-	E4K_REG_QLUT1		= 0x51,
-	E4K_REG_QLUT2		= 0x52,
-	E4K_REG_QLUT3		= 0x53,
-	// gap
-	E4K_REG_ILUT0		= 0x60,
-	E4K_REG_ILUT1		= 0x61,
-	E4K_REG_ILUT2		= 0x62,
-	E4K_REG_ILUT3		= 0x63,
-	// gap
-	E4K_REG_DCTIME1		= 0x70,
-	E4K_REG_DCTIME2		= 0x71,
-	E4K_REG_DCTIME3		= 0x72,
-	E4K_REG_DCTIME4		= 0x73,
-	E4K_REG_PWM1		= 0x74,
-	E4K_REG_PWM2		= 0x75,
-	E4K_REG_PWM3		= 0x76,
-	E4K_REG_PWM4		= 0x77,
-	E4K_REG_BIAS		= 0x78,
-	E4K_REG_CLKOUT_PWDN	= 0x7a,
-	E4K_REG_CHFILT_CALIB	= 0x7b,
-	E4K_REG_I2C_REG_ADDR	= 0x7d,
-	// FIXME
-};
-
-#define E4K_MASTER1_RESET	(1 << 0)
-#define E4K_MASTER1_NORM_STBY	(1 << 1)
-#define E4K_MASTER1_POR_DET	(1 << 2)
-
-#define E4K_SYNTH1_PLL_LOCK	(1 << 0)
-#define E4K_SYNTH1_BAND_SHIF	1
-
-#define E4K_SYNTH7_3PHASE_EN	(1 << 3)
-
-#define E4K_SYNTH8_VCOCAL_UPD	(1 << 2)
-
-#define E4K_FILT3_DISABLE	(1 << 5)
-
-#define E4K_AGC1_LIN_MODE	(1 << 4)
-#define E4K_AGC1_LNA_UPDATE	(1 << 5)
-#define E4K_AGC1_LNA_G_LOW	(1 << 6)
-#define E4K_AGC1_LNA_G_HIGH	(1 << 7)
-
-#define E4K_AGC6_LNA_CAL_REQ	(1 << 4)
-
-#define E4K_AGC7_MIX_GAIN_AUTO	(1 << 0)
-#define E4K_AGC7_GAIN_STEP_5dB	(1 << 5)
-
-#define E4K_AGC8_SENS_LIN_AUTO	(1 << 0)
-
-#define E4K_AGC11_LNA_GAIN_ENH	(1 << 0)
-
-#define E4K_DC1_CAL_REQ		(1 << 0)
-
-#define E4K_DC5_I_LUT_EN	(1 << 0)
-#define E4K_DC5_Q_LUT_EN	(1 << 1)
-#define E4K_DC5_RANGE_DET_EN	(1 << 2)
-#define E4K_DC5_RANGE_EN	(1 << 3)
-#define E4K_DC5_TIMEVAR_EN	(1 << 4)
-
-#define E4K_CLKOUT_DISABLE	0x96
-
-#define E4K_CHFCALIB_CMD	(1 << 0)
-
-#define E4K_AGC1_MOD_MASK	0xF
-
-enum e4k_agc_mode {
-	E4K_AGC_MOD_SERIAL		= 0x0,
-	E4K_AGC_MOD_IF_PWM_LNA_SERIAL	= 0x1,
-	E4K_AGC_MOD_IF_PWM_LNA_AUTONL	= 0x2,
-	E4K_AGC_MOD_IF_PWM_LNA_SUPERV	= 0x3,
-	E4K_AGC_MOD_IF_SERIAL_LNA_PWM	= 0x4,
-	E4K_AGC_MOD_IF_PWM_LNA_PWM	= 0x5,
-	E4K_AGC_MOD_IF_DIG_LNA_SERIAL	= 0x6,
-	E4K_AGC_MOD_IF_DIG_LNA_AUTON	= 0x7,
-	E4K_AGC_MOD_IF_DIG_LNA_SUPERV	= 0x8,
-	E4K_AGC_MOD_IF_SERIAL_LNA_AUTON	= 0x9,
-	E4K_AGC_MOD_IF_SERIAL_LNA_SUPERV = 0xa,
-};
-
-enum e4k_band {
-	E4K_BAND_VHF2	= 0,
-	E4K_BAND_VHF3	= 1,
-	E4K_BAND_UHF	= 2,
-	E4K_BAND_L	= 3,
-};
-
-enum e4k_mixer_filter_bw {
-	E4K_F_MIX_BW_27M	= 0,
-	E4K_F_MIX_BW_4M6	= 8,
-	E4K_F_MIX_BW_4M2	= 9,
-	E4K_F_MIX_BW_3M8	= 10,
-	E4K_F_MIX_BW_3M4	= 11,
-	E4K_F_MIX_BW_3M		= 12,
-	E4K_F_MIX_BW_2M7	= 13,
-	E4K_F_MIX_BW_2M3	= 14,
-	E4K_F_MIX_BW_1M9	= 15,
-};
-
-enum e4k_if_filter {
-	E4K_IF_FILTER_MIX,
-	E4K_IF_FILTER_CHAN,
-	E4K_IF_FILTER_RC
-};
-struct e4k_pll_params {
-	uint32_t fosc;
-	uint32_t intended_flo;
-	uint32_t flo;
-	uint16_t x;
-	uint8_t z;
-	uint8_t r;
-	uint8_t r_idx;
-	uint8_t threephase;
-};
-
-struct e4k_state {
-	void *i2c_dev;
-	uint8_t i2c_addr;
-	enum e4k_band band;
-	struct e4k_pll_params vco;
-	void *rtl_dev;
-};
-
-int e4k_init(struct e4k_state *e4k);
-int e4k_if_gain_set(struct e4k_state *e4k, uint8_t stage, int8_t value);
-int e4k_mixer_gain_set(struct e4k_state *e4k, int8_t value);
-int e4k_commonmode_set(struct e4k_state *e4k, int8_t value);
-int e4k_tune_freq(struct e4k_state *e4k, uint32_t freq);
-int e4k_tune_params(struct e4k_state *e4k, struct e4k_pll_params *p);
-uint32_t e4k_compute_pll_params(struct e4k_pll_params *oscp, uint32_t fosc, uint32_t intended_flo);
-int e4k_if_filter_bw_get(struct e4k_state *e4k, enum e4k_if_filter filter);
-int e4k_if_filter_bw_set(struct e4k_state *e4k, enum e4k_if_filter filter,
-		         uint32_t bandwidth);
-int e4k_if_filter_chan_enable(struct e4k_state *e4k, int on);
-int e4k_rf_filter_set(struct e4k_state *e4k);
-
-int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val);
-uint8_t e4k_reg_read(struct e4k_state *e4k, uint8_t reg);
-
-int e4k_manual_dc_offset(struct e4k_state *e4k, int8_t iofs, int8_t irange, int8_t qofs, int8_t qrange);
-int e4k_dc_offset_calibrate(struct e4k_state *e4k);
-int e4k_dc_offset_gen_table(struct e4k_state *e4k);
-
-int e4k_set_lna_gain(struct e4k_state *e4k, int32_t gain);
-int e4k_enable_manual_gain(struct e4k_state *e4k, uint8_t manual);
-int e4k_set_enh_gain(struct e4k_state *e4k, int32_t gain);
-#endif /* _E4K_TUNER_H */

+ 0 - 36
include/tuner_fc0012.h

@@ -1,36 +0,0 @@
-/*
- * Fitipower FC0012 tuner driver
- *
- * Copyright (C) 2012 Hans-Frieder Vogt <hfvogt@gmx.net>
- *
- * modified for use in librtlsdr
- * Copyright (C) 2012 Steve Markgraf <steve@steve-m.de>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This program is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *    GNU General Public License for more details.
- *
- *    You should have received a copy of the GNU General Public License
- *    along with this program; if not, write to the Free Software
- *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _FC0012_H_
-#define _FC0012_H_
-
-#define FC0012_I2C_ADDR		0xc6
-#define FC0012_CHECK_ADDR	0x00
-#define FC0012_CHECK_VAL	0xa1
-
-int fc0012_init(void *dev);
-int fc0012_set_params(void *dev, uint32_t freq, uint32_t bandwidth);
-int fc0012_set_gain(void *dev, int gain);
-
-#endif

+ 0 - 37
include/tuner_fc0013.h

@@ -1,37 +0,0 @@
-/*
- * Fitipower FC0013 tuner driver
- *
- * Copyright (C) 2012 Hans-Frieder Vogt <hfvogt@gmx.net>
- *
- * modified for use in librtlsdr
- * Copyright (C) 2012 Steve Markgraf <steve@steve-m.de>
- *
- *    This program is free software; you can redistribute it and/or modify
- *    it under the terms of the GNU General Public License as published by
- *    the Free Software Foundation; either version 2 of the License, or
- *    (at your option) any later version.
- *
- *    This program is distributed in the hope that it will be useful,
- *    but WITHOUT ANY WARRANTY; without even the implied warranty of
- *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *    GNU General Public License for more details.
- *
- *    You should have received a copy of the GNU General Public License
- *    along with this program; if not, write to the Free Software
- *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _FC0013_H_
-#define _FC0013_H_
-
-#define FC0013_I2C_ADDR		0xc6
-#define FC0013_CHECK_ADDR	0x00
-#define FC0013_CHECK_VAL	0xa3
-
-int fc0013_init(void *dev);
-int fc0013_set_params(void *dev, uint32_t freq, uint32_t bandwidth);
-int fc0013_set_gain_mode(void *dev, int manual);
-int fc0013_set_lna_gain(void *dev, int gain);
-
-#endif

+ 0 - 127
include/tuner_fc2580.h

@@ -1,127 +0,0 @@
-#ifndef __TUNER_FC2580_H
-#define __TUNER_FC2580_H
-
-#define	BORDER_FREQ	2600000	//2.6GHz : The border frequency which determines whether Low VCO or High VCO is used
-#define USE_EXT_CLK	0	//0 : Use internal XTAL Oscillator / 1 : Use External Clock input
-#define OFS_RSSI 57
-
-#define FC2580_I2C_ADDR		0xac
-#define FC2580_CHECK_ADDR	0x01
-#define FC2580_CHECK_VAL	0x56
-
-typedef enum {
-	FC2580_UHF_BAND,
-	FC2580_L_BAND,
-	FC2580_VHF_BAND,
-	FC2580_NO_BAND
-} fc2580_band_type;
-
-typedef enum {
-	FC2580_FCI_FAIL,
-	FC2580_FCI_SUCCESS
-} fc2580_fci_result_type;
-
-enum FUNCTION_STATUS
-{
-	FUNCTION_SUCCESS,
-	FUNCTION_ERROR,
-};
-
-extern void fc2580_wait_msec(void *pTuner, int a);
-
-fc2580_fci_result_type fc2580_i2c_write(void *pTuner, unsigned char reg, unsigned char val);
-fc2580_fci_result_type fc2580_i2c_read(void *pTuner, unsigned char reg, unsigned char *read_data);
-
-/*==============================================================================
-       fc2580 initial setting
-
-  This function is a generic function which gets called to initialize
-
-  fc2580 in DVB-H mode or L-Band TDMB mode
-
-  <input parameter>
-
-  ifagc_mode
-    type : integer
-	1 : Internal AGC
-	2 : Voltage Control Mode
-
-==============================================================================*/
-fc2580_fci_result_type fc2580_set_init(void *pTuner, int ifagc_mode, unsigned int freq_xtal );
-
-/*==============================================================================
-       fc2580 frequency setting
-
-  This function is a generic function which gets called to change LO Frequency
-
-  of fc2580 in DVB-H mode or L-Band TDMB mode
-
-  <input parameter>
-
-  f_lo
-	Value of target LO Frequency in 'kHz' unit
-	ex) 2.6GHz = 2600000
-
-==============================================================================*/
-fc2580_fci_result_type fc2580_set_freq(void *pTuner, unsigned int f_lo, unsigned int freq_xtal );
-
-
-/*==============================================================================
-       fc2580 filter BW setting
-
-  This function is a generic function which gets called to change Bandwidth
-
-  frequency of fc2580's channel selection filter
-
-  <input parameter>
-
-  filter_bw
-    1 : 1.53MHz(TDMB)
-	6 : 6MHz
-	7 : 7MHz
-	8 : 7.8MHz
-
-
-==============================================================================*/
-fc2580_fci_result_type fc2580_set_filter( void *pTuner, unsigned char filter_bw, unsigned int freq_xtal );
-
-// The following context is FC2580 tuner API source code
-// Definitions
-
-// AGC mode
-enum FC2580_AGC_MODE
-{
-	FC2580_AGC_INTERNAL = 1,
-	FC2580_AGC_EXTERNAL = 2,
-};
-
-
-// Bandwidth mode
-enum FC2580_BANDWIDTH_MODE
-{
-	FC2580_BANDWIDTH_1530000HZ = 1,
-	FC2580_BANDWIDTH_6000000HZ = 6,
-	FC2580_BANDWIDTH_7000000HZ = 7,
-	FC2580_BANDWIDTH_8000000HZ = 8,
-};
-
-// Manipulaing functions
-int
-fc2580_Initialize(
-	void *pTuner
-	);
-
-int
-fc2580_SetRfFreqHz(
-	void *pTuner,
-	unsigned long RfFreqHz
-	);
-
-// Extra manipulaing functions
-int
-fc2580_SetBandwidthMode(
-	void *pTuner,
-	int BandwidthMode
-	);
-
-#endif

+ 0 - 196
include/tuner_r820t.h

@@ -1,196 +0,0 @@
-#ifndef _R820T_TUNER_H
-#define _R820T_TUNER_H
-
-#define R820T_I2C_ADDR		0x34
-#define R820T_CHECK_ADDR	0x00
-#define R820T_CHECK_VAL		0x69
-
-#define R820T_IF_FREQ		3570000
-
-//***************************************************************
-//*                       INCLUDES.H
-//***************************************************************
-#define VERSION   "R820T_v1.49_ASTRO"
-#define VER_NUM  49
-
-#define USE_16M_XTAL		FALSE
-#define R828_Xtal		28800
-
-#define USE_DIPLEXER		FALSE
-#define TUNER_CLK_OUT		TRUE
-
-#ifndef _UINT_X_
-#define _UINT_X_ 1
-typedef unsigned char  UINT8;
-typedef unsigned short UINT16;
-typedef unsigned int   UINT32;
-#endif
-
-#define TRUE	1
-#define FALSE	0
-
-#define FUNCTION_SUCCESS	0
-#define FUNCTION_ERROR		-1
-
-typedef enum _R828_ErrCode
-{
-	RT_Success,
-	RT_Fail
-}R828_ErrCode;
-
-typedef enum _Rafael_Chip_Type  //Don't modify chip list
-{
-	R828 = 0,
-	R828D,
-	R828S,
-	R820T,
-	R820C,
-	R620D,
-	R620S
-}Rafael_Chip_Type;
-//----------------------------------------------------------//
-//                   R828 Parameter                        //
-//----------------------------------------------------------//
-
-extern UINT8 R828_ADDRESS;
-
-#define DIP_FREQ  	  320000
-#define IMR_TRIAL    9
-#define VCO_pwr_ref   0x02
-
-extern UINT32 R828_IF_khz;
-extern UINT32 R828_CAL_LO_khz;
-extern UINT8  R828_IMR_point_num;
-extern UINT8  R828_IMR_done_flag;
-extern UINT8  Rafael_Chip;
-
-typedef enum _R828_Standard_Type  //Don't remove standand list!!
-{
-	NTSC_MN = 0,
-	PAL_I,
-	PAL_DK,
-	PAL_B_7M,       //no use
-	PAL_BGH_8M,     //for PAL B/G, PAL G/H
-	SECAM_L,
-	SECAM_L1_INV,   //for SECAM L'
-	SECAM_L1,       //no use
-	ATV_SIZE,
-	DVB_T_6M = ATV_SIZE,
-	DVB_T_7M,
-	DVB_T_7M_2,
-	DVB_T_8M,
-	DVB_T2_6M,
-	DVB_T2_7M,
-	DVB_T2_7M_2,
-	DVB_T2_8M,
-	DVB_T2_1_7M,
-	DVB_T2_10M,
-	DVB_C_8M,
-	DVB_C_6M,
-	ISDB_T,
-	DTMB,
-	R828_ATSC,
-	FM,
-	STD_SIZE
-}R828_Standard_Type;
-
-extern UINT8  R828_Fil_Cal_flag[STD_SIZE];
-
-typedef enum _R828_SetFreq_Type
-{
-	FAST_MODE = TRUE,
-	NORMAL_MODE = FALSE
-}R828_SetFreq_Type;
-
-typedef enum _R828_LoopThrough_Type
-{
-	LOOP_THROUGH = TRUE,
-	SIGLE_IN     = FALSE
-}R828_LoopThrough_Type;
-
-
-typedef enum _R828_InputMode_Type
-{
-	AIR_IN = 0,
-	CABLE_IN_1,
-	CABLE_IN_2
-}R828_InputMode_Type;
-
-typedef enum _R828_IfAgc_Type
-{
-	IF_AGC1 = 0,
-	IF_AGC2
-}R828_IfAgc_Type;
-
-typedef enum _R828_GPIO_Type
-{
-	HI_SIG = TRUE,
-	LO_SIG = FALSE
-}R828_GPIO_Type;
-
-typedef struct _R828_Set_Info
-{
-	UINT32        RF_Hz;
-	UINT32        RF_KHz;
-	R828_Standard_Type R828_Standard;
-	R828_LoopThrough_Type RT_Input;
-	R828_InputMode_Type   RT_InputMode;
-	R828_IfAgc_Type R828_IfAgc_Select; 
-}R828_Set_Info;
-
-typedef struct _R828_RF_Gain_Info
-{
-	UINT8   RF_gain1;
-	UINT8   RF_gain2;
-	UINT8   RF_gain_comb;
-}R828_RF_Gain_Info;
-
-typedef enum _R828_RF_Gain_TYPE
-{
-	RF_AUTO = 0,
-	RF_MANUAL
-}R828_RF_Gain_TYPE;
-
-typedef struct _R828_I2C_LEN_TYPE
-{
-	UINT8 RegAddr;
-	UINT8 Data[50];
-	UINT8 Len;
-}R828_I2C_LEN_TYPE;
-
-typedef struct _R828_I2C_TYPE
-{
-	UINT8 RegAddr;
-	UINT8 Data;
-}R828_I2C_TYPE;
-//----------------------------------------------------------//
-//                   R828 Function                         //
-//----------------------------------------------------------//
-R828_ErrCode R828_Init(void *pTuner);
-R828_ErrCode R828_Standby(void *pTuner, R828_LoopThrough_Type R828_LoopSwitch);
-R828_ErrCode R828_GPIO(void *pTuner, R828_GPIO_Type R828_GPIO_Conrl);
-R828_ErrCode R828_SetStandard(void *pTuner, R828_Standard_Type RT_Standard);
-R828_ErrCode R828_SetFrequency(void *pTuner, R828_Set_Info R828_INFO, R828_SetFreq_Type R828_SetFreqMode);
-R828_ErrCode R828_GetRfGain(void *pTuner, R828_RF_Gain_Info *pR828_rf_gain);
-R828_ErrCode R828_SetRfGain(void *pTuner, int gain);
-R828_ErrCode R828_RfGainMode(void *pTuner, int manual);
-
-int
-r820t_SetRfFreqHz(
-	void *pTuner,
-	unsigned long RfFreqHz
-	);
-
-int
-r820t_SetStandardMode(
-	void *pTuner,
-	int StandardMode
-	);
-
-int
-r820t_SetStandby(
-	void *pTuner,
-	int LoopThroughType
-	);
-
-#endif /* _R820T_TUNER_H */

+ 0 - 11
librtlsdr.pc.in

@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: RTL-SDR Library
-Description: C Utility Library
-Version: @VERSION@
-Cflags: -I${includedir}/ @RTLSDR_PC_CFLAGS@
-Libs: -L${libdir} -lrtlsdr -lusb-1.0
-Libs.private: @RTLSDR_PC_LIBS@

+ 0 - 101
rtl-sdr.rules

@@ -1,101 +0,0 @@
-#
-# Copyright 2012 Osmocom rtl-sdr project
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-#
-
-# original RTL2832U vid/pid (hama nano, for example)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2832", MODE:="0666"
-
-# ezcap EzTV668 (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bda", ATTRS{idProduct}=="2838", MODE:="0666"
-
-# Terratec Cinergy T Stick Black (rev 1) (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00a9", MODE:="0666"
-
-# Terratec NOXON rev 1 (FC0013)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b3", MODE:="0666"
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b4", MODE:="0666"
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00b7", MODE:="0666"
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00c6", MODE:="0666"
-
-# Terratec Cinergy T Stick RC (Rev.3) (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d3", MODE:="0666"
-
-# Terratec T Stick PLUS (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00d7", MODE:="0666"
-
-# Terratec NOXON rev 2 (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0ccd", ATTRS{idProduct}=="00e0", MODE:="0666"
-
-# PixelView PV-DT235U(RN) (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1554", ATTRS{idProduct}=="5020", MODE:="0666"
-
-# Compro Videomate U620F (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0620", MODE:="0666"
-
-# Compro Videomate U650F (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0650", MODE:="0666"
-
-# Compro Videomate U680F (E4000)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="185b", ATTRS{idProduct}=="0680", MODE:="0666"
-
-# Sweex DVB-T USB (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="a803", MODE:="0666"
-
-# GTek T803 (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="b803", MODE:="0666"
-
-# Lifeview LV5TDeluxe (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="c803", MODE:="0666"
-
-# MyGica TD312 (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d286", MODE:="0666"
-
-# PROlectrix DV107669 (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1f4d", ATTRS{idProduct}=="d803", MODE:="0666"
-
-# Zaapa ZT-MINDVBZP (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d398", MODE:="0666"
-
-# Twintech UT-40 (FC0013)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d3a4", MODE:="0666"
-
-# Dexatek DK DVB-T Dongle (Logilink VG0002A) (FC2580)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1101", MODE:="0666"
-
-# Dexatek DK DVB-T Dongle (MSI DigiVox mini II V3.0)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1102", MODE:="0666"
-
-# Dexatek DK 5217 DVB-T Dongle (FC2580)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1103", MODE:="0666"
-
-# MSI DigiVox Micro HD (FC2580)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d19", ATTRS{idProduct}=="1104", MODE:="0666"
-
-# Genius TVGo DVB-T03 USB dongle (Ver. B)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="0458", ATTRS{idProduct}=="707f", MODE:="0666"
-
-# GIGABYTE GT-U7300 (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d393", MODE:="0666"
-
-# DIKOM USB-DVBT HD
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d394", MODE:="0666"
-
-# Peak 102569AGPK (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d395", MODE:="0666"
-
-# SVEON STV20 DVB-T USB & FM (FC0012)
-SUBSYSTEMS=="usb", ATTRS{idVendor}=="1b80", ATTRS{idProduct}=="d39d", MODE:="0666"
-

+ 9 - 0
rtl433.pc.in

@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: RTL-433 Utility
+Description: C Utility
+Version: @VERSION@
+Cflags: -I${includedir}/ @RTL433_PC_CFLAGS@

+ 7 - 111
src/CMakeLists.txt

@@ -1,13 +1,9 @@
-# Copyright 2012 OSMOCOM Project
-#
-# This file is part of rtl-sdr
-#
-# GNU Radio is free software; you can redistribute it and/or modify
+# rtl_433 is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3, or (at your option)
 # any later version.
 #
-# GNU Radio is distributed in the hope that it will be useful,
+# rtl_433 is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
@@ -17,61 +13,9 @@
 # the Free Software Foundation, Inc., 51 Franklin Street,
 # Boston, MA 02110-1301, USA.
 
-########################################################################
-# Setup library
-########################################################################
-add_library(rtlsdr_shared SHARED
-    librtlsdr.c
-    tuner_e4k.c
-    tuner_fc0012.c
-    tuner_fc0013.c
-    tuner_fc2580.c
-    tuner_r820t.c
-)
-
-target_link_libraries(rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-)
-
-set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
-set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
-set_target_properties(rtlsdr_shared PROPERTIES SOVERSION 0 VERSION 0.0.0)
-
-add_library(rtlsdr_static STATIC
-    librtlsdr.c
-    tuner_e4k.c
-    tuner_fc0012.c
-    tuner_fc0013.c
-    tuner_fc2580.c
-    tuner_r820t.c
-)
-
-if(WIN32)
-add_library(libgetopt_static STATIC
-    getopt/getopt.c
-)
-endif()
-
-target_link_libraries(rtlsdr_static
-    ${LIBUSB_LIBRARIES}
-)
-
-set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-
-if(NOT WIN32)
-# Force same library filename for static and shared variants of the library
-set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
-endif()
-
 ########################################################################
 # Build utility
 ########################################################################
-add_executable(rtl_sdr rtl_sdr.c)
-add_executable(rtl_tcp rtl_tcp.c)
-add_executable(rtl_test rtl_test.c)
-add_executable(rtl_fm rtl_fm.c)
-add_executable(rtl_eeprom rtl_eeprom.c)
-add_executable(rtl_adsb rtl_adsb.c)
 add_executable(rtl_433 
 	rtl_433.c
 	devices/silvercrest.c
@@ -87,69 +31,21 @@ add_executable(rtl_433
 	devices/intertechno.c
 	devices/alecto.c
 	devices/newkaku.c)
-	
-set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_433)
 
-target_link_libraries(rtl_sdr rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_tcp rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_test rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_fm rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_433 rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_eeprom rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
-    ${CMAKE_THREAD_LIBS_INIT}
-)
-target_link_libraries(rtl_adsb rtlsdr_shared
-    ${LIBUSB_LIBRARIES}
+target_link_libraries(rtl_433
+	${LIBRTLSDR_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
+
+	
+set(INSTALL_TARGETS rtl_433)
 if(UNIX)
-target_link_libraries(rtl_fm m)
 target_link_libraries(rtl_433 m)
-target_link_libraries(rtl_adsb m)
-if(APPLE)
-    target_link_libraries(rtl_test m)
-else()
-    target_link_libraries(rtl_test m rt)
-endif()
 endif()
 
-if(WIN32)
-target_link_libraries(rtl_sdr libgetopt_static)
-target_link_libraries(rtl_tcp libgetopt_static)
-target_link_libraries(rtl_test libgetopt_static)
-target_link_libraries(rtl_fm libgetopt_static)
-target_link_libraries(rtl_433 libgetopt_static)
-target_link_libraries(rtl_eeprom libgetopt_static)
-target_link_libraries(rtl_adsb libgetopt_static)
-set_property(TARGET rtl_sdr APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_tcp APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_test APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_fm APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_433 APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_eeprom APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-set_property(TARGET rtl_adsb APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-endif()
 ########################################################################
 # Install built library files & utilities
 ########################################################################
 install(TARGETS ${INSTALL_TARGETS}
-    LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
-    ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
     RUNTIME DESTINATION bin              # .dll file
 )

+ 18 - 31
src/Makefile.am

@@ -1,34 +1,21 @@
-# This is _NOT_ the library release version, it's an API version.
-# Please read Chapter 6 "Library interface versions" of the libtool documentation before making any modification
-LIBVERSION=0:0:0
-
 INCLUDES = $(all_includes) -I$(top_srcdir)/include
 AM_CFLAGS = ${CFLAGS} -fPIC ${SYMBOL_VISIBILITY}
 
-lib_LTLIBRARIES = librtlsdr.la
-
-librtlsdr_la_SOURCES = librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c tuner_r820t.c
-librtlsdr_la_LDFLAGS = -version-info $(LIBVERSION)
-
-bin_PROGRAMS         = rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_433
-
-rtl_sdr_SOURCES      = rtl_sdr.c
-rtl_sdr_LDADD        = librtlsdr.la
-
-rtl_tcp_SOURCES      = rtl_tcp.c
-rtl_tcp_LDADD        = librtlsdr.la
-
-rtl_test_SOURCES      = rtl_test.c
-rtl_test_LDADD        = librtlsdr.la $(LIBM)
-
-rtl_fm_SOURCES      = rtl_fm.c
-rtl_fm_LDADD        = librtlsdr.la $(LIBM)
-
-rtl_eeprom_SOURCES      = rtl_eeprom.c
-rtl_eeprom_LDADD        = librtlsdr.la $(LIBM)
-
-rtl_adsb_SOURCES      = rtl_adsb.c
-rtl_adsb_LDADD        = librtlsdr.la $(LIBM)
-
-rtl_433_SOURCES      = rtl_433.c
-rtl_433_LDADD        = librtlsdr.la $(LIBM)
+bin_PROGRAMS         = rtl_433
+
+rtl_433_SOURCES      = rtl_433.c \
+                       devices/acurite.c \
+                       devices/intertechno.c \
+                       devices/newkaku.c \
+                       devices/rubicson.c \
+                       devices/waveman.c \
+                       devices/alecto.c \
+                       devices/lacrosse.c \
+                       devices/oregon_scientific.c \
+                       devices/silvercrest.c \
+                       devices/elv.c \
+                       devices/mebus.c \
+                       devices/prologue.c \
+                       devices/steffen.c
+
+rtl_433_LDADD        = $(LIBRTLSDR) $(LIBM)

File diff suppressed because it is too large
+ 0 - 1698
src/librtlsdr.c


+ 0 - 512
src/rtl_adsb.c

@@ -1,512 +0,0 @@
-/*
- * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
- * Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
- * Copyright (C) 2012 by Hoernchen <la@tfc-server.de>
- * Copyright (C) 2012 by Kyle Keen <keenerd@gmail.com>
- * Copyright (C) 2012 by Youssef Touil <youssef@sdrsharp.com>
- * Copyright (C) 2012 by Ian Gilmour <ian@sdrsharp.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-
-#include <errno.h>
-#include <signal.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <Windows.h>
-#include <fcntl.h>
-#include <io.h>
-#include "getopt/getopt.h"
-#endif
-
-#include <semaphore.h>
-#include <pthread.h>
-#include <libusb.h>
-
-#include "rtl-sdr.h"
-
-#ifdef _WIN32
-#define sleep Sleep
-#define round(x) (x > 0.0 ? floor(x + 0.5): ceil(x - 0.5))
-#endif
-
-#define ADSB_RATE			2000000
-#define ADSB_FREQ			1090000000
-#define DEFAULT_ASYNC_BUF_NUMBER	12
-#define DEFAULT_BUF_LENGTH		(16 * 16384)
-#define AUTO_GAIN			-100
-
-static pthread_t demod_thread;
-static sem_t data_ready;
-static volatile int do_exit = 0;
-static rtlsdr_dev_t *dev = NULL;
-
-/* look up table, could be made smaller */
-uint8_t pyth[129][129];
-
-/* todo, bundle these up in a struct */
-uint8_t *buffer;
-int verbose_output = 0;
-int short_output = 0;
-double quality = 1.0;
-int allowed_errors = 5;
-FILE *file;
-int adsb_frame[14];
-#define preamble_len		16
-#define long_frame		112
-#define short_frame		56
-
-void usage(void)
-{
-	fprintf(stderr,
-		"rtl_adsb, a simple ADS-B decoder\n\n"
-		"Use:\trtl_adsb [-R] [-g gain] [-p ppm] [output file]\n"
-		"\t[-d device_index (default: 0)]\n"
-		"\t[-V verbove output (default: off)]\n"
-		"\t[-S show short frames (default: off)]\n"
-		"\t[-Q quality (0: no sanity checks, 0.5: half bit, 1: one bit (default), 2: two bits)]\n"
-		"\t[-e allowed_errors (default: 5)]\n"
-		"\t[-g tuner_gain (default: automatic)]\n"
-		"\t[-p ppm_error (default: 0)]\n"
-		"\tfilename (a '-' dumps samples to stdout)\n"
-		"\t (omitting the filename also uses stdout)\n\n"
-		"Streaming with netcat:\n"
-		"\trtl_adsb | netcat -lp 8080\n"
-		"\twhile true; do rtl_adsb | nc -lp 8080; done\n"
-		"Streaming with socat:\n"
-		"\trtl_adsb | socat -u - TCP4:sdrsharp.com:47806\n"
-		"\n");
-	exit(1);
-}
-
-#ifdef _WIN32
-BOOL WINAPI
-sighandler(int signum)
-{
-	if (CTRL_C_EVENT == signum) {
-		fprintf(stderr, "Signal caught, exiting!\n");
-		do_exit = 1;
-		rtlsdr_cancel_async(dev);
-		return TRUE;
-	}
-	return FALSE;
-}
-#else
-static void sighandler(int signum)
-{
-	fprintf(stderr, "Signal caught, exiting!\n");
-	do_exit = 1;
-	rtlsdr_cancel_async(dev);
-}
-#endif
-
-void display(int *frame, int len)
-{
-	int i, df;
-	if (!short_output && len <= short_frame) {
-		return;}
-	df = (frame[0] >> 3) & 0x1f;
-	if (quality == 0.0 && !(df==11 || df==17 || df==18 || df==19)) {
-		return;}
-	fprintf(file, "*");
-	for (i=0; i<((len+7)/8); i++) {
-		fprintf(file, "%02x", frame[i]);}
-	fprintf(file, ";\r\n");
-	if (!verbose_output) {
-		return;}
-	fprintf(file, "DF=%i CA=%i\n", df, frame[0] & 0x07);
-	fprintf(file, "ICAO Address=%06x\n", frame[1] << 16 | frame[2] << 8 | frame[3]);
-	if (len <= short_frame) {
-		return;}
-	fprintf(file, "PI=0x%06x\n",  frame[11] << 16 | frame[12] << 8 | frame[13]);
-	fprintf(file, "Type Code=%i S.Type/Ant.=%x\n", (frame[4] >> 3) & 0x1f, frame[4] & 0x07);
-	fprintf(file, "--------------\n");
-}
-
-void pyth_precompute(void)
-{
-	int x, y;
-	double scale = 1.408 ;  /* use the full 8 bits */
-	for (x=0; x<129; x++) {
-	for (y=0; y<129; y++) {
-		pyth[x][y] = (uint8_t)round(scale * sqrt(x*x + y*y));
-	}}
-}
-
-inline uint8_t abs8(uint8_t x)
-/* do not subtract 128 from the raw iq, this handles it */
-{
-	if (x >= 128) {
-		return x - 128;}
-	return 128 - x;
-}
-
-int magnitute(uint8_t *buf, int len)
-/* takes i/q, changes buf in place, returns new len */
-{
-	int i;
-	for (i=0; i<len; i+=2) {
-		buf[i/2] = pyth[abs8(buf[i])][abs8(buf[i+1])];
-	}
-	return len/2;
-}
-
-inline uint8_t single_manchester(uint8_t a, uint8_t b, uint8_t c, uint8_t d)
-/* takes 4 consecutive real samples, return 0 or 1, 255 on error */
-{
-	int bit, bit_p;
-	bit_p = a > b;
-	bit   = c > d;
-
-	if (quality == 0.0) {
-		return bit;}
-
-	if (quality == 0.5) {
-		if ( bit &&  bit_p && b > c) {
-			return 255;}
-		if (!bit && !bit_p && b < c) {
-			return 255;}
-		return bit;
-	}
-
-	if (quality == 1.0) {
-		if ( bit &&  bit_p && c > b) {
-			return 1;}
-		if ( bit && !bit_p && d < b) {
-			return 1;}
-		if (!bit &&  bit_p && d > b) {
-			return 0;}
-		if (!bit && !bit_p && c < b) {
-			return 0;}
-		return 255;
-	}
-
-	if ( bit &&  bit_p && c > b && d < a) {
-		return 1;}
-	if ( bit && !bit_p && c > a && d < b) {
-		return 1;}
-	if (!bit &&  bit_p && c < a && d > b) {
-		return 0;}
-	if (!bit && !bit_p && c < b && d > a) {
-		return 0;}
-	return 255;
-}
-
-inline uint8_t min8(uint8_t a, uint8_t b)
-{
-	return a<b ? a : b;
-}
-
-inline uint8_t max8(uint8_t a, uint8_t b)
-{
-	return a>b ? a : b;
-}
-
-inline int preamble(uint8_t *buf, int len, int i)
-/* returns 0/1 for preamble at index i */
-{
-	int i2;
-	uint8_t low  = 0;
-	uint8_t high = 255;
-	for (i2=0; i2<preamble_len; i2++) {
-		switch (i2) {
-			case 0:
-			case 2:
-			case 7:
-			case 9:
-				//high = min8(high, buf[i+i2]);
-				high = buf[i+i2];
-				break;
-			default:
-				//low  = max8(low,  buf[i+i2]);
-				low = buf[i+i2];
-				break;
-		}
-		if (high <= low) {
-			return 0;}
-	}
-	return 1;
-}
-
-void manchester(uint8_t *buf, int len)
-/* overwrites magnitude buffer with valid bits (255 on errors) */
-{
-	/* a and b hold old values to verify local manchester */
-	uint8_t a=0, b=0;
-	uint8_t bit;
-	int i, i2, start, errors;
-	// todo, allow wrap across buffers
-	i = 0;
-	while (i < len) {
-		/* find preamble */
-		for ( ; i < (len - preamble_len); i++) {
-			if (!preamble(buf, len, i)) {
-				continue;}
-			a = buf[i];
-			b = buf[i+1];
-			for (i2=0; i2<preamble_len; i2++) {
-				buf[i+i2] = 253;}
-			i += preamble_len;
-			break;
-		}
-		i2 = start = i;
-		errors = 0;
-		/* mark bits until encoding breaks */
-		for ( ; i < len; i+=2, i2++) {
-			bit = single_manchester(a, b, buf[i], buf[i+1]);
-			a = buf[i];
-			b = buf[i+1];
-			if (bit == 255) {
-				errors += 1;
-				if (errors > allowed_errors) {
-					buf[i2] = 255;
-					break;
-				} else {
-					bit = a > b;
-					/* these don't have to match the bit */
-					a = 0;
-					b = 255;
-				}
-			}
-			buf[i] = buf[i+1] = 254;  /* to be overwritten */
-			buf[i2] = bit;
-		}
-	}
-}
-
-void messages(uint8_t *buf, int len)
-{
-	int i, i2, start, preamble_found;
-	int data_i, index, shift, frame_len;
-	// todo, allow wrap across buffers
-	for (i=0; i<len; i++) {
-		if (buf[i] > 1) {
-			continue;}
-		frame_len = long_frame;
-		data_i = 0;
-		for (index=0; index<14; index++) {
-			adsb_frame[index] = 0;}
-		for(; i<len && buf[i]<=1 && data_i<frame_len; i++, data_i++) {
-			if (buf[i]) {
-				index = data_i / 8;
-				shift = 7 - (data_i % 8);
-				adsb_frame[index] |= (uint8_t)(1<<shift);
-			}
-			if (data_i == 7) {
-				if (adsb_frame[0] == 0) {
-				    break;}
-				if (adsb_frame[0] & 0x80) {
-					frame_len = long_frame;}
-				else {
-					frame_len = short_frame;}
-			}
-		}
-		if (data_i < (frame_len-1)) {
-			continue;}
-		display(adsb_frame, frame_len);
-		fflush(file);
-	}
-}
-
-static void rtlsdr_callback(unsigned char *buf, uint32_t len, void *ctx)
-{
-	int dr_val;
-	if (do_exit) {
-		return;}
-	memcpy(buffer, buf, len);
-	sem_getvalue(&data_ready, &dr_val);
-	if (dr_val <= 0) {
-		sem_post(&data_ready);}
-}
-
-static void *demod_thread_fn(void *arg)
-{
-	int len;
-	while (!do_exit) {
-		sem_wait(&data_ready);
-		len = magnitute(buffer, DEFAULT_BUF_LENGTH);
-		manchester(buffer, len);
-		messages(buffer, len);
-	}
-	rtlsdr_cancel_async(dev);
-	return 0;
-}
-
-int main(int argc, char **argv)
-{
-#ifndef _WIN32
-	struct sigaction sigact;
-#endif
-	char *filename = NULL;
-	int n_read, r, opt;
-	int i, gain = AUTO_GAIN; /* tenths of a dB */
-	uint32_t dev_index = 0;
-	int device_count;
-	int ppm_error = 0;
-	char vendor[256], product[256], serial[256];
-	sem_init(&data_ready, 0, 0);
-	pyth_precompute();
-
-	while ((opt = getopt(argc, argv, "d:g:p:e:Q:VS")) != -1)
-	{
-		switch (opt) {
-		case 'd':
-			dev_index = atoi(optarg);
-			break;
-		case 'g':
-			gain = (int)(atof(optarg) * 10);
-			break;
-		case 'p':
-			ppm_error = atoi(optarg);
-			break;
-		case 'V':
-			verbose_output = 1;
-			break;
-		case 'S':
-			short_output = 1;
-			break;
-		case 'e':
-			allowed_errors = atoi(optarg);
-			break;
-		case 'Q':
-			quality = atof(optarg);
-			break;
-		default:
-			usage();
-			return 0;
-		}
-	}
-
-	if (argc <= optind) {
-		filename = "-";
-	} else {
-		filename = argv[optind];
-	}
-
-	buffer = malloc(DEFAULT_BUF_LENGTH * sizeof(uint8_t));
-
-	device_count = rtlsdr_get_device_count();
-	if (!device_count) {
-		fprintf(stderr, "No supported devices found.\n");
-		exit(1);
-	}
-
-	fprintf(stderr, "Found %d device(s):\n", device_count);
-	for (i = 0; i < device_count; i++) {
-		rtlsdr_get_device_usb_strings(i, vendor, product, serial);
-		fprintf(stderr, "  %d:  %s, %s, SN: %s\n", i, vendor, product, serial);
-	}
-	fprintf(stderr, "\n");
-
-	fprintf(stderr, "Using device %d: %s\n",
-		dev_index, rtlsdr_get_device_name(dev_index));
-
-	r = rtlsdr_open(&dev, dev_index);
-	if (r < 0) {
-		fprintf(stderr, "Failed to open rtlsdr device #%d.\n", dev_index);
-		exit(1);
-	}
-#ifndef _WIN32
-	sigact.sa_handler = sighandler;
-	sigemptyset(&sigact.sa_mask);
-	sigact.sa_flags = 0;
-	sigaction(SIGINT, &sigact, NULL);
-	sigaction(SIGTERM, &sigact, NULL);
-	sigaction(SIGQUIT, &sigact, NULL);
-	sigaction(SIGPIPE, &sigact, NULL);
-#else
-	SetConsoleCtrlHandler( (PHANDLER_ROUTINE) sighandler, TRUE );
-#endif
-
-	if (strcmp(filename, "-") == 0) { /* Write samples to stdout */
-		file = stdout;
-		setvbuf(stdout, NULL, _IONBF, 0);
-#ifdef _WIN32
-		_setmode(_fileno(file), _O_BINARY);
-#endif
-	} else {
-		file = fopen(filename, "wb");
-		if (!file) {
-			fprintf(stderr, "Failed to open %s\n", filename);
-			exit(1);
-		}
-	}
-
-	/* Set the tuner gain */
-	if (gain == AUTO_GAIN) {
-		r = rtlsdr_set_tuner_gain_mode(dev, 0);
-	} else {
-		r = rtlsdr_set_tuner_gain_mode(dev, 1);
-		r = rtlsdr_set_tuner_gain(dev, gain);
-	}
-	if (r != 0) {
-		fprintf(stderr, "WARNING: Failed to set tuner gain.\n");
-	} else if (gain == AUTO_GAIN) {
-		fprintf(stderr, "Tuner gain set to automatic.\n");
-	} else {
-		fprintf(stderr, "Tuner gain set to %0.2f dB.\n", gain/10.0);
-	}
-
-	r = rtlsdr_set_freq_correction(dev, ppm_error);
-	r = rtlsdr_set_agc_mode(dev, 1);
-
-	/* Set the tuner frequency */
-	r = rtlsdr_set_center_freq(dev, ADSB_FREQ);
-	if (r < 0) {
-		fprintf(stderr, "WARNING: Failed to set center freq.\n");}
-	else {
-		fprintf(stderr, "Tuned to %u Hz.\n", ADSB_FREQ);}
-
-	/* Set the sample rate */
-	fprintf(stderr, "Sampling at %u Hz.\n", ADSB_RATE);
-	r = rtlsdr_set_sample_rate(dev, ADSB_RATE);
-	if (r < 0) {
-		fprintf(stderr, "WARNING: Failed to set sample rate.\n");}
-
-	/* Reset endpoint before we start reading from it (mandatory) */
-	r = rtlsdr_reset_buffer(dev);
-	if (r < 0) {
-		fprintf(stderr, "WARNING: Failed to reset buffers.\n");}
-
-	/* flush old junk */
-	sleep(1);
-	rtlsdr_read_sync(dev, NULL, 4096, NULL);
-
-	pthread_create(&demod_thread, NULL, demod_thread_fn, (void *)(NULL));
-	rtlsdr_read_async(dev, rtlsdr_callback, (void *)(NULL),
-			      DEFAULT_ASYNC_BUF_NUMBER,
-			      DEFAULT_BUF_LENGTH);
-
-
-	if (do_exit) {
-		fprintf(stderr, "\nUser cancel, exiting...\n");}
-	else {
-		fprintf(stderr, "\nLibrary error %d, exiting...\n", r);}
-	rtlsdr_cancel_async(dev);
-
-	if (file != stdout) {
-		fclose(file);}
-
-	rtlsdr_close(dev);
-	free(buffer);
-	return r >= 0 ? r : -r;
-}
-

+ 0 - 423
src/rtl_eeprom.c

@@ -1,423 +0,0 @@
-/*
- * rtl-sdr, turns your Realtek RTL2832 based DVB dongle into a SDR receiver
- * rtl_eeprom, EEPROM modification tool
- * Copyright (C) 2012 by Steve Markgraf <steve@steve-m.de>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#else
-#include <Windows.h>
-#include "getopt/getopt.h"
-#endif
-
-#include "rtl-sdr.h"
-
-#define EEPROM_SIZE	256
-#define MAX_STR_SIZE	256
-#define STR_OFFSET	0x09
-
-static rtlsdr_dev_t *dev = NULL;
-
-typedef struct rtlsdr_config {
-	uint16_t vendor_id;
-	uint16_t product_id;
-	char manufacturer[MAX_STR_SIZE];
-	char product[MAX_STR_SIZE];
-	char serial[MAX_STR_SIZE];
-	int have_serial;
-	int enable_ir;
-	int remote_wakeup;
-} rtlsdr_config_t;
-
-void dump_config(rtlsdr_config_t *conf)
-{
-	fprintf(stderr, "__________________________________________\n");
-	fprintf(stderr, "Vendor ID:\t\t0x%04x\n", conf->vendor_id);
-	fprintf(stderr, "Product ID:\t\t0x%04x\n", conf->product_id);
-	fprintf(stderr, "Manufacturer:\t\t%s\n", conf->manufacturer);
-	fprintf(stderr, "Product:\t\t%s\n", conf->product);
-	fprintf(stderr, "Serial number:\t\t%s\n", conf->serial);
-	fprintf(stderr, "Serial number enabled:\t");
-	fprintf(stderr, conf->have_serial ? "yes\n": "no\n");
-	fprintf(stderr, "IR endpoint enabled:\t");
-	fprintf(stderr, conf->enable_ir ? "yes\n": "no\n");
-	fprintf(stderr, "Remote wakeup enabled:\t");
-	fprintf(stderr, conf->remote_wakeup ? "yes\n": "no\n");
-	fprintf(stderr, "__________________________________________\n");
-}
-
-void usage(void)
-{
-	fprintf(stderr,
-		"rtl_eeprom, an EEPROM programming tool for "
-		"RTL2832 based DVB-T receivers\n\n"
-		"Usage:\n"
-		"\t[-d device_index (default: 0)]\n"
-		"\t[-m <str> set manufacturer string]\n"
-		"\t[-p <str> set product string]\n"
-		"\t[-s <str> set serial number string]\n"
-		"\t[-i <0,1> disable/enable IR-endpoint]\n"
-		"\t[-g <conf> generate default config and write to device]\n"
-		"\t[   <conf> can be one of:]\n"
-		"\t[   realtek\t\tRealtek default (as without EEPROM)]\n"
-		"\t[   realtek_oem\t\tRealtek default OEM with EEPROM]\n"
-		"\t[   noxon\t\tTerratec NOXON DAB Stick]\n"
-		"\t[   terratec_black\tTerratec T Stick Black]\n"
-		"\t[   terratec_plus\tTerratec T Stick+ (DVB-T/DAB)]\n"
-		"\t[-w <filename> write dumped file to device]\n"
-		"\t[-r <filename> dump EEPROM to file]\n"
-		"\t[-h display this help text]\n"
-		"\nUse on your own risk, especially -w!\n");
-	exit(1);
-}
-
-int get_string_descriptor(int pos, uint8_t *data, char *str)
-{
-	int len, i, j = 0;
-
-	len = data[pos];
-
-	if (data[pos + 1] != 0x03)
-		fprintf(stderr, "Error: invalid string descriptor!\n");
-
-	for (i = 2; i < len; i += 2)
-		str[j++] = data[pos + i];
-
-	str[j] = 0x00;
-
-	return pos + i;
-}
-
-int set_string_descriptor(int pos, uint8_t *data, char *str)
-{
-	int i = 0, j = 2;
-
-	if (pos < 0)
-		return -1;
-
-	data[pos + 1] = 0x03;
-
-	while (str[i] != 0x00) {
-		if ((pos + j) >= 78) {
-			fprintf(stderr, "Error: string too long, truncated!\n");
-			return -1;
-		}
-		data[pos + j++] = str[i++];
-		data[pos + j++] = 0x00;
-	}
-
-	data[pos] = j;
-
-	return pos + j;
-}
-
-int parse_eeprom_to_conf(rtlsdr_config_t *conf, uint8_t *dat)
-{
-	int pos;
-
-	if ((dat[0] != 0x28) || (dat[1] != 0x32))
-		fprintf(stderr, "Error: invalid RTL2832 EEPROM header!\n");
-
-	conf->vendor_id = dat[2] | (dat[3] << 8);
-	conf->product_id = dat[4] | (dat[5] << 8);
-	conf->have_serial = (dat[6] == 0xa5) ? 1 : 0;
-	conf->remote_wakeup = (dat[7] & 0x01) ? 1 : 0;
-	conf->enable_ir = (dat[7] & 0x02) ? 1 : 0;
-
-	pos = get_string_descriptor(STR_OFFSET, dat, conf->manufacturer);
-	pos = get_string_descriptor(pos, dat, conf->product);
-	get_string_descriptor(pos, dat, conf->serial);
-
-	return 0;
-}
-
-int gen_eeprom_from_conf(rtlsdr_config_t *conf, uint8_t *dat)
-{
-	int pos;
-
-	dat[0] = 0x28;
-	dat[1] = 0x32;
-	dat[2] = conf->vendor_id & 0xff;
-	dat[3] = (conf->vendor_id >> 8) & 0xff ;
-	dat[4] = conf->product_id & 0xff;
-	dat[5] = (conf->product_id >> 8) & 0xff;
-	dat[6] = conf->have_serial ? 0xa5 : 0x00;
-	dat[7] = 0x14;
-	dat[7] |= conf->remote_wakeup ? 0x01 : 0x00;
-	dat[7] |= conf->enable_ir ? 0x02 : 0x00;
-	dat[8] = 0x02;
-
-	pos = set_string_descriptor(STR_OFFSET, dat, conf->manufacturer);
-	pos = set_string_descriptor(pos, dat, conf->product);
-	pos = set_string_descriptor(pos, dat, conf->serial);
-
-	dat[78] = 0x00;		/* length of IR config */
-
-	return pos;
-}
-
-enum configs {
-	CONF_NONE = 0,
-	REALTEK,
-	REALTEK_EEPROM,
-	TERRATEC_NOXON,
-	TERRATEC_T_BLACK,
-	TERRATEC_T_PLUS,
-};
-
-void gen_default_conf(rtlsdr_config_t *conf, int config)
-{
-	switch (config) {
-	case REALTEK:
-		fprintf(stderr, "Realtek default (as without EEPROM)\n");
-		conf->vendor_id = 0x0bda;
-		conf->product_id = 0x2832;
-		strcpy(conf->manufacturer, "Generic");
-		strcpy(conf->product, "RTL2832U DVB-T");
-		strcpy(conf->serial, "0");
-		conf->have_serial = 1;
-		conf->enable_ir = 0;
-		conf->remote_wakeup = 1;
-		break;
-	case REALTEK_EEPROM:
-		fprintf(stderr, "Realtek default OEM with EEPROM\n");
-		conf->vendor_id = 0x0bda;
-		conf->product_id = 0x2838;
-		strcpy(conf->manufacturer, "Realtek");
-		strcpy(conf->product, "RTL2838UHIDIR");
-		strcpy(conf->serial, "00000001");
-		conf->have_serial = 1;
-		conf->enable_ir = 1;
-		conf->remote_wakeup = 0;
-		break;
-	case TERRATEC_NOXON:
-		fprintf(stderr, "Terratec NOXON DAB Stick\n");
-		conf->vendor_id = 0x0ccd;
-		conf->product_id = 0x00b3;
-		strcpy(conf->manufacturer, "NOXON");
-		strcpy(conf->product, "DAB Stick");
-		strcpy(conf->serial, "0");
-		conf->have_serial = 1;
-		conf->enable_ir = 0;
-		conf->remote_wakeup = 1;
-		break;
-	case TERRATEC_T_BLACK:
-		fprintf(stderr, "Terratec T Stick Black\n");
-		conf->vendor_id = 0x0ccd;
-		conf->product_id = 0x00a9;
-		strcpy(conf->manufacturer, "Realtek");
-		strcpy(conf->product, "RTL2838UHIDIR");
-		strcpy(conf->serial, "00000001");
-		conf->have_serial = 1;
-		conf->enable_ir = 1;
-		conf->remote_wakeup = 0;
-		break;
-	case TERRATEC_T_PLUS:
-		fprintf(stderr, "Terratec ran T Stick+\n");
-		conf->vendor_id = 0x0ccd;
-		conf->product_id = 0x00d7;
-		strcpy(conf->manufacturer, "Realtek");
-		strcpy(conf->product, "RTL2838UHIDIR");
-		strcpy(conf->serial, "00000001");
-		conf->have_serial = 1;
-		conf->enable_ir = 1;
-		conf->remote_wakeup = 0;
-		break;
-	default:
-		break;
-	};
-}
-
-int main(int argc, char **argv)
-{
-	int i, r, opt;
-	uint32_t dev_index = 0;
-	int device_count;
-	char *filename = NULL;
-	FILE *file = NULL;
-	char *manuf_str = NULL;
-	char *product_str = NULL;
-	char *serial_str = NULL;
-	uint8_t buf[EEPROM_SIZE];
-	rtlsdr_config_t conf;
-	int flash_file = 0;
-	int default_config = 0;
-	int change = 0;
-	int ir_endpoint = 0;
-	char ch;
-
-	while ((opt = getopt(argc, argv, "d:m:p:s:i:g:w:r:h?")) != -1) {
-		switch (opt) {
-		case 'd':
-			dev_index = atoi(optarg);
-			break;
-		case 'm':
-			manuf_str = optarg;
-			change = 1;
-			break;
-		case 'p':
-			product_str = optarg;
-			change = 1;
-			break;
-		case 's':
-			serial_str = optarg;
-			change = 1;
-			break;
-		case 'i':
-			ir_endpoint = (atoi(optarg) > 0) ? 1 : -1;
-			change = 1;
-			break;
-		case 'g':
-			if (!strcmp(optarg, "realtek"))
-				default_config = REALTEK;
-			else if (!strcmp(optarg, "realtek_oem"))
-				default_config = REALTEK_EEPROM;
-			else if (!strcmp(optarg, "noxon"))
-				default_config = TERRATEC_NOXON;
-			else if (!strcmp(optarg, "terratec_black"))
-				default_config = TERRATEC_T_BLACK;
-			else if (!strcmp(optarg, "terratec_plus"))
-				default_config = TERRATEC_T_PLUS;
-
-			if (default_config != CONF_NONE)
-				change = 1;
-			break;
-		case 'w':
-			flash_file = 1;
-			change = 1;
-		case 'r':
-			filename = optarg;
-			break;
-		default:
-			usage();
-			break;
-		}
-	}
-
-	device_count = rtlsdr_get_device_count();
-	if (!device_count) {
-		fprintf(stderr, "No supported devices found.\n");
-		exit(1);
-	}
-
-	fprintf(stderr, "Found %d device(s):\n", device_count);
-	for (i = 0; i < device_count; i++)
-		fprintf(stderr, "  %d:  %s\n", i, rtlsdr_get_device_name(i));
-	fprintf(stderr, "\n");
-
-	fprintf(stderr, "Using device %d: %s\n",
-		dev_index,
-		rtlsdr_get_device_name(dev_index));
-
-	r = rtlsdr_open(&dev, dev_index);