From ca78548d36b1655d94844e031c0fb6c0aa88d24d Mon Sep 17 00:00:00 2001 From: Thilo Bangert Date: Mon, 7 Jun 2010 10:29:45 +0000 Subject: startup scripts for f3507g svn path=/ebuilds/; revision=108 --- app-laptop/f3507g-initd/ChangeLog | 12 ++++++ app-laptop/f3507g-initd/Manifest | 8 ++++ .../f3507g-initd/f3507g-initd-20100529.ebuild | 34 ++++++++++++++++ app-laptop/f3507g-initd/files/f3507g-gpsd.confd | 10 +++++ app-laptop/f3507g-initd/files/f3507g-gpsd.initd | 40 +++++++++++++++++++ app-laptop/f3507g-initd/files/f3507g.confd | 13 ++++++ app-laptop/f3507g-initd/files/f3507g.initd | 46 ++++++++++++++++++++++ app-laptop/f3507g-initd/files/net.example | 36 +++++++++++++++++ app-laptop/f3507g-initd/metadata.xml | 8 ++++ 9 files changed, 207 insertions(+) create mode 100644 app-laptop/f3507g-initd/ChangeLog create mode 100644 app-laptop/f3507g-initd/Manifest create mode 100644 app-laptop/f3507g-initd/f3507g-initd-20100529.ebuild create mode 100644 app-laptop/f3507g-initd/files/f3507g-gpsd.confd create mode 100644 app-laptop/f3507g-initd/files/f3507g-gpsd.initd create mode 100644 app-laptop/f3507g-initd/files/f3507g.confd create mode 100644 app-laptop/f3507g-initd/files/f3507g.initd create mode 100644 app-laptop/f3507g-initd/files/net.example create mode 100644 app-laptop/f3507g-initd/metadata.xml diff --git a/app-laptop/f3507g-initd/ChangeLog b/app-laptop/f3507g-initd/ChangeLog new file mode 100644 index 0000000..174f2a6 --- /dev/null +++ b/app-laptop/f3507g-initd/ChangeLog @@ -0,0 +1,12 @@ +# ChangeLog for app-laptop/f3507g-initd +# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2 +# $Header: $ + +*f3507g-initd-20100529 (07 Jun 2010) + + 07 Jun 2010; Thilo Bangert +files/f3507g.confd, + +files/f3507g.initd, +files/f3507g-gpsd.confd, + +f3507g-initd-20100529.ebuild, +files/f3507g-gpsd.initd, + +files/net.example, +metadata.xml: + f3507g startup scripts + diff --git a/app-laptop/f3507g-initd/Manifest b/app-laptop/f3507g-initd/Manifest new file mode 100644 index 0000000..836ff6a --- /dev/null +++ b/app-laptop/f3507g-initd/Manifest @@ -0,0 +1,8 @@ +AUX f3507g-gpsd.confd 217 RMD160 2fb7cfffe0823d059a6563ea05dfe34c88df73a6 SHA1 3104b6a7547042fcc0c810688e8387bb6e4b7ccc SHA256 60b572eadd3dfafdf8cf5375fb66df1e09d048fc6d638c8e2ab993535f9fb029 +AUX f3507g-gpsd.initd 1101 RMD160 1616df2c395c8e5d9d75eb9ce39982c4a0248cdb SHA1 1fd6fdc7bcc340d59a25f7f2bdf508a53a0d8d73 SHA256 42e441ba2d891232b499d62241315352073787c918c78b33ba3f7cc11f874143 +AUX f3507g.confd 276 RMD160 c35e241c328690cd6ec5425a46df78ce7ea57973 SHA1 c1a9977b41c971866bdef98bdfd44477daf11e29 SHA256 de7c81e9969e7dfc0bc0e39ded8954346feb4988ea236340e4599a3cfab5207f +AUX f3507g.initd 1127 RMD160 2be5015ca0bf214cb5580777b4aa36d23ac67ac5 SHA1 dbd7d431b5efafbea3c96c70deeaa912161bd55d SHA256 117412548ef578577f935612ad96645bee71feda2cbdc52b26896822f09538ac +AUX net.example 567 RMD160 5e745182cb48ecf3d29f51e1b98e6b8f1a4c546a SHA1 6f5c93b1075182831a69ae5bc6005c667809d33d SHA256 86ff64ddf9127e10d081853edd21ce871eade2e07800a86712248b4771b93f34 +EBUILD f3507g-initd-20100529.ebuild 840 RMD160 e5d3b3e318e8199ddbb342f246177c608bbd0f63 SHA1 6320f264f87261a9a8a96239840a1fe1bb2d59a6 SHA256 ac94d646410213c4e0c6e6c8dfd77ee04aa0a4bac979ebbfdfb3447fe4aff56e +MISC ChangeLog 404 RMD160 1a8913e75df600e9d2d6ee0db10a2a3fa224c6c2 SHA1 231e63e3dda11c23889a8b350502d9949c995e98 SHA256 956418c5c5060ee18778fdeea7e7179cb61013332733378118a23dfe6f41fbac +MISC metadata.xml 207 RMD160 f041515b697e2133f70e22c8bd75a0ce84e5d05c SHA1 50ddb26fee7256d16a336cb0a25122acb89fe4cc SHA256 3c59c22ba3c4af603bab3b9bc0b6119a6ecf570ab3cba0de8a434e8c436d0aaf diff --git a/app-laptop/f3507g-initd/f3507g-initd-20100529.ebuild b/app-laptop/f3507g-initd/f3507g-initd-20100529.ebuild new file mode 100644 index 0000000..d1a8f72 --- /dev/null +++ b/app-laptop/f3507g-initd/f3507g-initd-20100529.ebuild @@ -0,0 +1,34 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=3 + +DESCRIPTION="control scripts for f3507g" +HOMEPAGE="http://www.gentoo.org/" +SRC_URI="" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" +IUSE="gps" + +DEPEND="" +RDEPEND="${DEPEND} + net-dialup/ppp + gps? ( >=sci-geosciences/gpsd-2.39 )" + +src_install() { + newconfd "${FILESDIR}/f3507g.confd" f3507g + newinitd "${FILESDIR}/f3507g.initd" f3507g + use gps && newinitd "${FILESDIR}/f3507g-gpsd.initd" f3507g-gpsd + use gps && newconfd "${FILESDIR}/f3507g-gpsd.confd" f3507g-gpsd + dodoc "${FILESDIR}"/net.example +} + +pkg_postinst() { + elog "Use the /etc/conf.d/f3507g-gpsd script to start a gpsd" + elog "instance which uses the f3507g gps device." + elog "An ppp example config has been installed at" + elog "/usr/share/doc/${PV}" +} diff --git a/app-laptop/f3507g-initd/files/f3507g-gpsd.confd b/app-laptop/f3507g-initd/files/f3507g-gpsd.confd new file mode 100644 index 0000000..49555ff --- /dev/null +++ b/app-laptop/f3507g-initd/files/f3507g-gpsd.confd @@ -0,0 +1,10 @@ +# Config file for f3507g gpsd service + +#The control device +CONTROL_DEV="/dev/ttyACM1" + +#The gps device +GPS_DEV="/dev/ttyACM2" + +#The gpsd options +GPSD_OPTS="-b -n -P /var/run/gpsd.pid -F /var/run/gpsd.sock ${GPS_DEV}" diff --git a/app-laptop/f3507g-initd/files/f3507g-gpsd.initd b/app-laptop/f3507g-initd/files/f3507g-gpsd.initd new file mode 100644 index 0000000..9b7c0bd --- /dev/null +++ b/app-laptop/f3507g-initd/files/f3507g-gpsd.initd @@ -0,0 +1,40 @@ +#!/sbin/runscript +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +depend() { + after serial hotplug dbus bluetooth + need f3507g + before ntpd +} + +checkconfig() { + if [ -z "${GPS_DEV}" ] || [ -z "${CONTROL_DEV}" ] + then + eerror "You must define GPS_DEV and CONTROL_DEV in /etc/conf.d/f3507g-gpsd." + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Turning on F3507g gps device" + /usr/sbin/chat -v "" "AT*E2GPSCTL=1,3,1" "OK" > ${CONTROL_DEV} < ${CONTROL_DEV} + /usr/sbin/chat -v "" "AT*E2GPSNPD" "GPGGA" > ${GPS_DEV} < ${GPS_DEV} + eend $? "Failed to turn gps on" + ebegin "Starting gpsd" + start-stop-daemon --start --quiet --exec /usr/sbin/gpsd \ + -- ${GPSD_OPTS} + eend $? "Failed to start gpsd" +} + +stop() { + ebegin "Stopping gpsd" + start-stop-daemon --stop --quiet --pidfile /var/run/gpsd.pid + eend $? "Failed to stop gpsd" + rm -f /var/run/gpsd.pid + ebegin "Turning off F3507g gps device" + /usr/sbin/chat -v "" "AT*E2GPSCTL=0,1,0" "OK" > ${CONTROL_DEV} < ${CONTROL_DEV} + eend $? "Failed to turn gps off" +} diff --git a/app-laptop/f3507g-initd/files/f3507g.confd b/app-laptop/f3507g-initd/files/f3507g.confd new file mode 100644 index 0000000..92d781c --- /dev/null +++ b/app-laptop/f3507g-initd/files/f3507g.confd @@ -0,0 +1,13 @@ +# Config file for f3507g service + +#The control device +CONTROL_DEV="/dev/ttyACM1" + +#The rfkill state file +RFKILL_STATE="/sys/devices/platform/thinkpad_acpi/rfkill/rfkill1/state" + +#The +HOTKEY_STATE="/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw" + +#The SIM PIN +PIN="6014" 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 +} diff --git a/app-laptop/f3507g-initd/files/net.example b/app-laptop/f3507g-initd/files/net.example new file mode 100644 index 0000000..b59640e --- /dev/null +++ b/app-laptop/f3507g-initd/files/net.example @@ -0,0 +1,36 @@ + +# +# Example network configuration for f3507g utms module +# +# You will most likely have to adjust username, password +# and the APN (called "internet" below) + +config_ppp0="ppp" +RC_NEED_ppp0="f3507g" +link_ppp0="/dev/ttyACM0" +username_ppp0="nwgsm" +password_ppp0="guest" +pppd_ppp0=( + "debug" + "noauth" + "defaultroute" + "usepeerdns" + "noipdefault" + "lock" + "115200" + "modem crtscts" + "persist" + "maxfail 0" +) + +phone_number_ppp0="*99#" +chat_ppp0=( + 'TIMEOUT' '10' + '' 'AT+CGDCONT=1,"IP","internet"' + 'OK' 'ATDT\T' + 'TIMEOUT' '60' + 'CONNECT' '' + 'TIMEOUT' '5' + '~--' '' +) + diff --git a/app-laptop/f3507g-initd/metadata.xml b/app-laptop/f3507g-initd/metadata.xml new file mode 100644 index 0000000..116ce28 --- /dev/null +++ b/app-laptop/f3507g-initd/metadata.xml @@ -0,0 +1,8 @@ + + + +mobile + + + + -- cgit v1.2.3-65-gdbad