Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb use x alt format and print vendor and product in...



details:   https://anonhg.NetBSD.org/src/rev/2e174747ebd2
branches:  trunk
changeset: 822338:2e174747ebd2
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 14 19:40:42 2017 +0000

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

diffstat:

 sys/dev/usb/usb_subr.c |  27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diffs (87 lines):

diff -r b994c6a67a3d -r 2e174747ebd2 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Tue Mar 14 15:11:41 2017 +0000
+++ b/sys/dev/usb/usb_subr.c    Tue Mar 14 19:40:42 2017 +0000
@@ -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_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 @@
         */
        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 @@
        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 @@
        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 @@
         * 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 @@
         * 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;
 }



Home | Main Index | Thread Index | Old Index