aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/sf0x/sf0x.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/drivers/sf0x/sf0x.cpp b/src/drivers/sf0x/sf0x.cpp
index f25856689..5dd1f59de 100644
--- a/src/drivers/sf0x/sf0x.cpp
+++ b/src/drivers/sf0x/sf0x.cpp
@@ -209,6 +209,10 @@ SF0X::init()
{
int ret = ERROR;
+ /* do regular cdev init */
+ if (CDev::init() != OK)
+ goto out;
+
/* allocate basic report buffers */
_reports = new RingBuffer(2, sizeof(range_finder_report));
@@ -447,7 +451,7 @@ SF0X::measure()
char cmd = SF0X_TAKE_RANGE_REG;
ret = ::write(_fd, &cmd, 1);
- if (OK != sizeof(cmd)) {
+ if (ret != sizeof(cmd)) {
perf_count(_comms_errors);
log("serial transfer returned %d", ret);
return ret;