Giter Club home page Giter Club logo

adafruit_python_platformdetect's Introduction

Introduction

Documentation Status

Discord

Build Status

Code Style: Black

This library provides best-guess platform detection for a range of single-board computers and (potentially) other platforms. It was written primarily for use in Adafruit_Blinka, but may be useful in other contexts.

Platform detection is divided into "chip" and "board" detection, with the latter generally dependent on the former. Platform info is gathered from:

  • Python's sys.platform
  • Various files on Linux systems:
    • /proc/cpuinfo (for processor info, Raspberry Pi hardware revisions, etc.)
    • /proc/device-tree/compatible (for 96Boards info)
  • Beaglebone EEPROM board IDs
  • Distribution-specific files such as /etc/armbian-release.

Dependencies

This driver depends on:

  • Python 3.7 or higher

Installing from PyPI

On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally from PyPI. To install for current user:

pip3 install Adafruit-PlatformDetect

To install system-wide (this may be required in some cases):

sudo pip3 install Adafruit-PlatformDetect

To install in a virtual environment in your current project:

mkdir project-name && cd project-name
python3 -m venv .env
source .env/bin/activate
pip3 install Adafruit-PlatformDetect

Usage Example

from adafruit_platformdetect import Detector
detector = Detector()
print("Chip id: ", detector.chip.id)
print("Board id: ", detector.board.id)

# Check for specific board models:
print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
print("BBB? ", detector.board.BEAGLEBONE_BLACK)
print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Documentation

For information on building library documentation, please check out this guide.

adafruit_python_platformdetect's People

Contributors

alsprogrammer avatar anonymouscowhead avatar atan1021 avatar blitzcitydiy avatar brennen avatar caternuson avatar dmanla avatar ecarozzo avatar fig1010 avatar geekguy-wy avatar groguard avatar jfurcean avatar kingpharoo avatar ladyada avatar lesamouraipourpre avatar lugamodder avatar makermelissa avatar mmontol avatar mrpanc0 avatar nvswarren avatar paulcrawford avatar ryzer58 avatar sommersoft avatar ste-trat avatar steamfoundry avatar tekktrik avatar timonsku avatar twa127 avatar yeyeto2788 avatar zzts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_python_platformdetect's Issues

Docs are failing to build

Here's the message:

Running Sphinx v1.8.5
loading translations [en]... done
making output directory...
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [latex]: all documents
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
processing AdafruitPlatformDetectLibrary.tex...
Exception occurred:
  File "/home/docs/checkouts/readthedocs.org/user_builds/adafruit-platformdetect/envs/stable/lib/python3.7/site-packages/sphinx/builders/latex/__init__.py", line 201, in write
    if toctrees[0].get('maxdepth') > 0:
TypeError: 'generator' object is not subscriptable
The full traceback has been saved in /tmp/sphinx-err-kkelhqqh.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!

I'm not sure if it's something on our end or readthedocs' end.

import board fails - Raspberry Pi 4 Model B Rev 1.5

Unable to import board using the following system. Have tried to reinstall adafruit-blinka and Adafruit-PlatformDetect several times per the instructions on the troubleshooting page. Also re-imaged the boot drive several times as well.

My i2c devices work with no issue on Raspberry Pi 3 Model B Rev 1.2, so I don't believe it's a hardware issue at this time.

Any ideas?

