boot menu: turn the touchpad driver off, and trace its steps

The ASUS TUF A15 freezes at the default resolution shortly after the
loader hands over -- screen dark, Caps Lock dead -- and it is the only
machine here with an I2C-HID touchpad, which the driver added in the same
release now probes at boot. "Touchpad driver: on/off" in the F8 menu
answers whether it is the cause on the machine itself, through a new
SCHBOOT_OFF_FLAGS byte the kernel checks before starting the driver.

A verbose boot now prints each step of the probe before taking it, so if it
is the cause, the last line on the screen says which step.

Also: S in the menu wrapped at five entries whatever the count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
This commit is contained in:
Nexoniarz 2026-10-24 23:33:25 +02:00
commit c79b1d6d6d
3 changed files with 49 additions and 16 deletions

View file

@ -118,6 +118,9 @@ static int VERBOSE_BOOT;
// this particular moment.
static int DEBUG_BOOT;
// SCHBOOT_OFF_FLAGS: drivers turned off at the boot menu.
static int OFF_FLAGS;
static void
serial_putc(char c)
{
@ -1539,31 +1542,31 @@ boot_menu(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
// how to make it not refuse. An ISO built for anybody else has no way
// to turn a network debugger on, because the code that would set the
// flag is not in it.
const char *items[6];
int nitems = 5;
const char *items[7];
int nitems = 6;
items[0] = "Boot SchOS";
items[1] = "Boot SchOS (verbose)";
items[2] = resbuf;
items[3] = "System Information";
items[4] = "Reboot to firmware";
items[3] = (OFF_FLAGS & SCHBOOT_OFF_I2C_HID) ? "Touchpad driver: off"
: "Touchpad driver: on";
items[4] = "System Information";
items[5] = "Reboot to firmware";
#ifdef SCHOS_DEBUG
items[5] = DEBUG_BOOT ? "Remote debugging: on (schdbgd, port 4444)"
items[6] = DEBUG_BOOT ? "Remote debugging: on (schdbgd, port 4444)"
: "Remote debugging: off";
nitems = 6;
nitems = 7;
#endif
const char *hint = nitems == 7 ? "W/S or 1-7 to choose, Enter to select"
: "W/S or 1-6 to choose, Enter to select";
ui_menu("Boot Manager", items, nitems, selected,
nitems == 6 ? "W/S or 1-6 to choose, Enter to select"
: "W/S or 1-5 to choose, Enter to select");
ui_menu("Boot Manager", items, nitems, selected, hint);
// The same menu on the serial line: the whole thing once, then one
// line per *move*. Reprinting on every keypress would be correct and
// unreadable -- a serial terminal has no cursor to paint over, so an
// unrecognised key would scroll the selection past again for nothing.
if (echoed < 0) {
serial_menu("Boot Manager", items, nitems, selected,
nitems == 6 ? "W/S or 1-6 to choose, Enter to select"
: "W/S or 1-5 to choose, Enter to select", 1);
serial_menu("Boot Manager", items, nitems, selected, hint, 1);
} else if (echoed != selected) {
serial_item(items, selected, selected, 1);
}
@ -1584,21 +1587,22 @@ boot_menu(EFI_GRAPHICS_OUTPUT_PROTOCOL *gop)
if (scan == 0x01) { selected = (selected + nitems - 1) % nitems; continue; }
if (scan == 0x02) { selected = (selected + 1) % nitems; continue; }
if (c == L'w' || c == L'W') { selected = (selected + nitems - 1) % nitems; continue; }
if (c == L's' || c == L'S') { selected = (selected + 1) % 5; continue; }
if (c == L's' || c == L'S') { selected = (selected + 1) % nitems; continue; }
if (c >= L'1' && c <= L'0' + nitems) { selected = (int)(c - L'1'); continue; }
if (c == L'\r' || c == L'\n') {
if (selected == 0) return 0;
if (selected == 1) return 1;
if (selected == 2) { res_choose(gop); continue; }
if (selected == 3) { sys_info(gop); continue; }
if (selected == 3) { OFF_FLAGS ^= SCHBOOT_OFF_I2C_HID; echoed = -1; continue; }
if (selected == 4) { sys_info(gop); continue; }
#ifdef SCHOS_DEBUG
// A toggle rather than an action: picking it changes what the
// entry says and leaves you in the menu, so the state you booted
// with is the state you can see before you boot.
if (selected == 5) { DEBUG_BOOT = !DEBUG_BOOT; echoed = -1; continue; }
if (selected == 6) { DEBUG_BOOT = !DEBUG_BOOT; echoed = -1; continue; }
#endif
if (selected == 4) {
if (selected == 5) {
ui_clear();
ui_text_centered((int)ui_height() / 2, "Halted -- reset to reach firmware setup",
0xB9BEC7u);
@ -2338,6 +2342,7 @@ EfiMain(EFI_HANDLE image, EFI_SYSTEM_TABLE *systab)
*(UINT32 *)SCHBOOT_EFI_FLAG = SCHBOOT_EFI_MAGIC;
*(UINT8 *)SCHBOOT_VERBOSE_FLAG = (UINT8)VERBOSE_BOOT;
*(UINT8 *)SCHBOOT_DEBUG_FLAG = (UINT8)DEBUG_BOOT;
*(UINT8 *)SCHBOOT_OFF_FLAGS = (UINT8)OFF_FLAGS;
// The page tables mboot_entry would have built. entry64low's first act is
// a movabs to 0xffff8000...., so the high half must be mapped before the