tuner_e4k: update license in header

Changing the license of the header as well,
which had been forgotten in commit
6aec27c6d0830459e13f8781ad32a9c8345dcd5e
- "tuner_e4k: relicense driver under GPLv2+"

Signed-off-by: Steve Markgraf <steve@steve-m.de>
return RTLSDR_TUNER_UNKNOWN (0) on failure of rtlsdr_get_tuner_type
disable e4k enhanced mixer gain as it seems to have no effect
implement a more robust cancelation mechanism of async reader
rtlsdr_i2c_rad_reg: fix uninitialized variable

This could lead to a misdetection of the tuner on some
platforms (E4K instead of FC0013 on the raspberry pi).

Thanks to Christoph Gommel for reporting this issue.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
install (and uninstall) udev rules file
add initial support for the R820T tuner

Signed-off-by: Steve Markgraf <steve@steve-m.de>
don't install udev rules by default, as it may pollute the system

For cmake call with -DINSTALL_UDEV_RULES=ON for the rules to be
installed during the default install/uninstall stages.

For autotools call "make install-udev-rules" or "make uninstall-udev-

The rules file will be installed to "/etc/udev/rules.d".
autotools: add missing header

Signed-off-by: Steve Markgraf <steve@steve-m.de>
tuner_r820t: don't perform IMR calibration on init

This takes simply too much time (almost 3 seconds)
and doesn't really seem to make any difference for our
use case.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
rtl_fm: bugs found by Axiomatic, alkw0ia and cgommer

Signed-off-by: Steve Markgraf <steve@steve-m.de>
rtl_fm: fix auto/manual gain

Signed-off-by: Steve Markgraf <steve@steve-m.de>
rtl_fm: Axiomatic's automatic termination

Signed-off-by: Steve Markgraf <steve@steve-m.de>
rtl_fm: half the oversample bugs

Signed-off-by: Steve Markgraf <steve@steve-m.de>
add support for direct sampling mode

This commit adds the function rtlsdr_set_direct_sampling()
which can be used to enable/disable a mode where the
RTL2832 acts as a direct sampling receiver.

This mode disables the tuner, and by attaching a long
wire, or better, a 50Ω to 200Ω transformer and a lowpass-
filter to the In-phase ADC input (pin 1 or 2 of the RTL2832,
whereas pin 1 is at the molded dot) it is possible to listen to
shortwave radio stations. The coupling capacitors can be
left in place, but for better results they should be removed.

Tuning in this mode is done with the DDC, and since the
ADC samples with 28.8 MHz, tuning is possible from 0 to
28.8 MHz.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
make rtlsdr_close() build on win32 again

Signed-off-by: Steve Markgraf <steve@steve-m.de>
disable second ADC in IF mode, make input selectable in DS-mode

Signed-off-by: Steve Markgraf <steve@steve-m.de>
tuner_fc001x: check if PLL values are within boundaries

This fixes the issue of the FC0013 locking up at frequencies
between 928.0 and 950.0 MHz, which happened because
the numerator of the fraction exceeded its 5 bit limit.
For the tuner to behave normally again, the dongle needed
to be replugged.

For the FC0013 this now results in a small gap between
948.6 MHz and 950.0 MHz, where no valid PLL values
are existant.

For the FC0012 tuning is aborted when the maximum
frequency has been reached (948.6 MHz).

Signed-off-by: Steve Markgraf <steve@steve-m.de>
tuner_fc0013: setting GPIO not needed for filter selection

The driver selects the VHF/UHF filter via I2C.

Signed-off-by: Steve Markgraf <steve@steve-m.de>
tuner_fc0013: fix and improve manual LNA gain

Signed-off-by: Steve Markgraf <steve@steve-m.de>