Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 2018 23:16:16 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329538 - head/sbin/devmatch
Message-ID:  <201802182316.w1INGGXE050801@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sun Feb 18 23:16:16 2018
New Revision: 329538
URL: https://svnweb.freebsd.org/changeset/base/329538

Log:
  Print more info for -v runs and temp hack for usb vs uhub
  
  Despite best efforts to regularize, there's a few tables in the system
  that still report they are for bus usb when they are really for bus
  uhub (where usb devices attach). Add a temporary workaround for this
  until these places have been eliminated (likely my fault).
  
  Second, when running verbose, describe what we're doing when
  searching. This output can be quite long, but says exactly what's
  going on (this output is to stdout, so it's useless for scripting).

Modified:
  head/sbin/devmatch/devmatch.c

Modified: head/sbin/devmatch/devmatch.c
==============================================================================
--- head/sbin/devmatch/devmatch.c	Sun Feb 18 23:08:43 2018	(r329537)
+++ head/sbin/devmatch/devmatch.c	Sun Feb 18 23:16:16 2018	(r329538)
@@ -284,6 +284,9 @@ search_hints(const char *bus, const char *dev, const c
 	walker = hints;
 	getint(&walker);
 	found = 0;
+	if (verbose_flag)
+		printf("Searching bus %s dev %s for pnpinfo %s\n",
+		    bus, dev, pnpinfo);
 	while (walker < hints_end) {
 		len = getint(&walker);
 		ival = getint(&walker);
@@ -293,7 +296,7 @@ search_hints(const char *bus, const char *dev, const c
 			getstr(&ptr, val1);
 			ival = getint(&ptr);
 			getstr(&ptr, val2);
-			if (dump_flag)
+			if (dump_flag || verbose_flag)
 				printf("Version: if %s.%d kmod %s\n", val1, ival, val2);
 			break;
 		case MDT_MODULE:
@@ -302,7 +305,7 @@ search_hints(const char *bus, const char *dev, const c
 			if (lastmod)
 				free(lastmod);
 			lastmod = strdup(val2);
-			if (dump_flag)
+			if (dump_flag || verbose_flag)
 				printf("Module %s in %s\n", val1, val2);
 			break;
 		case MDT_PNP_INFO:
@@ -311,12 +314,23 @@ search_hints(const char *bus, const char *dev, const c
 			getstr(&ptr, val1);
 			getstr(&ptr, val2);
 			ents = getint(&ptr);
-			if (bus && strcmp(val1, bus) != 0)
-				break;
-			if (dump_flag)
+			if (dump_flag || verbose_flag)
 				printf("PNP info for bus %s format %s %d entries (%s)\n",
 				    val1, val2, ents, lastmod);
+			if (strcmp(val1, "usb") == 0) {
+				if (verbose_flag)
+					printf("Treating usb as uhub -- bug in source table still?\n");
+				strcpy(val1, "uhub");
+			}
+			if (bus && strcmp(val1, bus) != 0) {
+				if (verbose_flag)
+					printf("Skipped because table for bus %s, looking for %s\n",
+					    val1, bus);
+				break;
+			}
 			for (i = 0; i < ents; i++) {
+				if (verbose_flag)
+					printf("---------- Entry %d ----------\n", i);
 				if (dump_flag)
 					printf("   ");
 				cp = val2;
@@ -339,6 +353,9 @@ search_hints(const char *bus, const char *dev, const c
 						if (bit >= 0 && ((1 << bit) & mask) == 0)
 							break;
 						v = pnpval_as_int(cp + 2, pnpinfo);
+						if (verbose_flag)
+							printf("Matching %s (%c) table=%#x tomatch=%#x\n",
+							    cp + 2, *cp, v, ival);
 						switch (*cp) {
 						case 'J':
 							if (ival == -1)



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