nuttx: Support for the mouse ioctl interface

Signed-off-by: liuhongchao <liuhongchao@xiaomi.com>
This commit is contained in:
liuhongchao 2024-10-29 10:45:01 +08:00 committed by Xiang Xiao
parent c15b900a88
commit 6dbd355c1f
3 changed files with 66 additions and 1 deletions

View file

@ -108,6 +108,7 @@
#define _PINCTRLBASE (0x4000) /* Pinctrl driver ioctl commands */
#define _PCIBASE (0x4100) /* Pci ioctl commands */
#define _I3CBASE (0x4200) /* I3C driver ioctl commands */
#define _MSEIOCBASE (0x4300) /* Mouse ioctl commands */
#define _WLIOCBASE (0x8b00) /* Wireless modules ioctl network commands */
/* boardctl() commands share the same number space */
@ -370,6 +371,11 @@
#define _TSIOCVALID(c) (_IOC_TYPE(c)==_TSIOCBASE)
#define _TSIOC(nr) _IOC(_TSIOCBASE,nr)
/* NuttX mouse ioctl definitions (see nuttx/input/mouse.h) ******************/
#define _MSEIOCVALID(c) (_IOC_TYPE(c)==_MSEIOCBASE)
#define _MSEIOC(nr) _IOC(_MSEIOCBASE,nr)
/* NuttX sensor ioctl definitions (see nuttx/sensor/ioctl.h) ****************/
#define _SNIOCVALID(c) (_IOC_TYPE(c)==_SNIOCBASE)

View file

@ -37,6 +37,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/fs/ioctl.h>
/****************************************************************************
* Pre-processor Definitions
@ -50,6 +51,13 @@
#define MOUSE_BUTTON_2 (1 << 1) /* True: Right mouse button pressed */
#define MOUSE_BUTTON_3 (1 << 2) /* True: Middle mouse button pressed */
/* IOCTL Commands ***********************************************************/
/* Common mouse IOCTL commands */
#define MSE_FIRST 0x0001 /* First common command */
#define MSE_NCMDS 1 /* One common commands */
/****************************************************************************
* Public Types
****************************************************************************/
@ -75,6 +83,25 @@ struct mouse_report_s
struct mouse_lowerhalf_s
{
FAR void *priv; /* Save the upper half pointer */
/**************************************************************************
* Name: control
*
* Description:
* Users can use this interface to implement custom IOCTL.
*
* Arguments:
* lower - The instance of lower half of mouse device.
* cmd - User defined specific command.
* arg - Argument of the specific command.
*
* Return Value:
* Zero(OK) on success; a negated errno value on failure.
* -ENOTTY - The command is not supported.
**************************************************************************/
CODE int (*control)(FAR struct mouse_lowerhalf_s *lower,
int cmd, unsigned long arg);
};
/****************************************************************************