git clone https://garage44.eu/jeroen/pinnacle.gitcartopolis-agent · 2026-11-30T19:14:40Z
refactor(xtask): QEMU's OHCI keyboard and mouse, and what the self-check says of them, once The Pinebook landing (s935) wrote the six -device arguments in hardware() and again for a pinebook guest, and pinebook-demo listed OHCI_LINES' three lines a second time. Now OHCI_INPUT and OHCI_LINES, each used where the copies were.
xtask/src/main.rs | 40 +++++++++++++++++-----------------------
1 file changed, 17 insertions(+), 23 deletions(-)
diff --git a/xtask/src/main.rs b/xtask/src/main.rs
index 57f12b9..1d85afc 100644
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@ -1088,15 +1088,9 @@ fn hardware(name: &str, arch: Arch) -> Result<Vec<String>> {
"ich9-ahci,id=ahci",
"-device",
"ide-hd,drive=sata,bus=ahci.0",
- // USB 1.1, as a board's USB 2.0 host hands a keyboard and a
- // touchpad to its OHCI (a Pinebook Pro's own are there).
- "-device",
- "pci-ohci,id=ohci",
- "-device",
- "usb-kbd,bus=ohci.0",
- "-device",
- "usb-mouse,bus=ohci.0",
]
+ .into_iter()
+ .chain(OHCI_INPUT)
.map(String::from),
),
Arch::Pc => args.extend(["-device", "ide-hd,drive=sata,bus=ide.0"].map(String::from)),
@@ -1115,7 +1109,19 @@ const HARDWARE_LINES: &[&str] = &[
"storage ok",
];
-/// What the self-check says of [`hardware`]'s OHCI, on ARM only: a
+/// USB 1.1, as a board's USB 2.0 host hands a keyboard and a touchpad to
+/// its OHCI (a Pinebook Pro's own are there): a keyboard and a mouse on
+/// QEMU's OHCI, in [`hardware`] on ARM and as a `pinebook` guest's input.
+const OHCI_INPUT: [&str; 6] = [
+ "-device",
+ "pci-ohci,id=ohci",
+ "-device",
+ "usb-kbd,bus=ohci.0",
+ "-device",
+ "usb-mouse,bus=ohci.0",
+];
+
+/// What the self-check says of [`OHCI_INPUT`], on ARM only: a
/// keyboard and a mouse on it, read through it.
const OHCI_LINES: &[&str] = &[
"ohci0: OHCI, ",
@@ -1303,15 +1309,7 @@ fn qemu_guest(machine: &str, load: &Load, snapshot: bool, guest: &Guest) -> Comm
// Touch (a tablet: absolute positions) and a keyboard; or a Pinebook
// Pro's, a keyboard and a touchpad on USB 1.1.
.args(if guest.pinebook {
- [
- "-device",
- "pci-ohci,id=ohci",
- "-device",
- "usb-kbd,bus=ohci.0",
- "-device",
- "usb-mouse,bus=ohci.0",
- ]
- .as_slice()
+ OHCI_INPUT.as_slice()
} else {
[
"-device",
@@ -5587,11 +5585,7 @@ fn pinebook_demo() -> Result {
// The password chosen here, not by `attach`: on the OHCI keyboard.
let mut s = Session::attach(qemu, "", false, || Ok(()))?;
s.wait_for("display: choose a password for your data")?;
- for line in [
- "ohci0: OHCI, ",
- "ohci0: port 1: keyboard (QEMU USB Keyboard)",
- "ohci0: port 2: mouse (QEMU USB Mouse)",
- ] {
+ for line in OHCI_LINES {
if !s.read.iter().any(|l| l.starts_with(line)) {
return Err(format!("pinebook: no \"{line}\" in the output"));
}