diff --git a/nmeamux/root/etc/cron.daily/dyndns-update b/nmeamux/root/etc/cron.daily/dyndns-update new file mode 100755 index 0000000..bf7de96 --- /dev/null +++ b/nmeamux/root/etc/cron.daily/dyndns-update @@ -0,0 +1,9 @@ +#!/bin/ash +DDNS_USER=themadsens +DDNS_PW=nad3080 +DDNS_DOMAIN=sysummertime.dyndns.org +wget -q -O /var/run/new.ip http://checkip.dyndns.com/index.html +if [ "`cat /var/run/new.ip`" = "`cat /var/run/cur.ip`" ] ;then + wget -q -O /dev/null "http://$DDNS_USER:$DDNS_PW@members.dyndns.org/nic/update?hostname=$DDNS_DOMAIN" +fi +mv -f /var/run/new.ip /var/run/cur.ip diff --git a/nmeamux/root/etc/hotplug.d/usbtty/usbtty.hotplug b/nmeamux/root/etc/hotplug.d/usbtty/usbtty.hotplug new file mode 100755 index 0000000..dbf7121 --- /dev/null +++ b/nmeamux/root/etc/hotplug.d/usbtty/usbtty.hotplug @@ -0,0 +1,37 @@ +#!/bin/ash + +exec 1>/dev/console 2>&1 + +P=/sys$DEVPATH +[ -r $P/uevent ] && . $P/uevent + +# Exit unless proper type +[ $SUBSYSTEM = "usb-serial" -a -n "$DRIVER" ] || exit 0 + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +ME=${0##*/} +say () +{ + echo "$ME: $@" + logger -t $ME "$@" +} + +MANU=$( ( test -r $P/../manufacturer && cat $P/../manufacturer ) || \ + ( test -r $P/../../manufacturer && cat $P/../../manufacturer ) || echo "generic" ) + +PORT=$( cat $P/port_number ) +DEV_NM="$DRIVER-$(cat $P/../../idVendor)-$(cat $P/../../idProduct)" +DEVP=/dev/ttyusb/$DEV_NM + +if [ $ACTION = "add" ] ;then + mkdir -p $DEVP + ln -sf /dev/$MDEV $DEVP/$PORT + say "Add $DEVP/$PORT -> /dev/$MDEV MANU $MANU" +elif [ $ACTION = "remove" ] ;then + rm -f /dev/ttyusb/$MANU/$DEV_NM/$PORT + say "Rem $DEVP/$PORT -> /dev/$MDEV MANU $MANU" +else + say "Unknown action $ACTION for $MDEV $MANU $DEV_NM" +fi + diff --git a/nmeamux/root/etc/init.d/S15modules b/nmeamux/root/etc/init.d/S15modules new file mode 100755 index 0000000..2816d43 --- /dev/null +++ b/nmeamux/root/etc/init.d/S15modules @@ -0,0 +1,48 @@ +#! /bin/sh +# +# Beregn afhængigheder mellem moduler, opret modules.dep og load moduler fra /etc/modules. + +. /etc/init.d/rcS-helper + +start() { + # This will work when busysbox is configured with MODPROBE_SMALL + modprobe depmod-dummy 2>/dev/null + + # Loop over every line in /etc/modules. + dmesg -n 5 + echo -n 'Loading modules: ' + (cat /etc/modules; echo) | # The echo make sure there is a LF at the end. + while read module args; do + case "$module" in + \#*|"") continue ;; + esac + echo -n "$module: " + modprobe $module $args + done + echo '' + dmesg -n 7 +} + +stop() { + : +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 +esac diff --git a/nmeamux/root/etc/init.d/S16coldplug b/nmeamux/root/etc/init.d/S16coldplug new file mode 100755 index 0000000..74a8c3e --- /dev/null +++ b/nmeamux/root/etc/init.d/S16coldplug @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Mdev coldplugging +# + +start() { + # Autodetection of hardware + + echo -n "Autodetecting hardware ." + MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;` + while [ `echo "$MODALIAS"|wc -l` -gt `echo "$TMODALIAS"|wc -l` ]; do + echo -n "." + for i in $MODALIAS; do + /sbin/modprobe $i 2>/dev/null + done + [ "$VERBOSE" ] && echo Loaded `echo "$MODALIAS"|wc -l` modaliases + [ "$DRV_WAIT" -gt 0 ] && sleep $DRV_WAIT + TMODALIAS="$MODALIAS" + MODALIAS=`find /sys/devices -iname modalias -exec cat {} \;` + done + echo " done." +} + + + +stop() { + : +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + exit 1 +esac + diff --git a/nmeamux/root/etc/mdev.conf b/nmeamux/root/etc/mdev.conf new file mode 100644 index 0000000..2fea95e --- /dev/null +++ b/nmeamux/root/etc/mdev.conf @@ -0,0 +1,2 @@ +sd[a-z] 0:0 660 - */sbin/hotplug usb +ttyUSB[0-9]* 0:0 660 - */sbin/hotplug usbtty diff --git a/nmeamux/root/usr/bin/nmeamux b/nmeamux/root/usr/bin/nmeamux new file mode 100755 index 0000000..220387a --- /dev/null +++ b/nmeamux/root/usr/bin/nmeamux @@ -0,0 +1,21 @@ +#!/usr/bin/env amplua + +require "stdlib" +require "Class" +local NIL = Class.NIL + +local NmeaNode = Class("NmeaNode", nil, { + mSinks = NIL, + mPortNo = NIL, + mListeners = NIL, +}) + +local NmeaPort = Class("NmeaPort", NmeaNode, { + mPath = NIL, + mHispeed = NIL, + mDutyIn = NIL, + mDutyOut:w + = NIL, +}) + +