forked from pool/rtl-sdr
1ea97b31dd
- 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
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From d794155ba65796a76cd0a436f9709f4601509320 Mon Sep 17 00:00:00 2001
|
|
From: Derrick Pallas <derrick@pallas.us>
|
|
Date: Wed, 18 Mar 2020 14:54:48 -0700
|
|
Subject: [PATCH] tuner_r82xx: fix short-write in r82xx_read
|
|
|
|
In r82xx_read, there is a 1-byte I2C write followed by the I2C read. If
|
|
this I2C write fails, r82xx_read correctly bails out but may return 0.
|
|
Callers that check whether (rc < 0) will assume that the buffer was written
|
|
when it has not been, e.g. in r82xx_set_tv_standard where
|
|
|
|
priv->fil_cal_code = data[4] & 0x0f;
|
|
|
|
consumes a garbage value for data[4].
|
|
|
|
This change resolves that issue by copying the error path from r82xx_write.
|
|
---
|
|
src/tuner_r82xx.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/tuner_r82xx.c b/src/tuner_r82xx.c
|
|
index fe52bd9..997abd7 100644
|
|
--- a/src/tuner_r82xx.c
|
|
+++ b/src/tuner_r82xx.c
|
|
@@ -330,8 +330,14 @@ static int r82xx_read(struct r82xx_priv *priv, uint8_t reg, uint8_t *val, int le
|
|
priv->buf[0] = reg;
|
|
|
|
rc = rtlsdr_i2c_write_fn(priv->rtl_dev, priv->cfg->i2c_addr, priv->buf, 1);
|
|
- if (rc < 1)
|
|
- return rc;
|
|
+
|
|
+ if (rc != 1) {
|
|
+ fprintf(stderr, "%s: i2c wr failed=%d reg=%02x len=%d\n",
|
|
+ __FUNCTION__, rc, reg, 1);
|
|
+ if (rc < 0)
|
|
+ return rc;
|
|
+ return -1;
|
|
+ }
|
|
|
|
rc = rtlsdr_i2c_read_fn(priv->rtl_dev, priv->cfg->i2c_addr, p, len);
|
|
|