]> mj.ucw.cz Git - pciutils.git/blobdiff - lib/names.c
Updated display of power management information to PCI PM specs 1.1.
[pciutils.git] / lib / names.c
index a9bb620e6d7da8f32b3284e6797c7af552c54a20..704013f410c8fb9f5c9549192f68b6901debe6f4 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *     $Id: names.c,v 1.4 1999/12/11 22:38:55 mj Exp $
+ *     $Id: names.c,v 1.6 2000/04/29 12:56:23 mj Exp $
  *
  *     The PCI Library -- ID to Name Translation
  *
- *     Copyright (c) 1997--1999 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
+ *     Copyright (c) 1997--2000 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -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 == arg3 && arg2 == 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)