Sitelet https://github.com/gpiozero/gpiozero/issues/1186
Skip to content

PinUnknownPi: unknown old-style revision "0"聽#1186

Description

@narun4sk

Operating system: Arch Linux
Python version: Python 3.12.1
Pi model: Raspberry Pi 5 Model B Rev 1.1
GPIO Zero version: gpiozero==2.0.1, pigpio==1.78
Pin factory used: pigpio

Looks like it does not recognize Raspberry Pi 5? 馃

Revision info:

root@raspberrypi:~# grep Rev /proc/cpuinfo
Revision	: d04171
Model		: Raspberry Pi 5 Model B Rev 1.1

GPIO on the board are exposed using rgpiod.

An example from the documentation simply does not work:

In [1]: from gpiozero import LED
   ...: from gpiozero.pins.pigpio import PiGPIOFactory

In [2]: factory = PiGPIOFactory(host='192.168.22.8')

In [3]: led = LED(17, pin_factory=factory)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/pi.py:306, in PiBoardInfo.from_revision(cls, revision)
    289 try:
    290     (
    291         model,
    292         pcb_revision,
    293         released,
    294         soc,
    295         manufacturer,
    296         memory,
    297         storage,
    298         usb,
    299         ethernet,
    300         wifi,
    301         bluetooth,
    302         csi,
    303         dsi,
    304         headers,
    305         board,
--> 306         ) = data.PI_REVISIONS[revision]
    307     usb3 = 0

KeyError: 0

During handling of the above exception, another exception occurred:

PinUnknownPi                              Traceback (most recent call last)
Cell In[3], line 1
----> 1 led = LED(17, pin_factory=factory)

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/devices.py:108, in GPIOMeta.__call__(cls, *args, **kwargs)
    105         cls._instances[key] = weakref.ref(self)
    106 else:
    107     # Construct the instance as normal
--> 108     self = super().__call__(*args, **kwargs)
    109 # At this point __new__ and __init__ have all been run. We now fix the
    110 # set of attributes on the class by dir'ing the instance and creating a
    111 # frozenset of the result called __attrs__ (which is queried by
    112 # GPIOBase.__setattr__). An exception is made for SharedMixin devices
    113 # which can be constructed multiple times, returning the same instance
    114 if not issubclass(cls, SharedMixin) or self._refs == 1:

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/output_devices.py:192, in DigitalOutputDevice.__init__(self, pin, active_high, initial_value, pin_factory)
    190 self._blink_thread = None
    191 self._controller = None
--> 192 super().__init__(pin, active_high=active_high,
    193                  initial_value=initial_value, pin_factory=pin_factory)

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/output_devices.py:74, in OutputDevice.__init__(self, pin, active_high, initial_value, pin_factory)
     72 def __init__(self, pin=None, *, active_high=True, initial_value=False,
     73              pin_factory=None):
---> 74     super().__init__(pin, pin_factory=pin_factory)
     75     self._lock = Lock()
     76     self.active_high = active_high

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/mixins.py:75, in SourceMixin.__init__(self, *args, **kwargs)
     73 self._source_thread = None
     74 self._source_delay = 0.01
---> 75 super().__init__(*args, **kwargs)

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/devices.py:552, in GPIODevice.__init__(self, pin, pin_factory)
    550     raise GPIOPinMissing('No pin given')
    551 # Check you can reserve *before* constructing the pin
--> 552 self.pin_factory.reserve_pins(self, pin)
    553 pin = self.pin_factory.pin(pin)
    554 self._pin = pin

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/__init__.py:84, in Factory.reserve_pins(self, requester, *names)
     78 with self._res_lock:
     79     pins = (
     80         info
     81         for name in names
     82         for header, info in self.board_info.find_pin(name)
     83     )
---> 84     for pin in pins:
     85         for reserver_ref in self._reservations[pin]:
     86             reserver = reserver_ref()

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/__init__.py:82, in <genexpr>(.0)
     72 """
     73 Called to indicate that the device reserves the right to use the
     74 specified pin *names*. This should be done during device construction.
     75 If pins are reserved, you must ensure that the reservation is released
     76 by eventually called :meth:`release_pins`.
     77 """
     78 with self._res_lock:
     79     pins = (
     80         info
     81         for name in names
---> 82         for header, info in self.board_info.find_pin(name)
     83     )
     84     for pin in pins:
     85         for reserver_ref in self._reservations[pin]:

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/__init__.py:186, in Factory.<lambda>(self)
    182 def _get_board_info(self):
    183     raise NotImplementedError
    185 board_info = property(
--> 186     lambda self: self._get_board_info(),
    187     doc="""\
    188     Returns a :class:`BoardInfo` instance (or derivative) representing the
    189     board that instances generated by this factory will be attached to.
    190     """)
    192 def _get_pi_info(self):
    193     warnings.warn(
    194         DeprecationWarning(
    195             "Please use Factory.board_info instead of Factory.pi_info"))

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/pi.py:427, in PiFactory._get_board_info(self)
    425 def _get_board_info(self):
    426     if self._info is None:
--> 427         self._info = PiBoardInfo.from_revision(self._get_revision())
    428     return self._info

File ~/.pyenv/versions/3.12.1/envs/raspberry5/lib/python3.12/site-packages/gpiozero/pins/pi.py:310, in PiBoardInfo.from_revision(cls, revision)
    308         eth_speed = ethernet * 100
    309     except KeyError:
--> 310         raise PinUnknownPi(f'unknown old-style revision "{revision:x}"')
    311 headers = frozendict({
    312     header: HeaderInfo(
    313         name=header, rows=rows, columns=columns,
   (...)
    321     for header, (rows, columns, header_data) in headers.items()
    322 })
    323 return cls(
    324     f'{revision:04x}',
    325     model,
   (...)
    341     board,
    342     )

PinUnknownPi: unknown old-style revision "0"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions