input: use events instead of threads
This commit is contained in:
parent
a22b192e23
commit
8ddc3d448e
22 changed files with 1027 additions and 597 deletions
|
|
@ -3,59 +3,50 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BBX_INDEV_H
|
||||
#define BBX_INDEV_H
|
||||
|
||||
#ifndef BBX_APP_BUFFYBOARD
|
||||
#include "lvgl/lvgl.h"
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
struct bbx_indev_opts {
|
||||
#ifndef BBX_APP_BUFFYBOARD
|
||||
struct xkb_rule_names* keymap;
|
||||
uint8_t keyboard : 1;
|
||||
#endif
|
||||
uint8_t pointer : 1;
|
||||
uint8_t touchscreen : 1;
|
||||
};
|
||||
|
||||
#ifndef BBX_APP_BUFFYBOARD
|
||||
/* All keyboard devices are added to this input group */
|
||||
extern lv_group_t *keyboard_input_group;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the required capabilities for input devices.
|
||||
* Attach input devices from /dev/input/event* and set up monitoring for new devices.
|
||||
*
|
||||
* @param keyboard if true, allow connection of keyboard devices
|
||||
* @param pointer if true, allow connection of pointer devices
|
||||
* @param touchscreen if true, allow connection of touchscreen devices
|
||||
* @param fd_epoll epoll descriptor to add monitored events to
|
||||
* @param opts options for filtering input devices and setting a keyboard keymap
|
||||
* @return the number of file descriptors added to fd_epoll
|
||||
*/
|
||||
void bbx_indev_set_allowed_device_capability(bool keyboard, bool pointer, bool touchscreen);
|
||||
uint8_t bbx_indev_init(int fd_epoll, const struct bbx_indev_opts* opts);
|
||||
|
||||
/**
|
||||
* Set the group for receiving input from keyboard devices.
|
||||
*
|
||||
* @param group group that should receive input
|
||||
* Stop input processing.
|
||||
*/
|
||||
void bbx_indev_set_keyboard_input_group(lv_group_t *group);
|
||||
void bbx_indev_suspend();
|
||||
|
||||
/**
|
||||
* Start the udev device monitor and auto-connect currently available devices.
|
||||
*
|
||||
* @param keyboard if true, allow connection of keyboard devices
|
||||
* @param pointer if true, allow connection of pointer devices
|
||||
* @param touchscreen if true, allow connection of touchscreen devices
|
||||
* Resume input processing.
|
||||
*/
|
||||
void bbx_indev_start_monitor_and_autoconnect(bool keyboard, bool pointer, bool touchscreen);
|
||||
|
||||
/**
|
||||
* Auto-connect currently available keyboard, pointer and touchscreen input devices.
|
||||
*/
|
||||
void bbx_indev_auto_connect();
|
||||
|
||||
/**
|
||||
* Start the udev device monitor.
|
||||
*/
|
||||
void bbx_indev_start_monitor();
|
||||
|
||||
/**
|
||||
* Stop the udev device monitor.
|
||||
*/
|
||||
void bbx_indev_stop_monitor();
|
||||
|
||||
/**
|
||||
* Query the udev device monitor and (dis)connect added or removed devices
|
||||
*/
|
||||
void bbx_indev_query_monitor();
|
||||
void bbx_indev_resume();
|
||||
|
||||
#ifndef BBX_APP_BUFFYBOARD
|
||||
/**
|
||||
* Check if any keyboard devices are connected.
|
||||
*
|
||||
|
|
@ -63,4 +54,10 @@ void bbx_indev_query_monitor();
|
|||
*/
|
||||
bool bbx_indev_is_keyboard_connected();
|
||||
|
||||
/**
|
||||
* Set a function that will be called on pressing KEY_POWER.
|
||||
*/
|
||||
void bbx_indev_set_key_power_cb(void (*callback)());
|
||||
#endif
|
||||
|
||||
#endif /* BBX_INDEV_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue