On 2010/04/20 15:31, Miod Vallat wrote:
> > I think this makes dmesg uglier.  The information is easily available
> > from usbdevs(8).
> 
> This argues for sendbug(1) adding the output of `usbdevs -v'.

That makes sense to me. Tested on simh-vax and amd64.

Index: sendbug.1
===================================================================
RCS file: /cvs/src/usr.bin/sendbug/sendbug.1,v
retrieving revision 1.19
diff -u -p -r1.19 sendbug.1
--- sendbug.1   10 Jun 2009 06:46:53 -0000      1.19
+++ sendbug.1   20 Apr 2010 16:58:48 -0000
@@ -22,6 +22,7 @@ A template PR is opened in a text editor
 with some system information already filled in,
 such as machine architecture,
 .Xr dmesg 8 ,
+.Xr usbdevs 8 ,
 .Xr pcidump 8 ,
 and
 .Xr acpidump 8 .
@@ -63,6 +64,7 @@ The options are as follows:
 .It Fl D
 Do not attach
 .Xr dmesg 8 ,
+.Xr usbdevs 8 ,
 .Xr pcidump 8 ,
 and
 .Xr acpidump 8
Index: sendbug.c
===================================================================
RCS file: /cvs/src/usr.bin/sendbug/sendbug.c,v
retrieving revision 1.64
diff -u -p -r1.64 sendbug.c
--- sendbug.c   23 Mar 2010 19:19:53 -0000      1.64
+++ sendbug.c   20 Apr 2010 16:58:48 -0000
@@ -42,6 +42,7 @@ int   prompt(void);
 int    send_file(const char *, int);
 int    sendmail(const char *);
 void   template(FILE *);
+void   usbdevs(FILE *);
 
 const char *categories = "system user library documentation kernel "
     "alpha amd64 arm hppa i386 m68k m88k mips64 powerpc sh sparc sparc64 vax";
@@ -230,6 +231,26 @@ dmesg(FILE *fp)
        fclose(dfp);
 }
 
+void
+usbdevs(FILE *ofp)
+{
+       char buf[BUFSIZ];
+       FILE *ifp;
+       size_t len;
+
+       if ((ifp = popen("usbdevs -v", "r")) != NULL) {
+               while (!feof(ifp)) {
+                       len = fread(buf, 1, sizeof buf, ifp);
+                       if (len == 0)
+                               break;
+                       if (fwrite(buf, 1, len, ofp) != len)
+                               break;
+               }
+               pclose(ofp);
+       }
+       pclose(ifp);
+}
+
 /*
  * Execute an editor on the specified pathname, which is interpreted
  * from the shell.  This means flags may be included.
@@ -555,12 +576,14 @@ template(FILE *fp)
                if (!root)
                        fprintf(fp, "SENDBUG: Run sendbug as root "
                            "if this is an ACPI report!\n");
-               fprintf(fp, "SENDBUG: dmesg%s attached.\n"
-                   "SENDBUG: Feel free to delete or use the -D flag if it "
-                   "contains sensitive information.\n",
-                   root ? ", pcidump, and acpidump are" : " is");
+               fprintf(fp, "SENDBUG: dmesg%s and usbdevs are attached.\n"
+                   "SENDBUG: Feel free to delete or use the -D flag if they "
+                   "contain sensitive information.\n",
+                   root ? ", pcidump, acpidump" : "");
                fputs("\ndmesg:\n", fp);
                dmesg(fp);
+               fputs("\nusbdevs:\n", fp);
+               usbdevs(fp);
                if (root)
                        hwdump(fp);
        }

Reply via email to