From owner-svn-src-stable@FreeBSD.ORG Thu Oct 29 23:28:48 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C3E5410656A3; Thu, 29 Oct 2009 23:28:48 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AF34C8FC28; Thu, 29 Oct 2009 23:28:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n9TNSmKC016203; Thu, 29 Oct 2009 23:28:48 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n9TNSmOP016201; Thu, 29 Oct 2009 23:28:48 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <200910292328.n9TNSmOP016201@svn.freebsd.org> From: Andrew Thompson Date: Thu, 29 Oct 2009 23:28:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r198664 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/usb/input dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2009 23:28:49 -0000 Author: thompsa Date: Thu Oct 29 23:28:48 2009 New Revision: 198664 URL: http://svn.freebsd.org/changeset/base/198664 Log: MFC r198373 Allow dumping the USB mouse reports via 'sysctl -b dev.ums.N.parseinfo', previously only available via bootverbose. PR: usb/137191 Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/usb/input/ums.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/input/ums.c ============================================================================== --- stable/8/sys/dev/usb/input/ums.c Thu Oct 29 23:28:21 2009 (r198663) +++ stable/8/sys/dev/usb/input/ums.c Thu Oct 29 23:28:48 2009 (r198664) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -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[] = {