#!/bin/bash
# Copyright 2002-2004 3M. All rights reserved.
module="TWDrv"
device="twscreen"
mode="664"

#
# TouchWare normally scans serial ports for touch controllers starting
# with TWDrv_nMinSerial number up to TWDrv_nMaxSerial. If you
# are not using serial controllers, you can disable this function by
# removing the '#' character from the next "/sbin/insmod" line and
# placing a '#' before the "/sbin/insmod" line after that.
#/sbin/insmod -f ./$module.o TWDrv_nMaxSerial=0 || exit 1
/sbin/insmod -f ./$module.o TWDrv_pszSerialPath="$*" TWDrv_nMinSerial="0" TWDrv_nMaxSerial="`cat /proc/ioports|grep serial|wc -l`" || exit 1

rm -f /dev/${device}[0-3]

major=`awk "\\$2==\"$module\" {print \\$1}" /proc/devices`

mknod /dev/${device}0 c $major 0
mknod /dev/${device}1 c $major 1
mknod /dev/${device}2 c $major 2
mknod /dev/${device}3 c $major 3

chmod $mode /dev/${device}[0-3]
