From 0dbcea82bd862926e42e46e3ac2b718ead1205d9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 11 May 2004 12:28:31 +0000 Subject: rewrite a little probeSerialDevices(), the beginning is still very strange --- perl-install/detect_devices.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index b7a49cb32..3e699ba24 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -513,7 +513,8 @@ sub getUPS() { my $POWER_USAGE = 0x840020; my $hiddev_find_application = sub { my ($fd, $usage) = @_; - my ($i, $ret) = 0; + my $i = 0; + my $ret; do { $i++ } while ($ret = ioctl($fd, c::HIDIOCAPPLICATION(), $i)) && $ret != $usage; return $ret == $usage ? 1 : 0; }; @@ -743,9 +744,14 @@ sub probeSerialDevices() { print STDERR "Please wait while probing serial ports...\n"; #- start probing all serial ports... really faster than before ... #- ... but still take some time :-) - my %current; foreach (run_program::get_stdout('serial_probe')) { - $serialprobe{$current{DEVICE}} = { %current } and %current = () if /^\s*$/ && $current{DEVICE}; - $current{$1} = $2 if /^([^=]+)=(.*?)\s*$/; + my %current; + foreach (run_program::get_stdout('serial_probe')) { + if (/^\s*$/) { + $serialprobe{$current{DEVICE}} = { %current } if $current{DEVICE}; + %current = (); + } elsif (/^([^=]+)=(.*?)\s*$/) { + $current{$1} = $2; + } } foreach (values %serialprobe) { -- cgit v1.2.1