ioBroker.discovery icon indicating copy to clipboard operation
ioBroker.discovery copied to clipboard

Support for rpi2 adapter

Open UncleSamSwiss opened this issue 8 years ago • 3 comments

It would be very nice if I run the discovery on a Raspberry Pi, the list of suggested adapters would also show rpi2.

UncleSamSwiss avatar Jul 23 '17 15:07 UncleSamSwiss

How to detect a raspi?

Apollon77 avatar Sep 07 '18 10:09 Apollon77

My suggestions would be:

  1. Read /sys/firmware/devicetree/base/model: https://raspberrypi.stackexchange.com/questions/5100/detect-that-a-python-program-is-running-on-the-pi or
  2. grep Hardware /proc/cpuinfo: https://www.raspberrypi.org/forums/viewtopic.php?t=54413

Side note: if the detection is too narrow (i.e. it doesn't detect if the device is a RasPi), that's not too much of an issue IMHO. The other way around it would be worse (we shouldn't detect a RasPi if it isn't one).

UncleSamSwiss avatar Jan 13 '19 09:01 UncleSamSwiss

if (require('fs').existsSync('/proc/cpuinfo')) {
    const lines = require('fs').readFileSync('/proc/cpuinfo').toString().split(/\n|\r/);
    const isRaspi = lines.find(line => line.indexOf('Hardware') !== -1 && line.indexOf('BCM2708') !== -1);
    console.log(`IS Raspi: ${!!isRaspi}`);
} else {
    console.log(`IS Raspi: ${false}`);
}

GermanBluefox avatar Mar 09 '19 23:03 GermanBluefox