summaryrefslogtreecommitdiffstats
path: root/lspcidrake.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-03-20 15:24:29 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-03-20 15:24:29 +0000
commit450975f5927c3072eb875a3485cea1c5f3bedcd4 (patch)
tree66da9373120e2d8ad08c8a479a8316d7957b9a2f /lspcidrake.c
parent5cf2792079e2afbc216ea60f1a5577b79aeb10ef (diff)
downloadldetect-450975f5927c3072eb875a3485cea1c5f3bedcd4.tar
ldetect-450975f5927c3072eb875a3485cea1c5f3bedcd4.tar.gz
ldetect-450975f5927c3072eb875a3485cea1c5f3bedcd4.tar.bz2
ldetect-450975f5927c3072eb875a3485cea1c5f3bedcd4.tar.xz
ldetect-450975f5927c3072eb875a3485cea1c5f3bedcd4.zip
when faking probe (ie -p, -u, --dmidecode), do not do real probe on other bus
(eg: do not probe pci and usb if using --dmidecode)
Diffstat (limited to 'lspcidrake.c')
-rw-r--r--lspcidrake.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lspcidrake.c b/lspcidrake.c
index a24bcf3..2e32f51 100644
--- a/lspcidrake.c
+++ b/lspcidrake.c
@@ -52,6 +52,7 @@ static void print_dmi_entries(struct dmi_entries entries) {
int main(int argc, char **argv) {
char ** ptr = argv;
+ int fake = 0;
while (ptr && *ptr) {
if (!strcmp(*ptr, "-h") || !strcmp(*ptr, "--help")) {
@@ -65,19 +66,23 @@ int main(int argc, char **argv) {
}
if (!strcmp(*ptr, "-v"))
verboze = 1;
- else if (!strcmp(*ptr, "-u"))
+ else if (!strcmp(*ptr, "-u")) {
proc_usb_path = *++ptr;
- else if (!strcmp(*ptr, "-p"))
+ fake = 1;
+ } else if (!strcmp(*ptr, "-p")) {
proc_pci_path = *++ptr;
- else if (!strcmp(*ptr, "--dmidecode"))
+ fake = 1;
+ } else if (!strcmp(*ptr, "--dmidecode")) {
dmidecode_file = *++ptr;
+ fake = 1;
+ }
ptr++;
}
- printit(pci_probe(), print_pci_class);
- printit(usb_probe(), print_usb_class);
+ if (!fake || proc_pci_path) printit(pci_probe(), print_pci_class);
+ if (!fake || proc_usb_path) printit(usb_probe(), print_usb_class);
- if (geteuid() == 0 || dmidecode_file) {
+ if (!fake && geteuid() == 0 || dmidecode_file) {
struct dmi_entries dmi_entries = dmi_probe();
print_dmi_entries(dmi_entries);
dmi_entries_free(dmi_entries);