svn commit: r220310 - stable/8/sys/dev/usb/input

Hans Petter Selasky hselasky at FreeBSD.org
Sun Apr 3 22:21:41 UTC 2011


Author: hselasky
Date: Sun Apr  3 22:21:40 2011
New Revision: 220310
URL: http://svn.freebsd.org/changeset/base/220310

Log:
  MFC r219848.
  - Update format of sysctl node.
  
  Approved by:	thompsa (mentor)

Modified:
  stable/8/sys/dev/usb/input/ums.c
Directory Properties:
  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)

Modified: stable/8/sys/dev/usb/input/ums.c
==============================================================================
--- stable/8/sys/dev/usb/input/ums.c	Sun Apr  3 22:15:00 2011	(r220309)
+++ stable/8/sys/dev/usb/input/ums.c	Sun Apr  3 22:21:40 2011	(r220310)
@@ -669,7 +669,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);
 
@@ -950,10 +950,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 */
@@ -963,6 +963,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;",
@@ -996,7 +999,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);


More information about the svn-src-stable-8 mailing list