#!/sbin/runscript # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # This init script turns on/off the F3507g card. Have to be started # before gpsd and ppp services. depend() { after serial hotplug before gpsd net.ppp0 } checkradiosw() { if [ `cat /sys/devices/platform/thinkpad_acpi/hotkey_radio_sw` == "0" ] then ewarn "ThinkPad wireless is disabled" return 1 fi } start() { checkradiosw || return 1 ebegin "Powering F3507g up" echo 1 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill2/state while [ ! -c $CONTROL_DEV ]; do sleep 1; done ebegin "Turning F3507g on" if [ -n "$PIN" ] then /usr/sbin/chat -v "" "AT+CPIN?" "SIM PIN" "AT" "OK" "AT+CPIN=\"$PIN\"" "OK" > $CONTROL_DEV < $CONTROL_DEV fi sleep 3 /usr/sbin/chat -v "" "AT+CPIN?" "READY" "AT+CFUN=1" "+PACSP0" "AT" "OK" > $CONTROL_DEV < $CONTROL_DEV eend $? "Failed to turn F3507g on" } stop() { ebegin "Turning F3507g off" /usr/sbin/chat -v "" "AT+CFUN=4" "OK" > $CONTROL_DEV < $CONTROL_DEV eend $? "Failed to turn F3507g off" ebegin "Powering F3507g down" echo 0 > /sys/devices/platform/thinkpad_acpi/rfkill/rfkill2/state while [ -c $CONTROL_DEV ]; do sleep 1; done }