openmoko-gsmd: Add the Openmoko GSMD recipe

This is based on the gsmd recipe from OE classic. There will be
some more tweaking for respawn and the cell log utility.
diff --git a/recipes-openmoko/openmoko-gsmd/files/default b/recipes-openmoko/openmoko-gsmd/files/default
new file mode 100644
index 0000000..cf36460
--- /dev/null
+++ b/recipes-openmoko/openmoko-gsmd/files/default
@@ -0,0 +1,54 @@
+# gsmd	This shell script configures for the gsmd init script.
+
+. /etc/init.d/functions
+
+case `machine_id` in
+	"gta01"|"gta02")
+		GSMD_OPTS="-s 115200 -F"
+		if [ -d '/sys/bus/platform/devices/gta01-pm-gsm.0' ] ; then
+		GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
+		GSM_RES="/sys/bus/platform/devices/gta01-pm-gsm.0/reset"
+		else
+		GSM_POW="/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on"
+		GSM_RES="/sys/bus/platform/devices/neo1973-pm-gsm.0/reset"
+		fi
+		GSM_DEV="/dev/ttySAC0"
+		GSM_DL="/sys/devices/platform/neo1973-pm-gsm.0/download"
+		;;
+	"htc_apache"|"htc_blueangel"|"htc_universal")
+		GSMD_OPTS="-s 115200 -F"
+		GSM_DEV="/dev/ttyS0"
+		;;
+	"htc_himalaya")
+		GSMD_OPTS="-s 115200 -F"
+		GSM_DEV="/dev/ttyS2"
+		;;
+	"htc_magician")
+		GSMD_OPTS="-s 115200 -F"
+		GSM_DEV="/dev/ttyS1"
+		;;
+	"palm_treo_650")
+		GSMD_OPTS="-s 460800 -F -w 1"
+		GSM_DEV="/dev/ttyS0"
+		;;
+        "motorola_ezx_platform")
+                GSMD_OPTS="-s 115200 -F -v ti"
+                GSM_DEV="/dev/mux0"
+                ;;
+	*)
+		# Unknown board
+
+		# If you must specify special options, uncomment and modify the next line
+		#GSMD_OPTS="-s 115200 -F"
+
+		# If your GSM device needs to be powered up, uncomment and modify the next line
+		#GSM_POW="/sys/bus/platform/devices/gta01-pm-gsm.0/power_on"
+
+		# If your GSM device then needs to be reset, uncomment and modify the next line
+		#GSM_RES="/sys/bus/platform/devices/gta01-pm-gsm.0/reset"
+
+		# This should be in a common /etc/default/serial, together with
+		# BT_DEV and IR_DEV for devices that have those on a serial port
+		#GSM_DEV="/dev/ttyS1"
+		;;
+esac
diff --git a/recipes-openmoko/openmoko-gsmd/files/gsmd b/recipes-openmoko/openmoko-gsmd/files/gsmd
new file mode 100644
index 0000000..dc10e63
--- /dev/null
+++ b/recipes-openmoko/openmoko-gsmd/files/gsmd
@@ -0,0 +1,47 @@
+#! /bin/sh
+#
+# gsmd  This shell script starts and stops gsmd.
+#
+# chkconfig: 345 90 40
+# description: Gsmd manages access to a serial- or USB-connected GSM
+# processname: gsmd
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+[ -f /etc/default/rcS ] && . /etc/default/rcS
+[ -f /etc/default/gsmd ] && . /etc/default/gsmd
+
+case "$1" in
+    start)
+        [ -n "$GSM_POW" ] && ( echo "0" >$GSM_POW; sleep 1 )
+        [ -n "$GSM_POW" ] && ( echo "1" >$GSM_POW; sleep 1 )
+        [ -n "$GSM_RES" ] && ( echo "1" >$GSM_RES; sleep 1 )
+        [ -n "$GSM_RES" ] && ( echo "0" >$GSM_RES; sleep 2 )
+
+        echo -n "Starting GSM daemon: "
+        start-stop-daemon -S -x /usr/sbin/gsmd -- gsmd -p $GSM_DEV $GSMD_OPTS -d -l syslog
+
+        if [ $? = 0 ]; then
+            echo "gsmd."
+        else
+            echo "(failed.)"
+        fi
+        ;;
+    stop)
+        [ -n "$GSM_POW" ] && echo "0" >$GSM_POW
+
+        echo -n "Stopping GSM daemon: "
+        start-stop-daemon -K -x /usr/sbin/gsmd
+        echo "gsmd."
+        ;;
+    restart|force-reload)
+        $0 stop
+        $0 start
+        ;;
+    *)
+        echo "Usage: /etc/init.d/gsmd {start|stop|restart|force-reload}"
+        exit 1
+        ;;
+esac
+
+exit 0
diff --git a/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb b/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb
new file mode 100644
index 0000000..dce93fe
--- /dev/null
+++ b/recipes-openmoko/openmoko-gsmd/openmoko-gsmd_git.bb
@@ -0,0 +1,83 @@
+DESCRIPTION = "GSM libraries and daemons implementing the ETSI 07.10 specification"
+HOMEPAGE = "http://www.openmoko.org"
+SECTION = "telephony"
+
+LICENSE = "GPLv2+ & LGPLv2.1+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe \
+                    file://COPYING.library;md5=2d5025d4aa3495befef8f17206a5b0a1 "
+
+# Fork with wavecom support
+SRC_URI = "git://git.gnumonks.org/openmoko-gsmd.git;branch=master \
+           file://gsmd \
+           file://default"
+SRCREV = "28e25ae42da7d65face9ad2472075f7c4fc87e92"
+S = "${WORKDIR}/git"
+
+PR = "r7"
+
+inherit autotools pkgconfig update-rc.d
+
+
+# handle update-rc.d RDEPENDS_${PN} manually, we don't need it on
+# anything but gsmd
+
+INITSCRIPT_NAME = "gsmd"
+INITSCRIPT_PARAMS = "defaults 35"
+
+do_install_append() {
+	install -d ${D}/${sysconfdir}/init.d
+	install -m 0755 ${WORKDIR}/gsmd ${D}/${sysconfdir}/init.d/
+	install -d ${D}/${sysconfdir}/default
+	install ${WORKDIR}/default ${D}/${sysconfdir}/default/gsmd
+}
+
+PACKAGES =+ "\
+  ${PN}-tools \
+  ${PN}-plugins \
+  ${PN}-plugin-machine-generic \
+  ${PN}-plugin-machine-tihtc \
+  ${PN}-plugin-machine-gta01 \
+  ${PN}-plugin-machine-telit \
+  ${PN}-plugin-vendor-bcm \
+  ${PN}-plugin-vendor-qc \
+  ${PN}-plugin-vendor-telit \
+  ${PN}-plugin-vendor-ti \
+  ${PN}-plugin-vendor-tihtc \
+  ${PN}-plugin-vendor-wavecom \
+"
+
+RDEPENDS_${PN}-plugins = "\
+  ${PN}-plugin-machine-generic \
+  ${PN}-plugin-machine-tihtc \
+  ${PN}-plugin-machine-gta01 \
+  ${PN}-plugin-machine-telit \
+  ${PN}-plugin-vendor-bcm \
+  ${PN}-plugin-vendor-qc \
+  ${PN}-plugin-vendor-telit \
+  ${PN}-plugin-vendor-ti \
+  ${PN}-plugin-vendor-tihtc \
+  ${PN}-plugin-vendor-wavecom \
+"
+
+RDEPENDS_${PN} += "update-rc.d"
+
+FILES_${PN}-dbg += "${libdir}/gsmd/.debug/*"
+FILES_${PN}-tools = "${bindir}/*"
+FILES_${PN}-plugins = ""
+FILES_${PN}-dev += " ${libdir}/gsmd/*.la "
+FILES_${PN}-staticdev += " ${libdir}/gsmd/*.a"
+FILES_${PN}-plugin-machine-generic = "${libdir}/gsmd/libgsmd-machine_generic.so*"
+FILES_${PN}-plugin-machine-tihtc = "${libdir}/gsmd/libgsmd-machine_tihtc.so*"
+FILES_${PN}-plugin-machine-gta01 = "${libdir}/gsmd/libgsmd-machine_gta01.so*"
+FILES_${PN}-plugin-machine-telit = "${libdir}/gsmd/libgsmd-machine_telit.so*"
+FILES_${PN}-plugin-vendor-qc = "${libdir}/gsmd/libgsmd-vendor_qc.so*"
+FILES_${PN}-plugin-vendor-bcm = "${libdir}/gsmd/libgsmd-vendor_bcm.so*"
+FILES_${PN}-plugin-vendor-telit = "${libdir}/gsmd/libgsmd-vendor_telit.so*"
+FILES_${PN}-plugin-vendor-ti = "${libdir}/gsmd/libgsmd-vendor_ti.so*"
+FILES_${PN}-plugin-vendor-tihtc = "${libdir}/gsmd/libgsmd-vendor_tihtc.so*"
+FILES_${PN}-plugin-vendor-wavecom = "${libdir}/gsmd/libgsmd-vendor_wavecom.so*"
+
+PACKAGES_DYNAMIC = "lib${PN}* ${PN}"
+
+ALLOW_EMPTY_${PN}-plugins = "1"
+