Repository navigation
Laptop battery from real firmware, more Settings, new input drivers, winrun power and shlwapi - #114
Merged
Merged
Conversation
The AML interpreter could not load or run tables written the way laptop
firmware is. A ThinkPad-style table lost every method of its battery device
at the first `Package (0x04) {}`, so OSyx showed no battery state; a
method that took a mutex failed at `Acquire`; fields were stored as
objects and read later from the wrong embedded controller page; a
`CreateQWordField` panicked the daemon.
third_party/aml (details in OSYX-CHANGES.md):
- packages with fewer initializers than elements, tables that keep loading
after an object the interpreter cannot parse, device initialisation that
goes on after a failing `_INI`
- `Acquire` time-out encoding, fields read as values when used, fields wider
than 64 bits, fields at odd offsets, `IndexField` and `BankField`
- package arguments by reference, nested `Index` targets, implicit
conversion on stores to named objects, `CondRefOf` with a target
- `RefOf`, `FindSetLeftBit`, `FindSetRightBit`, `Match`, `Timer`, `FromBCD`,
`ToBCD`, `Load`, `LoadTable`, `Unload`
- no panics on buffer fields, `Fatal`, stale handles
batteryd:
- logs what a table lost while loading and which firmware method failed,
with the interpreter's error, once per method
- publishes what each battery says about itself (/run/battery.info), the
thermal zones' temperatures (/run/thermal) and the lid (/run/lid)
- stops re-reading the namespace after three scans without a battery device
Tests: firmware tables compiled by iasl, written in the style of three
firmware families, a secondary table and an operator conformance table;
scripts/acpi/qemu-battery.aml gives QEMU a battery through -acpitable.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
…er settings
USB HID devices with absolute X/Y were refused ("not a boot keyboard or
relative pointer"): QEMU's usb-tablet, the pointer VirtualBox and remote
consoles present, touch screens and pens. They are pointers now:
- osyx-usb: TabletLayout finds absolute X/Y, buttons, a wheel and a
digitizer's tip switch in a report descriptor and scales positions to
one range
- osyx-input: event kind ABSOLUTE (position across the whole screen)
- kernel: xHCI HID attaches such devices and reports their positions
- PRISM: maps positions to the screen
PRISM also takes pointer settings from /etc/osyx/pointer (speed, natural
scrolling, left-handed buttons) and follows that file and the keyboard
layout while it runs, so Settings can apply them without a new session.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
…olume options Settings gains two sections and its Keyboard, Sound and Date & Time sections more options. The five are built from one model (groups of rows: facts, switches, choices, sliders, meters) that lays itself out and scrolls with the wheel. - Power: charge, state and time left, power draw, energy, health, voltage, the battery's model, maker, chemistry, serial number and charge cycles, the power adapter, the lid and the thermal zones, all as batteryd reads them from the firmware; whether the task bar shows the percentage, and the charge at which it warns (/etc/osyx/power) - Mouse & Touchpad: pointer speed, left-handed buttons, natural scrolling (/etc/osyx/pointer, applied by PRISM within seconds) - Keyboard: German (QWERTZ), United Kingdom and French (AZERTY) layouts beside US and Polish; a layout applies without a new session - Sound: output volume and mute - Date & Time: 22 time zones, 12- or 24-hour clock, seconds, date (/etc/osyx/clock) Desktop: a notification when the battery reaches the low threshold and another when it is almost empty, once per discharge; the task bar clock and battery indicator follow the new options. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
…wapi helpers Power: GetSystemPowerStatus reported "unknown" and CallNtPowerInformation "AC power, no battery" on every machine. They now answer from the battery batteryd reads: AC line, charge, flags and time left; SystemBatteryState with capacities and the rate; SystemPowerCapabilities (also through the new GetPwrCapabilities) with the lid, thermal control and batteries; PowerDeterminePlatformRole(Ex) is mobile on a machine with a battery. shlwapi: path predicates, path editing and string helpers in their wide and ANSI forms (shlstr.rs), the ones ordinary programs and installers import: PathIsRelative, PathAddBackslash, PathCanonicalize, PathQuoteSpaces, StrCmpI, StrToIntEx, StrFormatByteSize and others. shlwapi coverage in the parity scan goes from 3.9 % to 23.9 % (x64) and to 20.8 % for 32-bit programs through the WoW64 bridge. Tests: power.exe (new) checks the relations between the power calls with and without a battery; shlpath.exe grows from 33 to 123 checks. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
A virtual machine with virtio input devices and no USB or PS/2 ones had no keyboard or pointer. The kernel now attaches virtio-input devices (1af4:1052): it reads the name, the event types and the absolute ranges from the configuration space, keeps 64 event buffers on the event queue, and one kernel thread collects the events of every device about 250 times a second. The events are Linux evdev events. osyx-input::evdev turns them into what the input core takes (keys by HID usage, buttons, motion and positions gathered until the synchronisation event, wheel detents) and is tested on the host. Checked in QEMU with virtio-keyboard-pci, virtio-tablet-pci and virtio-mouse-pci as the only input devices: typing, clicking by position, relative motion. Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
…ut paths - CI runs the osyx-battery, osyx-usb, osyx-i2c and osyx-i2chid host tests (the firmware tables compiled by iasl are checked in, so no ACPI compiler is needed there) - docs: absolute pointers, virtio-input and the pointer and keyboard settings (graphics.md); the QEMU devices each input driver is checked with (testing.md); README lists the input drivers and the laptop support - keyboard layouts and the power options without clippy findings; the AML interpreter loses the helpers the field rewrite left unused Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_01Wky8K22juFHFi5Lsqrq5dG
Contributor
v3nn7
marked this pull request as ready for review
November 10, 2026 10:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Battery on laptops (root cause). The AML interpreter could not load or run tables written the way laptop firmware is. A ThinkPad-style table lost every method of its battery device at the first
Package (0x04) {}, so no battery state was shown. Found by running firmware tables compiled withiasl; fixed inthird_party/aml(details inOSYX-CHANGES.md):_INIAcquiretime-out encoding (every method that takes a mutex failed), fields read as values when used (they were read later, from the wrong EC page), fields wider than 64 bits, fields at odd offsets,IndexField,BankFieldIndextargets, implicit conversion on stores,CondRefOfwith a target,RefOf,FindSetLeftBit/RightBit,Match,Timer,FromBCD/ToBCD,Load/UnloadCreateQWordField,Fatal, stale handles (a panic endedbatteryd)batterydlogs what a table lost and which firmware method failed (with the interpreter's error), and publishes the battery's identity, thermal zones and lid. The desktop warns at a low and at a critical charge.Settings. New sections Power and Mouse & Touchpad; Keyboard gains German, UK and French layouts; Sound gains volume and mute; Date & Time gains 22 time zones and the clock format. Layout and pointer options apply within seconds (PRISM follows the files).
Drivers.
batterydwinrun.
GetSystemPowerStatus,CallNtPowerInformation(battery state, capabilities),GetPwrCapabilities,PowerDeterminePlatformRoleanswer from the firmware's batteryCI runs the
osyx-battery,osyx-usb,osyx-i2candosyx-i2chidhost tests.How was it tested?
cargo testfor the CI crate list plusosyx-battery(14 + 17 + 13),osyx-usb(45),osyx-i2c,osyx-i2chid,osyx-input(20),osyx-ui(32),prism-core(45): all passiasl(checked in with their.aslsources): three firmware styles, a secondary table, an operator conformance table (9 methods, each run twice)scripts/build-linux.sh:-acpitable file=scripts/acpi/qemu-battery.aml: kernel firmware interface →batteryd→ task bar indicator, Settings > Power, notification on clickinit.args=tests,battery-demo: "Battery low: 12 %" notificationusb-tablet;virtio-keyboard-pci+virtio-tablet-pci;virtio-keyboard-pci+virtio-mouse-pci, each as the only input deviceswinrun shlpath.exe: 123 passed, 0 failed;winrun power.exe: 26 passed with the battery table, 17 without a battery servicepython3 scripts/winparity.py scanand its unit tests passLimitations or screenshots
scripts/test.ps1,win-test.ps1) was not run;build-wintests.ps1andwin_checks.rsgainedpower.exeuntested through those scripts (the same clang command was used on Linux).shlpath.cfollow the documentation; the test was not run on Windows.GetKeyboardLayoutstays US), HID over I2C touch screens.cargo clippy -D warningshas findings that predate this change (userspace/battery/src/model.rs,third_party/aml); the new code has none.Labels
Labels: enhancement, drivers, desktop, kernel
Generated by Claude Code