The Buffalo WHR-G54S has a slide switch, marked "AUTO/BRI". I'd like to read this to determine which of two possible configs to run.

Now, I've worked out that if you install a script /etc/hotplug.d/button/bridge, it is invoked whenever the switch changes position, with ACTION=pressed or ACTION=released.

Unfortunately, the polarity of the switch varies depending on how it was set initially. That is:

* If the switch was set to AUTO when the box initially booted, moving it to BRI gives a "pressed" action and moving to AUTO gives "released"
* If the switch was set to BRI when the box intially booted, moving it to AUTO gives a "pressed" action and moving to BRI gives "released"

This makes the switch pretty useless :-( In any case, I'd also like to be able to read the "current" position of the switch at startup, without it being moved at all.

So is there any way to read the absolute position of the switch? According to http://wiki.openwrt.org/OpenWrtDocs/Har … o/WHR-G54S it's GPIO bit 5, but I can't see how to read that. There's /proc/diag/gpiomask but that always reads 0x0000

I am running Kamikaze 7.07, brcm-2.4

Many thanks... Brian.