Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for rpi2 adapter #19

Open
UncleSamSwiss opened this issue Jul 23, 2017 · 3 comments
Open

Support for rpi2 adapter #19

UncleSamSwiss opened this issue Jul 23, 2017 · 3 comments

Comments

@UncleSamSwiss
Copy link
Contributor

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

@Apollon77
Copy link
Collaborator

How to detect a raspi?

@UncleSamSwiss
Copy link
Contributor Author

UncleSamSwiss commented Jan 13, 2019

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).

@GermanBluefox
Copy link
Contributor

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}`);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants