input/keyboard: Make each instance could have a different buffer size
just like what is done for touch screen driver Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
7de9b879a1
commit
7ea14aa8f8
|
@ -40,16 +40,6 @@ config INPUT_KEYBOARD
|
|||
select MM_CIRCBUF
|
||||
default n
|
||||
|
||||
if INPUT_KEYBOARD
|
||||
|
||||
config INPUT_KEYBOARD_BUFFSIZE
|
||||
int "Number keyboard data buffer"
|
||||
default 64
|
||||
---help---
|
||||
Maximum number of keyboard data buffer
|
||||
|
||||
endif # INPUT_KEYBOARD
|
||||
|
||||
config INPUT_UINPUT
|
||||
bool
|
||||
default n
|
||||
|
@ -100,6 +90,14 @@ config UINPUT_KEYBOARD
|
|||
---help---
|
||||
Enable support virtual input keyboard device driver
|
||||
|
||||
if UINPUT_KEYBOARD
|
||||
|
||||
config UINPUT_KEYBOARD_BUFNUMBER
|
||||
int "Number keyboard data buffer"
|
||||
default 8
|
||||
|
||||
endif
|
||||
|
||||
config INPUT_MAX11802
|
||||
bool "MAX11802 touchscreen controller"
|
||||
default n
|
||||
|
|
|
@ -60,6 +60,7 @@ struct keyboard_upperhalf_s
|
|||
struct list_node head; /* Head of list */
|
||||
FAR struct keyboard_lowerhalf_s
|
||||
*lower; /* A pointer of lower half instance */
|
||||
uint8_t nums; /* Number of buffer */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -148,7 +149,7 @@ static int keyboard_open(FAR struct file *filep)
|
|||
|
||||
/* Initializes the buffer for each open file */
|
||||
|
||||
ret = circbuf_init(&opriv->circ, NULL, CONFIG_INPUT_KEYBOARD_BUFFSIZE);
|
||||
ret = circbuf_init(&opriv->circ, NULL, upper->nums);
|
||||
if (ret < 0)
|
||||
{
|
||||
kmm_free(opriv);
|
||||
|
@ -342,7 +343,7 @@ static ssize_t keyboard_write(FAR struct file *filep,
|
|||
****************************************************************************/
|
||||
|
||||
int keyboard_register(FAR struct keyboard_lowerhalf_s *lower,
|
||||
FAR const char *path)
|
||||
FAR const char *path, uint8_t nums)
|
||||
{
|
||||
FAR struct keyboard_upperhalf_s *upper;
|
||||
int ret;
|
||||
|
@ -362,6 +363,7 @@ int keyboard_register(FAR struct keyboard_lowerhalf_s *lower,
|
|||
}
|
||||
|
||||
upper->lower = lower;
|
||||
upper->nums = nums;
|
||||
lower->priv = upper;
|
||||
list_initialize(&upper->head);
|
||||
nxsem_init(&upper->exclsem, 0, 1);
|
||||
|
|
|
@ -588,7 +588,9 @@ int uinput_keyboard_initialize(void)
|
|||
|
||||
/* Regiest Touchscreen device */
|
||||
|
||||
ret = keyboard_register(&ukbd_lower->lower, "/dev/" UINPUT_NAME_KEYBOARD);
|
||||
ret = keyboard_register(&ukbd_lower->lower,
|
||||
"/dev/" UINPUT_NAME_KEYBOARD,
|
||||
CONFIG_UINPUT_KEYBOARD_BUFNUMBER);
|
||||
if (ret < 0)
|
||||
{
|
||||
kmm_free(ukbd_lower);
|
||||
|
|
|
@ -80,7 +80,7 @@ void keyboard_event(FAR struct keyboard_lowerhalf_s *lower, uint32_t keycode,
|
|||
****************************************************************************/
|
||||
|
||||
int keyboard_register(FAR struct keyboard_lowerhalf_s *lower,
|
||||
FAR const char *path);
|
||||
FAR const char *path, uint8_t nums);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: keyboard_register
|
||||
|
|
Loading…
Reference in New Issue