Module Name: src Committed By: mrg Date: Thu Jul 20 20:00:34 UTC 2023
Modified Files: src/sys/dev/usb: ehci.c files.usb if_urtwn.c ugen.c ums.c usb.c Log Message: various debug updates for some usb drivers - several new *_DEBUG_DEFAULT options that allow usb debug values to be set to a default that is non-zero: EHCI_DEBUG_DEFAULT, UGEN_DEBUG_DEFAULT, URTWN_DEBUG_DEFAULT, UMS_DEBUG_DEFAULT, and USB_DEBUG_DEFAULT - ugen debug uses fewer usbhist lines for the same info - ums.c converted from printf() to usbhist To generate a diff of this commit: cvs rdiff -u -r1.315 -r1.316 src/sys/dev/usb/ehci.c cvs rdiff -u -r1.178 -r1.179 src/sys/dev/usb/files.usb cvs rdiff -u -r1.105 -r1.106 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.171 -r1.172 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.103 -r1.104 src/sys/dev/usb/ums.c cvs rdiff -u -r1.200 -r1.201 src/sys/dev/usb/usb.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/ehci.c diff -u src/sys/dev/usb/ehci.c:1.315 src/sys/dev/usb/ehci.c:1.316 --- src/sys/dev/usb/ehci.c:1.315 Tue Dec 13 21:29:04 2022 +++ src/sys/dev/usb/ehci.c Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ehci.c,v 1.315 2022/12/13 21:29:04 jakllsch Exp $ */ +/* $NetBSD: ehci.c,v 1.316 2023/07/20 20:00:34 mrg Exp $ */ /* * Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc. @@ -54,7 +54,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.315 2022/12/13 21:29:04 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.316 2023/07/20 20:00:34 mrg Exp $"); #include "ohci.h" #include "uhci.h" @@ -95,7 +95,12 @@ __KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.3 #ifndef EHCI_DEBUG #define ehcidebug 0 #else -static int ehcidebug = 0; + +#ifndef EHCI_DEBUG_DEFAULT +#define EHCI_DEBUG_DEFAULT 0 +#endif + +static int ehcidebug = EHCI_DEBUG_DEFAULT; SYSCTL_SETUP(sysctl_hw_ehci_setup, "sysctl hw.ehci setup") { Index: src/sys/dev/usb/files.usb diff -u src/sys/dev/usb/files.usb:1.178 src/sys/dev/usb/files.usb:1.179 --- src/sys/dev/usb/files.usb:1.178 Thu Jun 30 06:30:44 2022 +++ src/sys/dev/usb/files.usb Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -# $NetBSD: files.usb,v 1.178 2022/06/30 06:30:44 macallan Exp $ +# $NetBSD: files.usb,v 1.179 2023/07/20 20:00:34 mrg Exp $ # # Config file and device description for machine-independent USB code. # Included by ports that need it. Ports that use it must provide @@ -6,9 +6,11 @@ defflag USBVERBOSE defflag opt_usb.h USB_FRAG_DMA_WORKAROUND +defparam opt_usb.h USB_DEBUG_DEFAULT: USB_DEBUG # HC controllers defflag opt_usb.h EHCI_DEBUG: USB_DEBUG +defparam opt_usb.h EHCI_DEBUG_DEFAULT: EHCI_DEBUG defflag opt_usb.h OHCI_DEBUG: USB_DEBUG defflag opt_usb.h UHCI_DEBUG: USB_DEBUG defflag opt_usb.h DWC2_DEBUG: USB_DEBUG @@ -46,6 +48,7 @@ defflag opt_usb.h UDSBR_DEBUG: USB_DEBUG defflag opt_usb.h UFTDI_DEBUG: USB_DEBUG defflag opt_usb.h UGENSA_DEBUG: USB_DEBUG defflag opt_usb.h UGEN_DEBUG: USB_DEBUG +defparam opt_usb.h UGEN_DEBUG_DEFAULT: UGEN_DEBUG defflag opt_usb.h UHIDEV_DEBUG: USB_DEBUG defflag opt_usb.h UHID_DEBUG: USB_DEBUG defflag opt_usb.h UHMODEM_DEBUG: USB_DEBUG @@ -62,6 +65,7 @@ defflag opt_usb.h UMIDIQUIRK_DEBUG: USB_ defflag opt_usb.h UMIDI_DEBUG: USB_DEBUG defflag opt_usb.h UMODEM_DEBUG: USB_DEBUG defflag opt_usb.h UMS_DEBUG: USB_DEBUG +defparam opt_usb.h UMS_DEBUG_DEFAULT: UMS_DEBUG defflag opt_usb.h UPGT_DEBUG: USB_DEBUG defflag opt_usb.h UPLCOM_DEBUG: USB_DEBUG defflag opt_usb.h UPL_DEBUG: USB_DEBUG @@ -69,6 +73,7 @@ defflag opt_usb.h URAL_DEBUG: USB_DEBUG defflag opt_usb.h URL_DEBUG: USB_DEBUG defflag opt_usb.h URNDIS_DEBUG: USB_DEBUG defflag opt_usb.h URTWN_DEBUG: USB_DEBUG +defparam opt_usb.h URTWN_DEBUG_DEFAULT: URTWN_DEBUG defflag opt_usb.h URTW_DEBUG: USB_DEBUG defflag opt_usb.h USBNET_DEBUG: USB_DEBUG defflag opt_usb.h USCANNER_DEBUG: USB_DEBUG Index: src/sys/dev/usb/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.105 src/sys/dev/usb/if_urtwn.c:1.106 --- src/sys/dev/usb/if_urtwn.c:1.105 Sun Jul 31 12:59:26 2022 +++ src/sys/dev/usb/if_urtwn.c Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.105 2022/07/31 12:59:26 mlelstv Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.106 2023/07/20 20:00:34 mrg Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -25,7 +25,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.105 2022/07/31 12:59:26 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.106 2023/07/20 20:00:34 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -95,7 +95,13 @@ __KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v #define DBG_RF __BIT(5) #define DBG_REG __BIT(6) #define DBG_ALL 0xffffffffU -u_int urtwn_debug = 0; + +#ifndef URTWN_DEBUG_DEFAULT +#define URTWN_DEBUG_DEFAULT 0 +#endif + +u_int urtwn_debug = URTWN_DEBUG_DEFAULT; + #define DPRINTFN(n, fmt, a, b, c, d) do { \ if (urtwn_debug & (n)) { \ KERNHIST_LOG(usbhist, fmt, a, b, c, d); \ Index: src/sys/dev/usb/ugen.c diff -u src/sys/dev/usb/ugen.c:1.171 src/sys/dev/usb/ugen.c:1.172 --- src/sys/dev/usb/ugen.c:1.171 Sun Oct 23 11:06:37 2022 +++ src/sys/dev/usb/ugen.c Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.171 2022/10/23 11:06:37 riastradh Exp $ */ +/* $NetBSD: ugen.c,v 1.172 2023/07/20 20:00:34 mrg Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.171 2022/10/23 11:06:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.172 2023/07/20 20:00:34 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -72,7 +72,12 @@ __KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.1 #ifndef UGEN_DEBUG #define ugendebug 0 #else -int ugendebug = 0; + +#ifndef UGEN_DEBUG_DEFAULT +#define UGEN_DEBUG_DEFAULT 0 +#endif + +int ugendebug = UGEN_DEBUG_DEFAULT; SYSCTL_SETUP(sysctl_hw_ugen_setup, "sysctl hw.ugen setup") { @@ -108,6 +113,10 @@ fail: #define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(ugendebug,N,FMT,A,B,C,D) #define UGENHIST_FUNC() USBHIST_FUNC() #define UGENHIST_CALLED(name) USBHIST_CALLED(ugendebug) +#define UGENHIST_CALLARGS(FMT,A,B,C,D) \ + USBHIST_CALLARGS(ugendebug,FMT,A,B,C,D) +#define UGENHIST_CALLARGSN(N,FMT,A,B,C,D) \ + USBHIST_CALLARGSN(ugendebug,N,FMT,A,B,C,D) #define UGEN_CHUNK 128 /* chunk size for read */ #define UGEN_IBSIZE 1020 /* buffer size */ @@ -471,10 +480,9 @@ ugen_set_config(struct ugen_softc *sc, i usbd_status err; int dir; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTFN(1, "ugen%jd: to configno %jd, sc=%jx", - device_unit(sc->sc_dev), configno, (uintptr_t)sc, 0); + UGENHIST_FUNC(); + UGENHIST_CALLARGSN(1, "ugen%jd: to configno %jd, sc=%jx", + device_unit(sc->sc_dev), configno, (uintptr_t)sc, 0); KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */ @@ -564,16 +572,15 @@ ugenopen(dev_t dev, int flag, int mode, int error; int opened = 0; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("flag=%jd, mode=%jd, unit=%jd endpt=%jd", + flag, mode, unit, endpt); KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */ if ((sc = ugenif_acquire(unit)) == NULL) return ENXIO; - DPRINTFN(5, "flag=%jd, mode=%jd, unit=%jd endpt=%jd", - flag, mode, unit, endpt); - /* The control endpoint allows multiple opens. */ if (endpt == USB_CONTROL_ENDPOINT) { opened = sc->sc_is_open[USB_CONTROL_ENDPOINT] = 1; @@ -735,7 +742,8 @@ ugen_do_close(struct ugen_softc *sc, int int dir; int i; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("flag=%jd endpt=%jd", flag, endpt, 0, 0); KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */ @@ -809,10 +817,9 @@ ugenclose(dev_t dev, int flag, int mode, int endpt = UGENENDPOINT(dev); struct ugen_softc *sc; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTFN(5, "flag=%jd, mode=%jd, unit=%jd, endpt=%jd", - flag, mode, UGENUNIT(dev), endpt); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("flag=%jd, mode=%jd, unit=%jd, endpt=%jd", + flag, mode, UGENUNIT(dev), endpt); KASSERT(KERNEL_LOCKED_P()); /* ugen_do_close */ @@ -837,9 +844,8 @@ ugen_do_read(struct ugen_softc *sc, int usbd_status err; int error = 0; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTFN(5, "ugen%d: %jd", device_unit(sc->sc_dev), endpt, 0, 0); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("ugen%d: %jd", device_unit(sc->sc_dev), endpt, 0, 0); if (endpt == USB_CONTROL_ENDPOINT) return ENODEV; @@ -1050,9 +1056,9 @@ ugen_do_write(struct ugen_softc *sc, int struct usbd_xfer *xfer; usbd_status err; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTFN(5, "ugen%jd: %jd", device_unit(sc->sc_dev), endpt, 0, 0); + UGENHIST_FUNC(); + UGENHIST_CALLARGSN(5, "ugen%jd: %jd", + device_unit(sc->sc_dev), endpt, 0, 0); if (endpt == USB_CONTROL_ENDPOINT) return ENODEV; @@ -1229,9 +1235,8 @@ ugen_detach(device_t self, int flags) int i, dir; int maj, mn; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTF("sc=%ju flags=%ju", (uintptr_t)sc, flags, 0, 0); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("sc=%ju flags=%ju", (uintptr_t)sc, flags, 0, 0); KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */ @@ -1325,7 +1330,8 @@ ugenintr(struct usbd_xfer *xfer, void *a uint32_t count; u_char *ibuf; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("xfer %jx status %d", (uintptr_t)xfer, status, 0, 0); if (status == USBD_CANCELLED) return; @@ -1362,7 +1368,8 @@ ugen_isoc_rintr(struct usbd_xfer *xfer, uint32_t count, n; int i, isize; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0); /* Return if we are aborting. */ if (status == USBD_CANCELLED) @@ -1423,7 +1430,8 @@ ugen_bulkra_intr(struct usbd_xfer *xfer, char const *tbuf; usbd_status err; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0); /* Return if we are aborting. */ if (status == USBD_CANCELLED) @@ -1491,7 +1499,8 @@ ugen_bulkwb_intr(struct usbd_xfer *xfer, char *tbuf; usbd_status err; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0); /* Return if we are aborting. */ if (status == USBD_CANCELLED) @@ -1558,9 +1567,8 @@ ugen_set_interface(struct ugen_softc *sc uint8_t niface, nendpt, endptno, endpt; int dir; - UGENHIST_FUNC(); UGENHIST_CALLED(); - - DPRINTFN(15, "%d %d", ifaceidx, altno, 0, 0); + UGENHIST_FUNC(); + UGENHIST_CALLARGSN(15, "ifaceidx=%jd altno=%jd", ifaceidx, altno, 0, 0); err = usbd_interface_count(sc->sc_udev, &niface); if (err) @@ -1603,37 +1611,37 @@ ugen_set_interface(struct ugen_softc *sc Static usb_config_descriptor_t * ugen_get_cdesc(struct ugen_softc *sc, int index, int *lenp) { - usb_config_descriptor_t *cdesc, *tdesc, cdescr; - int len; + usb_config_descriptor_t *cdesc = NULL, *tdesc, cdescr; + int len = 0; usbd_status err; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); UGENHIST_CALLARGS("index=%jd", index, 0, 0, 0); - if (index == USB_CURRENT_CONFIG_INDEX) { + switch (index) { + case USB_CURRENT_CONFIG_INDEX: tdesc = usbd_get_config_descriptor(sc->sc_udev); if (tdesc == NULL) - return NULL; + break; len = UGETW(tdesc->wTotalLength); - if (lenp) - *lenp = len; cdesc = kmem_alloc(len, KM_SLEEP); memcpy(cdesc, tdesc, len); - DPRINTFN(5, "current, len=%jd", len, 0, 0, 0); - } else { + break; + default: err = usbd_get_config_desc(sc->sc_udev, index, &cdescr); if (err) - return 0; + break; len = UGETW(cdescr.wTotalLength); - DPRINTFN(5, "index=%jd, len=%jd", index, len, 0, 0); - if (lenp) - *lenp = len; cdesc = kmem_alloc(len, KM_SLEEP); err = usbd_get_config_desc_full(sc->sc_udev, index, cdesc, len); if (err) { kmem_free(cdesc, len); - return 0; + cdesc = NULL; } + break; } + DPRINTFN(5, "req len=%jd cdesc=%jx", len, (uintptr_t)cdesc, 0, 0); + if (cdesc && lenp) + *lenp = len; return cdesc; } @@ -1669,12 +1677,12 @@ ugen_do_ioctl(struct ugen_softc *sc, int int error; int dir; - UGENHIST_FUNC(); UGENHIST_CALLED(); + UGENHIST_FUNC(); + UGENHIST_CALLARGS("ugen%d: endpt=%ju cmd=%08jx flag=%jx", + device_unit(sc->sc_dev), endpt, cmd, flag); KASSERT(KERNEL_LOCKED_P()); /* ugen_set_config */ - DPRINTFN(5, "cmd=%08jx", cmd, 0, 0, 0); - switch (cmd) { case FIONBIO: /* All handled in the upper FS layer. */ @@ -1690,6 +1698,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int sce->state |= UGEN_SHORT_OK; else sce->state &= ~UGEN_SHORT_OK; + DPRINTFN(5, "pipe=%jx short xfer=%ju", + (uintptr_t)sce->pipeh, sce->state & UGEN_SHORT_OK, 0, 0); return 0; case USB_SET_TIMEOUT: for (dir = OUT; dir <= IN; dir++) { @@ -1698,6 +1708,8 @@ ugen_do_ioctl(struct ugen_softc *sc, int return EINVAL; sce->timeout = *(int *)addr; + DPRINTFN(5, "pipe=%jx timeout[dir=%ju] timeout=%ju", + (uintptr_t)sce->pipeh, dir, sce->timeout, 0); } return 0; case USB_SET_BULK_RA: Index: src/sys/dev/usb/ums.c diff -u src/sys/dev/usb/ums.c:1.103 src/sys/dev/usb/ums.c:1.104 --- src/sys/dev/usb/ums.c:1.103 Mon Mar 28 12:44:17 2022 +++ src/sys/dev/usb/ums.c Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ums.c,v 1.103 2022/03/28 12:44:17 riastradh Exp $ */ +/* $NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $ */ /* * Copyright (c) 1998, 2017 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.103 2022/03/28 12:44:17 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.104 2023/07/20 20:00:34 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -48,6 +48,7 @@ __KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.10 #include <sys/ioctl.h> #include <sys/file.h> #include <sys/select.h> +#include <sys/sysctl.h> #include <sys/proc.h> #include <sys/vnode.h> #include <sys/poll.h> @@ -60,18 +61,60 @@ __KERNEL_RCSID(0, "$NetBSD: ums.c,v 1.10 #include <dev/usb/usbdevs.h> #include <dev/usb/usb_quirks.h> #include <dev/usb/uhidev.h> +#include <dev/usb/usbhist.h> #include <dev/hid/hid.h> #include <dev/hid/hidms.h> -#ifdef UMS_DEBUG -#define DPRINTF(x) if (umsdebug) printf x -#define DPRINTFN(n,x) if (umsdebug>(n)) printf x -int umsdebug = 0; +#ifdef USB_DEBUG +#ifndef UMS_DEBUG +#define umsdebug 0 #else -#define DPRINTF(x) -#define DPRINTFN(n,x) + +#ifndef UMS_DEBUG_DEFAULT +#define UMS_DEBUG_DEFAULT 0 #endif +static int umsdebug = UMS_DEBUG_DEFAULT; + +SYSCTL_SETUP(sysctl_hw_ums_setup, "sysctl hw.ums setup") +{ + int err; + const struct sysctlnode *rnode; + const struct sysctlnode *cnode; + + err = sysctl_createv(clog, 0, NULL, &rnode, + CTLFLAG_PERMANENT, CTLTYPE_NODE, "ums", + SYSCTL_DESCR("ums global controls"), + NULL, 0, NULL, 0, CTL_HW, CTL_CREATE, CTL_EOL); + + if (err) + goto fail; + + /* control debugging printfs */ + err = sysctl_createv(clog, 0, &rnode, &cnode, + CTLFLAG_PERMANENT|CTLFLAG_READWRITE, CTLTYPE_INT, + "debug", SYSCTL_DESCR("Enable debugging output"), + NULL, 0, &umsdebug, sizeof(umsdebug), CTL_CREATE, CTL_EOL); + if (err) + goto fail; + + return; +fail: + aprint_error("%s: sysctl_createv failed (err = %d)\n", __func__, err); +} + +#endif /* UMS_DEBUG */ +#endif /* USB_DEBUG */ + +#define DPRINTF(FMT,A,B,C,D) USBHIST_LOGN(umsdebug,1,FMT,A,B,C,D) +#define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(umsdebug,N,FMT,A,B,C,D) +#define UMSHIST_FUNC() USBHIST_FUNC() +#define UMSHIST_CALLED(name) USBHIST_CALLED(umsdebug) +#define UMSHIST_CALLARGS(FMT,A,B,C,D) \ + USBHIST_CALLARGS(umsdebug,FMT,A,B,C,D) +#define UMSHIST_CALLARGSN(N,FMT,A,B,C,D) \ + USBHIST_CALLARGSN(umsdebug,N,FMT,A,B,C,D) + #define UMSUNIT(s) (minor(s)) struct ums_softc { @@ -273,7 +316,9 @@ ums_detach(device_t self, int flags) struct ums_softc *sc = device_private(self); int rv = 0; - DPRINTF(("ums_detach: sc=%p flags=%d\n", sc, flags)); + UMSHIST_FUNC(); + UMSHIST_CALLARGS("ums_detach: sc=%qd flags=%qd\n", + (uintptr_t)sc, flags, 0, 0); if (sc->sc_alwayson) uhidev_close(sc->sc_hdev); @@ -302,7 +347,7 @@ ums_enable(void *v) struct ums_softc *sc = v; int error = 0; - DPRINTFN(1,("ums_enable: sc=%p\n", sc)); + UMSHIST_FUNC(); UMSHIST_CALLARGS("sc=%jx\n", (uintptr_t)sc, 0, 0, 0); if (sc->sc_dying) return EIO; @@ -327,7 +372,8 @@ ums_disable(void *v) { struct ums_softc *sc = v; - DPRINTFN(1,("ums_disable: sc=%p\n", sc)); + UMSHIST_FUNC(); UMSHIST_CALLARGS("sc=%jx\n", (uintptr_t)sc, 0, 0, 0); + #ifdef DIAGNOSTIC if (!sc->sc_enabled) { printf("ums_disable: not enabled\n"); Index: src/sys/dev/usb/usb.c diff -u src/sys/dev/usb/usb.c:1.200 src/sys/dev/usb/usb.c:1.201 --- src/sys/dev/usb/usb.c:1.200 Sun Mar 13 11:28:52 2022 +++ src/sys/dev/usb/usb.c Thu Jul 20 20:00:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.200 2022/03/13 11:28:52 riastradh Exp $ */ +/* $NetBSD: usb.c,v 1.201 2023/07/20 20:00:34 mrg Exp $ */ /* * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.200 2022/03/13 11:28:52 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.201 2023/07/20 20:00:34 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -100,7 +100,11 @@ USBHIST_DEFINE(usbhist) = KERNHIST_INITI */ int usb_noexplore = 0; -int usbdebug = 0; +#ifndef USB_DEBUG_DEFAULT +#define USB_DEBUG_DEFAULT 0 +#endif + +int usbdebug = USB_DEBUG_DEFAULT; SYSCTL_SETUP(sysctl_hw_usb_setup, "sysctl hw.usb setup") { int err;