Arksine / moonraker

Web API Server for Klipper
https://moonraker.readthedocs.io
GNU General Public License v3.0
1.02k stars 392 forks source link

libgpiod v2 support #772

Closed Kritnich closed 6 months ago

Kritnich commented 6 months ago

Is your feature request related to a problem? Please describe

libgpiod v2 was released earlier this year. The new API is backwards incompatible. It would be good to support it sometime in the future since v1 will likely not be developed further.

Describe the solution you'd like

Adjusting the gpio module behaviour so it reads the version from the installed libgpiod module and uses the API as such to add support for libgpiod v2 while maintaining compatibility with v1.

Describe alternatives you've considered

No response

Additional information

No response

Arksine commented 6 months ago

I took a look at this and am frankly perplexed as to why the libgpiod developers chose to release a new API with no backward compatibility. As you indicate, this change requires applications that depend on libgpiod to support both APIs.

As such, I considered writing my own bindings for the gpio character device. Fortunately for me, this has already been done in python-periphery. Commit 5d079d8c264e2927d02b2093e7a2e70846828769 migrates Moonraker's gpio component from gpiod to python-periphery. Thanks.

Kritnich commented 6 months ago

Thank you for your quick response and great effort. I was working on designing some bindings as well, but this is a much better solution. On my end the problem is solved with this commit.