Skip to content

fix(HardwareManager): don't crash on devicetree boards without DMI - #559

Merged
ShadowApex merged 1 commit into
ShadowBlip:mainfrom
loki666:fix/no-dmi-devicetree
Oct 4, 2026
Merged

ShadowApex merged 1 commit into
ShadowBlip:mainfrom
loki666:fix/no-dmi-devicetree

Conversation

@loki666

@loki666 loki666 commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #542.

Problem

Devicetree ARM boards (Snapdragon SM8250 / SM8550 / SM8650 handhelds) have no SMBIOS, so /sys/devices/virtual/dmi/id/* does not exist. HardwareManager._read_sys() calls get_length() on the null FileAccess, and a release build dies with SIGSEGV about 10 s into every start.

Changes

  • _read_sys() returns "" when the file cannot be opened.
  • get_product_name() picks the path by CPU architecture: /sys/firmware/devicetree/base/model on arm64 / arm32, the DMI product_name everywhere else. It returns "Unknown" when nothing is read.
  • Devicetree properties end in a NUL. The buffer is now cut at the first NUL, so decoding no longer logs a Unicode warning or leaves a U+FFFD in the string.

x86 / DMI machines behave as before, except that an empty product name now reads "Unknown".

Testing

Tested on v0.46.1 with this patch, exported with the arm64 Godot 4.7.1 editor. Without the patch, OGUI crash-loops at startup.

  • First revision: AYANEO Pocket ACE (SM8550) and MANGMI Pocket Max (SM8250). OGUI starts normally and reports the board model as the product name.
  • Revision after review: Pocket ACE. OGUI starts and stays up, with no restarts.

Comment thread core/systems/hardware/hardware_manager.gd Outdated
Comment thread core/systems/hardware/hardware_manager.gd Outdated
Comment thread core/systems/hardware/hardware_manager.gd Outdated
Comment thread core/systems/hardware/hardware_manager.gd Outdated
@loki666
loki666 force-pushed the fix/no-dmi-devicetree branch from 4ed6ea9 to 26bc6e7 Compare October 3, 2026 22:35
ARM handhelds (e.g. Snapdragon SM8250/SM8550/SM8650) boot from devicetree
and have no SMBIOS, so /sys/devices/virtual/dmi/id/* does not exist.
_read_sys() called get_length() on the null FileAccess, which crashes a
release build with SIGSEGV a few seconds into every start.

Return an empty string when the file cannot be opened, and fall back to
/sys/firmware/devicetree/base/model for the product name. Devicetree
properties are NUL-terminated, so cut the buffer at the first NUL instead
of decoding it (which logs a Unicode warning and leaves a U+FFFD).

Fixes ShadowBlip#542

@ShadowApex ShadowApex left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you for this!

@ShadowApex
ShadowApex merged commit fc711f0 into ShadowBlip:main Oct 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Startup crash on Snapdragon ARM devices

3 participants