Giter Club home page Giter Club logo

Comments (24)

makermelissa avatar makermelissa commented on September 25, 2024 1

I'm spinning up a BBB at the moment. Maybe we could do something like I did for Beaglebone AI: https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/main/adafruit_platformdetect/board.py#L257-L262

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024 1

Give me 20 minutes, i'll have a kernel version vs location off eeprom database setup.. ;)

Just need to push an update and see what we have..
http://gfnd.rcn-ee.org:81/farm/uptime/

Regards,

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024 1

i agree, that should be the safest for now.. i was little worried some where even more off..

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Looks like the chip is right, but the board isn't.

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

Hi @makermelissa , i was also talking with @pdp7 about this... Maybe with the BeagleBone family we are trying to do too much... We try to support v3.8.x -> v5.17.x... @Dario503 found another interesting mainline change, as our eeprom location changed on mainline. ;)

sys/bus/nvmem/devices/0-00500/nvmem -> sys/bus/nvmem/devices/0-00501/nvmem

Any thoughts to allow our users to just hardcode it's a BeagleBone, and then define which interfaces, spi/i2c/etc, they want to use?

root@BeagleBone:~# uname -r
5.15.23-bone20
root@BeagleBone:~# tree /sys/bus/nvmem/devices/
/sys/bus/nvmem/devices/
├── 0-00501 -> ../../../devices/platform/ocp/44c00000.interconnect/44c00000.interconnect:segment@200000/44e0b000.target-module/44e0b000.i2c/i2c-0/0-0050/0-00501
└── omap_rtc_scratch0 -> ../../../devices/platform/ocp/44c00000.interconnect/44c00000.interconnect:segment@200000/44e3e074.target-module/44e3e000.rtc/omap_rtc_scratch0

2 directories, 0 files
root@BeagleBone:~# xxd /sys/bus/nvmem/devices/0-00501/nvmem
00000000: aa55 33ee 4133 3335 424e 4c54 4747 3141  .U3.A335BNLTGG1A
00000010: 3230 3230 3036 3030 3033 3537 ffff ffff  202006000357....
00000020: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000030: ffff ffff ffff ffff ffff ffff 3243 4637  ............2CF7
00000040: 4631 3036 3030 3031 0000 0000 0000 ffff  F1060001........

"0-00500"... is also not stable!!

The one solution, i don't want to do... I say only "v5.10.x" is supported, and then once a year we bump things..

The other crazy idea is epcohs, 3.8.x/bbb -> x, 4.14.x/bbb -> y, 5.4.x/bbb ->z ... but would be a mess...

Regards,

from adafruit_python_platformdetect.

ladyada avatar ladyada commented on September 25, 2024

hi there is no way to determine when code is running on a beaglebone?

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Ok, looks like running detect.py works fine:

debian@beaglebone:~/Adafruit_Python_PlatformDetect/bin$ python3 detect.py
Chip id:  AM33XX
Board id:  BEAGLEBONE_BLACK

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? True
Is this a Giant Board? False
Is this a Coral Dev Board? False
Is this a Coral Dev Board Mini? False
Is this a MaaXBoard? False
Is this a MaaXBoard 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? 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

I'm, using the latest. Perhaps you're right about trying to support too wide of a range.

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Oh, I guess it's not the latest. Just the latest recommended image with 4.19.94 kernel.

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

So yeah, looks like peeking at /proc/device-tree-model may be a workable alternative:

debian@beaglebone:~/Adafruit_Python_PlatformDetect/bin$ cat /proc/device-tree/model
TI AM335x BeagleBone Black

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

Personally... i've started moving away from that... too many clones...

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L136-L232

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Ok, if you'd like to modify https://github.com/adafruit/Adafruit_Python_PlatformDetect/blob/main/adafruit_platformdetect/board.py#L219 to also check at the new location (probably right after checking the first location) and submit a PR, we'd be happy to take a look.

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

Okay, @makermelissa this is what i'm seeing:

tree /sys/bus/nvmem/devices/

4.19.94-ti-r71
4.19.94-ti-rt-r71
5.4.106-ti-r38
5.4.106-ti-rt-r38
5.4.161-bone63
5.4.161-bone-rt-r63

0-00500

tree /sys/bus/nvmem/devices/

5.10.90-ti-r36
5.10.90-ti-rt-r36
5.10.90-bone60
5.10.90-bone-rt-r60
5.15.23-bone20
5.15.23-bone20

0-00501

So something in the kernel ABI change... 0-00500 -> 0-00501 !!!

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Good to know. We should have it just try the location it does now. If that fails, it should just try the second location. That way it just works for the different kernels.

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

It looks like you need elevated permissions to read the new location:

debian@beaglebone:~$ cat /sys/bus/nvmem/devices/0-00501/nvmem
cat: /sys/bus/nvmem/devices/0-00501/nvmem: Permission denied

Python isn't wanting to read it either without prepending a sudo.

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

Hi @makermelissa , I wonder if just fixed this, what is the permission of the directory..

ls -lh of that dir....

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024
debian@beaglebone:~$ ls -lh /sys/bus/nvmem/devices/0-00501
lrwxrwxrwx 1 root root 0 Jan  1  2000 /sys/bus/nvmem/devices/0-00501 -> ../../../devices/platform/ocp/44c00000.interconnect/44c00000.interconnect:segment@200000/44e0b000.target-module/44e0b000.i2c/i2c-0/0-0050/0-00501
debian@beaglebone:~$ ls -lh /sys/bus/nvmem/devices/0-00501/nvmem
-rw------- 1 root root 0 Mar  1 19:22 /sys/bus/nvmem/devices/0-00501/nvmem

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Or maybe you meant this:

