aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlcl <lcl@nanohome.be>2015-05-06 20:28:38 +0200
committerlcl <lcl7@nanohome.be>2015-05-08 11:10:30 +0200
commitc5dc459fc51d4b6721a7c0457ac0cddbb3213b2c (patch)
tree8e3a916d87d522e0d920a4c77dc2d0e12c864401
parentd447a2e9830463ff83f6dcaef59b5684ff1df255 (diff)
Correct return code of e4k_reg_write().
In contradiction with the documentation, e4k_reg_write() was returning the value 2 upon success (the number of bytes written), not zero as documented. Patched to return zero upon success. As a consequence, this corrects also the return value of e4k_reg_set_mask() and e4k_dc_offset_calibrate().
-rw-r--r--src/tuner_e4k.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tuner_e4k.c b/src/tuner_e4k.c
index c2ec044..400e745 100644
--- a/src/tuner_e4k.c
+++ b/src/tuner_e4k.c
@@ -64,11 +64,13 @@ static const uint8_t width2mask[] = {
*/
static int e4k_reg_write(struct e4k_state *e4k, uint8_t reg, uint8_t val)
{
+ int r;
uint8_t data[2];
data[0] = reg;
data[1] = val;
- return rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, data, 2);
+ r = rtlsdr_i2c_write_fn(e4k->rtl_dev, e4k->i2c_addr, data, 2);
+ return r == 2 ? 0 : -1;
}
/*! \brief Read a register of the tuner chip