Commit Graph

99170 Commits

Author SHA1 Message Date
Simon Glass
87c89fe434 snow: link: Disable the cursor
These boards enable EXPO. Disable the cursor so we can get build
coverage on this combination.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 12:55:57 -06:00
Simon Glass
2986bf7bcb video: Provide an option to enable the cursor
The video cursor is always enabled at present, but it is only used for
expo. Put it behind an option, to reduce code size for platforms which
do use video but don't want a cursor.

Move the existing set_cursor_visible() method behind this option, for
the normal console. For the truetype console, the fonts and extra
rendering dwarf the code-size saving, so include the cursor there
always.

Once the cursor is enabled for the CLI, this will produce code-size
savings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:51 -06:00
Simon Glass
1ecfbbcbad test: video: Split long strings
Some strings in this file are quite long and it is a pain to look at
them within an 80-column editor. Split them.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:51 -06:00
Simon Glass
0e944b89ab scripts: Fix conditional syntax for capsule ESL generation
The ifeq/else/endif conditional for capsule_esl_file generation was
incorrectly placed inside the recipe, causing malformed Makefile syntax
that prevented proper dependency resolution. This resulted in build
failures when CONFIG_EFI_CAPSULE_AUTHENTICATE was enabled because the
capsule_esl_file target could not be created from the certificate file.

Move the conditional to properly wrap the rule definitions, allowing
Make to correctly parse and execute the capsule ESL generation rules.

Signed-off-by: Simon Glass <sjg@chromium.org>
Co-developed-by: Claude <noreply@anthropic.com>
2025-09-19 11:42:34 -06:00
Simon Glass
08fbd3a911 Makefile: Silence the example Rust build
We don't need messages printed when building. Remove them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-19 11:42:33 -06:00
Simon Glass
551b30c659 video: Correct ops check for nominal, entry save/restore
All of these helper functions check the wrong member. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: 9e55d09596 ("video: Allow obtaining the nominal size of a...")
Fixes: 9899eef2cb ("video: Allow saving and restoring text-entry...")
2025-09-18 15:41:37 -06:00
Simon Glass
5e5eed7ded cyclic: Avoid showing messages when debugging
When using a debugger it is common to single step through functions. If
one of those functions happens to be called from a cyclic function, then
a warning messages is shown. When debugging the console itself, this can
mess up the session.

Add a Kconfig to control whether the message is shown. Disable it by
default if CONFIG_CC_OPTIMIZE_FOR_DEBUG is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-18 15:41:37 -06:00
Simon Glass
f2385b7bea Provide a README for Claude
Add the beginnings of a readme to help Claude do the right thing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-18 06:41:34 -06:00
Simon Glass
0c2531998e Merge branch 'apf' into 'master'
expo: Support interactions with a mouse or touchpad

See merge request u-boot/u-boot!183
2025-09-15 20:06:03 +00:00
Simon Glass
3b3ec58450 expo: Provide a test of expo mouse behaviour
Check the behaviour of non-popup menus with a mouse.

Series-to: concept
Series-cc: heinrich
Cover-letter:
expo: Support interactions with a mouse or touchpad
So far expo only supports user interaction with a keyboard. This is the
common case, but for PC devices it is typical to have a mouse or
touchpad available as well.

Particularly for the configuration editor, these devices are often more
convenient for selecting options than moving up and down with with the
keyboard.

This series adds mouse support to expo, providing a function to process
a click similar to processing of a keypress. The core of this is a new
expo_send_click() function. Within scenes, the logic to search for
objects by and x and y position is provided.

As with keypresses, expo provides clear separation between the
processing of a click (which may or may not produce an action) and the
handling of that action. This allows expo to be used within an existing
event loop.

Expo uses a mouse by default if available.

This series also includes a few other minor improvements, including some
code tidy-ups and support for filled boxes.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:34
2025-09-15 13:23:13 -06:00
Simon Glass
f44080081c expo: Provide a test of cedit mouse behaviour
Add a test which checks the various expected features of a cedit when
used with a mouse. This includes clicking on menu items and textlines.

For now, textedit is not supported.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
c4544d59f0 expo: Add a test helper for clicking on objects
Provide a way to click on an object and check that the expected action
resulted. Put it in a common file so it can be used by cedit and expo
tests.

