]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
Improved formatting of PCIe port/slot capabilities
authorMartin Mares <mj@ucw.cz>
Thu, 28 Jan 2010 10:14:40 +0000 (11:14 +0100)
committerMartin Mares <mj@ucw.cz>
Thu, 28 Jan 2010 10:14:40 +0000 (11:14 +0100)
The power limit is now limited to 3 decimal places and it always
includes units (watts), Port# and Slot# are both printed in decimal.
(Previously, the behavior was inconsistent between ports and slots.)

ls-caps.c

index 6de3e0cf384a754b64c618902444ce91c42ecdb7..a4bf713cac7b8e1a12e75fcfc88768c5a400ed3e 100644 (file)
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -674,7 +674,7 @@ static void cap_express_dev(struct device *d, int where, int type)
        FLAG(t, PCI_EXP_DEVCAP_RBE),
        FLAG(t, PCI_EXP_DEVCAP_FLRESET));
   if (type == PCI_EXP_TYPE_UPSTREAM)
-    printf("SlotPowerLimit %fW",
+    printf("SlotPowerLimit %.3fW",
        power_limit((t & PCI_EXP_DEVCAP_PWR_VAL) >> 18,
                    (t & PCI_EXP_DEVCAP_PWR_SCL) >> 26));
   printf("\n");
@@ -806,7 +806,7 @@ static void cap_express_slot(struct device *d, int where)
        FLAG(t, PCI_EXP_SLTCAP_PWRI),
        FLAG(t, PCI_EXP_SLTCAP_HPC),
        FLAG(t, PCI_EXP_SLTCAP_HPS));
-  printf("\t\t\tSlot #%3x, PowerLimit %f; Interlock%c NoCompl%c\n",
+  printf("\t\t\tSlot #%d, PowerLimit %.3fW; Interlock%c NoCompl%c\n",
        t >> 19,
        power_limit((t & PCI_EXP_SLTCAP_PWR_VAL) >> 7, (t & PCI_EXP_SLTCAP_PWR_SCL) >> 15),
        FLAG(t, PCI_EXP_SLTCAP_INTERLOCK),