From patchwork Sat Nov 15 18:51:52 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 701 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=1763232788; bh=AQiLjZ2c7/kIWOZl5yIFgSowc6wF+2wDDtQv7hRYfrk=; 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=deYft7j4zC2+aaqTuNUmca0hJraB+6JrLm/Qu3ToRIjpFF3bIPnu+e/l3WOLn9NCD UXQrcySWi/cXB/nKuT4Y2cVm0YhMdFjXO+s37Ad8NNQXgwsIum7gIXhtwaH9gbyrmj e9zzuYCsakF01JfasUC/Iv7lfU3Lxqs1qpwCBFl5/gChDQiXqK+mPe3jSvyvK49JkC 1zteqpTEwOD/OxEl4XSIlGxvs7u/W1YBFFurYrR2FBbkX6SZ+uJCj3D/fXpOYewwou ecossTsyxs5oHQ4UpJB5inrggrAJfOkB3Id6LeiKhBRgEhKPTeW39DZSemZZZfLxvH ZDHY81LBU4FHg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ED8C16861A for ; Sat, 15 Nov 2025 11:53:08 -0700 (MST) 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 AvO4eni10hTB for ; Sat, 15 Nov 2025 11:53:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232788; bh=AQiLjZ2c7/kIWOZl5yIFgSowc6wF+2wDDtQv7hRYfrk=; 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=deYft7j4zC2+aaqTuNUmca0hJraB+6JrLm/Qu3ToRIjpFF3bIPnu+e/l3WOLn9NCD UXQrcySWi/cXB/nKuT4Y2cVm0YhMdFjXO+s37Ad8NNQXgwsIum7gIXhtwaH9gbyrmj e9zzuYCsakF01JfasUC/Iv7lfU3Lxqs1qpwCBFl5/gChDQiXqK+mPe3jSvyvK49JkC 1zteqpTEwOD/OxEl4XSIlGxvs7u/W1YBFFurYrR2FBbkX6SZ+uJCj3D/fXpOYewwou ecossTsyxs5oHQ4UpJB5inrggrAJfOkB3Id6LeiKhBRgEhKPTeW39DZSemZZZfLxvH ZDHY81LBU4FHg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DC6DC685E5 for ; Sat, 15 Nov 2025 11:53:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232787; bh=/QrGPISfROPxsBqbzIWh8w1PUSF5HbhODUL5OOb01y4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pu4QiFZIIw0iOXNXqTLvJS9Cd0vettQgDKM/6Lvt2cBgcky1qDKmROdNwgxyAoNF5 Q/B81MbkMYQtIbwL9IYYYX45IdHpRKG3lF6Uj2trY2HqztMctUrGoYpzMnkxGh4k0z idPT4JgRg3s1rizax+MiFJDuUzu15H0O7vKu4MU+CR/nzBn3SImCdMUcVqtb+QoKzr S+46WCuMfPtgFSGo4ymsHlV//AJxJdp4q28XgyOevPmIz+EarLMfshg1eQXMwQyplQ yzHLZNZkrkIrrqrz8InB7VwTveUizqeYISyojJa7ao/48/WN5GA1u8kDUPZQq8IdBo pkhQOzvvjjwMA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4549466654; Sat, 15 Nov 2025 11:53:07 -0700 (MST) 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 iBu84pB0AMK3; Sat, 15 Nov 2025 11:53:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1763232781; bh=f4iwA/liGEb+7A6aJsR05P8tCJXuGE5LssMMglsGOPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c7Wu9wTlXBrZDwGokS/LKv342XFAL0K2zXFTw7YpCltjoHRS4spoBrFANvM2AJg7O 0TkhY6hxX9SiskJ1S9Erg645pfrW6ToiJtKLZI8n1H4YNTwwprn4S+nfCN2GQk0ovO B4oDV0d2Ruhm9pTd9LiNvX7X1DdVdg9JOkbCCJDUdZnT3ZWki9W/Jxzs7q5mgkydIQ OASWXVMHIZNY6EfysuktZbU0eS3UlW7a/Nj9pKCNhgAYwfbAIjqgmVKI8gpqxP9D2/ yVERWOPNgEI0x4voTMWDfwCkTPirfC6s1L8l2hJCalwQoSC2PJIEGHR/6XvDr0Rbh5 1jHQA8skRuJmw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 3F0B66861B; Sat, 15 Nov 2025 11:53:01 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 15 Nov 2025 11:51:52 -0700 Message-ID: <20251115185212.539268-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251115185212.539268-1-sjg@u-boot.org> References: <20251115185212.539268-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TAXDXNNEEL4WH6COBHWBFZ7MN3ADJUN7 X-Message-ID-Hash: TAXDXNNEEL4WH6COBHWBFZ7MN3ADJUN7 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: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/16] input: Provide a way for tests to register a mouse click 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 In tests it is useful to fake a mouse click to check that expo handles it correctly. Create a function for this. Signed-off-by: Simon Glass --- drivers/input/mouse-uclass.c | 13 +++++++++++++ include/mouse.h | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/input/mouse-uclass.c b/drivers/input/mouse-uclass.c index dea8babf5fe..99de94e68b0 100644 --- a/drivers/input/mouse-uclass.c +++ b/drivers/input/mouse-uclass.c @@ -107,6 +107,19 @@ int mouse_set_video(struct udevice *dev, struct udevice *video_dev) return 0; } +int mouse_queue_click_for_test(struct udevice *dev, int x, int y) +{ + struct mouse_uc_priv *uc_priv = dev_get_uclass_priv(dev); + + uc_priv->click_pending = true; + uc_priv->click_pos.x = x; + uc_priv->click_pos.y = y; + uc_priv->last_pos.x = x; + uc_priv->last_pos.y = y; + + return 0; +} + UCLASS_DRIVER(mouse) = { .id = UCLASS_MOUSE, .name = "mouse", diff --git a/include/mouse.h b/include/mouse.h index 92609cfd0e0..6180a2fc957 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -176,4 +176,18 @@ int mouse_set_ptr_visible(struct udevice *dev, bool visible); */ int mouse_set_video(struct udevice *dev, struct udevice *video_dev); +/** + * mouse_queue_click_for_test() - Queue a click event for testing + * + * This is a back-door function for tests to simulate a mouse click at a + * specific position. The click will be returned by the next call to + * mouse_get_click(). + * + * @dev: Mouse device + * @x: X coordinate of click + * @y: Y coordinate of click + * Returns: 0 if OK, -ve on error + */ +int mouse_queue_click_for_test(struct udevice *dev, int x, int y); + #endif