Tidy up the include-order in both cedit and expo.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
4eb8f8319a expo: Enable the mouse when available
When creating a new bootflow menu or cedit, enable the mouse, so the
user can interact with the expo more easily.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
bcf7b403e8 expo: Check the mouse when polling
If no key is pressed, check for a mouse click and process that, if
available.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
6cdc1c906a expo: Refactor expo_poll() to separate out key handling
In preparation for supporting mouse clicks, split the key-handling part
of this function into a separate poll_keys() function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
a6fd275924 expo: Support sending a click to an expo
Implement clicking on an expo, which simply passes it onto the scene.
For now, there are no callers for this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:13 -06:00
Simon Glass
f5ec16dbea expo: Support sending a click to a scene
Implement clicking on an object in the scene. For now only menus and
textlines respond to this. For menus the behaviour is different for
popups than for normal menus.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
407503e4a3 expo: Support sending a click to a menu
Clicking on a menu can result in selecting an item. If it is a popup
menu then the item should be closed. Add support for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
92a2b06a3b expo: Add three new actions for mouse events
Popup menus have particular behaviour which needs to be modelled in
the expoact_type enum:

- clicking on a menu item should select it and close the menu
- clicking on a menu should highlight it and open the menu
- clicking on a menu while another menu is open should select the item,
  close the menu, then open the other menu

Add actions associated with each of these. These are modelled as
combined actions for simplicity.

Implement the actions in cedit. The general expo support will come
later.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
1c6269576a expo: Tidy up comments for enum expoact_type
Some of the comments in this enum and the struct which uses it are
out-of-date. Fix this up.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
9d34fbe2e8 expo: Allow checking if a position is within a textline
For a textline it is possible to click into the edit field. Provide a
function to check whether a position is within this field.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
1e65b5e22e expo: Provide a way to check if a position is within a menu
To implement mouse clicks we need a way to figure out what the user has
clicked on. As a starting point, create a scene_menu_within() function
which returns the item containing an x, y coordinate.

Provide a helper function in scene.c for use with this. Add a simple
for completeness.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
c65b6e50cf expo: test: Move expo creation into a separate function
In preparation for adding more tests which use a common expo, move the
creation code out of expo_render_image() and into a new function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
932b6cfd23 expo: Tidy up image position with the menu
The bootflow menu creates an image at position -4, expecting that it
will be relative to the right side of the display.

With the recently added alignment feature, this is not supported. Update
the implementation to calculation the correct position instead. Update
the tests to match.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
d738ddf73f expo: Provide a way to enable the mouse
In some cases it is useful to use expo with a mouse (or touchpad). Add
a way to tell expo to find and record a mouse device.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
8960f0a4c8 expo: Add comments for enum bootmenu_id_t
Document the ranges in this enum, so it is clear what they a used for.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
e3e1b7aeb2 expo: Tidy up a few key-related comments
Fix up send_key_obj() to mention a missing argument. Add a bit more
detail in scene_send_key() to explain what 'processing' means.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
50596a9986 test: video: Provide an easy way to watch video tests
The video tests run past too quickly to see what is going on. Update
them to introduce a delay after each check of the screen contents, when
LOG_DEBUG is enabled.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
9f3b86c8f6 expo: Support boxes fully
At present boxes are not supported in the expo_build format. Also, it is
now possible to draw filled boxes, a recently added feature to the video
API.

Expand the box feature slightly to resolve these two items.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
f4b0561e8a expo: Guard against a crash in scene_textline_calc_dims()
If there is no console (e.g. in a test) this function segfaults. Add
the console as a parameter so it is clear that it is needed. Check for
it in the caller.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
9fa8a01d50 video: Support drawing filled boxes
At present only an outline boxes is supported, albeit with a thickness
parameter. Provide a way to draw a filled rectangle.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
7a80370d3a video: Provide a few Ubuntu fonts
These fonts look quite nice and are freely available. Bring in the bold
and light variants so that they can be selected as needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 13:23:12 -06:00
Simon Glass
203f498cf5 Merge branch 'ape2' into 'master'
mouse: Provide some support for using a mouse

See merge request u-boot/u-boot!182
2025-09-15 18:56:16 +00:00
Simon Glass
2f22976bc9 qemu: Enable the mouse
Enable the mouse when running on QEMU, for ARM and x86.

This requires 'usb start' on x86. For ARM, the mouse does not work,
perhaps related to the fact that the display does not work either.

