this post was submitted on 10 Oct 2021
1 points (100.0% liked)

postmarketOS

1026 readers
1 users here now

postmarketOS - a real Linux distribution for phones and other mobile devices 🐧 📱 👩‍💻

Rules:

See also:

founded 4 years ago
MODERATORS
 

Hi. I’d like to get the platform string like “lg-hammerhead” or “pine64-pinephone” which was used to build the OS image. I need to do that after the OS is already installed and running.

The software I’m working on has issues entering mem sleep state on Hammerhead. Appears to sleeps OK but the screen is still lit, albeit the brightness is decreased. The exact same binaries run well on the Pinephone.

I’d like to implement a workaround and fix, but to do that I need to detect the device first, to know whether to apply one. I’m using “console” for the shell.

Thanks in advance.

Regards, Kosta.

top 3 comments
sorted by: hot top controversial new old
[–] [email protected] 0 points 3 years ago (1 children)

It should be defined as deviceinfo_codename in /etc/deviceinfo.

[–] [email protected] 0 points 3 years ago (1 children)

Thanks, it’s indeed there on both of my test devices.

[–] [email protected] 1 points 3 years ago

Yep, /etc/deviceinfo exists for all devices in postmarketOS. So if you want to do a quick hack, you can simply source the file in a shell script and add logic based on the codename defined there.

If you want a distro-agnostic solution, use the device-tree string, e.g.:

$ cat /proc/device-tree/compatible
pine64,pinephone-1.2pine64,pinephoneallwinner,sun50i-a64

This is what we use in megapixels for example.