Date: Thu, 22 Oct 2009 21:00:10 GMT From: dfilter@FreeBSD.ORG (dfilter service) To: freebsd-usb@FreeBSD.org Subject: Re: usb/137191: commit references a PR Message-ID: <200910222100.n9ML0Aci034535@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR usb/137191; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: usb/137191: commit references a PR Date: Thu, 22 Oct 2009 20:54:14 +0000 (UTC) Author: thompsa Date: Thu Oct 22 20:54:01 2009 New Revision: 198373 URL: http://svn.freebsd.org/changeset/base/198373 Log: Allow dumping the USB mouse reports via 'sysctl -b dev.ums.N.parseinfo', previously only available via bootverbose. PR: usb/137191 Submitted by: Eygene Ryabinkin Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Thu Oct 22 20:44:55 2009 (r198372) +++ head/sys/dev/usb/input/ums.c Thu Oct 22 20:54:01 2009 (r198373) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include <sys/priv.h> #include <sys/conf.h> #include <sys/fcntl.h> +#include <sys/sbuf.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> @@ -161,7 +162,9 @@ static usb_fifo_open_t ums_open; static usb_fifo_close_t ums_close; static usb_fifo_ioctl_t ums_ioctl; -static void ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy, int32_t dz, int32_t dt, int32_t buttons); +static void ums_put_queue(struct ums_softc *, int32_t, int32_t, + int32_t, int32_t, int32_t); +static int ums_sysctl_handler_parseinfo(SYSCTL_HANDLER_ARGS); static struct usb_fifo_methods ums_fifo_methods = { .f_open = &ums_open, @@ -643,6 +646,12 @@ ums_attach(device_t dev) if (err) { goto detach; } + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), + OID_AUTO, "parseinfo", CTLTYPE_STRING|CTLFLAG_RD, + sc, 0, ums_sysctl_handler_parseinfo, + "", "Dump UMS report parsing information"); + return (0); detach: @@ -916,6 +925,67 @@ done: return (error); } +static int +ums_sysctl_handler_parseinfo(SYSCTL_HANDLER_ARGS) +{ + struct ums_softc *sc = arg1; + struct ums_info *info; + struct sbuf *sb; + int i, j, err; + + sb = sbuf_new_auto(); + for (i = 0; i < UMS_INFO_MAX; i++) { + info = &sc->sc_info[i]; + + /* Don't emit empty info */ + if ((info->sc_flags & + (UMS_FLAG_X_AXIS | UMS_FLAG_Y_AXIS | UMS_FLAG_Z_AXIS | + UMS_FLAG_T_AXIS | UMS_FLAG_W_AXIS)) == 0 && + info->sc_buttons == 0) + continue; + + sbuf_printf(sb, "i%d:", i + 1); + if (info->sc_flags & UMS_FLAG_X_AXIS) + sbuf_printf(sb, " X:r%d, p%d, s%d;", + (int)info->sc_iid_x, + (int)info->sc_loc_x.pos, + (int)info->sc_loc_x.size); + if (info->sc_flags & UMS_FLAG_Y_AXIS) + sbuf_printf(sb, " Y:r%d, p%d, s%d;", + (int)info->sc_iid_y, + (int)info->sc_loc_y.pos, + (int)info->sc_loc_y.size); + if (info->sc_flags & UMS_FLAG_Z_AXIS) + sbuf_printf(sb, " Z:r%d, p%d, s%d;", + (int)info->sc_iid_z, + (int)info->sc_loc_z.pos, + (int)info->sc_loc_z.size); + if (info->sc_flags & UMS_FLAG_T_AXIS) + sbuf_printf(sb, " T:r%d, p%d, s%d;", + (int)info->sc_iid_t, + (int)info->sc_loc_t.pos, + (int)info->sc_loc_t.size); + if (info->sc_flags & UMS_FLAG_W_AXIS) + sbuf_printf(sb, " W:r%d, p%d, s%d;", + (int)info->sc_iid_w, + (int)info->sc_loc_w.pos, + (int)info->sc_loc_w.size); + + for (j = 0; j < info->sc_buttons; j++) { + sbuf_printf(sb, " B%d:r%d, p%d, s%d;", j + 1, + (int)info->sc_iid_btn[j], + (int)info->sc_loc_btn[j].pos, + (int)info->sc_loc_btn[j].size); + } + sbuf_printf(sb, "\n"); + } + sbuf_finish(sb); + err = SYSCTL_OUT(req, sbuf_data(sb), sbuf_len(sb) + 1); + sbuf_delete(sb); + + return (err); +} + static devclass_t ums_devclass; static device_method_t ums_methods[] = { _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200910222100.n9ML0Aci034535>