Open UncleSamSwiss opened 7 years ago
How to detect a raspi?
My suggestions would be:
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).
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}`);
}
It would be very nice if I run the discovery on a Raspberry Pi, the list of suggested adapters would also show rpi2.