summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-11-17 14:08:48 +0000
committerjoe <joe@FreeBSD.org>2002-11-17 14:08:48 +0000
commit0108ac9770c5eb5fcd7297c143321acdb66b53c2 (patch)
tree4d1ecd58898ce30f4340afee9b803d42b3194231 /sys/dev/usb
parent86cc001c1b24d69bc74bfb49088aeac544a92e30 (diff)
downloadFreeBSD-src-0108ac9770c5eb5fcd7297c143321acdb66b53c2.zip
FreeBSD-src-0108ac9770c5eb5fcd7297c143321acdb66b53c2.tar.gz
Use a sysctl for controlling the debugging output.
Submitted by: akiyama
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/uftdi.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c
index c7179d4..bb9a4e8 100644
--- a/sys/dev/usb/uftdi.c
+++ b/sys/dev/usb/uftdi.c
@@ -65,6 +65,8 @@
#include <sys/select.h>
#endif
+#include <sys/sysctl.h>
+
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@@ -76,10 +78,21 @@
#include <dev/usb/uftdireg.h>
-#ifdef UFTDI_DEBUG
-#define DPRINTF(x) if (uftdidebug) printf x
-#define DPRINTFN(n,x) if (uftdidebug>(n)) printf x
-int uftdidebug = 0;
+#ifdef USB_DEBUG
+static int uftdidebug = 0;
+SYSCTL_NODE(_hw_usb, OID_AUTO, uftdi, CTLFLAG_RW, 0, "USB uftdi");
+SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debug, CTLFLAG_RW,
+ &uftdidebug, 0, "uftdi debug level");
+#define DPRINTF(x) do { \
+ if (uftdidebug) \
+ logprintf x; \
+ } while (0)
+
+#define DPRINTFN(n, x) do { \
+ if (uftdidebug > (n)) \
+ logprintf x; \
+ } while (0)
+
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
@@ -294,7 +307,7 @@ USB_DETACH(uftdi)
int rv = 0;
- DPRINTF(("uftdi_detach: sc=%p flags=%d\n", sc, flags));
+ DPRINTF(("uftdi_detach: sc=%p\n", sc));
sc->sc_dying = 1;
rv = ucom_detach(&sc->sc_ucom);
@@ -355,7 +368,7 @@ uftdi_read(void *vsc, int portno, u_char **ptr, u_int32_t *count)
msr = FTDI_GET_MSR(*ptr);
lsr = FTDI_GET_LSR(*ptr);
-#ifdef UFTDI_DEBUG
+#ifdef USB_DEBUG
if (*count != 2)
DPRINTFN(10,("uftdi_read: sc=%p, port=%d count=%d data[0]="
"0x%02x\n", sc, portno, *count, (*ptr)[2]));
OpenPOWER on IntegriCloud