summaryrefslogtreecommitdiffstats
path: root/meta-extras/packages/openmoko/libgsmd/gsmd
diff options
context:
space:
mode:
Diffstat (limited to 'meta-extras/packages/openmoko/libgsmd/gsmd')
-rw-r--r--meta-extras/packages/openmoko/libgsmd/gsmd106
1 files changed, 106 insertions, 0 deletions
diff --git a/meta-extras/packages/openmoko/libgsmd/gsmd b/meta-extras/packages/openmoko/libgsmd/gsmd
new file mode 100644
index 0000000000..5c78e8178a
--- /dev/null
+++ b/meta-extras/packages/openmoko/libgsmd/gsmd
@@ -0,0 +1,106 @@
1#!/bin/sh
2#
3# gsmd This shell script starts and stops gsmd.
4#
5# chkconfig: 345 90 40
6# description: Gsmd manages access to a serial- or USB-connected GSM
7# processname: gsmd
8
9# Source configuration
10. /etc/default/gsmd
11
12# Source function library.
13#. /etc/rc.d/init.d/functions
14
15RETVAL=0
16prog="gsmd"
17
18start() {
19 # Hack for broken uboot and/or kernel on the neo1973
20 dmesg -n1
21
22 if [ -n "${GSM_POW}" ]
23 then
24 if [ -e "${GSM_POW}" ]
25 then
26 echo -n "Powering up GSM device..."
27 echo "1" > ${GSM_POW}
28 sleep 1
29 echo "done"
30 else
31 echo "GSM device not found. Aborting startup"
32 return false
33 fi
34 fi
35 # Start daemons.
36 echo -n "Starting $prog: "
37 # We don't use the daemon function here because of a known bug
38 # in initlog -- it spuriously returns a nonzero status when
39 # starting daemons that fork themselves. See
40 # http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130629
41 # for discussion. Fortunately:
42 #
43 # 1. gsmd startup can't fail, or at least not in the absence of
44 # much larger resource-exhaustion problems that would be very obvious.
45 #
46 # 2. We don't need all the logging crud that daemon/initlog sets
47 # up -- gsmd does its own syslog calls.
48 #
49 if [ -e "${GSM_DEV}" ]
50 then
51 gsmd -p ${GSM_DEV} ${GSMD_OPTS} >/tmp/gsm.log 2>&1 &
52 echo "success"
53 else
54 # User needs to symlink ${GPS_DEV} to the right thing
55 echo "No ${GSM_DEV} device, aborting gsmd startup."
56 fi
57 RETVAL=$?
58 echo
59 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/gsmd
60 return $RETVAL
61}
62
63stop() {
64 # Stop daemons.
65 echo -n "Shutting down $prog: "
66 killall gsmd
67# killproc gsmd
68 RETVAL=$?
69 echo
70 if [ $RETVAL -eq 0 ]
71 then
72 rm -f /var/lock/subsys/gsmd;
73 fi
74 return $RETVAL
75}
76
77# See how we were called.
78case "$1" in
79 start)
80 start
81 ;;
82 stop)
83 stop
84 ;;
85 restart|reload)
86 stop
87 start
88 RETVAL=$?
89 ;;
90 condrestart)
91 if [ -f /var/lock/subsys/gsmd ]; then
92 stop
93 start
94 RETVAL=$?
95 fi
96 ;;
97 status)
98# status gsmd
99# RETVAL=$?
100 ;;
101 *)
102 echo "Usage: $0 {start|stop|restart|condrestart|status}"
103 exit 1
104esac
105
106exit $RETVAL