From 837da6ade7aebe9541b5a13e40b75ab2b308ac77 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 6 Feb 2017 15:02:25 +0100 Subject: libpayload: Add mouse cursor driver Add a driver to handle multiple low level mouse drivers and provide basic cursor acceleration support. Tested on Lenovo T500. Change-Id: Ib7cec736631b8acf81a14d28daa29ff720777b10 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/18593 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/include/libpayload.h | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'payloads/libpayload/include') diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 97d5944c63..54e01623a1 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -163,6 +163,20 @@ int keyboard_getchar(void); int keyboard_set_layout(char *country); /** @} */ +/** + * @defgroup mouse Mouse cursor functions + * @ingroup input + * @{ + */ +void mouse_cursor_poll(void); +void mouse_cursor_get_rel(int *x, int *y, int *z); +u32 mouse_cursor_get_buttons(void); +void mouse_cursor_set_speed(u32 val); +u32 mouse_cursor_get_speed(void); +void mouse_cursor_set_acceleration(u8 val); +u8 mouse_cursor_get_acceleration(void); +/** @} */ + /** * @defgroup serial Serial functions * @ingroup input @@ -304,6 +318,29 @@ int console_remove_output_driver(void *function); #define havechar havekey /** @} */ +/** + * @defgroup mouse_cursor Mouse cursor functions + * @{ + */ +typedef enum { + CURSOR_INPUT_TYPE_UNKNOWN = 0, + CURSOR_INPUT_TYPE_USB, + CURSOR_INPUT_TYPE_PS2, +} cursor_input_type; + +void mouse_cursor_init(void); + +struct mouse_cursor_input_driver; +struct mouse_cursor_input_driver { + struct mouse_cursor_input_driver *next; + /* X,Y,Z axis and buttons */ + void (*get_state)(int *, int *, int *, u32 *); + cursor_input_type input_type; +}; + +void mouse_cursor_add_input_driver(struct mouse_cursor_input_driver *in); + +/** @} */ /** * @defgroup exec Execution functions -- cgit v1.2.3