summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2002-08-08 15:20:27 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2002-08-08 15:20:27 +0000
commite3f143bf539e6daf0e83421c5d2c37966288f7fb (patch)
tree9b8a6f0e464a47d627227acdc4784b5e9de703f5
parentcccfcf2e54cb927c0282f076a40b2d327168980e (diff)
downloadldetect-e3f143bf539e6daf0e83421c5d2c37966288f7fb.tar
ldetect-e3f143bf539e6daf0e83421c5d2c37966288f7fb.tar.gz
ldetect-e3f143bf539e6daf0e83421c5d2c37966288f7fb.tar.bz2
ldetect-e3f143bf539e6daf0e83421c5d2c37966288f7fb.tar.xz
ldetect-e3f143bf539e6daf0e83421c5d2c37966288f7fb.zip
- struct pciusb_entrie : add already_found flag
- pciusb::pciusb_initialize() : zero the above flag: - pciusb::pciusb_find_modules() : use the above flag: o if device subids matches the table ones, swtich the already_found flag o skip already handled device (if already_found==1)
-rw-r--r--libldetect.h1
-rw-r--r--pciusb.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/libldetect.h b/libldetect.h
index 2e985e3..5f31c69 100644
--- a/libldetect.h
+++ b/libldetect.h
@@ -15,6 +15,7 @@ struct pciusb_entry {
char *module;
char *text;
+ int already_found:1;
};
struct pciusb_entries {
struct pciusb_entry *entries;
diff --git a/pciusb.c b/pciusb.c
index 14e8be3..010da59 100644
--- a/pciusb.c
+++ b/pciusb.c
@@ -103,6 +103,10 @@ extern int pciusb_find_modules(struct pciusb_entries *entries, const char *fpciu
}
for (i = 0; i < entries->nb; i++) {
struct pciusb_entry *e = &entries->entries[i];
+ if (e->already_found) {
+ if (e->device == 0x0525 &&e->device == device)
+ continue; // skip since already found with sub ids
+ }
if (vendor != e->vendor || device != e->device)
continue; // main ids differ
if (nb == 4 && e->subvendor == 0xffff && e->subdevice == 0xffff && !no_subid) {
@@ -113,6 +117,7 @@ extern int pciusb_find_modules(struct pciusb_entries *entries, const char *fpciu
if (nb == 4 && !(subvendor == e->subvendor && subdevice == e->subdevice))
continue; // subids differ
+
if (!p) { // only calc text & module if not already done
p = buf + offset + 1;
q = strchr(p, '\t');
@@ -120,6 +125,9 @@ extern int pciusb_find_modules(struct pciusb_entries *entries, const char *fpciu
e->module = strcmp(p, "unknown") ? strndup(p,q-p-1) : NULL;
ifree(e->text); /* usb.c set it so that we display something when usbtable doesn't refer that hw*/
e->text = strndup(q+2, strlen(q)-4);
+ if (e->subvendor != 0xffff && e->subdevice != 0xffff &&
+ subdevice == e->subdevice && subvendor == e->subvendor)
+ e->already_found = 1;
}
}
fh_close(&f);
@@ -137,6 +145,7 @@ extern void pciusb_initialize(struct pciusb_entry *e) {
e->pci_function = 0xffff;
e->module = NULL;
e->text = NULL;
+ e->already_found = 0;
}
extern void pciusb_free(struct pciusb_entries *entries) {