summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-09-10 22:11:45 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-09-10 22:11:45 +0000
commit30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada (patch)
tree707457fa3183ceaaf46699b6e2ded1623a734e64
parentd08f86da74f77533e48d79f3d3f14144583d8b5a (diff)
downloadldetect-30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada.tar
ldetect-30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada.tar.gz
ldetect-30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada.tar.bz2
ldetect-30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada.tar.xz
ldetect-30b8e72afa22a7ff5a72370e4dc0cfbe0a329ada.zip
add "-v" and "-f" options to lspcidrake for (v)erbose mode and (f)ull probe
-rw-r--r--ldetect.spec8
-rw-r--r--lspcidrake.c45
2 files changed, 48 insertions, 5 deletions
diff --git a/ldetect.spec b/ldetect.spec
index 3bed138..fc2feee 100644
--- a/ldetect.spec
+++ b/ldetect.spec
@@ -1,7 +1,7 @@
# !! DON'T MODIFY HERE, MODIFY IN THE CVS !!
%define name ldetect
-%define version 0.2.3
-%define release 14mdk
+%define version 0.2.4
+%define release 1mdk
Name: %{name}
Version: %{version}
@@ -53,6 +53,10 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/*
%changelog
+* Tue Sep 11 2001 Guillaume Cottenceau <gc@mandrakesoft.com> 0.2.4-1mdk
+- add "-v" and "-f" options to lspcidrake for (v)erbose mode and (f)ull
+ probe
+
* Wed Aug 29 2001 Pixel <pixel@mandrakesoft.com> 0.2.3-14mdk
- fix when 2 similar devices are there
diff --git a/lspcidrake.c b/lspcidrake.c
index 4bb987f..b17d184 100644
--- a/lspcidrake.c
+++ b/lspcidrake.c
@@ -3,15 +3,41 @@
#include <string.h>
#include "libldetect.h"
+int verboze = 0;
+int full_probe = 0;
+
+void usage(void) {
+ printf("usage: lspcidrake [-v] [-f]\n");
+ exit(0);
+}
+
+void print_name(struct pciusb_entry e) {
+ printf("%-16s: ", e.module ? e.module : "unknown");
+ if (e.text)
+ printf(e.text);
+ else
+ printf("unknown (%04x/%04x/%04x/%04x)", e.vendor, e.device, e.subvendor, e.subdevice);
+}
+
+void print_id(struct pciusb_entry e) {
+ if (verboze && e.text) {
+ printf(" (vendor:%04x device:%04x", e.vendor, e.device);
+ if (e.subvendor != 0xffff || e.subdevice != 0xffff)
+ printf(" subv:%04x subd:%04x", e.subvendor, e.subdevice);
+ printf(")");
+ }
+}
+
void pci_printit(struct pciusb_entries entries) {
int i;
for (i = 0; i < entries.nb; i++) {
struct pciusb_entry e = entries.entries[i];
- printf("%-16s: %s", e.module ? e.module : "unknown", e.text);
+ print_name(e);
if (e.class) {
const char *class = pci_class2text(e.class);
if (strcmp(class, "NOT_DEFINED") != 0) printf(" [%s]", class);
}
+ print_id(e);
printf("\n");
}
}
@@ -20,15 +46,28 @@ void usb_printit(struct pciusb_entries entries) {
int i;
for (i = 0; i < entries.nb; i++) {
struct pciusb_entry e = entries.entries[i];
- printf("%-16s: %s", e.module ? e.module : "unknown", e.text);
+ print_name(e);
if (e.class) printf(" [%s]", usb_class2text(e.class));
+ print_id(e);
printf("\n");
}
}
int main(int argc, char **argv) {
+ char ** ptr = argv;
+ while (ptr && *ptr) {
+ if (!strcmp(*ptr, "-h") || !strcmp(*ptr, "--help"))
+ usage();
+ if (!strcmp(*ptr, "-v")) {
+ verboze = 1;
+ full_probe = 1;
+ }
+ if (!strcmp(*ptr, "-f"))
+ full_probe = 1;
+ ptr++;
+ }
{
- struct pciusb_entries entries = pci_probe(0);
+ struct pciusb_entries entries = pci_probe(full_probe);
pci_printit(entries);
pciusb_free(entries);
}