📄 computone.txt
字号:
7. NOTESThis is a release version of the driver, but it is impossible to test itin all configurations of Linux. If there is any anomalous behaviour that does not match the standard serial port's behaviour please let us know.8. ip2mkdev shell scriptPreviously, this script was simply attached here. It is now attached as ashar archive to make it easier to extract the script from the documentation.To create the ip2mkdev shell script change to a convenient directory (/tmpworks just fine) and run the following command: unshar /usr/src/linux/Documentation/computone.txt (This file)You should now have a file ip2mkdev in your current working directory withpermissions set to execute. Running that script with then create thenecessary devices for the Computone boards, interfaces, and ports whichare present on you system at the time it is run.#!/bin/sh# This is a shell archive (produced by GNU sharutils 4.2.1).# To extract the files from this archive, save it to some FILE, remove# everything before the `!/bin/sh' line above, then type `sh FILE'.## Made on 2001-10-29 10:32 EST by <mhw@alcove.wittsend.com>.# Source directory was `/home2/src/tmp'.## Existing files will *not* be overwritten unless `-c' is specified.## This shar contains:# length mode name# ------ ---------- ------------------------------------------# 4251 -rwxr-xr-x ip2mkdev#save_IFS="${IFS}"IFS="${IFS}:"gettext_dir=FAILEDlocale_dir=FAILEDfirst_param="$1"for dir in $PATHdo if test "$gettext_dir" = FAILED && test -f $dir/gettext \ && ($dir/gettext --version >/dev/null 2>&1) then set `$dir/gettext --version 2>&1` if test "$3" = GNU then gettext_dir=$dir fi fi if test "$locale_dir" = FAILED && test -f $dir/shar \ && ($dir/shar --print-text-domain-dir >/dev/null 2>&1) then locale_dir=`$dir/shar --print-text-domain-dir` fidoneIFS="$save_IFS"if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILEDthen echo=echoelse TEXTDOMAINDIR=$locale_dir export TEXTDOMAINDIR TEXTDOMAIN=sharutils export TEXTDOMAIN echo="$gettext_dir/gettext -s"fiif touch -am -t 200112312359.59 $$.touch >/dev/null 2>&1 && test ! -f 200112312359.59 -a -f $$.touch; then shar_touch='touch -am -t $1$2$3$4$5$6.$7 "$8"'elif touch -am 123123592001.59 $$.touch >/dev/null 2>&1 && test ! -f 123123592001.59 -a ! -f 123123592001.5 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$1$2.$7 "$8"'elif touch -am 1231235901 $$.touch >/dev/null 2>&1 && test ! -f 1231235901 -a -f $$.touch; then shar_touch='touch -am $3$4$5$6$2 "$8"'else shar_touch=: echo $echo 'WARNING: not restoring timestamps. Consider getting and' $echo "installing GNU \`touch', distributed in GNU File Utilities..." echofirm -f 200112312359.59 123123592001.59 123123592001.5 1231235901 $$.touch#if mkdir _sh17581; then $echo 'x -' 'creating lock directory'else $echo 'failed to create lock directory' exit 1fi# ============= ip2mkdev ==============if test -f 'ip2mkdev' && test "$first_param" != -c; then $echo 'x -' SKIPPING 'ip2mkdev' '(file already exists)'else $echo 'x -' extracting 'ip2mkdev' '(text)' sed 's/^X//' << 'SHAR_EOF' > 'ip2mkdev' &&#!/bin/sh -## ip2mkdev## Make or remove devices as needed for Computone Intelliport drivers## First rule! If the dev file exists and you need it, don't mess# with it. That prevents us from screwing up open ttys, ownership# and permissions on a running system!## This script will NOT remove devices that no longer exist if their# board or interface box has been removed. If you want to get rid# of them, you can manually do an "rm -f /dev/ttyF* /dev/cuaf*"# before running this script. Running this script will then recreate# all the valid devices.## Michael H. Warfield# /\/\|=mhw=|\/\/# mhw@wittsend.com## Updated 10/29/2000 for version 1.2.13 naming convention# under devfs. /\/\|=mhw=|\/\/## Updated 03/09/2000 for devfs support in ip2 drivers. /\/\|=mhw=|\/\/#Xif test -d /dev/ip2 ; then# This is devfs mode... We don't do anything except create symlinks# from the real devices to the old names!X cd /devX echo "Creating symbolic links to devfs devices"X for i in `ls ip2` ; doX if test ! -L ip2$i ; thenX # Remove it incase it wasn't a symlink (old device)X rm -f ip2$iX ln -s ip2/$i ip2$iX fiX doneX for i in `( cd tts ; ls F* )` ; doX if test ! -L tty$i ; thenX # Remove it incase it wasn't a symlink (old device)X rm -f tty$iX ln -s tts/$i tty$iX fiX doneX for i in `( cd cua ; ls F* )` ; doX DEVNUMBER=`expr $i : 'F\(.*\)'`X if test ! -L cuf$DEVNUMBER ; thenX # Remove it incase it wasn't a symlink (old device)X rm -f cuf$DEVNUMBERX ln -s cua/$i cuf$DEVNUMBERX fiX doneX exit 0fiXif test ! -f /proc/tty/driversthenX echo "\Unable to check driver status.Make sure proc file system is mounted."XX exit 255fiXif test ! -f /proc/tty/driver/ip2thenX echo "\Unable to locate ip2 proc file.Attempting to load driver"XX if /sbin/insmod ip2X thenX if test ! -f /proc/tty/driver/ip2X thenX echo "\Unable to locate ip2 proc file after loading driver.Driver initialization failure or driver version error."X exit 255X fiX elseX echo "Unable to load ip2 driver."X exit 255X fifiX# Ok... So we got the driver loaded and we can locate the procfs files.# Next we need our major numbers.XTTYMAJOR=`sed -e '/^ip2/!d' -e '/\/dev\/tt/!d' -e 's/.*tt[^ ]*[ ]*\([0-9]*\)[ ]*.*/\1/' < /proc/tty/drivers`CUAMAJOR=`sed -e '/^ip2/!d' -e '/\/dev\/cu/!d' -e 's/.*cu[^ ]*[ ]*\([0-9]*\)[ ]*.*/\1/' < /proc/tty/drivers`BRDMAJOR=`sed -e '/^Driver: /!d' -e 's/.*IMajor=\([0-9]*\)[ ]*.*/\1/' < /proc/tty/driver/ip2`Xecho "\TTYMAJOR = $TTYMAJORCUAMAJOR = $CUAMAJORBRDMAJOR = $BRDMAJOR"X# Ok... Now we should know our major numbers, if appropriate...# Now we need our boards and start the device loops.Xgrep '^Board [0-9]:' /proc/tty/driver/ip2 | while read token number type alltherestdoX # The test for blank "type" will catch the stats lead-in linesX # if they exist in the fileX if test "$type" = "vacant" -o "$type" = "Vacant" -o "$type" = ""X thenX continueX fiXX BOARDNO=`expr "$number" : '\([0-9]\):'`X PORTS=`expr "$alltherest" : '.*ports=\([0-9]*\)' | tr ',' ' '`X MINORS=`expr "$alltherest" : '.*minors=\([0-9,]*\)' | tr ',' ' '`XX if test "$BOARDNO" = "" -o "$PORTS" = ""X then# This may be a bug. We should at least get this much informationX echo "Unable to process board line"X continueX fiXX if test "$MINORS" = ""X then# Silently skip this one. This board seems to have no boxesX continueX fiXX echo "board $BOARDNO: $type ports = $PORTS; port numbers = $MINORS"XX if test "$BRDMAJOR" != ""X thenX BRDMINOR=`expr $BOARDNO \* 4`X STSMINOR=`expr $BRDMINOR + 1`X if test ! -c /dev/ip2ipl$BOARDNO ; thenX mknod /dev/ip2ipl$BOARDNO c $BRDMAJOR $BRDMINORX fiX if test ! -c /dev/ip2stat$BOARDNO ; thenX mknod /dev/ip2stat$BOARDNO c $BRDMAJOR $STSMINORX fiX fiXX if test "$TTYMAJOR" != ""X thenX PORTNO=$BOARDBASEXX for PORTNO in $MINORSX doX if test ! -c /dev/ttyF$PORTNO ; thenX # We got the harware but no device - make itX mknod /dev/ttyF$PORTNO c $TTYMAJOR $PORTNOX fi X doneX fiXX if test "$CUAMAJOR" != ""X thenX PORTNO=$BOARDBASEXX for PORTNO in $MINORSX doX if test ! -c /dev/cuf$PORTNO ; thenX # We got the harware but no device - make itX mknod /dev/cuf$PORTNO c $CUAMAJOR $PORTNOX fi X doneX fidoneXXexit 0SHAR_EOF (set 20 01 10 29 10 32 01 'ip2mkdev'; eval "$shar_touch") && chmod 0755 'ip2mkdev' || $echo 'restore of' 'ip2mkdev' 'failed' if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \ && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then md5sum -c << SHAR_EOF >/dev/null 2>&1 \ || $echo 'ip2mkdev:' 'MD5 check failed'cb5717134509f38bad9fde6b1f79b4a4 ip2mkdevSHAR_EOF else shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'ip2mkdev'`" test 4251 -eq "$shar_count" || $echo 'ip2mkdev:' 'original size' '4251,' 'current size' "$shar_count!" fifirm -fr _sh17581exit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -