SHA256
1
0
forked from pool/rtl-sdr
rtl-sdr/rtl-sdr-0011-improve-rtl_power--scanning-range-parsing.patch

58 lines
1.6 KiB
Diff
Raw Normal View History

Accepting request 907681 from home:wkazubski:test:science - patches: rtl-sdr-0003-disable-zerocopy-by-default.patch rtl-sdr-0007-allow-build-rtlsdr-as-subroject.patch rtl-sdr-0008-add-CMP0075-policy.patch rtl-sdr-0016-add-missing-rtlsdrConfig.patch rtl-sdr-0017-add-rtl_biast-as-install-target.patch rtl-sdr-0018-fix-for-older-cmake.patch merged into rtl-sdr-0015-modernize-cmake-usage.patch - patch rtl-sdr-0005-add-rtlsdr_set_bias_tee_gpio.patch merged into rtl-sdr-0006-add-rtl_biast.patch - Added patches to upgrade to latest git head (only significant changes), including: + rtl-sdr-0001-mmap-bug-arm.patch + rtl-sdr-0002-fix-rtlsdr_open-memory-leak.patch + rtl-sdr-0003-disable-zerocopy-by-default.patch + rtl-sdr-0004-fix-rtl_eeprom-warnings.patch + rtl-sdr-0005-add-rtlsdr_set_bias_tee_gpio.patch + rtl-sdr-0006-add-rtl_biast.patch + rtl-sdr-0007-allow-build-rtlsdr-as-subroject.patch + rtl-sdr-0008-add-CMP0075-policy.patch + rtl-sdr-0009-fix-FC0013-UHF-reception.patch + rtl-sdr-0010-improve-librtlsdr_pc.patch + rtl-sdr-0011-improve-rtl_power--scanning-range-parsing.patch + rtl-sdr-0012-use-udev-uaccess_rules.patch (not used) + rtl-sdr-0013-add-IPV6-for-rtl_tcp.patch + rtl-sdr-0014-initialize-listensocket_in-rtl_tcp.patch + rtl-sdr-0015-modernize-cmake-usage.patch + rtl-sdr-0016-add-missing-rtlsdrConfig.patch + rtl-sdr-0017-add-rtl_biast-as-install-target.patch + rtl-sdr-0018-fix-for-older-cmake.patch + rtl-sdr-0019-fix-short-write-in-r82xx_read.patch + rtl-sdr-0020-populate-pkgconfig-with-prefix.patch * Full bias tee support for RTL-SDR v3 dongle * Command line utility rtl_biast for controlling bias tee * IPV-6 support for rtl_tcp * Fixed some bugs and compile time issues OBS-URL: https://build.opensuse.org/request/show/907681 OBS-URL: https://build.opensuse.org/package/show/hardware:sdr/rtl-sdr?expand=0&rev=21
2021-07-31 11:22:31 +02:00
From f2a9a81c4be95a6e9da97ec784f893d98a43f289 Mon Sep 17 00:00:00 2001
From: "A. Maitland Bottoms" <bottoms@debian.org>
Date: Thu, 24 Aug 2017 05:27:57 -0400
Subject: [PATCH] rtl_fm/rtl_power: Improve scanning range parsing
---
src/rtl_fm.c | 13 +++++++++++++
src/rtl_power.c | 8 ++++++++
2 files changed, 21 insertions(+)
diff --git a/src/rtl_fm.c b/src/rtl_fm.c
index b163979..283542d 100644
--- a/src/rtl_fm.c
+++ b/src/rtl_fm.c
@@ -926,8 +926,21 @@ void frequency_range(struct controller_state *s, char *arg)
int i;
start = arg;
stop = strchr(start, ':') + 1;
+ if (stop == (char *)1) { // no stop or step given
+ s->freqs[s->freq_len] = (uint32_t) atofs(start);
+ s->freq_len++;
+ return;
+ }
stop[-1] = '\0';
step = strchr(stop, ':') + 1;
+ if (step == (char *)1) { // no step given
+ s->freqs[s->freq_len] = (uint32_t) atofs(start);
+ s->freq_len++;
+ s->freqs[s->freq_len] = (uint32_t) atofs(stop);
+ s->freq_len++;
+ stop[-1] = ':';
+ return;
+ }
step[-1] = '\0';
for(i=(int)atofs(start); i<=(int)atofs(stop); i+=(int)atofs(step))
{
diff --git a/src/rtl_power.c b/src/rtl_power.c
index 625d818..6204de2 100644
--- a/src/rtl_power.c
+++ b/src/rtl_power.c
@@ -437,8 +437,16 @@ void frequency_range(char *arg, double crop)
/* hacky string parsing */
start = arg;
stop = strchr(start, ':') + 1;
+ if (stop == (char *)1) {
+ fprintf(stderr, "Bad frequency range specification: %s\n", arg);
+ exit(1);
+ }
stop[-1] = '\0';
step = strchr(stop, ':') + 1;
+ if (step == (char *)1) {
+ fprintf(stderr, "Bad frequency range specification: %s\n", arg);
+ exit(1);
+ }
step[-1] = '\0';
lower = (int)atofs(start);
upper = (int)atofs(stop);