diff options
author | Thierry Vignaud <tvignaud@mandriva.org> | 2002-07-16 14:54:45 +0000 |
---|---|---|
committer | Thierry Vignaud <tvignaud@mandriva.org> | 2002-07-16 14:54:45 +0000 |
commit | 667f94e4543832186ed073bbefa5873096f9c369 (patch) | |
tree | 710ffff3a79b3f4d99ce1940079c154bf7da1348 /usb.c | |
parent | f37544e3e0ec9f33b8440dac9fba28637415d494 (diff) | |
download | ldetect-667f94e4543832186ed073bbefa5873096f9c369.tar ldetect-667f94e4543832186ed073bbefa5873096f9c369.tar.gz ldetect-667f94e4543832186ed073bbefa5873096f9c369.tar.bz2 ldetect-667f94e4543832186ed073bbefa5873096f9c369.tar.xz ldetect-667f94e4543832186ed073bbefa5873096f9c369.zip |
- move usb devices proc entry path into
libldetect-private.h::proc_usb_path
- add -u option so that lspcidrake can read usb devices from a file in
order to understand what happened to remote testers
- make if (test) action clearer by rejecting action singleton in next
line
- lspcidrake: describe all options
Diffstat (limited to 'usb.c')
-rw-r--r-- | usb.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -5,17 +5,18 @@ #include "libldetect-private.h" #include "common.h" +char *proc_usb_path = "/proc/bus/usb/devices"; + extern struct pciusb_entries usb_probe(void) { FILE *f; char buf[BUF_SIZE]; int line; - const char *file = "/proc/bus/usb/devices"; struct pciusb_entry t[MAX_DEVICES]; struct pciusb_entries r; struct pciusb_entry *e = NULL; - if (!(f = fopen(file, "r"))) + if (!(f = fopen(proc_usb_path, "r"))) exit(1); for(r.nb = line = 0; fgets(buf, sizeof(buf) - 1, f) && r.nb < psizeof(t); line++) { @@ -24,7 +25,7 @@ extern struct pciusb_entries usb_probe(void) { pciusb_initialize(e); if (sscanf(buf, "P: Vendor=%hx ProdID=%hx", &e->vendor, &e->device) != 2) { - fprintf(stderr, "%s %d: unknown ``P'' line\n", file, line); + fprintf(stderr, "%s %d: unknown ``P'' line\n", proc_usb_path, line); pciusb_initialize(e); } } else if (e && buf[0] == 'I' && e->class_ == 0) { @@ -32,7 +33,7 @@ extern struct pciusb_entries usb_probe(void) { if (sscanf(buf, "I: If#=%*2d Alt=%*2d #EPs=%*2d Cls=%02x(%*5c) Sub=%02x Prot=%02x", &class_, &sub, &prot) == 3) { e->class_ = (class_ * 0x100 + sub) * 0x100 + prot; } else { - fprintf(stderr, "%s %d: unknown ``I'' line\n", file, line); + fprintf(stderr, "%s %d: unknown ``I'' line\n", proc_usb_path, line); } } else if (e && buf[0] == 'S') { int offset; |