HD-LAN(v1) Debianについて、ここに記述してください。

背景

1.初めの一歩

2.Watchdog timer

$ cat /etc/init.d/ls_boot
#! /bin/sh

LOCK_FILE=/var/run/ls_boot.pid

[ -c /dev/ttyS1 ] || exit 1
[ -c /dev/ttyS1 ] || mknod -m 660 /dev/ttyS1 c 4 65
[ X"`pidof ppc_uartd`" = X ] || exit 0

loop() {
        while :
        do
                echo -n 'VVVV' > /dev/ttyS1
                sleep 60
        done
}

do_boot() {
        echo -n "Starting watchdog timer"
        stty -F /dev/ttyS1 10:1:9f0d:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
        echo -n 'AAAAFFFFJJJJVVVVZZZZVVVVKKKK' > /dev/ttyS1
        loop &
        echo -n "$!" > $LOCK_FILE
        echo "($!)."
}

do_stop() {
        echo ""
        echo -n "Stopping watchdog timer"
        if [ -f $LOCK_FILE ]; then
                ps -p `cat $LOCK_FILE` > /dev/null
                [ $? -eq 0 ] && kill `cat $LOCK_FILE`
        fi
        rm -f $LOCK_FILE
        echo "."
}

do_halt() {
        echo -n "AVR switch to halt state"
        echo -n 'EEEE' > /dev/ttyS1
        echo "."
}

do_reboot() {
        echo -n "AVR switch to reboot state"
        echo -n 'CCCC' > /dev/ttyS1
        echo "."
}

case "$1" in
  start)
        do_boot
        ;;
  stop)
        do_stop
        case "$RUNLEVEL" in
          0)
                do_halt
                ;;
          6)
                do_reboot
                ;;
          *)
                # No-op
                ;;
        esac
        ;;
  restart|reload|force-reload)
        # No-op
        ;;
  *)
        echo "usage: $0 {start|stop}"
        ;;
esac
:

3.FAN 制御

$ cat /etc/init.d/ls_fan
#! /bin/sh

LIMIT_F=40
LIMIT_S=38

CONF_FILE=/etc/fan.prof
LOCK_FILE=/var/run/ls_fan.pid
HDDTEMP=/usr/sbin/hddtemp
OPT=-n
HDD=/dev/hda
CUR_SPEED=none

[ -x $HDDTEMP ] || exit 1
[ -f $CONF_FILE ] && . $CONF_FILE

to_fast() {
        echo -n ']]]]' > /dev/ttyS1
}

to_slow() {
        echo -n '\\\\' > /dev/ttyS1
}

loop() {
        while :
        do
                TEMP=`$HDDTEMP $OPT $HDD 2> /dev/null`; TEMP=${TEMP:-"30"}
                if [ ${TEMP} -ge ${LIMIT_F} ]; then
                        if [ ${CUR_SPEED} != fast ]; then
                                to_fast
                                CUR_SPEED=fast
                        fi
                elif [ ${TEMP} -lt ${LIMIT_S} ]; then
                        if [ ${CUR_SPEED} != slow ]; then
                                to_slow
                                CUR_SPEED=slow
                        fi
                fi
                sleep 60
        done
}

do_start() {
        echo -n "Starting cooling fan control"
        loop &
        echo -n "$!" > $LOCK_FILE
        echo "($!)."
}

do_stop() {
        echo -n "Stopping cooling fan control"
        if [ -f $LOCK_FILE ]; then
                ps -p `cat $LOCK_FILE` > /dev/null
                [ $? -eq 0 ] && kill `cat $LOCK_FILE`
        fi
        rm -f $LOCK_FILE
        echo "."
}

case "$1" in
  start)
        do_start
        ;;
  stop)
        do_stop
        ;;
  restart|reload|force-reload)
        # No-op
        ;;
  *)
        echo "usage: $0 {start|stop}"
        ;;
esac
:

4.key 処理

$ wget http://www.genbako.com/kuroevtd/kuroevtd1.1.3-pug1.0.tgz
$ wget http://hdlan.mmizuki.dyndns.org/hdlanevtd.patch.gz
$ tar zxf kuroevtd1.1.3-pug1.0.tgz
$ cd kuroevtd
$ zcat ../hdlanevtd.patch.gz | patch -p0
$ make
$ su
# make install

$ cat /etc/init.d/ls_evt
#! /bin/sh

DAEMON=/usr/local/sbin/hdlanevtd
OPT=""
PIDFILE=/var/run/hdlanevtd.pid

[ -x $DAEMON ] || exit 1

do_start() {
        echo -n "Starting HD-LAN key event monitor"
        start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $OPT
        echo "."
}

do_stop() {
        echo -n "Stopping HD-LAN key event monitor"
        start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
        echo "."
}

case "$1" in
  start)
        do_start
        ;;
  stop)
        do_stop
        ;;
  restart|reload|force-reload)
        do_stop
        sleep 1
        do_start
        ;;
  *)
        echo "usage: $0 {start|stop}"
esac
:

5.さぁ、Let's enjoy

HD-LAN v1 が再起不能になってもいいやって方は、binaries も置いておきます

Your own risk でね

HD-LAN(v1) Debian (最終更新日時 2013-05-18 22:32:11 更新者 mmizuki)