From 67087c6428661618480d9f1fb9af1cf19b5dc5d1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Sun, 11 Oct 2015 15:43:45 +0200 Subject: [PATCH] MS5611: Fix breakage introduced by failed Qualcomm MS5611 port --- src/drivers/ms5611/ms5611_i2c.cpp | 28 +++++++--------------------- src/drivers/ms5611/ms5611_nuttx.cpp | 2 +- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/drivers/ms5611/ms5611_i2c.cpp b/src/drivers/ms5611/ms5611_i2c.cpp index 86aa28a389..3a86a7f064 100644 --- a/src/drivers/ms5611/ms5611_i2c.cpp +++ b/src/drivers/ms5611/ms5611_i2c.cpp @@ -45,7 +45,6 @@ #include #include #include -//#include #include #include @@ -71,20 +70,16 @@ public: virtual ~MS5611_I2C(); virtual int init(); - virtual ssize_t read(device::file_t *handlep, char *data, size_t count); - virtual int ioctl(device::file_t *handlep, int cmd, unsigned long arg); + virtual int read(unsigned offset, void *data, unsigned count); + virtual int ioctl(unsigned operation, unsigned &arg); -#ifdef __PX4_NUTTX protected: virtual int probe(); -#endif private: ms5611::prom_u &_prom; -#ifdef __PX4_NUTTX int _probe_address(uint8_t address); -#endif /** * Send a reset command to the MS5611. @@ -116,13 +111,7 @@ MS5611_i2c_interface(ms5611::prom_u &prom_buf, uint8_t busnum) } MS5611_I2C::MS5611_I2C(uint8_t bus, ms5611::prom_u &prom) : - I2C("MS5611_I2C", -#ifdef __PX4_NUTTX - nullptr, bus, 0, 400000 -#else - "/dev/MS5611_I2C", bus, 0 -#endif - ), + I2C("MS5611_I2C", nullptr, bus, 0, 400000), _prom(prom) { } @@ -138,8 +127,8 @@ MS5611_I2C::init() return I2C::init(); } -ssize_t -MS5611_I2C::read(device::file_t *handlep, char *data, size_t buflen) +int +MS5611_I2C::read(unsigned offset, void *data, unsigned count) { union _cvt { uint8_t b[4]; @@ -163,11 +152,11 @@ MS5611_I2C::read(device::file_t *handlep, char *data, size_t buflen) } int -MS5611_I2C::ioctl(device::file_t *handlep, int cmd, unsigned long arg) +MS5611_I2C::ioctl(unsigned operation, unsigned &arg) { int ret; - switch (cmd) { + switch (operation) { case IOCTL_RESET: ret = _reset(); break; @@ -183,7 +172,6 @@ MS5611_I2C::ioctl(device::file_t *handlep, int cmd, unsigned long arg) return ret; } -#ifdef __PX4_NUTTX int MS5611_I2C::probe() { @@ -220,8 +208,6 @@ MS5611_I2C::_probe_address(uint8_t address) return PX4_OK; } -#endif - int MS5611_I2C::_reset() diff --git a/src/drivers/ms5611/ms5611_nuttx.cpp b/src/drivers/ms5611/ms5611_nuttx.cpp index 7c336dfcab..91dd785bc6 100644 --- a/src/drivers/ms5611/ms5611_nuttx.cpp +++ b/src/drivers/ms5611/ms5611_nuttx.cpp @@ -963,7 +963,7 @@ start(enum MS5611_BUS busid) continue; } - started |= start_bus(bus_options[i]); + started = started || start_bus(bus_options[i]); } if (!started) {