mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 06:53:33 +08:00
Framework to support disabling publications via IOCTL
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
#include "drivers/drv_device.h"
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
@@ -93,6 +94,7 @@ CDev::CDev(const char *name,
|
|||||||
Device(name, irq),
|
Device(name, irq),
|
||||||
// public
|
// public
|
||||||
// protected
|
// protected
|
||||||
|
_pub_blocked(false),
|
||||||
// private
|
// private
|
||||||
_devname(devname),
|
_devname(devname),
|
||||||
_registered(false),
|
_registered(false),
|
||||||
@@ -256,6 +258,13 @@ CDev::ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
case DIOC_GETPRIV:
|
case DIOC_GETPRIV:
|
||||||
*(void **)(uintptr_t)arg = (void *)this;
|
*(void **)(uintptr_t)arg = (void *)this;
|
||||||
return OK;
|
return OK;
|
||||||
|
break;
|
||||||
|
case DEVIOCSPUBBLOCK:
|
||||||
|
_pub_blocked = (arg != 0);
|
||||||
|
break;
|
||||||
|
case DEVIOCGPUBBLOCK:
|
||||||
|
return _pub_blocked;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOTTY;
|
return -ENOTTY;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
|
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
@@ -415,6 +415,8 @@ protected:
|
|||||||
*/
|
*/
|
||||||
virtual int unregister_class_devname(const char *class_devname, unsigned class_instance);
|
virtual int unregister_class_devname(const char *class_devname, unsigned class_instance);
|
||||||
|
|
||||||
|
bool _pub_blocked; /**< true if publishing should be blocked */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const unsigned _max_pollwaiters = 8;
|
static const unsigned _max_pollwaiters = 8;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user