I'm trying to add function to a button on my RE650 on OpenWrt 21.02.
Reading the wiki and this post gave me some idea, but I didn't succeed so far.
/sys/kernel/debug/gpio
gpiochip2: GPIOs 416-447, parent: platform/1e000600.gpio, 1e000600.gpio-bank2:
gpiochip1: GPIOs 448-479, parent: platform/1e000600.gpio, 1e000600.gpio-bank1:
gpiochip0: GPIOs 480-511, parent: platform/1e000600.gpio, 1e000600.gpio-bank0:
gpio-498 ( |wps ) in hi IRQ
gpio-499 ( |reset ) out hi ACTIVE LOW
gpio-502 ( |blue:power ) out lo ACTIVE LOW
gpio-503 ( |blue:wifi2g ) out lo ACTIVE LOW
gpio-504 ( |blue:wifi5g ) out hi ACTIVE LOW
gpio-505 ( |power ) in hi IRQ
gpio-506 ( |red:wps ) out lo
gpio-507 ( |blue:wps ) out lo
gpio-508 ( |green:eth_act ) out hi ACTIVE LOW
gpio-509 ( |green:eth_link ) out lo ACTIVE LOW
gpio-510 ( |led ) in hi IRQ
gpio-511 ( |reset ) in hi IRQ
So the button "led" seems to be known to the system. That's why I thought adding the following file and doing "chmod 755" could be enough, but no /root/buttonpress.test appears when pressing the button.
Thank you for the suggestion, but unfortunately the same result. Do I have to restart / reload anything for the new button script in /etc/rc.button/ to be picked up?
Also I keep reading about DTS (like in the above mentioned post) and don't know if I need to do further customization around that topic to make the button work...
Nice, thank you pavelgl. The hotplug-script worked and told me that the button was called "lights_toggle" instead of "led".
Creating /etc/rc.button/lights_toggle and giving it execute permission worked as expected. I will post back with the complete script as soon as I've finished and tested it!