#!/bin/sh
set -e
DEV=/dev/usb/legousbtower0
echo Prepariere $DEV für Kernel 2.6.5
MINOR=160
# Until version 0.5.2 this minor device version was used
# MINOR=240
# MINOR=179

#TARGET=/lib/modules/`uname -r`/misc

echo "Please unplug USB tower ..."
read
#sudo modprobe -r legousbtower
#sudo mkdir -p ${TARGET}
#sudo cp -a legousbtower.o ${TARGET}
#sudo chown root: ${TARGET}/legousbtower.o
#sudo depmod -a
sudo rm -f ${DEV}
# This was suggested by www.informatik.fh-muenchen.de/~schieder/usbtower/slide0001.html
sudo mknod ${DEV} c 180 ${MINOR}
sudo chmod 666 ${DEV}
# From the original Makefile
# sudo mknod --mode=a=rw ${DEV} c 180 ${MINOR}
sudo modprobe legousbtower
echo "Plug in USB tower and test for instance with ..."
echo "       firmdl3 --tty=/dev/tower0 -s firm0328.lgo"
echo "or rather"
echo "nqc -Susb -firmware firm0328.lgo"
