Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion core/systems/hardware/hardware_manager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ func get_bios_version() -> String:

## Returns the hardware product name
func get_product_name() -> String:
return _read_sys("/sys/devices/virtual/dmi/id/product_name")
var path := "/sys/devices/virtual/dmi/id/product_name"
match Engine.get_architecture_name():
"arm64", "arm32":
path = "/sys/firmware/devicetree/base/model"
var product := _read_sys(path)
if product.is_empty():
return "Unknown"
return product


## Returns the hardware vendor name
Expand Down Expand Up @@ -406,8 +413,14 @@ func _exec(command: String, args: PackedStringArray = []) -> Array:
## Used to read values from sysfs
func _read_sys(path: String) -> String:
var file := FileAccess.open(path, FileAccess.READ)
if not file:
return ""
var length := file.get_length()
var bytes := file.get_buffer(length)
# Avoid Unicode warnings by removing any NUL terminators.
var nul := bytes.find(0)
if nul >= 0:
bytes = bytes.slice(0, nul)
return bytes.get_string_from_utf8().strip_escapes()


Expand Down
Loading