Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Mar 2000 20:35:58 -0800 (PST)
From:      spock@techfour.net
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/17425: [PATCH] fix two small printing errors in ppbus
Message-ID:  <200003170435.UAA32029@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         17425
>Category:       kern
>Synopsis:       [PATCH] fix two small printing errors in ppbus
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 16 20:40:04 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Mike Heffner
>Release:        5.0-current
>Organization:
>Environment:
FreeBSD 5.0-CURRENT #2: Thu Mar 16 23:15:16 EST 2000
>Description:
First fix, the following line:
ppbus0: IEEE1284 device found /NIBBLE
shouldn't include '/' if not needed (ie. only one mode detected).

Second fix, when searching for the 'class' token in the ppb PNP string, 
we should test for "CLASS", in addition to "CLS" (already present). 
>How-To-Repeat:
N/A
>Fix:
The following patch fixes both items, sorry for any whitespace problems.


Index: ppbconf.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/ppbus/ppbconf.c,v
retrieving revision 1.17
diff -u -r1.17 ppbconf.c
--- ppbconf.c	2000/01/23 14:41:04	1.17
+++ ppbconf.c	2000/03/17 04:34:19
@@ -262,7 +262,8 @@
 
 	printf(">");
 
-	if ((token = search_token(str, len, "CLS")) != NULL) {
+	if ((token = search_token(str, len, "CLS")) != NULL ||
+	    (token = search_token(str, len, "CLASS")) != NULL) {
 		class = search_token(token, UNKNOWN_LENGTH, ":") + 1;
 		printf(" %s", class);
 	}
@@ -300,6 +301,7 @@
 	struct ppb_data * ppb = (struct ppb_data *)device_get_softc(bus);
 	int error = 0;
 	int unit = device_get_unit(bus);
+	short int nmodes = 0;
 
 	/* try all IEEE1284 modes, for one device only
 	 * 
@@ -317,27 +319,27 @@
 	printf("ppbus%d: IEEE1284 device found ", unit);
 
 	if (!(error = ppb_1284_negociate(bus, PPB_NIBBLE, 0))) {
-		printf("/NIBBLE");
+		printf("%sNIBBLE", nmodes++ ? "/" : "");
 		ppb_1284_terminate(bus);
 	}
 
 	if (!(error = ppb_1284_negociate(bus, PPB_PS2, 0))) {
-		printf("/PS2");
+		printf("%sPS2", nmodes++ ? "/" : "");
 		ppb_1284_terminate(bus);
 	}
 
 	if (!(error = ppb_1284_negociate(bus, PPB_ECP, 0))) {
-		printf("/ECP");
+		printf("%sECP", nmodes++ ? "/" : "");
 		ppb_1284_terminate(bus);
 	}
 
 	if (!(error = ppb_1284_negociate(bus, PPB_ECP, PPB_USE_RLE))) {
-		printf("/ECP_RLE");
+		printf("%sECP_RLE", nmodes++ ? "/" : "");
 		ppb_1284_terminate(bus);
 	}
 
 	if (!(error = ppb_1284_negociate(bus, PPB_EPP, 0))) {
-		printf("/EPP");
+		printf("%sEPP", nmodes++ ? "/" : "");
 		ppb_1284_terminate(bus);
 	}
 
@@ -345,31 +347,31 @@
 	if (bootverbose) {
 		if (!(error = ppb_1284_negociate(bus, PPB_NIBBLE,
 				PPB_REQUEST_ID))) {
-			printf("/NIBBLE_ID");
+			printf("%sNIBBLE_ID", nmodes++ ? "/" : "");
 			ppb_1284_terminate(bus);
 		}
 
 		if (!(error = ppb_1284_negociate(bus, PPB_PS2,
 				PPB_REQUEST_ID))) {
-			printf("/PS2_ID");
+			printf("%sPS2_ID", nmodes++ ? "/" : "");
 			ppb_1284_terminate(bus);
 		}
 
 		if (!(error = ppb_1284_negociate(bus, PPB_ECP,
 				PPB_REQUEST_ID))) {
-			printf("/ECP_ID");
+			printf("%sECP_ID", nmodes++ ? "/" : "");
 			ppb_1284_terminate(bus);
 		}
 
 		if (!(error = ppb_1284_negociate(bus, PPB_ECP,
 				PPB_REQUEST_ID | PPB_USE_RLE))) {
-			printf("/ECP_RLE_ID");
+			printf("%sECP_RLE_ID", nmodes++ ? "/" : "");
 			ppb_1284_terminate(bus);
 		}
 
 		if (!(error = ppb_1284_negociate(bus, PPB_COMPATIBLE,
 				PPB_EXTENSIBILITY_LINK))) {
-			printf("/Extensibility Link");
+			printf("%sExtensibility Link", nmodes++ ? "/" : "");
 			ppb_1284_terminate(bus);
 		}
 	}

>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003170435.UAA32029>