input/uinput: fix codesyle issue
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
d49ad207ef
commit
ef66c620c4
@ -21,8 +21,6 @@
|
|||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <debug.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -89,8 +87,8 @@ static ssize_t uinput_touch_write(FAR struct touch_lowerhalf_s *lower,
|
|||||||
FAR const char *buffer, size_t buflen)
|
FAR const char *buffer, size_t buflen)
|
||||||
{
|
{
|
||||||
FAR const struct touch_sample_s *sample;
|
FAR const struct touch_sample_s *sample;
|
||||||
sample = (FAR const struct touch_sample_s *)buffer;
|
|
||||||
|
|
||||||
|
sample = (FAR const struct touch_sample_s *)buffer;
|
||||||
if (sample == NULL)
|
if (sample == NULL)
|
||||||
{
|
{
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -103,6 +101,10 @@ static ssize_t uinput_touch_write(FAR struct touch_lowerhalf_s *lower,
|
|||||||
|
|
||||||
#ifdef CONFIG_INPUT_BUTTONS
|
#ifdef CONFIG_INPUT_BUTTONS
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uinput_button_write
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uinput_button_write
|
* Name: uinput_button_write
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -143,9 +145,14 @@ uinput_button_buttons(FAR const struct btn_lowerhalf_s *lower)
|
|||||||
{
|
{
|
||||||
FAR struct uinput_button_lowerhalf_s *ubtn_lower =
|
FAR struct uinput_button_lowerhalf_s *ubtn_lower =
|
||||||
(FAR struct uinput_button_lowerhalf_s *)lower;
|
(FAR struct uinput_button_lowerhalf_s *)lower;
|
||||||
|
|
||||||
return ubtn_lower->buttons;
|
return ubtn_lower->buttons;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uinput_button_enable
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
|
static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
|
||||||
btn_buttonset_t press,
|
btn_buttonset_t press,
|
||||||
btn_buttonset_t release,
|
btn_buttonset_t release,
|
||||||
@ -153,6 +160,7 @@ static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
|
|||||||
{
|
{
|
||||||
FAR struct uinput_button_lowerhalf_s *ubtn_lower =
|
FAR struct uinput_button_lowerhalf_s *ubtn_lower =
|
||||||
(FAR struct uinput_button_lowerhalf_s *)lower;
|
(FAR struct uinput_button_lowerhalf_s *)lower;
|
||||||
|
|
||||||
ubtn_lower->arg = arg;
|
ubtn_lower->arg = arg;
|
||||||
ubtn_lower->handler = handler;
|
ubtn_lower->handler = handler;
|
||||||
}
|
}
|
||||||
@ -180,12 +188,14 @@ static void uinput_button_enable(FAR const struct btn_lowerhalf_s *lower,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_INPUT_TOUCHSCREEN
|
||||||
int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
|
int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
|
||||||
{
|
{
|
||||||
char devname[UINPUT_NAME_SIZE];
|
char devname[UINPUT_NAME_SIZE];
|
||||||
FAR struct touch_lowerhalf_s *lower;
|
FAR struct touch_lowerhalf_s *lower;
|
||||||
|
int ret;
|
||||||
|
|
||||||
lower = kmm_malloc(sizeof(struct touch_lowerhalf_s));
|
lower = kmm_zalloc(sizeof(struct touch_lowerhalf_s));
|
||||||
if (!lower)
|
if (!lower)
|
||||||
{
|
{
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -195,16 +205,39 @@ int uinput_touch_initialize(FAR const char *name, int maxpoint, int buffnums)
|
|||||||
|
|
||||||
lower->write = uinput_touch_write;
|
lower->write = uinput_touch_write;
|
||||||
lower->maxpoint = maxpoint;
|
lower->maxpoint = maxpoint;
|
||||||
snprintf(devname, UINPUT_NAME_SIZE, "/dev/%s", name);
|
|
||||||
|
|
||||||
return touch_register(lower, devname, buffnums);
|
snprintf(devname, UINPUT_NAME_SIZE, "/dev/%s", name);
|
||||||
|
ret = touch_register(lower, devname, buffnums);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
kmm_free(lower);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: uinput_button_initialize
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Initialized the uinput button device
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* name: Button devices name
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
|
* Zero is returned on success. Otherwise, a negated errno value is
|
||||||
|
* returned to indicate the nature of the failure.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_INPUT_BUTTONS
|
#ifdef CONFIG_INPUT_BUTTONS
|
||||||
int uinput_button_initialize(FAR const char *name)
|
int uinput_button_initialize(FAR const char *name)
|
||||||
{
|
{
|
||||||
char devname[UINPUT_NAME_SIZE];
|
char devname[UINPUT_NAME_SIZE];
|
||||||
FAR struct uinput_button_lowerhalf_s *ubtn_lower;
|
FAR struct uinput_button_lowerhalf_s *ubtn_lower;
|
||||||
|
int ret;
|
||||||
|
|
||||||
ubtn_lower = kmm_zalloc(sizeof(struct uinput_button_lowerhalf_s));
|
ubtn_lower = kmm_zalloc(sizeof(struct uinput_button_lowerhalf_s));
|
||||||
ubtn_lower->lower.bl_buttons = uinput_button_buttons;
|
ubtn_lower->lower.bl_buttons = uinput_button_buttons;
|
||||||
@ -213,6 +246,12 @@ int uinput_button_initialize(FAR const char *name)
|
|||||||
ubtn_lower->lower.bl_write = uinput_button_write;
|
ubtn_lower->lower.bl_write = uinput_button_write;
|
||||||
|
|
||||||
snprintf(devname, UINPUT_NAME_SIZE, "/dev/%s", name);
|
snprintf(devname, UINPUT_NAME_SIZE, "/dev/%s", name);
|
||||||
return btn_register(devname, &ubtn_lower->lower);
|
ret = btn_register(devname, &ubtn_lower->lower);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
kmm_free(ubtn_lower);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_INPUT_BUTTONS */
|
#endif /* CONFIG_INPUT_BUTTONS */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user