USB modules (4.x) and debug levels
Barry Bouwsma
freebsd-misuser at remove-NOSPAM-to-reply.NOSPAM.dyndns.dk
Thu Dec 2 02:39:29 PST 2004
[feel free to drop me from replies, or the hostname part of this IPv6-
only address if you don't have IPv6 mail connectivity]
Moin,
I'm reviewing the differences between my hacked USB code and the
latest I've downloaded, and I see that I've added the following
(in a reversed diff; cut'n'paste no less, to make it useless)
--- uhub.c Thu Sep 23 14:21:29 2004
+++ uhub.c-pre-4.11 Wed Nov 24 19:55:46 2004
@@ -67,19 +67,6 @@
#define UHUB_INTR_INTERVAL 255 /* ms */
-/* XXX Hm, seems like it's impossible to enable debugging in kernel
- modules without explicitly recompiling... Looks as if the
- default of 0 doesn't do anything disruptive, so let's play
- like firewire and always define these too... */
- /* Stolen from my hack to usb.c */
-int uhubdebug = 0;
-SYSCTL_NODE(_hw_usb, OID_AUTO, uhub, CTLFLAG_RW, 0, "USB uhub");
-SYSCTL_INT(_hw_usb_uhub, OID_AUTO, debug, CTLFLAG_RW,
- &uhubdebug, 0, "uhub debug level");
-#define DPRINTF(x) if (uhubdebug) logprintf x
-#define DPRINTFN(n,x) if (uhubdebug>(n)) logprintf x
-
-#if 0 /* XXX HACK */
#ifdef USB_DEBUG
#define DPRINTF(x) if (uhubdebug) logprintf x
#define DPRINTFN(n,x) if (uhubdebug>(n)) logprintf x
@@ -91,7 +78,6 @@
@@ -91,7 +78,6 @@
#define DPRINTF(x)
#define DPRINTFN(n,x)
#endif
-#endif /* HAXK */
struct uhub_softc {
USBBASEDEVICE sc_dev; /* base device */
Basically, my problem is (as per the comment) that I build my USB
support as modules, under 4.x, which as far as I know, does not
pay attention to what I may have defined in my kernel config file.
So I basically stole the code from firewire, where it seems that
debugging via sysctl is always available...
debug.firewire_debug: 0
debug.fwmem_debug: 0
debug.sbp_debug: 1
Then I have at hand a tunable, should I want to enable debugging
with my USB modules...
hw.usb.uhub.debug: 0
hw.usb.debug: 0
(I've probably done the same for uhci/ehci/ohci but haven't merged
this hack into the latest code I'm trying)
Does it seem to anyone else to be a good idea to enable dynamic
debug tuning this way (or a more correct debug.usb_debug-like
thing), particularly for kernel modules, instead of requiring
the sufferer to rebuild the kernel and/or modules?
thanks
barry bouwsma
More information about the freebsd-usb
mailing list