diff --git a/src/drivers/device/device.cpp b/src/drivers/device/device.cpp index b4976250d4..34382263ac 100644 --- a/src/drivers/device/device.cpp +++ b/src/drivers/device/device.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -121,7 +122,7 @@ int Device::dev_ioctl(unsigned operation, unsigned &arg) { switch (operation) { - case PX4_DEVIOCGDEVICEID: + case DEVIOCGDEVICEID: return (int)_device_id.devid; } return -ENODEV; diff --git a/src/drivers/device/vdev.cpp b/src/drivers/device/vdev.cpp index 0d02d2b420..0c1dc3abe9 100644 --- a/src/drivers/device/vdev.cpp +++ b/src/drivers/device/vdev.cpp @@ -298,19 +298,20 @@ VDev::ioctl(px4_dev_handle_t *handlep, int cmd, unsigned long arg) switch (cmd) { /* fetch a pointer to the driver's private data */ - case PX4_DIOC_GETPRIV: + case DIOC_GETPRIV: *(void **)(uintptr_t)arg = (void *)this; ret = PX4_OK; break; - case PX4_DEVIOCSPUBBLOCK: + case DEVIOCSPUBBLOCK: _pub_blocked = (arg != 0); ret = PX4_OK; break; - case PX4_DEVIOCGPUBBLOCK: + case DEVIOCGPUBBLOCK: ret = _pub_blocked; break; - case PX4_DEVIOCGDEVICEID: + case DEVIOCGDEVICEID: ret = (int)_device_id.devid; + printf("IOCTL DEVIOCGDEVICEID %d\n", ret); default: break; } diff --git a/src/drivers/drv_device.h b/src/drivers/drv_device.h index 650b18bed5..3477dde9fd 100644 --- a/src/drivers/drv_device.h +++ b/src/drivers/drv_device.h @@ -65,5 +65,8 @@ */ #define DEVIOCGDEVICEID _DEVICEIOC(2) +#ifdef __PX4_POSIX +#define DIOC_GETPRIV SIOCDEVPRIVATE +#endif #endif /* _DRV_DEVICE_H */ diff --git a/src/platforms/px4_posix.h b/src/platforms/px4_posix.h index ed4edbb24e..18f4878878 100644 --- a/src/platforms/px4_posix.h +++ b/src/platforms/px4_posix.h @@ -49,12 +49,6 @@ #define PX4_F_RDONLY 1 #define PX4_F_WRONLY 2 -#define PX4_DEVIOCGDEVICEID 1 - -#define PX4_DIOC_GETPRIV 2 -#define PX4_DEVIOCSPUBBLOCK 3 -#define PX4_DEVIOCGPUBBLOCK 4 - #define PX4_DEBUG(...) //#define PX4_DEBUG(...) printf(__VA_ARGS__)