Using the power button for setup mode would work for the AVM 3370, but may side effects on other devices. On devices with a dedicated controller for power management, 'power pressed' and 'power released' events might be consumed by the controller, or emitted at unexpected times. This might lead to shutdowns failing, the device randomly put into setup mode, or similar things. Support for an outdated, non-mainstream device such as the AVM 3370 shouldn't invite such extra problems. Moreover, the feature in question can also be added after the installation, simply by editing `/etc/hotplug.d/button/50-gluon-setup-mode` and changing one line: ` -if [ "$BUTTON" = wps ] || [ "$BUTTON" = reset ] || [ "$BUTTON" = phone ]; then +if [ "$BUTTON" = wps ] || [ "$BUTTON" = reset ] || [ "$BUTTON" = phone ] || [ "$BUTTON" = power ]; then `
30 lines
474 B
Bash
Executable File
30 lines
474 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 ]; 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
|