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.

  • ConstOP
    link
    fedilink
    arrow-up
    2
    ·
    3 years ago

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

    • ollieparanoidM
      link
      fedilink
      arrow-up
      3
      ·
      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.