Date: Fri, 19 Apr 2002 23:35:22 -0400 From: Tom Limoncelli <tal@lumeta.com> To: freebsd-hardware@FreeBSD.ORG Subject: 4.5 MAKEDEV is buggy for RocketPorts Message-ID: <3CC0E1FA.8020900@lumeta.com>
next in thread | raw e-mail | index | archive | help
Hi! The code in /dev/MAKEDEV to create the cuaR* and ttyR* devices is broken. This is likely because so few people use RocketPort serial ports with FreeBSD (I wish they'd contribute a newer driver!) There are 2 bugs: 1) MAKEDEV assumes that only one "RocketPort = 32" will appear in the output of dmesg. I fixed this by passing the output of dmesg through "sort -u", but there has got to be a better way. (my ugly patch is below). Without this patch, $ndevices="32\n32\n32\n32\n" instead of "32", similar problem with $controllers. The final patch should handle the situation where multiple controller cards are installed. 2) The code relies on "dmesg" to find out what controllers exist. I consider this to be a problem, albiet minor. If the machine hasn't been rebooted in long enough that dmesg no longer mentions "RocketPort0 = 32" (or whatever) then the script fails. (Hey, it actually happened to me. I had a machine up for something like 6 months before I went to run MAKEDEV). I don't see any other use of "dmesg" in MAKEDEV. --Tom # diff -cw /tmp/MAKEDEV /dev/MAKEDEV *** /tmp/MAKEDEV Mon Jan 28 08:13:17 2002 --- /dev/MAKEDEV Fri Apr 19 18:13:50 2002 *************** *** 1404,1410 **** BOARD=1; Rnum=0 MINOR=$(($BOARD * 65536)) controllers=$( ! dmesg | while read first rest; do case "$first" in RocketPort[0-4]) echo "$first" --- 1404,1410 ---- BOARD=1; Rnum=0 MINOR=$(($BOARD * 65536)) controllers=$( ! dmesg | /usr/bin/sort -u | while read first rest; do case "$first" in RocketPort[0-4]) echo "$first" *************** *** 1415,1421 **** rm -f ttyR* ttyiR* ttylR* for i in $controllers; do ndevices=$( ! dmesg | while read first bar ports rest; do case "$first" in $i*) echo "$ports" --- 1415,1421 ---- rm -f ttyR* ttyiR* ttylR* for i in $controllers; do ndevices=$( ! dmesg | /usr/bin/sort -u | while read first bar ports rest; do case "$first" in $i*) echo "$ports" *************** *** 1444,1450 **** BOARD=1; Rnum=0 MINOR=$(($BOARD * 65536)) controllers=$( ! dmesg | while read first rest; do case "$first" in RocketPort[0-4]) echo "$first" --- 1444,1450 ---- BOARD=1; Rnum=0 MINOR=$(($BOARD * 65536)) controllers=$( ! dmesg | /usr/bin/sort -u | while read first rest; do case "$first" in RocketPort[0-4]) echo "$first" *************** *** 1455,1461 **** rm -f cuaR* cuaiR* cualR* for i in $controllers; do ndevices=$( ! dmesg | while read first bar ports rest; do case "$first" in $i*) echo "$ports" --- 1455,1461 ---- rm -f cuaR* cuaiR* cualR* for i in $controllers; do ndevices=$( ! dmesg | /usr/bin/sort -u | while read first bar ports rest; do case "$first" in $i*) echo "$ports" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hardware" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CC0E1FA.8020900>