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:
Simon Glass
2025-09-12 14:19:18 -06:00
parent ebdefefba5
commit 6c848941e7
3 changed files with 39 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View 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,
};