board/sim: update uinput init & Kconfig

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2022-02-17 11:00:03 +08:00 committed by Petro Karashchenko
parent 0c2f86f74d
commit eebd736891
4 changed files with 51 additions and 21 deletions

View File

@ -319,15 +319,21 @@ int sim_bringup(void)
}
#endif
#ifdef CONFIG_INPUT_UINPUT
/* Initialize the touchscreen uinput */
#ifdef CONFIG_UINPUT_TOUCHSCREEN
ret = uinput_touch_initialize("utouch", 1, 4);
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: uinput_touch_initialize failed: %d\n", ret);
}
#endif
#endif /* CONFIG_UINPUT_TOUCHSCREEN */
#ifdef CONFIG_UINPUT_BUTTONS
ret = uinput_button_initialize("ubutton");
if (ret < 0)
{
syslog(LOG_ERR, "ERROR: uinput_button_initialize failed: %d\n", ret);
}
#endif /* CONFIG_UINPUT_BUTTONS */
#ifdef CONFIG_IEEE802154_LOOPBACK
/* Initialize and register the IEEE802.15.4 MAC network loop device */

View File

@ -36,12 +36,27 @@ config INPUT_TOUCHSCREEN
default n
config INPUT_UINPUT
bool "Enable uinput"
select INPUT_TOUCHSCREEN
bool
default n
---help---
Enable support virtual input device driver
config UINPUT_TOUCHSCREEN
bool "Enable uinput touchscreen"
select INPUT_TOUCHSCREEN
select INPUT_UINPUT
default n
---help---
Enable support virtual input touchscreen device driver
config UINPUT_BUTTONS
bool "Enable uinput buttons"
select INPUT_BUTTONS
select INPUT_UINPUT
default n
---help---
Enable support virtual input button device driver
config INPUT_MAX11802
bool "MAX11802 touchscreen controller"
default n

View File

@ -51,12 +51,15 @@ struct uinput_button_lowerhalf_s
* Private Function Prototypes
****************************************************************************/
#ifdef CONFIG_INPUT_TOUCHSCREEN
#ifdef CONFIG_UINPUT_TOUCHSCREEN
static ssize_t uinput_touch_write(FAR struct touch_lowerhalf_s *lower,
FAR const char *buffer, size_t buflen);
#endif
#ifdef CONFIG_INPUT_BUTTONS
#endif /* CONFIG_UINPUT_TOUCHSCREEN */
#ifdef CONFIG_UINPUT_BUTTONS
static ssize_t uinput_button_write(FAR const struct btn_lowerhalf_s *lower,
FAR const char *buffer, size_t buflen);
@ -71,13 +74,14 @@ static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
btn_buttonset_t release,
btn_handler_t handler,
FAR void *arg);
#endif
#endif /* CONFIG_UINPUT_BUTTONS */
/****************************************************************************
* Private Functions
****************************************************************************/
#ifdef CONFIG_INPUT_TOUCHSCREEN
#ifdef CONFIG_UINPUT_TOUCHSCREEN
/****************************************************************************
* Name: uinput_touch_write
@ -97,13 +101,10 @@ static ssize_t uinput_touch_write(FAR struct touch_lowerhalf_s *lower,
touch_event(lower->priv, sample);
return buflen;
}
#endif /* CONFIG_INPUT_TOUCHSCREEN */
#ifdef CONFIG_INPUT_BUTTONS
#endif /* CONFIG_UINPUT_TOUCHSCREEN */
/****************************************************************************
* Name: uinput_button_write
****************************************************************************/
#ifdef CONFIG_UINPUT_BUTTONS
/****************************************************************************
* Name: uinput_button_write
@ -165,7 +166,7 @@ static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
ubtn_lower->handler = handler;
}
#endif /* CONFIG_INPUT_BUTTONS */
#endif /* CONFIG_UINPUT_BUTTONS */
/****************************************************************************
* Public Functions
@ -188,7 +189,8 @@ static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
*
****************************************************************************/
#ifdef CONFIG_INPUT_TOUCHSCREEN
#ifdef CONFIG_UINPUT_TOUCHSCREEN
int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
{
char devname[UINPUT_NAME_SIZE];
@ -215,7 +217,8 @@ int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
return ret;
}
#endif
#endif /* CONFIG_UINPUT_TOUCHSCREEN */
/****************************************************************************
* Name: uinput_button_initialize
@ -232,7 +235,8 @@ int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
*
****************************************************************************/
#ifdef CONFIG_INPUT_BUTTONS
#ifdef CONFIG_UINPUT_BUTTONS
int uinput_button_initialize(FAR const char *name)
{
char devname[UINPUT_NAME_SIZE];
@ -254,4 +258,5 @@ int uinput_button_initialize(FAR const char *name)
return ret;
}
#endif /* CONFIG_INPUT_BUTTONS */
#endif /* CONFIG_UINPUT_BUTTONS */

View File

@ -46,8 +46,10 @@
*
****************************************************************************/
#ifdef CONFIG_UINPUT_TOUCHSCREEN
int uinput_touch_initialize(FAR const char *name, int maxpoint,
int buffnums);
#endif
/****************************************************************************
* Name: uinput_button_initialize
@ -64,6 +66,8 @@ int uinput_touch_initialize(FAR const char *name, int maxpoint,
*
****************************************************************************/
#ifdef CONFIG_UINPUT_BUTTONS
int uinput_button_initialize(FAR const char *name);
#endif
#endif /* __INCLUDE_NUTTX_INPUT_UINPUT_H */