From: Martin Mares Date: Fri, 21 Apr 2000 11:58:48 +0000 (+0000) Subject: Chat when the subsystem ID is the same as device ID and just print X-Git-Tag: v3.0.0~225 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=f4d2199987341f4e3e5570d3058e0785aae9ab05;p=pciutils.git Chat when the subsystem ID is the same as device ID and just print the device ID without needing to have all such subsystem ID's in the database. --- diff --git a/lib/names.c b/lib/names.c index a9bb620..4511f93 100644 --- a/lib/names.c +++ b/lib/names.c @@ -1,5 +1,5 @@ /* - * $Id: names.c,v 1.4 1999/12/11 22:38:55 mj Exp $ + * $Id: names.c,v 1.5 2000/04/21 11:58:48 mj Exp $ * * The PCI Library -- ID to Name Translation * @@ -289,6 +289,8 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, u32 arg1, case PCI_LOOKUP_DEVICE | PCI_LOOKUP_SUBSYSTEM: if (n = nl_lookup(a, num, NL_SUBSYSTEM, arg1, arg2, arg3, arg4)) return n->name; + else if (arg1 == arg3 && arg2 == arg4 && (n = nl_lookup(a, num, NL_DEVICE, arg1, arg2, 0, 0))) + return n->name; else res = snprintf(buf, size, "%04x", arg2); break; @@ -298,6 +300,9 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, u32 arg1, struct nl_entry *e, *e2; e = nl_lookup(a, 0, NL_VENDOR, arg3, 0, 0, 0); e2 = nl_lookup(a, 0, NL_SUBSYSTEM, arg1, arg2, arg3, arg4); + if (!e2 && arg1 == arg2 && arg3 == arg4) + /* Cheat for vendors blindly setting subsystem ID same as device ID */ + e2 = nl_lookup(a, 0, NL_DEVICE, arg1, arg2, 0, 0); if (!e) res = snprintf(buf, size, "Unknown device %04x:%04x", arg3, arg4); else if (!e2)