input: sandbox: Provide a mouse driver
Add a sandbox driver for the mouse, so it can be used as an input device. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -103,6 +103,7 @@ config TWL4030_INPUT
|
||||
|
||||
config MOUSE
|
||||
bool "Support for mice and other pointing devices"
|
||||
depends on INPUT
|
||||
default y if SANDBOX
|
||||
help
|
||||
This allows U-Boot to access mouse input, typically needed for
|
||||
|
||||
@@ -17,3 +17,6 @@ obj-$(CONFIG_TWL4030_INPUT) += twl4030.o
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_MOUSE) += mouse-uclass.o
|
||||
ifdef CONFIG_MOUSE
|
||||
obj-$(CONFIG_SANDBOX) += sandbox_mouse.o
|
||||
endif
|
||||
|
||||
35
drivers/input/sandbox_mouse.c
Normal file
35
drivers/input/sandbox_mouse.c
Normal file
@@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Copyright 2020 Google LLC
|
||||
* Written by Simon Glass <sjg@chromium.org>
|
||||
*/
|
||||
|
||||
#include <dm.h>
|
||||
#include <mouse.h>
|
||||
#include <asm/sdl.h>
|
||||
|
||||
static int mouse_sandbox_get_event(struct udevice *dev,
|
||||
struct mouse_event *event)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = sandbox_sdl_get_mouse_event(event);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
const struct mouse_ops mouse_sandbox_ops = {
|
||||
.get_event = mouse_sandbox_get_event,
|
||||
};
|
||||
|
||||
static const struct udevice_id mouse_sandbox_ids[] = {
|
||||
{ .compatible = "sandbox,mouse" },
|
||||
{ }
|
||||
};
|
||||
|
||||
U_BOOT_DRIVER(mouse_sandbox) = {
|
||||
.name = "mouse_sandbox",
|
||||
.id = UCLASS_MOUSE,
|
||||
.of_match = mouse_sandbox_ids,
|
||||
.ops = &mouse_sandbox_ops,
|
||||
};
|
||||
Reference in New Issue
Block a user