Unlike other AVM devices, the Fritz!Box 3370 has got a 'Power' button instead of 'WPS', 'DECT' or similar. However, for a complete implementation of gluon it must be possible to reboot the device into setup mode via pressing a button. Notes: 1. The power button is used both for rebooting to setup mode (long press > 3s) and switching off the device (short press). This works because wait_setup_mode() is already started by 'power pressed', whereas poweroff would be called later upon 'power released'. 2. Adding yet another button for setup mode isn't very pretty, esp. for the sake of one device. However, - there are only few devices (21/784) with a power button - 302/784 devices have more than one button (reset + wps|phone) assigned to setup-mode, so the confusion is already there anyway.
31 lines
500 B
Bash
Executable File
31 lines
500 B
Bash
Executable File
#!/bin/sh
|
|
|
|
|
|
wait=3
|
|
|
|
|
|
wait_setup_mode() {
|
|
sleep $wait
|
|
uci set 'gluon-setup-mode.@setup_mode[0].enabled=1'
|
|
uci commit gluon-setup-mode
|
|
reboot
|
|
}
|
|
|
|
|
|
if [ "$BUTTON" = wps ] || [ "$BUTTON" = reset ] ||
|
|
[ "$BUTTON" = phone ] || [ "$BUTTON" = power ]; then
|
|
case "$ACTION" in
|
|
pressed)
|
|
wait_setup_mode &
|
|
PID=$!
|
|
echo $PID > /tmp/.wait_setup_mode
|
|
;;
|
|
released)
|
|
if [ -r /tmp/.wait_setup_mode ]; then
|
|
kill "$(cat /tmp/.wait_setup_mode)"
|
|
rm /tmp/.wait_setup_mode
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|