Date: Mon, 21 Mar 2011 21:34:12 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r219848 - head/sys/dev/usb/input Message-ID: <201103212134.p2LLYCqO021527@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Mar 21 21:34:12 2011 New Revision: 219848 URL: http://svn.freebsd.org/changeset/base/219848 Log: - Do not output the trailing newline to the HID report descriptor information, sysctl utility will show it for us. - Modify sysctl node description to make it more understanable. Found by: Alexander Best <arundel@freebsd.org> Submitted by: Eygene Ryabinkin <rea@freebsd.org> MFC after: 14 days Approved by: thompsa (mentor) Modified: head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Mon Mar 21 21:31:50 2011 (r219847) +++ head/sys/dev/usb/input/ums.c Mon Mar 21 21:34:12 2011 (r219848) @@ -668,7 +668,7 @@ ums_attach(device_t 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"); + "", "Dump of parsed HID report descriptor"); return (0); @@ -949,10 +949,10 @@ ums_sysctl_handler_parseinfo(SYSCTL_HAND struct ums_softc *sc = arg1; struct ums_info *info; struct sbuf *sb; - int i, j, err; + int i, j, err, had_output; sb = sbuf_new_auto(); - for (i = 0; i < UMS_INFO_MAX; i++) { + for (i = 0, had_output = 0; i < UMS_INFO_MAX; i++) { info = &sc->sc_info[i]; /* Don't emit empty info */ @@ -962,6 +962,9 @@ ums_sysctl_handler_parseinfo(SYSCTL_HAND info->sc_buttons == 0) continue; + if (had_output) + sbuf_printf(sb, "\n"); + had_output = 1; 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;", @@ -995,7 +998,6 @@ ums_sysctl_handler_parseinfo(SYSCTL_HAND (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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103212134.p2LLYCqO021527>