summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app-laptop/f3507g-initd/files/f3507g.initd')
-rw-r--r--app-laptop/f3507g-initd/files/f3507g.initd46
1 files changed, 46 insertions, 0 deletions
diff --git a/app-laptop/f3507g-initd/files/f3507g.initd b/app-laptop/f3507g-initd/files/f3507g.initd
new file mode 100644
index 0000000..497a76d
--- /dev/null
+++ b/app-laptop/f3507g-initd/files/f3507g.initd
@@ -0,0 +1,46 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# This init script turns on/off the F3507g card. Has to be started
+# before gpsd and ppp services.
+
+depend() {
+ after serial hotplug
+ before gpsd net.ppp0
+}
+
+checkradiosw() {
+ if [ `cat ${HOTKEY_STATE}` == "0" ]
+ then
+ ewarn "Wireless switch is disabled"
+ return 1
+ fi
+}
+
+start() {
+ checkradiosw || return 1
+
+ ebegin "Powering up F3507g"
+ echo 1 > ${RFKILL_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 > ${RFKILL_STATE}
+ while [ -c ${CONTROL_DEV} ]; do sleep 1; done
+}