adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
453 stars 340 forks source link

libgpiod 1.4.2 or older results in error: '<' not supported between instances of 'builtin_function_or_method' and 'int' #685

Closed how2flow closed 1 year ago

how2flow commented 1 year ago

If the Using libgpiod version is low, the following error might occur. (I am using libgpiod v1.4.2.)

...

'<' not supported between instances of 'builtin_function_or_method' and 'int'

Logs that appear after https://github.com/adafruit/Adafruit_Blinka/pull/678 is reflected, i.e. when you use pip package version 8.19.0 or later. Run command sed -i s/num_lines/num_lines\(\)/g {your_prefix}/microcontroller/amlogic/meson_g12_common/pin.py or Change the version to 8.18.1 or lower. Fixing a simple error line may have some side effects. I recommend that you lower the version.

I leave a message for those who meet the error log.

makermelissa commented 1 year ago

It appears an attempt was made to update this file to work with both older and newer versions of libgpiod as evidenced by snippets of code like:

if hasattr(gpiod, "Chip"):
    chip0 = gpiod.Chip("0")
    chip1 = gpiod.Chip("1")
else:
    chip0 = gpiod.chip("0")
    chip1 = gpiod.chip("1")

However, it appears that some of the logic may have been missed.