Series-to: concept
Series-cc: heinrich
Cover-letter:
mouse: Provide some support for using a mouse
This series resurects some old code that was never submitted, related to
using Nuklear with U-Boot.

It includes:
- a very simple mouse uclass
- sandbox mouse driver
- USB mouse driver, useful on x86
- EFI mouse driver, useful when running as an EFI app
- script updates to use the above with build-qemu and build-efi

It also includes a few small patches for sandbox, tests and membuf

Not everything is fully working at present:
- Mouse works on x86 QEMU (after 'usb start') but not ARM
- Mouse works on real hardware with EFI, but not with build-efi script
- Mouse times out with 'usb start', even though it does actually work

More work will be needed to tidy up these remaining issues.
END

Signed-off-by: Simon Glass <sjg@chromium.org>
Series-links: 1:33
Series-version: 2
2025-09-15 04:49:38 -06:00
Simon Glass
5a4a8278ee x86: emulation: Enable USB support
The mouse is typically connected via USB on x86, so enable this feature.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 04:49:38 -06:00
Simon Glass
ff37f4218a script: Support mouse with build-efi/qemu scripts
Provide arguments to QEMU to enable a mouse. Note that this does not
work with EFI at present.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 04:49:38 -06:00
Simon Glass
b05dd27c97 efi: arm: x86: Enable the mouse
Provide a devicetree fragment to enable the mouse for x86 and arm, when
running as an EFI app.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 04:49:38 -06:00
Simon Glass
6a078d8cb7 efi: Provide a mouse driver for EFI
In some cases the device may have a touchpad or mouse, so it is useful
to be able to use this in U-Boot. Add a simple driver for a mouse that
uses the EFI simple-pointer protocol.

Series-changes: 2
- Add missed Claude credit

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 04:49:15 -06:00
Simon Glass
5d802fc523 efi: Add the simple-pointer protocol
Add definitions for the simple-pointer protocol so that it can be used
in drivers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:58 -06:00
Simon Glass
5d4d719064 mouse: Provide a way to read clicks
A mouse click is defined as pressing the mouse and then releasing it
over a given spot. Add a function the tracks the mouse state and
returns the most recent mouse click, if any.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:58 -06:00
Simon Glass
9b9fcc8c1e usb: Add a USB mouse driver
Add a basic mouse driver for USB mice. It only handles very basic mice so
assumes that the reports are in the basic format described by the USB HID
specification 1.11.

Change-Id: I74dbe55eb065be1782737c8b2b86558e53e0292a
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:57 -06:00
Simon Glass
899722153f sandbox: Provide a test for the mouse uclass
Provide a few simple tests for two methods available in the mouse
uclass.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:35 -06:00
Simon Glass
f7189fe034 sandbox: Enable the mouse
Provide a devicetree fragment to enable a mouse for sandbox.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:35 -06:00
Simon Glass
9e1888ee68 input: Add a command to show mouse input
This reads mouse input and shows it on the terminal. It is useful for
testing mice.

Change-Id: Ifebe6452f38904689e3e2142fc08a623131ed0de
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:26:35 -06:00
Simon Glass
6c848941e7 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>
2025-09-15 03:26:34 -06:00
Simon Glass
ebdefefba5 sandbox: sdl: Add support for mouse input
Allow mouse input to be reported from sandbox using SDL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:23:22 -06:00
Simon Glass
74cf6bee6c input: Add mouse support
When running a simple GUI it is useful to support a mouse. This is
similar to what is provided in UEFI's boot menu. Add a simple uclass and
a way to read the mouse position.

For sandbox add a driver that reads the position from SDL. Disable input
for the tools-only build, since it is of no use there and causes build
failures.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-15 03:22:49 -06:00
Simon Glass
ad59fee0e8 test: Add newlines at the end of the img functions
The functions which create images lack a newline at the end of the file.
Add one, for consistency.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-14 17:32:24 -06:00
Simon Glass
2f8c113cfc sandbox: Add a way to set the window title
Add a new option to set the window title for U-Boot sandbox. This is
helpful when different sandbox instances are used for different purposes
at the same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-14 15:51:09 -06:00
Simon Glass
05990c1bb8 membuf: Add a function to set up a static membuf
Add a way to set up a membuf with some pre-loaded data, so it is
possible to read it out using membuf_readline(), etc.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-09-14 14:23:29 -06:00