Get bored with hard coded debug level variables and introduce a debug.usb

sysctl tree for tweaking them real-time.

Reviewed by:	iedowse
This commit is contained in:
Josef Karthauser 2002-07-31 13:33:55 +00:00
parent 7fc37b7c09
commit 0e6b196686
20 changed files with 58 additions and 17 deletions

View File

@ -66,6 +66,7 @@
#include <sys/conf.h>
#endif
#include <sys/poll.h>
#include <sys/sysctl.h>
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/audioio.h>
@ -89,6 +90,8 @@
#define DPRINTF(x) if (uaudiodebug) logprintf x
#define DPRINTFN(n,x) if (uaudiodebug>(n)) logprintf x
int uaudiodebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, uaudio, CTLFLAG_RW,
&uaudiodebug, 0, "uaudio debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -64,6 +64,7 @@
#endif
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <machine/endian.h>
@ -93,6 +94,8 @@ struct cfdriver ohci_cd = {
#define DPRINTF(x) if (ohcidebug) logprintf x
#define DPRINTFN(n,x) if (ohcidebug>(n)) logprintf x
int ohcidebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, ohci, CTLFLAG_RW,
&ohcidebug, 0, "ohci debug level");
#ifndef __NetBSD__
#define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
#endif

View File

@ -88,6 +88,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbcdc.h>
@ -100,14 +101,9 @@
#include <dev/usb/ucomvar.h>
#ifdef UCOM_DEBUG
#include <sys/sysctl.h>
static int ucomdebug = 1;
SYSCTL_NODE(_debug, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging");
SYSCTL_INT(_debug_usb, OID_AUTO, ucom, CTLFLAG_RW,
&ucomdebug, 0, "ucom debug level");
#define DPRINTF(x) do { \
if (ucomdebug) \
logprintf x; \

View File

@ -87,6 +87,7 @@
#include <sys/socket.h>
#include <sys/ctype.h>
#include <sys/errno.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <dev/usb/usb.h>
@ -107,6 +108,8 @@
#define DPRINTF(x) if (udbpdebug) logprintf x
#define DPRINTFN(n,x) if (udbpdebug>(n)) logprintf x
int udbpdebug = 9;
SYSCTL_INT(_debug_usb, OID_AUTO, udbp, CTLFLAG_RW,
&udbpdebug, 0, "udbp debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -55,6 +55,7 @@
#endif
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -67,6 +68,8 @@
#define DPRINTF(x) if (ufmdebug) logprintf x
#define DPRINTFN(n,x) if (ufmdebug>(n)) logprintf x
int ufmdebug = 100;
SYSCTL_INT(_debug_usb, OID_AUTO, ufm, CTLFLAG_RW,
&ufmdebug, 0, "ufm debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -63,6 +63,7 @@
#endif
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -72,6 +73,8 @@
#define DPRINTF(x) if (ugendebug) logprintf x
#define DPRINTFN(n,x) if (ugendebug>(n)) logprintf x
int ugendebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, ugen, CTLFLAG_RW,
&ugendebug, 0, "ugen debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -66,6 +66,7 @@
#endif
#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
#include <machine/bus.h>
#include <machine/endian.h>
@ -102,6 +103,8 @@ uhci_softc_t *thesc;
#define DPRINTFN(n,x) if (uhcidebug>(n)) printf x
int uhcidebug = 0;
int uhcinoloop = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, uhci, CTLFLAG_RW,
&uhcidebug, 0, "uhci debug level");
#ifndef __NetBSD__
#define bitmask_snprintf(q,f,b,l) snprintf((b), (l), "%b", (q), (f))
#endif

View File

@ -70,6 +70,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@ -86,6 +87,8 @@
#define DPRINTF(x) if (uhiddebug) logprintf x
#define DPRINTFN(n,x) if (uhiddebug>(n)) logprintf x
int uhiddebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, uhid, CTLFLAG_RW,
&uhiddebug, 0, "uhid debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -57,6 +57,7 @@
#include <sys/select.h>
#endif
#include <sys/vnode.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@ -79,6 +80,8 @@
#define DPRINTF(x) if (ukbddebug) logprintf x
#define DPRINTFN(n,x) if (ukbddebug>(n)) logprintf x
int ukbddebug = 1;
SYSCTL_INT(_debug_usb, OID_AUTO, ukbd, CTLFLAG_RW,
&ukbddebug, 0, "ukbd debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -58,6 +58,7 @@
#include <sys/conf.h>
#include <sys/vnode.h>
#include <sys/syslog.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -75,6 +76,8 @@
#define DPRINTF(x) if (ulptdebug) logprintf x
#define DPRINTFN(n,x) if (ulptdebug>(n)) logprintf x
int ulptdebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, ulpt, CTLFLAG_RW,
&ulptdebug, 0, "ulpt debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -104,6 +104,7 @@
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -134,6 +135,8 @@
#define UDMASS_WIRE (UDMASS_BBB|UDMASS_CBI)
#define UDMASS_ALL 0xffff0000 /* all of the above */
int umassdebug = UDMASS_ALL;
SYSCTL_INT(_debug_usb, OID_AUTO, umass, CTLFLAG_RW,
&umassdebug, 0, "umass debug level");
#else
#define DIF(m, x) /* nop */
#define DPRINTF(m, x) /* nop */

View File

@ -75,6 +75,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbcdc.h>
@ -90,6 +91,8 @@
#define DPRINTF(x) if(umodemdebug) logprintf x
#define DPRINTFN(n, x) if(umodemdebug > (n)) logprintf x
int umodemdebug = 1;
SYSCTL_INT(_debug_usb, OID_AUTO, umodem, CTLFLAG_RW,
&umodemdebug, 0, "umodem debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n, x)

View File

@ -58,6 +58,7 @@
#endif
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@ -74,6 +75,8 @@
#define DPRINTF(x) if (umsdebug) logprintf x
#define DPRINTFN(n,x) if (umsdebug>(n)) logprintf x
int umsdebug = 1;
SYSCTL_INT(_debug_usb, OID_AUTO, ums, CTLFLAG_RW,
&umsdebug, 0, "ums debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -89,6 +89,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbcdc.h>
@ -101,11 +102,7 @@
#include <dev/usb/ucomvar.h>
#ifdef UPLCOM_DEBUG
#include <sys/sysctl.h>
static int uplcomdebug = 1;
SYSCTL_DECL(_debug_usb);
SYSCTL_INT(_debug_usb, OID_AUTO, uplcom, CTLFLAG_RW,
&uplcomdebug, 0, "uplcom debug level");

View File

@ -67,6 +67,7 @@
#endif
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -79,6 +80,8 @@
#define DPRINTF(x) if (uriodebug) logprintf x
#define DPRINTFN(n,x) if (uriodebug>(n)) logprintf x
int uriodebug = 100;
SYSCTL_INT(_debug_usb, OID_AUTO, urio, CTLFLAG_RW,
&uriodebug, 0, "urio debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -70,6 +70,7 @@
#endif
#include <sys/vnode.h>
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -91,10 +92,17 @@ MALLOC_DEFINE(M_USBHC, "USBHC", "USB host controller");
#include <dev/usb/usbdivar.h>
#include <dev/usb/usb_quirks.h>
/* Define this unconditionally in case a kernel module is loaded that
* has been compiled with debugging options.
*/
SYSCTL_NODE(_debug, OID_AUTO, usb, CTLFLAG_RW, 0, "USB debugging");
#ifdef USB_DEBUG
#define DPRINTF(x) if (usbdebug) logprintf x
#define DPRINTFN(n,x) if (usbdebug>(n)) logprintf x
int usbdebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, usb, CTLFLAG_RW,
&usbdebug, 0, "usb debug level");
#ifdef UHCI_DEBUG
extern int uhcidebug;
#endif

View File

@ -532,6 +532,10 @@ __CONCAT(dname,_detach)(device_t self)
*/
#define logprintf printf
#ifdef SYSCTL_DECL
SYSCTL_DECL(_debug_usb);
#endif
#endif /* __FreeBSD__ */
#endif /* _USB_PORT_H */

View File

@ -64,6 +64,7 @@
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/conf.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -75,6 +76,8 @@
#define DPRINTF(x) if (uscannerdebug) logprintf x
#define DPRINTFN(n,x) if (uscannerdebug>(n)) logprintf x
int uscannerdebug = 0;
SYSCTL_INT(_debug_usb, OID_AUTO, uscanner, CTLFLAG_RW,
&uscannerdebug, 0, "uscanner debug level");
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -64,6 +64,7 @@
#endif
#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@ -78,10 +79,8 @@
#define DPRINTF(x) if (uvisordebug) printf x
#define DPRINTFN(n,x) if (uvisordebug>(n)) printf x
int uvisordebug = 0;
#ifdef SYSCTL_DECL
SYSCTL_INT(_debug_usb, OID_AUTO, uvisor, CTLFLAG_RW,
&uvisordebug, 0, "uvisor debug level");
#endif
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)

View File

@ -57,6 +57,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbcdc.h>
@ -70,14 +71,8 @@
#ifdef UVSCOM_DEBUG
static int uvscomdebug = 1;
#if defined(__FreeBSD__)
#include <sys/sysctl.h>
SYSCTL_DECL(_debug_usb);
SYSCTL_INT(_debug_usb, OID_AUTO, uvscom, CTLFLAG_RW,
&uvscomdebug, 0, "uvscom debug level");
#endif
#define DPRINTFN(n, x) do { \
if (uvscomdebug > (n)) \