richardk Posted July 17, 2019 Posted July 17, 2019 (edited) So using the old sysfs (/sys/class/gpio/) interface, you "export" a gpio by spitting the gpio number into /sys/class/gpio/export. The GPIO number depends on the board and relevant documentation. Having once found that I need GPIO number 76, I'm migrating code to the new "gpio character device" interface (/dev/gpiochipn) on my Rock64. However, "gpioinfo" shows that hardly any gpios have useful labels, and Google searches always turn up Raspberry Pi results. So, can I just calculate the new gpio identify? Old gpio is 76, all /dev/gpiochips have 32 lines, 76/32 = 2 rem 12, so old gpio 76 is now /dev/gpiochip2 line 12? Edit: I tried this, and it was correct. Is this anywhere documented to be correct in all/most/many/some cases? Edited July 17, 2019 by richardk Tried it.
martinayotte Posted July 17, 2019 Posted July 17, 2019 2 hours ago, richardk said: Is this anywhere documented to be correct in all/most/many/some cases? You were indeed correct ... doing "cat /sys/kernel/debug/gpio" will help you figuring out ...
Recommended Posts