Accessing Mango V2 third switch position

I trimmed the button slot on the case to allow the switch to move to the third position (‘3 right’ in table).

In this position BTN_0 is low and BTN_1 is high.

BTN_0(gpio-0) BTN_1(gpio-3)

1 left hi lo
2 mid lo lo
3 right lo hi

Could now modify /etc/init.d/initswitch to get a 3rd behavior.

Just curious, where on system does it configure which gpio are used for the switch?

I noticed that those gpio are somehow reserved and you can use them like others. e.g. can’t do

cat /sys/class/gpio/gpio0/value

 

This command shows state of switch gpio0 and gpio3

root@GL-MT300N-V2:/sys/kernel/debug# cat gpio
GPIOs 0-31, platform/10000600.gpio, 10000600.gpio:
gpio-0 ( |BTN_0 ) in hi
gpio-1 ( |sysfs ) in lo
gpio-2 ( |sysfs ) in lo
gpio-3 ( |BTN_1 ) in lo
gpio-4 ( |sysfs ) in hi
gpio-5 ( |sysfs ) in hi
gpio-6 ( |sysfs ) in hi
gpio-7 ( |sysfs ) in lo
gpio-8 ( |sysfs ) in lo
gpio-9 ( |sysfs ) in lo
gpio-10 ( |sysfs ) in hi
gpio-11 ( |usbpow ) out hi

GPIOs 32-63, platform/10000600.gpio, 10000600.gpio:
gpio-38 ( |reset ) in hi
gpio-42 ( |? ) out lo
gpio-43 ( |? ) out hi
gpio-44 ( |? ) out lo
gpio-45 ( |sysfs ) out lo
gpio-46 ( |sysfs ) out lo