Browse Source

hmc5883: fixed DEVIOCGDEVICEID ioctl

we need to pass the ioctl through to the bus interface

thanks to Jon Challinger for noticing this bug
sbg
Andrew Tridgell 10 years ago
parent
commit
9b10395e94
  1. 4
      src/drivers/hmc5883/hmc5883.cpp
  2. 5
      src/drivers/hmc5883/hmc5883_i2c.cpp
  3. 5
      src/drivers/hmc5883/hmc5883_spi.cpp

4
src/drivers/hmc5883/hmc5883.cpp

@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
#include <drivers/drv_mag.h>
#include <drivers/drv_hrt.h>
#include <drivers/device/ringbuffer.h>
#include <drivers/drv_device.h>
#include <uORB/uORB.h>
#include <uORB/topics/subsystem_info.h>
@ -725,6 +726,9 @@ HMC5883::ioctl(struct file *filp, int cmd, unsigned long arg) @@ -725,6 +726,9 @@ HMC5883::ioctl(struct file *filp, int cmd, unsigned long arg)
debug("MAGIOCGEXTERNAL in main driver");
return _interface->ioctl(cmd, dummy);
case DEVIOCGDEVICEID:
return _interface->ioctl(cmd, dummy);
default:
/* give it to the superclass */
return CDev::ioctl(filp, cmd, arg);

5
src/drivers/hmc5883/hmc5883_i2c.cpp

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include <drivers/device/i2c.h>
#include <drivers/drv_mag.h>
#include <drivers/drv_device.h>
#include "hmc5883.h"
@ -90,6 +91,7 @@ HMC5883_I2C_interface(int bus) @@ -90,6 +91,7 @@ HMC5883_I2C_interface(int bus)
HMC5883_I2C::HMC5883_I2C(int bus) :
I2C("HMC5883_I2C", nullptr, bus, HMC5883L_ADDRESS, 400000)
{
_device_id.devid_s.devtype = DRV_MAG_DEVTYPE_HMC5883;
}
HMC5883_I2C::~HMC5883_I2C()
@ -117,6 +119,9 @@ HMC5883_I2C::ioctl(unsigned operation, unsigned &arg) @@ -117,6 +119,9 @@ HMC5883_I2C::ioctl(unsigned operation, unsigned &arg)
return 0;
}
case DEVIOCGDEVICEID:
return CDev::ioctl(nullptr, operation, arg);
default:
ret = -EINVAL;
}

5
src/drivers/hmc5883/hmc5883_spi.cpp

@ -53,6 +53,7 @@ @@ -53,6 +53,7 @@
#include <drivers/device/spi.h>
#include <drivers/drv_mag.h>
#include <drivers/drv_device.h>
#include "hmc5883.h"
#include <board_config.h>
@ -92,6 +93,7 @@ HMC5883_SPI_interface(int bus) @@ -92,6 +93,7 @@ HMC5883_SPI_interface(int bus)
HMC5883_SPI::HMC5883_SPI(int bus, spi_dev_e device) :
SPI("HMC5883_SPI", nullptr, bus, device, SPIDEV_MODE3, 11*1000*1000 /* will be rounded to 10.4 MHz */)
{
_device_id.devid_s.devtype = DRV_MAG_DEVTYPE_HMC5883;
}
HMC5883_SPI::~HMC5883_SPI()
@ -146,6 +148,9 @@ HMC5883_SPI::ioctl(unsigned operation, unsigned &arg) @@ -146,6 +148,9 @@ HMC5883_SPI::ioctl(unsigned operation, unsigned &arg)
return 0;
}
case DEVIOCGDEVICEID:
return CDev::ioctl(nullptr, operation, arg);
default:
{
ret = -EINVAL;

Loading…
Cancel
Save