Skip to content

Added Improved Pi Revision Code Detection #294

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 2 commits into from
May 12, 2023

Conversation

makermelissa
Copy link
Collaborator

Fixes #268.

This adds a revision code decoder to the Pi which can accurately check the model and revision number of the Raspberry Pi revision code along with some other information about it. This works for both new style and old style codes.
I added rpi_info.py, which if run on a Pi, it will display all the info for the device and if run on something else, it will prompt for a code to decode. I also added rev_code_tester.py, which will run through all the existing codes, run that code through the decoder, and check if it matches what is expected, which it does with 100% accuracy. By decoding it can ignore many of the similar variations of codes.

This also adds detection for the new CM4S modules.

@makermelissa makermelissa requested a review from a team May 11, 2023 22:19
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

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

One suggestion but fine as-is too.

Comment on lines +242 to +296
@property
def overvoltage(self):
"""Overvoltage allowed/disallowed"""
return self._get_property("overvoltage")

@property
def warranty_bit(self):
"""Warranty bit"""
return self._get_property("warranty")

@property
def otp_program(self):
"""OTP programming allowed/disallowed"""
return self._get_property("otp_program")

@property
def otp_read(self):
"""OTP reading allowed/disallowed"""
return self._get_property("otp_read")

@property
def rev_style(self):
"""Revision Code style"""
# Force new style for Rev Style
return self._get_rev_prop_value("rev_style")

@property
def memory_size(self):
"""Memory size"""
return self._get_property("memory_size")

@property
def manufacturer(self):
"""Manufacturer"""
return self._get_property("manufacturer")

@property
def processor(self):
"""Processor"""
return self._get_property("processor")

@property
def type(self):
"""Specific Model"""
return self._get_property("type")

@property
def type_raw(self):
"""Raw Value of Specific Model"""
return self._get_property("type", raw=True)

@property
def revision(self):
"""Revision Number"""
return self._get_property("revision")
Copy link
Member

Choose a reason for hiding this comment

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

You could use a Data Descriptor class to factor these all out. (Works like CP Register does.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, I'll have to take a look at that. I'm not familiar with it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think since this has been well tested as it is and I don't feel confident with descriptors, I'd rather use this as a starting point. That could be a future improvement.

@makermelissa makermelissa merged commit 7b3c72a into adafruit:main May 12, 2023
@makermelissa makermelissa changed the title Added improved Pi Revision Code detection Added Improved Pi Revision Code Detection May 12, 2023
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.

Simplify Pi 4 (and possibly CM4) Rev Code Checks
2 participants