#!/bin/sh #------------------------------------------------------------------------------ # __FLI4LVER__ # /usr/bin/embedded_keyprog # Creation: 17.06.2006 bastard # Last Update: $Id$ #------------------------------------------------------------------------------ log() { logger -t hwsupp_keyprog "$1" } case "$#" in 0) myname=`basename $0` echo "Usage: $myname wlan_toggle|reset|online_toggle [debug]" ;; *) case $1 in wlan_toggle) . /var/run/hwsupp.conf if [ -n "$hwsupp_wlan_dev" ] then if ip link show $hwsupp_wlan_dev 2>/dev/null | grep -q "[<,]UP[,>]" then log "shutting down wlan device $hwsupp_wlan_dev" ip link set $hwsupp_wlan_dev down echo "$hwsupp_wlan_led off" > /var/run/embedded.fifo else log "activation wlan device $hwsupp_wlan_dev" ip link set $hwsupp_wlan_dev up echo "$hwsupp_wlan_led on" > /var/run/embedded.fifo fi fi ;; reset) reboot ;; online_toggle) if [ -f /etc/default-route-interface ] # default route existing? then default_route_interface=`/bin/cat /etc/default-route-interface` else default_route_interface=`ip route show | grep '^default' | sed 's/^default.*dev //g'` case $default_route_interface in ppp0) default_route_interface=pppoe ;; esac fi if [ -f /var/run/online ] then # go offline log "going offline due to user button" fli4lctrl hangup $default_route_interface else # go online log "going online due to user button" fli4lctrl dial $default_route_interface fi ;; none) ;; esac ;; esac