imrahil / OctoPrint-NavbarTemp

Plugin for OctoPrint - displays temperatures on navbar
GNU Affero General Public License v3.0
44 stars 50 forks source link

[fix suggested] cannot identify hardware when running Alpine Linux #58

Open draeath opened 5 years ago

draeath commented 5 years ago

Your method of detecting the hardware is not resilient. I'm running Alpine Linux 3.9 using the Raspberry Pi kernel (4.19.34-0-rpi) and my /proc/cpuinfo looks like the following. Note the lack of any "Hardware" lines, which you check for.

processor       : 0
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
BogoMIPS        : 38.40
Features        : fp asimd evtstrm crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

It is maybe wise to fall back on checking /proc/device-tree/model - anyone using recent bootcode will be loading a device tree, and this would then contain useful text. For example, on my RPI 3 B+ it contains Raspberry Pi 3 Model B Plus Rev 1.3

Cosik commented 4 years ago

@draeath do you have something like vcgencmd on Alpine linux?

draeath commented 4 years ago

I don't recall there's a package for it... But the binaries from the firmware repository work. I keep them in /opt myself.

draeath commented 4 years ago

See here: https://github.com/raspberrypi/firmware/tree/master/opt/vc