From patchwork Mon Sep 15 10:46:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 305 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757933261; bh=0AWAX+ZEIHtc6n45NAyYkg7PdX08XY1nvjQCaS0j4I0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nHSpRO/es6Qucu/8VfxpblHRiAM6yYzkuRICTtKNQC+ZYbLcbj2bfrbXbBeT04ej0 vVjWgQxxX7f062KWQefU0690wS0MTZEUKjJ5AMk/pfU+fUghprEYaKi54VRGChO1sR 9lg/bNb/6GhZOfPVOQaBSNWwq4DpXCq7C6VffRnAbLRlGRMaB8jM/rJvSOcTJcOIwC NIRaloy62V2EQnTemzG/mTqD7zv+1xT+oybRofDrBMaY63R1QT1O9lc4Qv8QZz9CqR tNFMrEPx6hHMK29UCuqa1581lqyEGjy1d70QeihijdpqsBGEz8ocMkR7R2t1JOqTi0 3t7N2jQ0fAr/w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3E2967A99 for ; Mon, 15 Sep 2025 04:47:41 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id DHtB3IytF1Fr for ; Mon, 15 Sep 2025 04:47:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757933261; bh=0AWAX+ZEIHtc6n45NAyYkg7PdX08XY1nvjQCaS0j4I0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=nHSpRO/es6Qucu/8VfxpblHRiAM6yYzkuRICTtKNQC+ZYbLcbj2bfrbXbBeT04ej0 vVjWgQxxX7f062KWQefU0690wS0MTZEUKjJ5AMk/pfU+fUghprEYaKi54VRGChO1sR 9lg/bNb/6GhZOfPVOQaBSNWwq4DpXCq7C6VffRnAbLRlGRMaB8jM/rJvSOcTJcOIwC NIRaloy62V2EQnTemzG/mTqD7zv+1xT+oybRofDrBMaY63R1QT1O9lc4Qv8QZz9CqR tNFMrEPx6hHMK29UCuqa1581lqyEGjy1d70QeihijdpqsBGEz8ocMkR7R2t1JOqTi0 3t7N2jQ0fAr/w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A0DB167B22 for ; Mon, 15 Sep 2025 04:47:41 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757933259; bh=k/p1EIyY5J5+U8o52M0p/G0CaWbhr/2sJzndivUCOW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IP5hBDIJGY9KBUwRxGyiMzHqJq0VpErSW4PmwbEikp5Ha3zdNZkprtxEXzHhtQP5a aIHdO+6JOSYU40i2bXfTGFFWg5dhDDNsiRVt5DS6MK8zHi1gPyqmg1jmvDP54pxjHu kEijljy5FZENaXVOY6qK2AM7cgmDSu3G4AH6rHHV0zubN7UtQ1UQr7rSvZLxgWaGPJ 6cZuWI2Buoaj3dQaBcILx+/6+Ija1+jzgABk2wQkb5r2K1mRAcLToINIoWtcZ5fHqZ 3itTlcFoumoKbZO9/1mFa0IMyb/L0M6lNyilVlHn7aoZPRtP0pMkv43kABUrNIGYLu IoPoOzr8pr9Xg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E442467B22; Mon, 15 Sep 2025 04:47:39 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id tu2cSCNuN623; Mon, 15 Sep 2025 04:47:39 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757933254; bh=mFk8lnFf6xamZ62rXEoLm6ZuQHsWxuRpcXer8UxXfWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dW32LYBBTVwlrEZzSAbPumqrKsbzLmrQXz4cOGboZqny3B2LoM9izOTmy2L7Ol6Fo LK5KETbZrQ6/ugbtaGbi78aGeY+YqPRzcGl/pTGsOKMm0NdqnS/pstRV2hCRqguMrM VfGXTzttkcrHx+cWqJLcgdcuBdLS/QDrWCPi3ABW67mOR1Gg3v907b13piIRfqeuqP pwUHJIlw5qqNj8YLsnlBKSm/o27CMdgTkFCR5vzEso3QQAMcbRvr4WhbAxCLGbTikM WuG8wag5EkEO2bmRDg7+oiXPMi/++mAc8PFe2gFpOFx5aNMxp63RNWs/sax+eBTsnA fBdqS+/7jfdkQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C6C5E67BAC; Mon, 15 Sep 2025 04:47:33 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 15 Sep 2025 04:46:47 -0600 Message-ID: <20250915104705.937780-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915104705.937780-1-sjg@u-boot.org> References: <20250915104705.937780-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5KKLGPUZZPR7SG22QZL6KU5ZCMZKW4CD X-Message-ID-Hash: 5KKLGPUZZPR7SG22QZL6KU5ZCMZKW4CD X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/17] input: sandbox: Provide a mouse driver List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a sandbox driver for the mouse, so it can be used as an input device. Signed-off-by: Simon Glass --- drivers/input/Kconfig | 1 + drivers/input/Makefile | 3 +++ drivers/input/sandbox_mouse.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 drivers/input/sandbox_mouse.c diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 6bfee40ccac..101257f9767 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -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 diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 7ed7eba3e8c..8c5a395a540 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -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 diff --git a/drivers/input/sandbox_mouse.c b/drivers/input/sandbox_mouse.c new file mode 100644 index 00000000000..4aedf0fdf2d --- /dev/null +++ b/drivers/input/sandbox_mouse.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Google LLC + * Written by Simon Glass + */ + +#include +#include +#include + +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, +};