debian@beaglebone:/sys/bus/nvmem/devices/0-00501$ ls -lh
total 0
-rw------- 1 root root    0 Mar  1 19:22 nvmem
lrwxrwxrwx 1 root root    0 Mar  1 19:24 of_node -> ../../../../../../../../../../firmware/devicetree/base/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/baseboard_eeprom@50
drwxr-xr-x 2 root root    0 Mar  1 19:24 power
lrwxrwxrwx 1 root root    0 Jan  1  2000 subsystem -> ../../../../../../../../../../bus/nvmem
-r--r--r-- 1 root root 4.0K Mar  1 19:24 type
-rw-r--r-- 1 root root 4.0K Jan  1  2000 uevent

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

@makermelissa what version of bb-customizations does that image have?

root@BeagleBone:~# dpkg --list | grep bb-customizations
ii  bb-customizations                          1.20220119.0-0~bullseye+20220125              armhf        beagleboard.org customizations
root@BeagleBone:~# ls -lah /sys/bus/nvmem/devices/0-00501/
total 0
drwxrwxr-x 3 root gpio    0 Jan  1  2000 .
drwxrwxr-x 4 root gpio    0 Jan  1  2000 ..
-rw-rw---- 1 root gpio  32K Jan  1  2000 nvmem
lrwxrwxrwx 1 root gpio    0 Mar  1 03:08 of_node -> ../../../../../../../../../../firmware/devicetree/base/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/baseboard_eeprom@50
drwxrwxr-x 2 root gpio    0 Jan  1  2000 power
lrwxrwxrwx 1 root gpio    0 Mar  1 03:08 subsystem -> ../../../../../../../../../../bus/nvmem
-r--r--r-- 1 root gpio 4.0K Jan  1  2000 type
-rw-rw-r-- 1 root gpio 4.0K Jan  1  2000 uevent

okay.... i'm not sure now where the udev rule is triggered..

root@BeagleBone:~# cat /etc/udev/rules.d/* | grep eeprom

REgards,

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024
debian@BeagleBone:~$ ls -lah /sys/bus/nvmem/devices/0-00501/
total 0
drwxrwxr-x 3 root gpio    0 Jan  1  2000 .
drwxrwxr-x 4 root gpio    0 Jan  1  2000 ..
-rw-rw---- 1 root gpio  32K Jan  1  2000 nvmem
lrwxrwxrwx 1 root gpio    0 Mar  1 03:08 of_node -> ../../../../../../../../../../firmware/devicetree/base/ocp/interconnect@44c00000/segment@200000/target-module@b000/i2c@0/baseboard_eeprom@50
drwxrwxr-x 2 root gpio    0 Jan  1  2000 power
lrwxrwxrwx 1 root gpio    0 Mar  1 03:08 subsystem -> ../../../../../../../../../../bus/nvmem
-r--r--r-- 1 root gpio 4.0K Jan  1  2000 type
-rw-rw-r-- 1 root gpio 4.0K Jan  1  2000 uevent
debian@BeagleBone:~$ cat /sys/bus/nvmem/devices/0-00501/nvmem | xxd
00000000: aa55 33ee 4133 3335 424e 4c54 3030 4330  .U3.A335BNLT00C0
00000010: 3235 3136 4242 424b 3236 3236 ffff ffff  2516BBBK2626....
00000020: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000030: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000040: ffff ffff ffff ffff ffff ffff ffff ffff  ................
00000050: 3430 3035 3234 2b31 3330 312b 3030 3937  400524+1301+0097
00000060: 3636 2b31 3632 3558 5858 5858 5858 5858  66+1625XXXXXXXXX
debian@BeagleBone:~$ cat /etc/dogtag 
BeagleBoard.org Debian Bullseye IoT Image 2022-02-28

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

Ok, that looks promising.

debian@beaglebone:/sys/bus/nvmem/devices/0-00501$ cat /etc/udev/rules.d/* | grep eeprom
# From: https://github.com/s-light/pocketbeagle_python_tests/blob/master/80-eeprom-noroot.rules
# /etc/udev/rules.d/80-eeprom-noroot.rules
# allow i2c group to read of eeprom
# /sys/bus/i2c/devices/0-0050/eeprom
# ls -l /sys/bus/i2c/devices/0-0050/eeprom /sys/bus/nvmem/devices/0-00500/nvmem
SUBSYSTEM=="i2c", DEVPATH=="*0-0050", RUN+="/bin/chown root:gpio /sys$env{DEVPATH}/eeprom", RUN+="/bin/chmod 0640 /sys$env{DEVPATH}/eeprom"

After a quick edit to the udev rules and a reboot it works.

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

building right now... rcn-ee/repos@f78bcd1

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

I'll submit a PR. Looks like it working great now. Users who upgrade will need to edit udev ruls though. File is /etc/udev/rules.d/80-eeprom-noroot.rules and just needs to be changed from 0-00500 to 0-00501

debian@beaglebone:~/Adafruit_Python_PlatformDetect/bin$ python3 detect.py
Chip id:  AM33XX
Board id:  BEAGLEBONE_BLACK

from adafruit_python_platformdetect.

makermelissa avatar makermelissa commented on September 25, 2024

building right now... rcn-ee/repos@f78bcd1

even better

from adafruit_python_platformdetect.

RobertCNelson avatar RobertCNelson commented on September 25, 2024

apt repo is now updated...

Should be fixed with:

sudo apt update
sudo apt upgrade

i was going to tag and update:

https://forum.beagleboard.org/t/debian-10-x-buster-monthly-snapshots/31203

today, but i'll delay it so this fix will be in our buster image.. (aka tomorrow's rebuild..)

Regards,

from adafruit_python_platformdetect.

Related Issues (20)

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.