community/libgpiod: add kludgy compat with libgpiod 1.x tools
libgpiod 2.0 broke all tools CLI interface abruptly with no partial transition possible (no syntax working with both the old and new version that could allow migrating scripts that depend on these tools one at a time) This patch introduces a rough (and hopefully safe) heuristic to keep the old syntax alive in the new tool, just for alpine 3.21 (this will NOT be submitted to master) Folks on 3.21 that have scripts depending on this will hopefully see the warning and fix their scripts, at which point this patch will not matter at all and upgrading will keep working. The logic is as follow, if `--chip` was not specified and either of: - the first argument is a gpiochip (/dev/gpiochip* or gpiochip*) then there is no doubt it was intended as an 1.x chip argument - the first argument is a single digit, then it could technically also be a gpio "named" as per that single digit, but as far as I'm aware name are more likely to be something like "gpio3" so this should not happen? then the first argument is considered to be a chip and gpioget/set will enable compatibility options (--numeric for get, unreachable option to exit immediately for set) and a warning will be printed on stderr. scripts using gpioget would hopefully only be reading stdin so the stderr warning can be displayed to users without breaking the scripts; even if that warning is lost or otherwise badly interpretted then this is no worse than failing because chip was not set anyway. For people using the new syntax, either by specifying the chip or by using named gpios by names, then this check will be ignored and the tools will work as expected. Link: https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/commit/?id=8ffb6489286fc9cd68bc5fa283f99b1fa1e05f9d
parent
be64c52e
No related branches found
No related tags found
Checking pipeline status
Loading
Please register or sign in to comment