]> mj.ucw.cz Git - pciutils.git/commitdiff
Fixed formatting of programming interfaces.
authorMartin Mares <mj@ucw.cz>
Sat, 3 Jun 2006 17:41:18 +0000 (19:41 +0200)
committerMartin Mares <mj@ucw.cz>
Sat, 3 Jun 2006 17:41:18 +0000 (19:41 +0200)
ChangeLog
lib/names.c
lib/pci.h

index 7fd6a5130a4e2df28e57d3646aaa51bea2360b23..8bb7b852a8997241b96c697d06bc41bda930cc44 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-06-03  Martin Mares  <mj@ucw.cz>
 
+       * lib/names.c (pci_lookup_name): If PCI_LOOKUP_NO_NUMBERS is given,
+       pci_access->numeric_ids is ignored.
+
        * lspci.c: Introduced the -nn switch. Thanks to David N. Welton
        for the idea.
 
index cfda85dc36aec7a3144ff0fbe44b856cecd0a48d..646a9c08019acae09233904c2205b02bef345f3c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library -- ID to Name Translation
  *
- *     Copyright (c) 1997--2005 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
@@ -383,10 +383,13 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...)
 
   va_start(args, flags);
 
-  if (a->numeric_ids > 1)
-    flags |= PCI_LOOKUP_MIXED;
-  else if (a->numeric_ids)
-    flags |= PCI_LOOKUP_NUMERIC;
+  if (!(flags & PCI_LOOKUP_NO_NUMBERS))
+    {
+      if (a->numeric_ids > 1)
+       flags |= PCI_LOOKUP_MIXED;
+      else if (a->numeric_ids)
+       flags |= PCI_LOOKUP_NUMERIC;
+    }
   if (flags & PCI_LOOKUP_MIXED)
     flags &= ~PCI_LOOKUP_NUMERIC;
 
@@ -451,12 +454,14 @@ pci_lookup_name(struct pci_access *a, char *buf, int size, int flags, ...)
        {
          /* IDE controllers have complex prog-if semantics */
          sprintf(pifbuf, "%s%s%s%s%s",
-                 (ipif & 0x80) ? "Master " : "",
-                 (ipif & 0x08) ? "SecP " : "",
-                 (ipif & 0x04) ? "SecO " : "",
-                 (ipif & 0x02) ? "PriP " : "",
-                 (ipif & 0x01) ? "PriO " : "");
+                 (ipif & 0x80) ? " Master" : "",
+                 (ipif & 0x08) ? " SecP" : "",
+                 (ipif & 0x04) ? " SecO" : "",
+                 (ipif & 0x02) ? " PriP" : "",
+                 (ipif & 0x01) ? " PriO" : "");
          pif = pifbuf;
+         if (*pif)
+           pif++;
        }
       return format_name(buf, size, flags, pif, numbuf, "ProgIf");
     default:
index 8618df5408b2910bed5250be841c4ff4795c537d..22c336bca7c992b8943c2f33ca165fe65dfe0ad3 100644 (file)
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -1,7 +1,7 @@
 /*
  *     The PCI Library
  *
- *     Copyright (c) 1997--2005 Martin Mares <mj@ucw.cz>
+ *     Copyright (c) 1997--2006 Martin Mares <mj@ucw.cz>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */