diff options
-rw-r--r-- | usr.bin/sendbug/sendbug.1 | 6 | ||||
-rw-r--r-- | usr.bin/sendbug/sendbug.c | 33 |
2 files changed, 32 insertions, 7 deletions
diff --git a/usr.bin/sendbug/sendbug.1 b/usr.bin/sendbug/sendbug.1 index e4508432a47..37280de8556 100644 --- a/usr.bin/sendbug/sendbug.1 +++ b/usr.bin/sendbug/sendbug.1 @@ -1,9 +1,9 @@ -.\" $OpenBSD: sendbug.1,v 1.19 2009/06/10 06:46:53 jmc Exp $ +.\" $OpenBSD: sendbug.1,v 1.20 2010/04/20 19:05:03 sthen Exp $ .\" .\" Written by Raymond Lai <ray@cyth.net>. .\" Public domain. .\" -.Dd $Mdocdate: June 10 2009 $ +.Dd $Mdocdate: April 20 2010 $ .Dt SENDBUG 1 .Os .Sh NAME @@ -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 diff --git a/usr.bin/sendbug/sendbug.c b/usr.bin/sendbug/sendbug.c index 780190615c4..cabe2dd6c8a 100644 --- a/usr.bin/sendbug/sendbug.c +++ b/usr.bin/sendbug/sendbug.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendbug.c,v 1.64 2010/03/23 19:19:53 deraadt Exp $ */ +/* $OpenBSD: sendbug.c,v 1.65 2010/04/20 19:05:03 sthen Exp $ */ /* * Written by Ray Lai <ray@cyth.net>. @@ -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); } |