Skip to content

RFC: Attempt To Recognize Raspberry Pi Running Non-Raspbian OS #40

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

Merged
merged 11 commits into from
Jan 8, 2020

Conversation

sommersoft
Copy link
Collaborator

Addresses Adafruit-Blinka issue 99.

I'm currently running Ubuntu Server 19.04 on a Pi 3B+, which seems to produce the same results as the Arch user in the aforementioned issue. The RPI.GPIO issue seems to have been fixed, according to the linked issue/ticket.

Output examples:

(.env) rosie@rosiepi:~/plat_detect/Adafruit_Python_PlatformDetect$ uname -a
Linux rosiepi 5.0.0-1020-raspi2 #20-Ubuntu SMP Wed Oct 2 07:03:12 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux

(.env) rosie@rosiepi:~/plat_detect/Adafruit_Python_PlatformDetect$ cat /proc/device-tree/model
Raspberry Pi 3 Model B Plus Rev 1.3

(.env) rosie@rosiepi:~/plat_detect/Adafruit_Python_PlatformDetect$ python3
Python 3.7.3 (default, Oct  7 2019, 12:56:13) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from adafruit_platformdetect import Detector
>>> foo = Detector()           
>>> foo.chip.id 
'BCM2XXX'
>>> foo.board.id
'RASPBERRY_PI_3B_PLUS'
>>> 

(.env) rosie@rosiepi:~/plat_detect/Adafruit_Python_PlatformDetect$ python3 -m bin.detect
Chip id:  BCM2XXX
Board id:  RASPBERRY_PI_3B_PLUS
Is this a DragonBoard 410c? False
Is this a Pi 3B+? True
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? True
Is this a Raspberry Pi Compute Module? False
Is this a BBB? False
Is this a Giant Board? False
Is this a Coral Edge TPU? False
Is this a SiFive Unleashed?  False
Is this an embedded Linux system? False
Is this a generic Linux PC? False

I haven't tested this on any other board, nor with Raspbian or any other distro.

Also, attempts so far to test with Adafruit-Blinka have failed. rpi-ws281x has build issues on aarch64/arm64 (same as this issue: rpi-ws281x/rpi-ws281x-python#26, but with all versions).

@satmandu
Copy link

Any resolution on this? I'm trying to get the bme280 python library working and I'm also running into this:

Traceback (most recent call last):
  File "./save-env.py", line 8, in <module>
    i2c = busio.I2C(board.SCL, board.SDA)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 16, in __init__
    self.init(scl, sda, frequency)
  File "/usr/local/lib/python3.7/dist-packages/busio.py", line 27, in init
    from machine import I2C as _I2C
ModuleNotFoundError: No module named 'machine'

I also have the same setup:

python3 -m bin.detect
Chip id:  BCM2XXX
Board id:  RASPBERRY_PI_3B_PLUS
Is this a DragonBoard 410c? False
Is this a Pi 3B+? True
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? True
Is this a Raspberry Pi Compute Module? False
Is this a BBB? False
Is this a Giant Board? False
Is this a Coral Edge TPU? False
Is this a SiFive Unleashed?  False
Is this an embedded Linux system? False
Is this a generic Linux PC? False

(I can get this to work by hacking /usr/local/lib/python3.7/dist-packages/busio.py
so that

elif detector.board.any_embedded_linux:
            from adafruit_blinka.microcontroller.generic_linux.i2c import I2C as _I2C
        else:
            #from machine import I2C as _I2C

is changed to

elif detector.board.any_embedded_linux:
            from adafruit_blinka.microcontroller.generic_linux.i2c import I2C as _I2C
        else:
            #from machine import I2C as _I2C
            from adafruit_blinka.microcontroller.generic_linux.i2c import I2C as _I2C

FYI I can get rpi-ws281x-python to install by first compiling rpi_ws281x from github, changing DEBIAN/control to be for arm64, and then making a debian package with dpkg-deb --build rpi_ws281x and then installing that resultant package first.

@makermelissa
Copy link
Collaborator

Hi @sommersoft, Could you please look into the merge conflicts? I'd like to test this on a Raspberry Pi 4 to see if it's still working. Thanks.

@sommersoft
Copy link
Collaborator Author

@makermelissa,

I'll deconflict and re-test on RPi3, tonight.

@makermelissa
Copy link
Collaborator

Thank you!

@sommersoft
Copy link
Collaborator Author

Conflicts fixed.

Re-loading my Pi3b+ with Ubuntu Disco now (needed to happen anyway, since CircuitPython bumped to using GCC9).

Will have my test results up later.

@makermelissa
Copy link
Collaborator

Sounds good. I'll test on a RasPi 4 with ubuntu as soon as I'm able.

@sommersoft
Copy link
Collaborator Author

sommersoft commented Dec 31, 2019

Re-test checks good on my end, with my old SD with Ubuntu Server 19.04.

Now to try and figure out how to boot Ubuntu from an SSD. It has fought me for a couple hours.

EDIT: now booting from SSD, with Ubuntu Server 19.10. Platform detected correctly.

@makermelissa
Copy link
Collaborator

Doh, sorry to do this, but after merging another PR that I had been assisting with, it appears we have another merge conflict. I'm going to see if I can just fix it...

@makermelissa
Copy link
Collaborator

Looks like you didn't give permissions for me to upload the fixed merge conflicts to your repo, so you'll have to do it. If you want to see what I did, you can check it out at https://github.com/makermelissa/Adafruit_Python_PlatformDetect/tree/ubuntu-disco

@makermelissa
Copy link
Collaborator

Thanks @sommersoft. This is now at the front of the line. ;)

@sommersoft
Copy link
Collaborator Author

All good. Ran re-regression; all good from my setup.

Sorry about the PR not letting you edit. It's marked allow maintainers to edit, so it should work.

Copy link
Collaborator

@makermelissa makermelissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Raspberry Pi 4 with Raspbian and Ubuntu and everything seemed to work fine.

@makermelissa makermelissa merged commit eab68f0 into adafruit:master Jan 8, 2020
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

Successfully merging this pull request may close these issues.

3 participants