avrdudes/avrdude

linuxgpio sysfs fallback improvement to deal with shifted GPIO numbering in new kernel version

mcuee opened this issue · 2 comments

From here.

From @stefanrueger

The AVRDUDE project likes to be backward compatible, and as such is unlikely to remove support for libgpiod v1 or sysfs for that matter.

I think(!) I have read up sufficiently on sysfs and gpiod to hazard a guess that it ought to be possible to try a workaround once AVRDUDE realises that the current config doesn't work with the current kernel. Knowing that some kernels shifted the GPIO numbering from one version to the next, AVRDUDE could try to undo that shift by carefully looking at the config GPIO numbers and the GPIO numbers offered by the kernel.

root@raspberrypi:~# ls -la /sys/class/gpio
total 0
drwxrwxr-x  2 root gpio    0 Apr 13 13:32 .
drwxr-xr-x 65 root root    0 Jan  1  1970 ..
--w--w----  1 root gpio 4096 Apr 13 13:29 export
lrwxrwxrwx  1 root gpio    0 Apr 11 19:17 gpiochip512 -> ../../devices/platform/soc/fe200000.gpio/gpio/gpiochip512
lrwxrwxrwx  1 root gpio    0 Apr 11 19:17 gpiochip570 -> ../../devices/platform/soc/soc:firmware/soc:firmware:gpio/gpio/gpiochip570
--w--w----  1 root gpio 4096 Apr 13 13:29 unexport

Reference for the pin number change.

It's been a long time, and judging by the the number of complaints around this ebbing away, I am guessing users have gotten accustomed to using libgpiod ... I don't think spending effort on this is worth our while. So closing....