Trying to add support for the sliding switch on the Netgear EX6100v2. The switch controls gpio58. This is a two position switch. The up position is marked "extender" on the case silk screen and sets the device in extender mode under the stock firmware. Here is the info with the switch in the up position with gpio58 pulled high.
# cat /sys/kernel/debug/gpio | grep 'gpio58 : in high'
gpio58 : in high func0 2mA pull up
The down position is marked "access point" on the case silk screen and sets the device in access point mode under the stock firmware. Here is the info with the switch in the down position with gpio58 pulled low.
# cat /sys/kernel/debug/gpio | grep 'gpio58 : in low'
gpio58 : in low func0 2mA pull up
This script predicts switch position with 100% accuracy:
#!/bin/sh
while :
do
cat /sys/kernel/debug/gpio | grep -q 'gpio58 : in high' #check if switch is up
if [ "$?" -eq 0 ]; then
echo Switch is up! && exit 0
else
echo Switch is down! && exit 0
fi
done
I have built a custom image where I modified https://github.com/openwrt/openwrt/blob/main/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-ex61x0v2.dtsi to add these lines under keys:
switch {
label = "switch";
gpios = <&tlmm 58 GPIO_ACTIVE_LOW>;
linux,input-type = <EV_SW>;
linux,code = <BTN_0>;
};
The image builds however when # find /sys/firmware/devicetree/base/keys -mindepth 1 -type d | while read -r f; do printf '%s: %s\n' $(basename $f) $(hexdump -s2 -e '2/1 "%02x""\n"' $f/linux,code); done
is run, there is no 0100 hex for BTN_0. The only buttons are reset and wps:
wps: 0211
reset: 0198