Module Name:    src
Committed By:   christos
Date:           Tue Mar 14 19:40:42 UTC 2017

Modified Files:
        src/sys/dev/usb: usb_subr.c

Log Message:
use x alt format and print vendor and product in hex too


To generate a diff of this commit:
cvs rdiff -u -r1.218 -r1.219 src/sys/dev/usb/usb_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.218 src/sys/dev/usb/usb_subr.c:1.219
--- src/sys/dev/usb/usb_subr.c:1.218	Thu Jan 19 11:05:00 2017
+++ src/sys/dev/usb/usb_subr.c	Tue Mar 14 15:40:42 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.218 2017/01/19 16:05:00 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.219 2017/03/14 19:40:42 christos Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.218 2017/01/19 16:05:00 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.219 2017/03/14 19:40:42 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -249,7 +249,8 @@ usbd_devinfo(struct usbd_device *dev, in
 
 	usbd_devinfo_vp(dev, vendor, USB_MAX_ENCODED_STRING_LEN,
 	    product, USB_MAX_ENCODED_STRING_LEN, 0, 1);
-	cp += snprintf(cp, ep - cp, "%s %s", vendor, product);
+	cp += snprintf(cp, ep - cp, "%s (%#04x) %s (%#04x)", vendor,
+	    UGETW(udd->idVendor), product, UGETW(udd->idProduct));
 	if (showclass)
 		cp += snprintf(cp, ep - cp, ", class %d/%d",
 		    udd->bDeviceClass, udd->bDeviceSubClass);
@@ -680,7 +681,7 @@ usbd_set_config_index(struct usbd_device
 	 */
 	selfpowered = !!(cdp->bmAttributes & UC_SELF_POWERED);
 
-	DPRINTF("addr %d cno=%d attr=0x%02x, selfpowered=%d",
+	DPRINTF("addr %d cno=%d attr=%#02x, selfpowered=%d",
 	    dev->ud_addr, cdp->bConfigurationValue, cdp->bmAttributes,
 	    selfpowered);
 	DPRINTF("max power=%d", cdp->bMaxPower * 2, 0, 0, 0);
@@ -799,7 +800,7 @@ usbd_setup_pipe_flags(struct usbd_device
 	SIMPLEQ_INIT(&p->up_queue);
 	err = dev->ud_bus->ub_methods->ubm_open(p);
 	if (err) {
-		DPRINTF("endpoint=0x%x failed, error=%d",
+		DPRINTF("endpoint=%#x failed, error=%d",
 		    ep->ue_edesc->bEndpointAddress, err, 0, 0);
 		kmem_free(p, dev->ud_bus->ub_pipesize);
 		return err;
@@ -1403,8 +1404,8 @@ usbd_reload_device_desc(struct usbd_devi
 	DPRINTFN(15, "bDeviceSubClass     %5u", udd->bDeviceSubClass, 0, 0, 0);
 	DPRINTFN(15, "bDeviceProtocol     %5u", udd->bDeviceProtocol, 0, 0, 0);
 	DPRINTFN(15, "bMaxPacketSize0     %5u", udd->bMaxPacketSize, 0, 0, 0);
-	DPRINTFN(15, "idVendor           0x%04x", udd->idVendor, 0, 0, 0);
-	DPRINTFN(15, "idProduct          0x%04x", udd->idProduct, 0, 0, 0);
+	DPRINTFN(15, "idVendor            %#04x", udd->idVendor, 0, 0, 0);
+	DPRINTFN(15, "idProduct           %#04x", udd->idProduct, 0, 0, 0);
 	DPRINTFN(15, "bcdDevice           %2x.%02x", udd->bcdDevice[1],
 	    udd->bcdDevice[0], 0, 0);
 	DPRINTFN(15, "iManufacturer       %5u", udd->iManufacturer, 0, 0, 0);
@@ -1458,11 +1459,11 @@ usbd_print(void *aux, const char *pnp)
 	 * by each driver.
 	 */
 	if (uaa->uaa_vendor != UHUB_UNK_VENDOR)
-		aprint_normal(" vendor 0x%04x", uaa->uaa_vendor);
+		aprint_normal(" vendor %#04x", uaa->uaa_vendor);
 	if (uaa->uaa_product != UHUB_UNK_PRODUCT)
-		aprint_normal(" product 0x%04x", uaa->uaa_product);
+		aprint_normal(" product %#04x", uaa->uaa_product);
 	if (uaa->uaa_release != UHUB_UNK_RELEASE)
-		aprint_normal(" release 0x%04x", uaa->uaa_release);
+		aprint_normal(" release %#04x", uaa->uaa_release);
 #endif
 	return UNCONF;
 }
@@ -1484,11 +1485,11 @@ usbd_ifprint(void *aux, const char *pnp)
 	 * by each driver.
 	 */
 	if (uaa->uaa_vendor != UHUB_UNK_VENDOR)
-		aprint_normal(" vendor 0x%04x", uaa->uaa_vendor);
+		aprint_normal(" vendor %#04x", uaa->uaa_vendor);
 	if (uaa->uaa_product != UHUB_UNK_PRODUCT)
-		aprint_normal(" product 0x%04x", uaa->uaa_product);
+		aprint_normal(" product %#04x", uaa->uaa_product);
 	if (uaa->uaa_release != UHUB_UNK_RELEASE)
-		aprint_normal(" release 0x%04x", uaa->uaa_release);
+		aprint_normal(" release %#04x", uaa->uaa_release);
 #endif
 	return UNCONF;
 }

Reply via email to