aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2015-05-16 00:48:37 +0200
committerSteve Markgraf <steve@steve-m.de>2015-05-16 00:48:37 +0200
commit8b4d755ba1b889510fba30f627ee08736203070d (patch)
tree32adb5a9a0b0f1c3c4cd3f93aaaae388d0e24449
parent92df068dc5acae9e671eefe1f80626319819c52b (diff)
parentc5dc459fc51d4b6721a7c0457ac0cddbb3213b2c (diff)
Merge pull request #20 from lcl7/correct-e4k_reg_write
Correct return code of e4k_reg_write().
-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