$ python
Python 3.7.3 (default, Jan 22 2021, 20:04:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/pi/.local/lib/python3.7/site-packages/board.py", line 289, in <module>
    platform.system(), package[0], package[1]
NotImplementedError: Adafruit-PlatformDetect version 3.19.2 was unable to identify the board and/or microcontroller running the Linux platform. Please be sure you have the latest packages running: 'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ cat /proc/cpuinfo
processor	: 0
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 1
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 2
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

processor	: 3
model name	: ARMv7 Processor rev 3 (v7l)
BogoMIPS	: 108.00
Features	: half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer	: 0x41
CPU architecture: 7
CPU variant	: 0x0
CPU part	: 0xd08
CPU revision	: 3

Hardware	: BCM2711
Revision	: b03115
Serial		: 1000000025ecbd1e
Model		: Raspberry Pi 4 Model B Rev 1.5

Support for Allwinner H5

Hi,

I'd like to add support for the Orange Pi Zero Plus2 H5, but am struggling to see how I can do it in chips.py as there is already detection, the h5 returns sun50iw1p1 which is already being used for the A64

        elif "sun50iw1p1" in hardware:
            linux_id = chips.A64

Any idea how I can resolve the issue ?

JETSON_NANO is capitalized

The nomenclature is supposed to be all lowercase to be consistent with pulseio board detection. However, this is the result:

'>>> detector.board.id
'JETSON_NANO'
detector.board.jetson_nano
False

detector.board.jetson_nx
False
detector.board.JETSON_NANO
True

Which breaks all files in Blinka looking for lowercase

Calling `check_dt_compatible_value` causes a `ResourcesWarning`

To replicate, write this test script (I've only been able to replicate it running tests with the unittest module)

import unittest

from adafruit_platformdetect import Detector


class UnittestCausesTheIssue(unittest.TestCase):
    def test(self):
        detector = Detector()
        self.assertFalse(detector.check_dt_compatible_value("test"))

and run it in the shell

$ python3 -m unittest
/home/pi/.local/lib/python3.7/site-packages/adafruit_platformdetect/__init__.py:65: ResourceWarning: unclosed file <_io.TextIOWrapper name='/proc/device-tree/compatible' mode='r' encoding='UTF-8'>
  if value in open("/proc/device-tree/compatible").read():
ResourceWarning: Enable tracemalloc to get the object allocation traceback
.
----------------------------------------------------------------------
Ran 1 test in 0.014s

OK

Really old Beaglebone black

I found a stack of 30 BBBs circa 2014 at my job
eeprom: A335BNLT0A6A5113BBBK0690
when I run some sample commands

from adafruit_platformdetect import Detector
detector = Detector()
print("Chip id: ", detector.chip.id)
Chip id: AM33XX
print("Board id: ", detector.board.id)
Board id: None

I assume the eeprom code isn't in the list

Pine64 board not being detected

Hi thanks for adding the support to the Pine64!

This doesn't work for me in my machine I see this for cat /proc/cpuinfo :
Processor : AArch64 Processor rev 4 (aarch64)
processor : 0
processor : 1
processor : 2
processor : 3
Features : fp asimd aes pmull sha1 sha2 crc32
CPU implementer : 0x41
CPU architecture: AArch64
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : Pine64+

and cat /proc/device-tree/model

Pine64+

Maybe is it the + at the end?

Thanks!

Originally posted by @lucapinello in #52 (comment)

chip.py returns true for similar strings

Hi,

In chip.py the python operator 'in' is used for chip detection, but this can cause problems for similar strings e.g.

if self.detector.check_dt_compatible_value("sun50i-h6"): and if self.detector.check_dt_compatible_value("sun50i-h616"): will both be true.

Typing module not available on Micropython

Blinka, and PlatformDetect are used on micropython, which does not have the typing module, like CP.
A solution would be to escape the imports from typing with try/catch like they are on Circuitpython libraries.

failure to detect BeagleBone Green

The 1st generation BeagleBone Green has an unusual board ID:

Here is the SeeedStudio BeagleBone Green from image-builder README:

  1A: [aa 55 33 ee 41 33 33 35  42 4e 4c 54 1a 00 00 00 |.U3.A335BNLT....|]
   ?: [aa 55 33 ee 41 33 33 35  42 4e 4c 54 42 42 47 31 |.U3.A335BNLTBBG1|]

adafruit_platformdetect/board.py tries to handle this with:

    BEAGLEBONE_GREEN: (
        ('1A', 'A335BNLT....'),
        ('UNKNOWN', 'A335BNLTBBG1'),
    ),

However, it should be A335BNLT followed by 0x1a:

41 33 33 35  42 4e 4c 54 1a

This is how u-boot handles it: board/ti/common/board_detect.c

	/* BeagleBone Green '1' eeprom, board_rev: 0x1a 0x00 0x00 0x00 */
	if (am_ep.version[0] == 0x1a && am_ep.version[1] == 0x00 &&
	    am_ep.version[2] == 0x00 && am_ep.version[3] == 0x00)
		strlcpy(ep->version, "BBG1", TI_EEPROM_HDR_REV_LEN + 1);

Getting fields from CPUINFO only returns first element.

Hey!

Using the detector in a GENERIC_LINUX_PC when I execute detector.get_cpuinfo_field("processor") it only returns the first element.

This is the output:

from adafruit_platformdetect import Detector
...detector = Detector()
detector.chip
<adafruit_platformdetect.chip.Chip object at 0x7f3c2d7dcf60>
detector.board.id
'GENERIC_LINUX_PC'
detector.chip.id
'GENERIC_X86'
detector.get_cpuinfo_field("hardware")
detector.get_cpuinfo_field("info")
detector.get_cpuinfo_field("processor")
'0'
detector.get_cpuinfo_field("processor")
'0'
detector.get_cpuinfo_field("processor")
'0'
detector.get_cpuinfo_field("processor")

Shouldn't this return all available items with the same key?

Here you have the information of the /proc/cpuinfo file:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
stepping        : 9
microcode       : 0xca
cpu MHz         : 1599.999
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 5808.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
stepping        : 9
microcode       : 0xca
cpu MHz         : 1600.015
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 5808.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
stepping        : 9
microcode       : 0xca
cpu MHz         : 1600.008
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 0
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 5808.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
stepping        : 9
microcode       : 0xca
cpu MHz         : 1600.010
cache size      : 4096 KB
physical id     : 0
siblings        : 4
core id         : 1
cpu cores       : 2
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips        : 5808.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

Regards.

Board not supported when detecting on Raspberry Pi Compute Module 4 rev 1.0

Hello,
when I run the script on Raspberry Pi Compute Module 4 rev 1.0, i am getting a "Board not supported" error message.

Here are the info from detect.py:
Chip id: BCM2XXX
Board id: None

Is this a DragonBoard 410c? False
Is this a Pi 3B+? False
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? False
Is this a Raspberry Pi Compute Module? False
Is this a BeagleBone Black? False
Is this a BeagleBone Green? False
Is this a Giant Board? False
Is this a Coral Dev Board? False
Is this a Coral Dev Board Mini? False
Is this a SiFive Unleashed? False
Is this a PYNQ Board? False
Is this a Rock Pi board? False
Is this a Clockwork Pi board? False
Is this an embedded Linux system? True
Is this a generic Linux PC? False
Is this a UDOO Bolt? False
Is this an ASUS Tinker Board? False
Is this an STM32MP1 Board? False
Is this an OS environment variable special case? False
Raspberry Pi detected.

CPU info:
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : a03140
Serial : 10000000a8b419ce
Model : Raspberry Pi Compute Module 4 Rev 1.0

Is there any workaround for this error?

Thank You in advance for Your help.

Martin

Alpha sorting of the boards

While working on adding a couple of the riscv boards, I noted that the boards could use a bit of sorting to make it easier to edit.

Is it ok if I PR the coded with the chips+boards sorted out?

RecursionError when I am trying to 'import board'

Hello friends, I am using the FT232H and I am following the example that is shown here but when I am trying to import board I get the following error:

 ~  python3
Python 3.8.5 (default, Jul 23 2020, 00:47:04) 
[GCC 10.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/site-packages/board.py", line 32, in <module>
    from adafruit_blinka.agnostic import board_id, detector
  File "/usr/lib/python3.8/site-packages/adafruit_blinka/agnostic/__init__.py", line 18, in <module>
    chip_id = detector.chip.id
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/chip.py", line 243, in __getattr__
    if self.id == attr:
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/chip.py", line 243, in __getattr__
    if self.id == attr:
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/chip.py", line 243, in __getattr__
    if self.id == attr:
  [Previous line repeated 973 more times]
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/chip.py", line 104, in id
    return self._linux_id()
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/chip.py", line 137, in _linux_id
    hardware = self.detector.get_cpuinfo_field("Hardware")
  File "/usr/lib/python3.8/site-packages/adafruit_platformdetect/__init__.py", line 54, in get_cpuinfo_field
    return match.group(1)
RecursionError: maximum recursion depth exceeded while calling a Python object
>>> 

I don't know if it's related with this error:

>>> from pyftdi.ftdi import Ftdi
>>> Ftdi().open_from_url('ftdi:///?')
Available interfaces:
  ftdi://ftdi:232h:1/1   (������)

Please specify the USB device
 ✘  ~ 

But anyway, this works:

>>> from pyftdi.ftdi import Ftdi
>>> Ftdi.show_devices()
Available interfaces:
  ftdi://ftdi:232h:1/1   (������)

>>> 

I followed the steps with udev rules and reloading, I re-connected the FT232H but nothing. Important note: I installed Blinka, Platform-Detect, pyftdi and the rest with Portage on Gentoo Linux and not with pip3.

Also pyusb is installed along with pyftdi and the following packages:

dev-python/Adafruit-Blinka:0
dev-python/adafruit-circuitpython-mcp230xx:0
dev-python/Adafruit-PlatformDetect:0
dev-python/Adafruit-PureIO:0

Any ideas what I could be missing here? Thank you in advance.

Possibility to read info from OpenWRT devices

Hello guys!

I'm trying to get all info to add the Onion Omega (first version) into the project, digging a bit through the code I see that you're using a regex looking in the /proc/cpuinfo so it is possible to add the board into the project so it detects the board as the Onion Omega or at least as generic OpenWRT device?

How can I proceed with it?

Just in case, here you have some info that might help with it:

root@Omega-198C:/# uname -a
Linux Omega-198C 4.9.152 #0 Mon Jan 28 08:54:32 2019 mips GNU/Linux

root@Omega-198C:/# cat /proc/cpuinfo 
system type             : Atheros AR9330 rev 1
machine                 : Onion Omega
processor               : 0
cpu model               : MIPS 24Kc V7.4
BogoMIPS                : 265.42
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

Regards.

chip.py using very inefficient subcall to pyftdi

Pardon any unfamiliarity, as I've only been poking around for a day.

I'm currently using a Raspberry Pi 4B (up to date) with an Adafruit FT232H adapter (USB-C version) to an LIS3DH. While using the example Adafruit LIS3DH CircuitPython libraries, I discovered that I was getting a whopping 5 samples per second out of an expected 400 (default data rate). After a few hours of digging and tracing, I discovered that pyftdi is essentially crawling through and examining many USB devices every time I read bytes, leading to 120ms being spent every single accelerometer read on just init backend calls through libusb1.py.

This is happening due to line 72 in chip.py: count = len(UsbTools.find_all([(0x0403, 0x6014)])), which is there solely to determine whether the FT232H (or whatever board you might be using, if you're in another if-else branch) is connected. The corresponding function in the pyftdi library seems to do local caching which worked as I expected, so not sure why this kind of delay is happening in there - though there are a few TODO's in there about optimizing searches. Regardless, I didn't do much experimentation in there after I commented out the chip.py line as a hacky workaround (with the hope that I'll always be connected while running this & set the Blinka env variable in-application). My sampling rate went up to ~240 from 5 - still not where I'd like it to be, but much closer in magnitude.

Anyhow, I'd like to make a newbie recommendation that the count() call be changed to something more efficient. Also, thanks for writing all these libraries!

(Note: everything installed via pip3)
Raspbian Buster Desktop (fully up to date as of Sep 7, 2020)
pyftdi 0.52.2
Adafruit Blinka 5.3.3
adafruit-circuitpython-busdevice 5.0.1
Adafruit-PlatformDetect 2.15.0

Compute Module 4 Aditional Revision

Hello, I am unable to get a proper detection for my CM4, I believe this is due to my revision ID not being listed in the constants, here is the proper information to add my board.

Output from detect.py:

Chip id: BCM2XXX
Board id: None
Is this a DragonBoard 410c? False
Is this a Pi 3B+? False
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? False
Is this a Raspberry Pi Compute Module? False
Is this a BeagleBone Black? False
Is this a BeagleBone Green? False
Is this a Giant Board? False
Is this a Coral Dev Board? False
Is this a Coral Dev Board Mini? False
Is this a SiFive Unleashed? False
Is this a PYNQ Board? False
Is this a Rock Pi board? False
Is this a Clockwork Pi board? False
Is this an embedded Linux system? True
Is this a generic Linux PC? False
Is this a UDOO Bolt? False
Is this an ASUS Tinker Board? False
Is this an STM32MP1 Board? False
Is this an OS environment variable special case? False
Raspberry Pi detected.

Output from /proc/cpuinfo

processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 108.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : d03140
Serial : XXX (Removed by OP)
Model : Raspberry Pi Compute Module 4 Rev 1.0

I removed the serial number.

No Revision on cpuinfo for properly detecting openSUSE

On openSUSE in Raspberry Pi 4 there is no Revision section in cat /proc/cpuinfo, so board isn't properly detected:

def any_embedded_linux(self):
"""Check whether the current board is any embedded Linux device."""
return any(
[
self.any_raspberry_pi, self.any_beaglebone, self.any_orange_pi,

def any_raspberry_pi(self):
"""Check whether the current board is any Raspberry Pi."""
return self._pi_rev_code() is not None

return self.detector.get_cpuinfo_field('Revision')

As I see cat /proc/device-tree/system/linux,revision | xxd returns the rev that is present in the list

RASPBERRY_PI_4B: (
'a03111', 'b03111', 'c03111',
'a03112', 'b03112', 'c03112',

RASPBERRY_PI_ZERO_W not detected if board revision is 0000

looks like kernel bug (upstream or debian packaging), but maybe we want to work around it?

using image from https://raspi.debian.net/tested-images/ and tried with two different kernels:

# uname -r
4.19.0-14-rpi
# cat /proc/cpuinfo
processor       : 0 
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.34
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41 
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 0000
Serial          : 00000000d83bf83f

# uname -r
5.10.0-0.bpo.5-rpi
# cat /proc/cpuinfo 
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.34
Features        : half thumb fastmult vfp edsp java tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 0000
Serial          : 00000000d83bf83f

relevant code:

possible work around:

--- board.py    2021-05-01 12:55:47.189499433 +0300
+++ /usr/local/lib/python3.7/dist-packages/adafruit_platformdetect/board.py     2021-05-01 12:59:37.766854833 +0300
@@ -205,7 +205,7 @@
             return None
         rev = self.detector.get_cpuinfo_field("Revision")
 
-        if rev is not None:
+        if rev is not None and not re.search('^0+$', rev):
             return rev
 
         try:

this way revision check will fail properly and proceeds with /proc/device-tree/system/linux,revision.

detect.py output without and with work around:

# python3 detect.py
Chip id:  BCM2XXX
Board id:  None
--8<-- snip --8<--
Raspberry Pi detected.

# python3 detect.py
Chip id:  BCM2XXX
Board id:  RASPBERRY_PI_ZERO_W
--8<-- snip --8<--
Raspberry Pi detected.

but before I create PR, maybe maintainer(s) have some better ideas or additional thoughts?

Missing Type Annotations

I'm still going through libraries and adding typing, and just wanted to see if there was any benefit to adding those here. I know this isn't necessarily a commonly end-user modified file, so wanted to check.

Do not rely on specific distribution (armbian) to detect OrangePi and NanoPi platforms

Hi,

Running this on Nanopi or OrangePi without using armbian leads to board detection failure, as it leans on armbian release string from /etc/armbian-release file.
Seems to me that board detection can be done from various other available info, a least on a nanopi h3 and the orangepizero + (h5).
I can try to work on something and PR it when it become mature enough if you share the same goal not to be distro dependant for detection

Cheers

Board not supported None : EspressoBinBoard on OpenWrt

Héllo,

How can I add or request an addition for the Marvell EspressoBin Board ?

Thanks...

# cat /proc/device-tree/mode
l 
Globalscale Marvell ESPRESSOBin Board V7
# cat /proc/device-tree/comp
atible 
globalscale,espressobin-v7globalscale,espressobinmarvell,armada3720marvell,armada3710
# cat /proc/cpuinfo 
processor	: 0
BogoMIPS	: 25.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
BogoMIPS	: 25.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

Error on detector due to new implementations

Using the detect.py and exception is raised due to new implementations (Onion Omega implementations)

Traceback (most recent call last):
 File "/home/xxx/own_workspace/Adafruit_Python_PlatformDetect/bin/detect.py", line 7, in <module>
   print("Chip id: ", detector.chip.id)
 File "/home/xxx/own_workspace/Adafruit_Python_PlatformDetect/adafruit_platformdetect/chip.py", line 66, in id
   return self._linux_id()
 File "/home/xxx/own_workspace/Adafruit_Python_PlatformDetect/adafruit_platformdetect/chip.py", line 111, in _linux_id
   if "MIPS 24Kc" in cpu_model:
TypeError: argument of type 'NoneType' is not iterable

I'll file a PR fixing the issue.

About Error SyntaxError: future feature annotations.... on python 3.6

about the Error

I am a Jetson user (using pyhton 3.6), for Adafruit_Python_PlatformDetect version bigger than 3.19.6
the following error wil be recived

>>> import board
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/board.py", line 39, in <module>
    import adafruit_platformdetect.constants.boards as ap_board
  File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/__init__.py", line 10, in <module>
    from .board import Board
  File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/board.py", line 24
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

Issues

Maybe this due to the 3.20.0 added Type Annotations?
Therefore maybe the version that require Python 3.7 is starting from 3.20.0 instead of 3.21.0?

Possible quick fix for this issues

the solution that work for me (using python3.6)

  1. remove the current version(anything > 3.19.6)
    $sudo -H pip3 uninstall Adafruit-PlatformDetect
  2. specify the version to 3.19.6
    $sudo -H pip3 install Adafruit-PlatformDetect==3.19.6

OR
try backport of future annotations(not yet test)
OR
update to python3.7(painful in jetson)(not yet test)

image
image

Duplicate constants in boards and chips

I'm trying to get pre-commit working to close #140.

However pre-commit fails locally on pylint with

adafruit_platformdetect/board.py:1:0: R0801: Similar lines in 2 files
==adafruit_platformdetect.constants.boards:119
==adafruit_platformdetect.constants.chips:48
PICO_U2IF = "PICO_U2IF"
FEATHER_U2IF = "FEATHER_U2IF"
ITSYBITSY_U2IF = "ITSYBITSY_U2IF"
QTPY_U2IF = "QTPY_U2IF"
QT2040_TRINKEY_U2IF = "QT2040_TRINKEY_U2IF"
 (duplicate-code)

This is detected in the build.yml Github action but seems to pass anyway, for example https://github.com/adafruit/Adafruit_Python_PlatformDetect/runs/2797662229?check_suite_focus=true under the Pylint section

Do these need to be defined in both files?

Too many open files

I am getting the following error after reading the MCP3008 sensor over SPI successfully for about 4 hours:

Traceback (most recent call last): File "piSolarMonitor.py", line 438, in MainTimer File "piSolarMonitor.py", line 350, in ReadPin File "/usr/local/lib/python3.7/dist-packages/adafruit_mcp3xxx/analog_in.py", line 70, in value File "/usr/local/lib/python3.7/dist-packages/adafruit_mcp3xxx/mcp3xxx.py", line 97, in read File "/usr/local/lib/python3.7/dist-packages/adafruit_bus_device/spi_device.py", line 93, in __enter__ File "/usr/local/lib/python3.7/dist-packages/busio.py", line 198, in configure File "/usr/local/lib/python3.7/dist-packages/adafruit_platformdetect/board.py", line 383, in any_raspberry_pi File "/usr/local/lib/python3.7/dist-packages/adafruit_platformdetect/board.py", line 188, in _pi_rev_code File "/usr/local/lib/python3.7/dist-packages/adafruit_platformdetect/__init__.py", line 49, in get_cpuinfo_field OSError: [Errno 24] Too many open files: '/proc/cpuinfo'

Here is my code for reading the sensor, runs every 10 seconds on a timer:

` def ReadPin(self):
with busio.SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI) as spi:
cs = digitalio.DigitalInOut(self.CS.value)
mcp = MCP.MCP3008(spi, cs)
chan = AnalogIn(mcp, self.Pin)
self.RawADC = (chan.value/64) + self.ToleranceAdjust

    self.Voltage = round(VoltageDiv(self.RawADC, self.Resistor1, self.Resistor2) + self.ToleranceAdjust,2)
    log.debug('CS: ' + str(self.CS) + ' Pin: ' + str(self.Pin) + ' Name: ' + self.Name + ' Voltage (ADC): ' + str(self.Voltage) + '(' + str(self.RawADC) + ')')
    log.info('Name: ' + self.Name + ' Voltage (ADC): ' + str(self.Voltage))`

Any chance you can investigate this please. Running on a Rapberry PI 3B.

AttributeError: 'module' object has no attribute 'environ' on MicroPython and an ESP32

Hello,

I was trying to replicate one of the examples from the "adafruit/Adafruit_CircuitPython_SHTC3" repository in the REPL, but when I imported the "busio" module I got an error from the adafruit_platformdetect/chip.py file which returned this traceback:

  File "<stdin>", line 1, in <module>
  File "/lib/busio.py", line 17, in <module>
  File "/lib/adafruit_blinka/agnostic/__init__.py", line 18, in <module>
  File "/lib/adafruit_platformdetect/chip.py", line 69, in id
AttributeError: 'module' object has no attribute 'environ'

It seems like it comes from the line number 69 in that file where the script tries to access the os.environ attribute, which also doesn't appear when I list them:

>>> import os
>>> dir(os)
['__class__', '__name__', 'remove', 'VfsFat', 'VfsLfs2', 'chdir', 'dupterm', 'dupterm_notify', 'getcwd', 'ilistdir', 'listdir', 'mkdir', 'mount', 'rename', 'rmdir', 'stat', 'statvfs', 'umount', 'uname', 'urandom']

I'm currently using the "ASDelivery ESP32 NodeMCU" with an ESP32-WROOM-32 on it which is running the prebuilt firmware from the official website named esp32-idf4-20210202-v1.14.bin.

And the modules I installed are the following:

  • adafruit-circuitpython-bundle-py-20210225 (partially)
  • Adafruit_Blinka-6.2.2
  • Adafruit_Python_PlatformDetect-3.1.1
  • Adafruit_Python_PureIO-1.1.8

Is this normal or is it a bug, I haven't seen any mention of this error anywhere ?

Pi4B , revision a03115 missing from Pi4B list, not detected, causes raspi-blinka.py to report "None" and import board fail

I have circuitpython running on Pi Zero 2w, an original B+, but recently purchased a Pi4B 1G Model
and things aren't going so well, as the raspi-blinka.py script reports "None"detected" when it runs.
Although the script runs, I cannot import board without getting the NotImplemented error.
My Pi 4 id is a03115:

import adafruit_platformdetect
adafruit_platformdetect.Detector().get_cpuinfo_field("Revision")
'a03115'
adafruit_platformdetect.Board(adafruit_platformdetect.Detector()).id

If I force it to be a Pi4:
pi@pi41:~ $ sudo BLINKA_FORCEBOARD=RASPBERRY_PI_4B python3
Python 3.9.2 (default, Mar 12 2021, 04:06:34)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.

import board

All good.
Without the environment variable

import board
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.9/dist-packages/board.py", line 285, in
raise NotImplementedError(
NotImplementedError: Adafruit-PlatformDetect version 3.19.4 was unable to identify the board and/or microcontroller running the Linux platform. Please be sure you have the latest packages running: 'pip3 install --upgrade adafruit-blinka adafruit-platformdetect'

I have the following installed:
pi@pi41:~ $ sudo python3 -m pip list | grep Adafruit
Adafruit-ADS1x15 1.0.2
Adafruit-Blinka 6.20.1
Adafruit-PlatformDetect 3.19.4
Adafruit-PureIO 1.1.9

I can see that my id of a03115 isn't in the Pi4 list, will do a local test to add it and see if that fixes the issue.

Regards,

Joe

Adafruit Blinka fails to detect Orange Pi Zero 2 correctly

adafruit_platformdetect detects the AllWinner H616 chip correclly. But detector.board.id reports "none".
Orange Pi Zero 2 is already defined in the constants file boards.py.
But the board.py module has some complex logic that should detect an Orange Pi Zero 2 but seems to fail.

There is only one SBC with an AllWinner H616 chip that I could find - so rather than fixing the logic a simple change to board.py setting the board to "ORANGE_PI_ZERO_2" whenever the chip is identified as H616, and removing all other code referencing H616 and ORANGE_PI_ZERO_2 from board.py seems to fix the problem.

Missing rev_code for RPi 4B

Hello,

I just get a RPi 4B+ (2GB), and its rev code is b03114, which isn't in the current list, so I have to add it manually.

NotImplementedError: Board not supported None error on Raspberry Pi 3b V1.2

I am having an issue using this library. When I try to use the library it returns a board not supported error.

please see the out put of detect and cpuinfo below

processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : Generic DT based system
Revision        : 0000
Serial          : 00000000e9223457
root@pi:~#
root@pi:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : Generic DT based system
Revision        : 0000
Serial          : 00000000e9223457
Chip id:  None
Board id:  None

Is this a DragonBoard 410c? False
Is this a Pi 3B+? False
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? False
Is this a Raspberry Pi Compute Module? False
Is this a BeagleBone Black? False
Is this a BeagleBone Green? False
Is this a Giant Board? False
Is this a Coral Edge TPU? False
Is this a SiFive Unleashed?  False
Is this a PYNQ Board? False
Is this a Rock Pi board? False
Is this a Clockwork Pi board? False
Is this an embedded Linux system? False
Is this a generic Linux PC? False
Is this a UDOO Bolt? False
Is this an ASUS Tinker Board? False
Is this an STM32MP1 Board? False
Is this an OS environment variable special case? False

Possible library refactor

Hey @ladyada, @makermelissa,

I have done a little refactor on the library so when it becomes bigger detecting more boards we don't have 10k lines modules within the library.

I have made the changes here https://github.com/yeyeto2788/Adafruit_Python_PlatformDetect/tree/module_refactor, if you wish I can make a PR with this changes.

It still works as before to save retro-compatibility issue in case there is any:

import adafruit_platformdetect
detector = adafruit_platformdetect.Detector()
detector.board.id
'GENERIC_LINUX_PC'
detector.chip.id
'GENERIC_X86'
detector.board.any_embedded_linux
False

Regards.

Support for Raspberry Pi 400 Rev 1.1

PlatformDetect failed to detect my new Raspberry Pi 400 Rev 1.1.
Looks that revision c03131 needs to be added to boards.py under the RASPBERRY_PI_400 list in line 447.

pi@raspberrypi:~ $ more /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 126.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 1
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 126.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 2
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 126.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

processor : 3
model name : ARMv7 Processor rev 3 (v7l)
BogoMIPS : 126.00
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt
vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd08
CPU revision : 3

Hardware : BCM2711
Revision : c03131
Serial : 10000000a9f2dc67
Model : Raspberry Pi 400 Rev 1.1

advice for adding new board?

hello!

Thanks for making this, it's really cool.
I have a libre computer La Frite that runs on an Amlogic S805X.
When I ran the detector it looks like everything pretty much came out as None.
Digging through it seems like I will just have to make some files in the chips and boards files to add to this collection?
Please let me know if that is the way to go about it.
...
Just noticed some connected issues and saw that this info might be needed so I am putting this here in case:
/proc/cpuinfo

processor	: 0
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 1
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 2
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

processor	: 3
BogoMIPS	: 48.00
Features	: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer	: 0x41
CPU architecture: 8
CPU variant	: 0x0
CPU part	: 0xd03
CPU revision	: 4

/proc/device-tree/model
Libre Computer Board AML-S805X-AC

Thanks!

Detection of Pine64 boards/devices

As per issue adafruit/Adafruit_Blinka#118, I'm creating this issue in order to keep track the changes regarding the addition of Pine64 boards/devices.

@makermelissa I'll need the output of the /proc/cpuinfo from your board so I can add the different boards/devices from Pine64.

Should I also add the PineBook and the PinePhone?

Regards.

P.D: @makermelissa also if you want, you can assign this issue to me.

Board not supported - BBB

Trying to revive my trusty ol'BBB, board not identified.

python detect.py

Chip id: AM33XX
Board id: None

Is this a DragonBoard 410c? False
Is this a Pi 3B+? False
Is this a Pi 4B? False
Is this a 40-pin Raspberry Pi? False
Is this a Raspberry Pi Compute Module? False
Is this a BeagleBone Board? False
Is this a Giant Board? False
Is this a Coral Dev Board? False
Is this a Coral Dev Board Mini? False
Is this a SiFive Unleashed? False
Is this a PYNQ Board? False
Is this a Rock Pi board? False
Is this a NanoPi board? False
Is this a Clockwork Pi board? False
Is this an embedded Linux system? False
Is this a generic Linux PC? False
Is this a UDOO Bolt? False
Is this an ASUS Tinker Board? False
Is this an STM32MP1 Board? False
Is this an OS environment variable special case? False

cat /proc/cpuinfo

processor : 0
model name : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 995.32
Features : half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x3
CPU part : 0xc08
CPU revision : 2

Hardware : Generic AM33XX (Flattened Device Tree)
Revision : 0000
Serial : 0000000000000000

BeagleBoards - root privileges are required for reading board id

currently the call to with open("/sys/bus/nvmem/devices/0-00500/nvmem", "rb") as eeprom:
requires root privileges.
this leads to scripts that use Blinka and are run on a BeagleBoard require root (sudo) execution.

this seems to be a known limitation regarding beagle eeprom reading..
one relevant discussion:
https://groups.google.com/d/msg/beagleboard/rtB2f4Aqd-Q/I8GCpvTlAAAJ

after some searching i found this blog post that describes how to add a udev rule to allow reading the eeprom from the i2c group.

i have extended this example to also allow this for the nvmem path. its working nicely :-)
you find it attached.

would it make sens to include it in this library?
and eventually install it on lib-install?
(i have no idea if this is a good idea..)

80-eeprom-noroot.rules.txt

BeagleBone Black is not detected properly on kernel 5.10 and later

debian@BeagleBone:~$ sudo python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44) 
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from adafruit_platformdetect import Detector
>>> detector = Detector()
>>> print("Chip id: ", detector.chip.id)
Chip id:  AM33XX
>>> print("Board id: ", detector.board.id)
Board id:  None
>>> # Check for specific board models:
>>> print("Pi 3B+? ", detector.board.RASPBERRY_PI_3B_PLUS)
Pi 3B+?  False
>>> print("BBB? ", detector.board.BEAGLEBONE_BLACK)
BBB?  False
>>> print("Orange Pi PC? ", detector.board.ORANGE_PI_PC)
Orange Pi PC?  False
>>> print("generic Linux PC? ", detector.board.GENERIC_LINUX_PC)
generic Linux PC?  False
>>> 

How to deal with custom SoC/SoM implementations

I'm creating a PCB based on the RPI Compute Module 4 and have ICs attached to it that I would like to expose in a CPY fashion as a pre-configured peripheral as part of the board definition.
So this would be a sort of flavour of an existing supported board ("bare" CM4).

This is something I have not seen addressed so far but would require a solution for in order to offer a good Blinka/CPY experience.
For me its specific to the CM4 but in general this holds true I guess for any other SoM of any of the supported SoCs (BeagleBone f.e.). I'm not sure if a generic solution can exist though.

Personally I would prefer it if an EEPROM solution like used for Pi HATs could be avoided as I feel these add unnecessary bulk. My board does not have an EEPROM connected.
My favourite solution would be to have a text file in /boot that contains an ID string that overrides whatever https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/master/adafruit_platformdetect/board.py determines.
This would be quite easy to do by a user manually or by an install script.

This is something that can also be done by a user on their computer or a host side install script after flashing a generic image in case of a Pi image (and others, I think BB also worked that way) as the boot partition is readable on any OS. So that would make it possible to modify an existing SDCard/mounted eMMC to work with a specific board instance without creating a custom image for people to flash which I think would be very bad thing to have in the ecosystem if board creators feel they need to maintain their own Raspbian flavor just to have a user friendly experience (which would eventually become outdated when they stop maintaining).

Board not supported {}".format(board_id) needs better error message.

This will become a more common error as newer hardware is used on older images or packages. It's a nonintuitive issue, as board.py is the same as several scripts.

import adafruit_motorkit File "/usr/local/lib/python3.7/dist-packages/adafruit_motorkit.py", line 55, in <module> import board **File "/home/pi/.local/lib/python3.7/site-packages/board.py", line 166, in <module> raise **NotImplementedError("Board not supported {}".format(board_id)) NotImplementedError: Board not supported None****

The error message should instruct the user that their hardware is unknown to the version of platformdetect (give version) , to upgrade to the latest version using: pip3 install --upgrade adafruit-blinka adafruit-platformdetect

SyntaxError: future feature annotations is not defined

I was using this package and it worked perfectly. Now I have some trouble because I re-install the latest version which has "from future import annotations" in both board.py and chip.py files.

Below shows the error I got:

Traceback (most recent call last):
  File "servo_motor.py", line 1, in <module>
    from adafruit_servokit import ServoKit
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_servokit.py", line 35, in <module>
    import board
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/board.py", line 39, in <module>
    import adafruit_platformdetect.constants.boards as ap_board
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_platformdetect/__init__.py", line 11, in <module>
    from .chip import Chip
  File "/home/nvidia/Desktop/face_env/lib/python3.6/site-packages/adafruit_platformdetect/chip.py", line 23
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

I solved this by copying the previous version code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.