• Has gpio changed completely betwen bookworm and trixie?

    From Chris Green@21:1/5 to All on Thu Aug 28 15:24:26 2025
    I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Alfter@21:1/5 to cl@isbd.net on Thu Aug 28 16:34:38 2025
    In article <qd56ol-6mhl.ln1@q957.zbmc.eu>, Chris Green <cl@isbd.net> wrote:
    I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    I noticed that when I tried updating a RPi 4 + Geekworm X728 system
    yesterday. The scripts that talk to the X728 (using rpi-lgpio instead of rpi-gpio) were completely broken. I'm trying to rework them to use
    gpiozero, hoping that it might be a better-supported system for the long
    term.

    --
    _/_
    / v \ Scott Alfter (remove the obvious to send mail)
    (IIGS( https://alfter.us/ Top-posting!
    \_^_/ >What's the most annoying thing on Usenet?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Scott Alfter on Thu Aug 28 17:41:15 2025
    On 28/08/2025 17:34, Scott Alfter wrote:
    In article <qd56ol-6mhl.ln1@q957.zbmc.eu>, Chris Green <cl@isbd.net> wrote:
    I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    I noticed that when I tried updating a RPi 4 + Geekworm X728 system yesterday. The scripts that talk to the X728 (using rpi-lgpio instead of rpi-gpio) were completely broken. I'm trying to rework them to use
    gpiozero, hoping that it might be a better-supported system for the long term.

    It's probably some rearrangement of the /sys hierarchy.

    At some level the C library gpio functions should still work...


    --
    For in reason, all government without the consent of the governed is the
    very definition of slavery.

    Jonathan Swift

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to The Natural Philosopher on Thu Aug 28 19:05:55 2025
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 28/08/2025 17:34, Scott Alfter wrote:
    In article <qd56ol-6mhl.ln1@q957.zbmc.eu>, Chris Green <cl@isbd.net> wrote:
    I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    I noticed that when I tried updating a RPi 4 + Geekworm X728 system yesterday. The scripts that talk to the X728 (using rpi-lgpio instead of rpi-gpio) were completely broken. I'm trying to rework them to use gpiozero, hoping that it might be a better-supported system for the long term.

    It's probably some rearrangement of the /sys hierarchy.

    At some level the C library gpio functions should still work...

    OP here, yes, I'm not going mad. There are major changes between the
    i.6.x and 2.x versions of python3-libgpiod. The trouble is that
    finding out about it all is very difficult because there are so many
    different python wrappers for gpiod and this makes searching very
    frustrating.

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md

    It has some Python examples but the coding style is very odd and makes
    it difficult to follow what's going on IMHO.

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Chris Green on Fri Aug 29 10:47:18 2025
    On 28/08/2025 19:05, Chris Green wrote:
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 28/08/2025 17:34, Scott Alfter wrote:
    In article <qd56ol-6mhl.ln1@q957.zbmc.eu>, Chris Green <cl@isbd.net> wrote:
    I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    I noticed that when I tried updating a RPi 4 + Geekworm X728 system
    yesterday. The scripts that talk to the X728 (using rpi-lgpio instead of >>> rpi-gpio) were completely broken. I'm trying to rework them to use
    gpiozero, hoping that it might be a better-supported system for the long >>> term.

    It's probably some rearrangement of the /sys hierarchy.

    At some level the C library gpio functions should still work...

    OP here, yes, I'm not going mad. There are major changes between the
    i.6.x and 2.x versions of python3-libgpiod. The trouble is that
    finding out about it all is very difficult because there are so many different python wrappers for gpiod and this makes searching very frustrating.

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md

    It has some Python examples but the coding style is very odd and makes
    it difficult to follow what's going on IMHO.

    Can't help. I never use python.

    --
    WOKE is an acronym... Without Originality, Knowledge or Education.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Scott Alfter@21:1/5 to tnp@invalid.invalid on Fri Aug 29 18:25:16 2025
    In article <108q0rb$1fmpt$6@dont-email.me>,
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 28/08/2025 17:34, Scott Alfter wrote:
    In article <qd56ol-6mhl.ln1@q957.zbmc.eu>, Chris Green <cl@isbd.net> wrote: >>> I have upgraded my Pi 4B from bookworm to trixie and, while most
    things work fine, my gpiod code in Python is completely broken. Can
    anyone confirm that everything has changed a lot or am I going mad?

    I noticed that when I tried updating a RPi 4 + Geekworm X728 system
    yesterday. The scripts that talk to the X728 (using rpi-lgpio instead of
    rpi-gpio) were completely broken. I'm trying to rework them to use
    gpiozero, hoping that it might be a better-supported system for the long
    term.

    It's probably some rearrangement of the /sys hierarchy.

    One thing I forgot to mention: the system in question was running Armbian.
    I'm trying again under Raspbian to see if that makes a difference.

    Before blowing Armbian off the board, I was tinkering around with gpiod
    instead of gpiozero. I tweaked a gpiod example and got the buzzer on the
    X728 to sound off, but it looks like porting to gpiod would be much more difficult than porting to gpiozero.

    --
    _/_
    / v \ Scott Alfter (remove the obvious to send mail)
    (IIGS( https://alfter.us/ Top-posting!
    \_^_/ >What's the most annoying thing on Usenet?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence =?iso-8859-13?q?D=FFOlivei@21:1/5 to Chris Green on Sat Aug 30 00:23:46 2025
    On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md

    It has some Python examples but the coding style is very odd and
    makes it difficult to follow what's going on IMHO.

    I had a look at one or two examples, but they didn’t look very “odd”
    to me. Any particular ones you are having trouble with?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to ldo@nz.invalid on Sat Aug 30 09:02:46 2025
    Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
    On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md

    It has some Python examples but the coding style is very odd and
    makes it difficult to follow what's going on IMHO.

    I had a look at one or two examples, but they didn’t look very “odd”
    to me. Any particular ones you are having trouble with?

    I worked it all out OK, I do write quite a lot of Python code. My
    comment was rather that the style using 'with' and so on which makes
    it rather diffcult to actually follow the sequence of calls required
    to do simple things like 'set this line high' or 'read the state of
    that line'.

    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Chris Green on Sat Aug 30 09:11:44 2025
    On 30/08/2025 09:02, Chris Green wrote:
    Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
    On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md >>>
    It has some Python examples but the coding style is very odd and
    makes it difficult to follow what's going on IMHO.

    I had a look at one or two examples, but they didn’t look very “odd” >> to me. Any particular ones you are having trouble with?

    I worked it all out OK, I do write quite a lot of Python code. My
    comment was rather that the style using 'with' and so on which makes
    it rather diffcult to actually follow the sequence of calls required
    to do simple things like 'set this line high' or 'read the state of
    that line'.

    Ah. Written by a computer scientist rather than a software engineer.
    Designed to impress, not to elucidate...



    --
    “Some people like to travel by train because it combines the slowness of
    a car with the cramped public exposure of 
an airplane.”

    Dennis Miller

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence =?iso-8859-13?q?D=FFOlivei@21:1/5 to Chris Green on Sat Aug 30 09:13:15 2025
    On Sat, 30 Aug 2025 09:02:46 +0100, Chris Green wrote:

    Lawrence D’Oliveiro <ldo@nz.invalid> wrote:

    On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md >>>
    It has some Python examples but the coding style is very odd and
    makes it difficult to follow what's going on IMHO.

    I had a look at one or two examples, but they didn’t look very
    “odd” to me. Any particular ones you are having trouble with?

    I worked it all out OK, I do write quite a lot of Python code. My
    comment was rather that the style using 'with' and so on which makes
    it rather diffcult to actually follow the sequence of calls required
    to do simple things like 'set this line high' or 'read the state of
    that line'.

    You don’t know about context managers? They’re a basic Python
    mechanism for ensuring proper cleanup. You consider it “odd” just
    because you hadn’t learned about that feature of Python?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Green@21:1/5 to ldo@nz.invalid on Sat Aug 30 13:42:52 2025
    Lawrence D’Oliveiro <ldo@nz.invalid> wrote:
    On Sat, 30 Aug 2025 09:02:46 +0100, Chris Green wrote:

    Lawrence D’Oliveiro <ldo@nz.invalid> wrote:

    On Thu, 28 Aug 2025 19:05:55 +0100, Chris Green wrote:

    The best I've found so far is the 'source':-
    https://github.com/brgl/libgpiod/blob/master/bindings/python/README.md

    It has some Python examples but the coding style is very odd and
    makes it difficult to follow what's going on IMHO.

    I had a look at one or two examples, but they didn’t look very
    “odd” to me. Any particular ones you are having trouble with?

    I worked it all out OK, I do write quite a lot of Python code. My
    comment was rather that the style using 'with' and so on which makes
    it rather diffcult to actually follow the sequence of calls required
    to do simple things like 'set this line high' or 'read the state of
    that line'.

    You don’t know about context managers? They’re a basic Python
    mechanism for ensuring proper cleanup. You consider it “odd” just
    because you hadn’t learned about that feature of Python?

    Look, I'm a software engineer (Eur. Ing., FEANI) with well over 50
    years of programming experience in all sorts of languages.

    Yes, context managers are a 'good thing' but using them to help
    **understand** how the basics of a package work is not, IMHO, a good
    idea. First show how to do something **then** emphasise that you
    must release resources and say that using a context manager is one
    way of doing it.

    Someone unfamiliar with Python and/or someone who is not an
    experienced programmer is much more likely to be the audience for
    these examples. The more professional/skilful people will probably
    simply dive in to the API documentation.


    --
    Chris Green
    ·

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence =?iso-8859-13?q?D=FFOlivei@21:1/5 to Chris Green on Sat Aug 30 23:01:15 2025
    On Sat, 30 Aug 2025 13:42:52 +0100, Chris Green wrote:

    Yes, context managers are a 'good thing' but using them to help **understand** how the basics of a package work is not, IMHO, a good
    idea.

    It is in fact quite a common thing. Look at the examples of use
    of the open() function in the standard Python library docs <https://docs.python.org/3/library/functions.html#open>, for instance.

    There is another call to open() on that page, in an example for another function, and that uses a with-statement too.

    First show how to do something **then** emphasise that you
    must release resources and say that using a context manager is one
    way of doing it.

    This is the old “do as I say, not as I do” school of writing example code. You tell people to understand what the code does and use it as a model,
    not just blindly copy-and-paste, and ... guess what they do?

    Someone unfamiliar with Python and/or someone who is not an
    experienced programmer is much more likely to be the audience for
    these examples.

    In other words, precisely the ones who are in a hurry to get something
    done, finish an assignment or whatever, and therefore ... blindly copy- and-paste.

    The more professional/skilful people will probably simply dive in to the
    API documentation.

    One would hope so, but given some discussions that have been happening recently, I’m not so sure ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)