Unable to get procd buttons working

Hi Team,

I was working on openwrt build using linkit-smart-7688 board. I have configured my dts for keys as below
'


                rti_switch_a {
                        label = "switch_a";
                        gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
                        linux,code = <BTN_0>;
                        debounce-interval = <100>;
                };

                rti_switch_b {
                        label = "switch_b";
                        gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
                        linux,code = <BTN_1>;
                        debounce-interval = <100>;
                };

'

I am able to get the interupts in /proc/interrupts
'

          CPU0       
  5:          0      MIPS   5  10100000.ethernet
  6:       2088      MIPS   6  mt7603e
  7:       7188      MIPS   7  timer
 14:          2      INTC   6  10000600.gpio-bank0, 10000600.gpio-bank1, 10000600.gpio-bank2
 22:          0      INTC  14  10130000.sdhci
 25:          3      INTC  17  esw
 26:          1      INTC  18  ehci_hcd:usb1, ohci_hcd:usb2
 30:        451      INTC  22  ttyS2
 40:          0  10000600.gpio   6  keys
 41:          0  10000600.gpio   2  keys
 42:          2  10000600.gpio   3  keys
ERR:          0
'

I have gpio debug as

'

root@OpenWrt:~# cat /sys/kernel/debug/gpio
gpiochip2: GPIOs 416-447, parent: platform/10000600.gpio, 10000600.gpio-bank2:

gpiochip1: GPIOs 448-479, parent: platform/10000600.gpio, 10000600.gpio-bank1:
 gpio-454 (                    |reset               ) in  hi IRQ ACTIVE LOW
 gpio-460 (                    |orange:wifi         ) out lo ACTIVE LOW

gpiochip0: GPIOs 480-511, parent: platform/10000600.gpio, 10000600.gpio-bank0:
 gpio-480 (                    |red:rti_led_a       ) out lo ACTIVE LOW
 gpio-481 (                    |green:rti_led_b     ) out hi ACTIVE LOW
 gpio-482 (                    |switch_a            ) in  lo IRQ ACTIVE LOW
 gpio-483 (                    |switch_b            ) in  lo IRQ ACTIVE LOW
'

I was trying get some scripts running on /etc/rc.button. For that I created scripts with names
rti_switch_a, switch_a, rti_switch_b , switch_b in folder /etc/rc.button/. all having same content

'

#!/bin/sh

#[ "${ACTION}" = "released" ] || exit 0

logger "the button was ${BUTTON} and the action was ${ACTION}"

return 0
'

But nothing worked. None of the script executed.

Could you please help me to solve this?

I would test the name/working order by following the wiki: https://openwrt.org/docs/guide-user/hardware/hardware.button#preliminary_steps

2 Likes

Thank you. it helped , the name was BTN_1

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.