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

Raspberry Pi 4 bcm2711 #107

Open
westerxddd opened this issue Aug 20, 2020 · 4 comments
Open

Raspberry Pi 4 bcm2711 #107

westerxddd opened this issue Aug 20, 2020 · 4 comments

Comments

@westerxddd
Copy link

I had to add: case 'bcm2711': return 1;
to: lib/ws281x-native.js

var raspberryVersion = (function() {
        var cpuInfo = require('fs').readFileSync('/proc/cpuinfo').toString(),
            socFamily = cpuInfo.match(/hardware\s*:\s*(bcm\d+)/i);
            console.log(cpuInfo.match(/hardware\s*:\s*(bcm\d+)/i));
        if(!socFamily) { return 0; }

        switch(socFamily[1].toLowerCase()) {
            case 'bcm2708': return 1;
            case 'bcm2835': return 1;
            case 'bcm2709': return 2;
            case 'bcm2711': return 1; <--- this line to work with my raspberry pi 4
            default: return 0;
        }
    } ());
@CaskAle
Copy link

CaskAle commented Aug 20, 2020

I discovered the same and found that the same case statement with a return of 2 rather than 1 works as well. I was not able to determine what the return value is used for??

@westerxddd
Copy link
Author

@CaskAle me too.

So i suspect this is only to limit script only for raspberry use.

@dJPoida
Copy link

dJPoida commented Sep 21, 2020

I also had to add this line on a Raspberry Pi 4. Does the return value perhaps describe the device GPIO pinout?

@Deboracgs
Copy link

I had to add: case 'bcm2711': return 1;
to: lib/ws281x-native.js

var raspberryVersion = (function() {
        var cpuInfo = require('fs').readFileSync('/proc/cpuinfo').toString(),
            socFamily = cpuInfo.match(/hardware\s*:\s*(bcm\d+)/i);
            console.log(cpuInfo.match(/hardware\s*:\s*(bcm\d+)/i));
        if(!socFamily) { return 0; }

        switch(socFamily[1].toLowerCase()) {
            case 'bcm2708': return 1;
            case 'bcm2835': return 1;
            case 'bcm2709': return 2;
            case 'bcm2711': return 1; <--- this line to work with my raspberry pi 4
            default: return 0;
        }
    } ());

it's really works! thank you!

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

No branches or pull requests

4 participants