diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-28 15:39:57 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-28 15:39:57 -0600 |
commit | 8f19ca38293a6615be3fd6b2ec43f59bc1892010 (patch) | |
tree | 975ed38ef3369ac9054734e184435a5f049f34bb /nuttx/drivers | |
parent | 98bb52c4a4b7a48ac508adfb6206368166cc356b (diff) | |
download | px4-nuttx-8f19ca38293a6615be3fd6b2ec43f59bc1892010.tar.gz px4-nuttx-8f19ca38293a6615be3fd6b2ec43f59bc1892010.tar.bz2 px4-nuttx-8f19ca38293a6615be3fd6b2ec43f59bc1892010.zip |
DJoystick: Add a new ioctl to get the support joystick discrete signals
Diffstat (limited to 'nuttx/drivers')
-rw-r--r-- | nuttx/drivers/input/djoystick.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nuttx/drivers/input/djoystick.c b/nuttx/drivers/input/djoystick.c index 05342c29a..2be11ec54 100644 --- a/nuttx/drivers/input/djoystick.c +++ b/nuttx/drivers/input/djoystick.c @@ -584,6 +584,7 @@ static int djoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg) FAR struct inode *inode; FAR struct djoy_upperhalf_s *priv; FAR struct djoy_open_s *opriv; + FAR const struct djoy_lowerhalf_s *lower; int ret; DEBUGASSERT(filep && filep->f_priv && filep->f_inode); @@ -606,6 +607,29 @@ static int djoy_ioctl(FAR struct file *filep, int cmd, unsigned long arg) ret = -EINVAL; switch (cmd) { + /* Command: DJOYIOC_SUPPORTED + * Description: Report the set of button events supported by the hardware; + * Argument: A pointer to writeable integer value in which to return the + * set of supported buttons. + * Return: Zero (OK) on success. Minus one will be returned on failure + * with the errno value set appropriately. + */ + + case DJOYIOC_SUPPORTED: + { + FAR int *supported = (FAR int *)((uintptr_t)arg); + + if (supported) + { + lower = priv->du_lower; + DEBUGASSERT(lower && lower->dl_supported); + + *supported = (int)lower->dl_supported(lower); + ret = OK; + } + } + break; + #ifndef CONFIG_DISABLE_POLL /* Command: DJOYIOC_POLLEVENTS * Description: Specify the set of button events that can cause a poll() |