X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lspci.c;h=0515fcd6ad8d89c64bcc54fdf5d61da73163285b;hb=c953c3094d13235ad97b41cd5b59df1309d9367b;hp=905c30072af0361a1de090a1fb532b0303e77dc6;hpb=c6b83ae3aece7a098858701c4ae3b36adc1c1378;p=pciutils.git diff --git a/lspci.c b/lspci.c index 905c300..0515fcd 100644 --- a/lspci.c +++ b/lspci.c @@ -12,6 +12,7 @@ #include #include +#define PCIUTILS_LSPCI #include "pciutils.h" /* Options */ @@ -36,7 +37,22 @@ static char options[] = "nvbxs:d:ti:mgp:qkMDQ" GENERIC_OPTIONS ; static char help_msg[] = "Usage: lspci []\n" "\n" -"-v\t\tBe verbose\n" +"Basic display modes:\n" +"-mm\t\tProduce machine-readable output (single -m for an obsolete format)\n" +"-t\t\tShow bus tree\n" +"\n" +"Display options:\n" +"-v\t\tBe verbose (-vv for very verbose)\n" +#ifdef PCI_OS_LINUX +"-k\t\tShow kernel drivers handling each device\n" +#endif +"-x\t\tShow hex-dump of the standard part of the config space\n" +"-xxx\t\tShow hex-dump of the whole config space (dangerous; root only)\n" +"-xxxx\t\tShow hex-dump of the 4096-byte extended config space (root only)\n" +"-b\t\tBus-centric view (addresses and IRQ's as seen by the bus)\n" +"-D\t\tAlways show domain numbers\n" +"\n" +"Resolving of device ID's to names:\n" "-n\t\tShow numeric ID's\n" "-nn\t\tShow both textual and numeric ID's (names & numbers)\n" #ifdef PCI_USE_DNS @@ -44,21 +60,19 @@ static char help_msg[] = "-qq\t\tAs above, but re-query locally cached entries\n" "-Q\t\tQuery the PCI ID database for all ID's via DNS\n" #endif -"-b\t\tBus-centric view (PCI addresses and IRQ's instead of those seen by the CPU)\n" -"-x\t\tShow hex-dump of the standard portion of config space\n" -"-xxx\t\tShow hex-dump of the whole config space (dangerous; root only)\n" -"-xxxx\t\tShow hex-dump of the 4096-byte extended config space (root only)\n" +"\n" +"Selection of devices:\n" "-s [[[[]:]]:][][.[]]\tShow only devices in selected slots\n" -"-d []:[]\tShow only selected devices\n" -"-t\t\tShow bus tree\n" -"-m\t\tProduce machine-readable output\n" +"-d []:[]\t\t\tShow only devices with specified ID's\n" +"\n" +"Other options:\n" "-i \tUse specified ID database instead of %s\n" #ifdef PCI_OS_LINUX -"-k\t\tShow kernel drivers handling each device\n" "-p \tLook up kernel modules in a given file instead of default modules.pcimap\n" #endif -"-D\t\tAlways show domain numbers\n" "-M\t\tEnable `bus mapping' mode (dangerous; root only)\n" +"\n" +"PCI access options:\n" GENERIC_HELP ; @@ -1584,13 +1598,16 @@ static char * find_driver(struct device *d, char *buf) { struct pci_dev *dev = d->dev; - char *base = dev->access->method_params[PCI_ACCESS_SYS_BUS_PCI]; - char name[1024], *drv; + char name[1024], *drv, *base; int n; if (dev->access->method != PCI_ACCESS_SYS_BUS_PCI) return NULL; + base = pci_get_param(dev->access, "sysfs.path"); + if (!base || !base[0]) + return NULL; + n = snprintf(name, sizeof(name), "%s/devices/%04x:%02x:%02x.%d/driver", base, dev->domain, dev->bus, dev->dev, dev->func); if (n < 0 || n >= (int)sizeof(name)) @@ -2724,21 +2741,29 @@ main(int argc, char **argv) case 'p': opt_pcimap = optarg; break; +#ifdef PCI_OS_LINUX case 'k': opt_kernel++; break; +#endif case 'M': opt_map_mode++; break; case 'D': opt_domains = 2; break; +#ifdef PCI_USE_DNS case 'q': opt_query_dns++; break; case 'Q': opt_query_all = 1; break; +#else + case 'q': + case 'Q': + die("DNS queries are not available in this version"); +#endif default: if (parse_generic_option(i, pacc, optarg)) break;