From patchwork Mon Sep 15 12:28: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: 334 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=1757939428; bh=iZ10K2RoOYC8Z1xy6m/8VbJncVttH6w2Wr3jA1pyK60=; 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=ZNtMG/qKwEI+zZSvP54AgtLeZ5rhN+UNWblYfvdM8NLkexZcbDF6kMEJpikDy0Wng 607tB++CflgIlYSnTauYB4TT/0gHLu5L4bNcbDidDRnJnFZnxvEY3ecvhTjsr5Q9Bs IBAjebXhiuOAnC7+6GsM9tmh0F+oBnbYStcL3ib3/dmjCSrlJoHi+UIPgcnGJ1rJxE 6LgRqHTMkJRzC6YY1LGjBQdsMaZPvEUb9SfeGn1jVxnG65wootw6fzwIhPmnbfnARL nab+gckRvj0YTuu39CaXZsBX6YArfRxd3zO685Wyb287Zhdi3jZ3I8EWa35HuBfRYl SVELqRrt7a2BA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3960B67B3C for ; Mon, 15 Sep 2025 06:30:28 -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 UE8XnxbKg9xb for ; Mon, 15 Sep 2025 06:30:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939428; bh=iZ10K2RoOYC8Z1xy6m/8VbJncVttH6w2Wr3jA1pyK60=; 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=ZNtMG/qKwEI+zZSvP54AgtLeZ5rhN+UNWblYfvdM8NLkexZcbDF6kMEJpikDy0Wng 607tB++CflgIlYSnTauYB4TT/0gHLu5L4bNcbDidDRnJnFZnxvEY3ecvhTjsr5Q9Bs IBAjebXhiuOAnC7+6GsM9tmh0F+oBnbYStcL3ib3/dmjCSrlJoHi+UIPgcnGJ1rJxE 6LgRqHTMkJRzC6YY1LGjBQdsMaZPvEUb9SfeGn1jVxnG65wootw6fzwIhPmnbfnARL nab+gckRvj0YTuu39CaXZsBX6YArfRxd3zO685Wyb287Zhdi3jZ3I8EWa35HuBfRYl SVELqRrt7a2BA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 27DDC67BCB for ; Mon, 15 Sep 2025 06:30:28 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939425; bh=OQ0oso+ge1uJ/jfphbwh1V7A0fOgkgF5yA/91NrbeFc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hRqHN798qZN7zCONGA8aRfs/6xWX4ZuycqZ4hLdvOYwZ3aSTpYssp9Py675Xwa0hq UlEqNbWkXkcDpv0heNzywMQUzaBWUsSLmHJ5ibztJ5LW7GUQYfQOmpBQBWz0enJD8c JXtAgOK/sDCKDEpAzGdrGM8pl3qbneBXfUJPmqaF6toGVBb0eTn5PlpL46LdfYfM9g DpDd+HElAIFCkyPYmYmjALXrctomPGAhGRsDtm/dcjQ01I7UH0uo+oMI1foCDYB1hI afEsI6spH6rPKpctJ8kVo5A0cjnxRta6isyr4o2ujRq1zUgNum/BXB/S7sXI/jj/yU Agri0oETaJQyw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9026D67BAC; Mon, 15 Sep 2025 06:30:25 -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 64WBt5y6w-2o; Mon, 15 Sep 2025 06:30:25 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757939421; bh=gsDFf9tbsf561sfZ4QBFwzYe/6U7YZEHpbjCgUlbFTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHwCJgSc96/PtRtrcdmVGd8t58xYZgp2MBw/UYawBLss//qJ5p8PoCWG1xfWrGF4E xvgbHvL4n+VxR2Ed3yIDZ1wSNH16ym4XyG4bJRo2FMJfaulpMzVDSl585qojQIvk8A QBMuaTFyRXqPGj0PzcIftRsjz7U1jfj+SB7qX15AkwtYc2lBEd8VJSAy3RZRQbttc6 BOm/T1v9b0YwdJrG+MkKMt9BNUNaQjDM1wM7bc2LjIB1JiAZZ3PQBajvRH76NlSPgd JlcysHPdmSqkGjcd+Z2TLtDeniXFuXdGF5wog/TqT9M2vnkuXDLxVFCTcr49I0pYfm wRpdc8pcDOgTg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4107967B34; Mon, 15 Sep 2025 06:30:21 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Mon, 15 Sep 2025 06:28:52 -0600 Message-ID: <20250915122905.1217249-20-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915122905.1217249-1-sjg@u-boot.org> References: <20250915122905.1217249-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HWZMMLE6YW3PYEFCQODK7KDUTX5M5OXL X-Message-ID-Hash: HWZMMLE6YW3PYEFCQODK7KDUTX5M5OXL 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 19/23] expo: Check the mouse when polling 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 If no key is pressed, check for a mouse click and process that, if available. Signed-off-by: Simon Glass --- boot/expo.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/boot/expo.c b/boot/expo.c index f9573858082..00924a19d27 100644 --- a/boot/expo.c +++ b/boot/expo.c @@ -411,15 +411,42 @@ static int poll_keys(struct expo *exp) return key ? key : -EAGAIN; } +static int poll_mouse(struct expo *exp, int *xp, int *yp) +{ + int ret, x, y; + + if (!exp->mouse_enabled) + return -EAGAIN; + + /* First check if we have a click available */ + ret = mouse_get_click(exp->mouse, &x, &y); + if (ret) + return log_msg_ret("epm", ret); + + *xp = x; + *yp = y; + + return 0; /* Click available */ +} + int expo_poll(struct expo *exp, struct expo_action *act) { int key, ret = -EAGAIN; key = poll_keys(exp); - if (key != -EAGAIN) + if (key != -EAGAIN) { ret = expo_send_key(exp, key); + } else if (IS_ENABLED(CONFIG_MOUSE)) { + int x, y; + + ret = poll_mouse(exp, &x, &y); + if (!ret) + ret = expo_send_click(exp, x, y); + } if (ret) return log_msg_ret("epk", ret); + + /* get the action (either a key or a click) */ ret = expo_action_get(exp, act); if (ret) return log_msg_ret("eag", ret);