From c4016a940441713854c0a982e4f1ed7129bc0d4c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 25 Aug 2005 16:01:28 +0000 Subject: since ldetect runs gzip, time spent in some of these detect functions was a significant part of mcc's startup time --- perl-install/detect_devices.pm | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 683535eaa..77448b3f6 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -673,7 +673,8 @@ sub add_addons { @l; } -sub pci_probe() { +my (@pci, @usb); +sub pci_probe__real() { add_addons($pcitable_addons, map { my %l; @l{qw(vendor id subvendor subid pci_bus pci_device pci_function media_type driver description)} = split "\t"; @@ -682,8 +683,15 @@ sub pci_probe() { \%l; } c::pci_probe()); } +sub pci_probe() { + if ($::isStandalone && @pci) { + @pci; + } else { + @pci = pci_probe__real(); + } +} -sub usb_probe() { +sub usb_probe__real() { -e "/proc/bus/usb/devices" or return; add_addons($usbtable_addons, map { @@ -695,6 +703,13 @@ sub usb_probe() { \%l; } c::usb_probe()); } +sub usb_probe() { + if ($::isStandalone && @usb) { + @usb; + } else { + @usb = usb_probe__real(); + } +} sub firewire_probe() { my $dev_dir = '/sys/bus/ieee1394/devices'; @@ -824,11 +839,13 @@ sub tryWrite($) { sysopen($F, devices::make($_[0]), 1 | c::O_NONBLOCK()) && $F; } +my @dmesg; sub syslog() { if (-r "/tmp/syslog") { map { /<\d+>(.*)/ } cat_("/tmp/syslog"); } else { - `/bin/dmesg`; + @dmesg = `/bin/dmesg` if !@dmesg; + @dmesg; } } -- cgit v1.2.1