diff options
author | Francois Pons <fpons@mandriva.com> | 2000-04-07 14:43:04 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2000-04-07 14:43:04 +0000 |
commit | 1800d14ff9ac6dd218d274b6b4e13e3e71baecc4 (patch) | |
tree | 4a915815837bb688748bcefaaef31e1dce35fcac /perl-install/detect_devices.pm | |
parent | fe2f11d05f38a658db90c75ce73dbe87bfb84a64 (diff) | |
download | drakx-backup-do-not-use-1800d14ff9ac6dd218d274b6b4e13e3e71baecc4.tar drakx-backup-do-not-use-1800d14ff9ac6dd218d274b6b4e13e3e71baecc4.tar.gz drakx-backup-do-not-use-1800d14ff9ac6dd218d274b6b4e13e3e71baecc4.tar.bz2 drakx-backup-do-not-use-1800d14ff9ac6dd218d274b6b4e13e3e71baecc4.tar.xz drakx-backup-do-not-use-1800d14ff9ac6dd218d274b6b4e13e3e71baecc4.zip |
*** empty log message ***
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r-- | perl-install/detect_devices.pm | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index ee4aa3319..9a6061484 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -15,6 +15,7 @@ use c; #- Globals #-##################################################################################### my @netdevices = map { my $l = $_; map { "$l$_" } (0..3) } qw(eth tr plip fddi); +my %serialprobe = (); #-###################################################################################### #- Functions @@ -239,23 +240,36 @@ sub whatPrinterPort() { grep { tryWrite($_)} qw(/dev/lp0 /dev/lp1 /dev/lp2); } -sub probe_device($) { - my $device = devices::make($_[0]); - my %probe; +sub probeSerialDevices { + #- make sure the device are created before probing. + foreach (0..3) { devices::make("/dev/ttyS$_") } - #- TODO cache hash result of probe according to device. - local *F; - open F, "pnp_serial $device 2>/dev/null |" if $device =~ /ttyS/; + #- for device already probed, we can safely (assuming device are + #- not moved during install :-) + #- include /dev/mouse device if using an X server. + -d "/var/lock" or mkdir "/var/lock", 0755; + -l "/dev/mouse" and $serialprobe{"/dev/" . readlink "/dev/mouse"} = undef; + foreach (keys %serialprobe) { m|^/dev/(.*)| and touch "/var/lock/LCK..$1" } - foreach (<F>) { $probe{$1} = $2 if /^\s+(.*?)\s*:\s*\"(.*)\"\s*$/ } - log::l("probing $device find class: $probe{CLASS}"); + #- start probing all serial ports... really faster than before :-) + local *F; + open F, "serial_probe 2>/dev/null |"; + my %current = (); foreach (<F>) { + chomp; + $serialprobe{$current{DEVICE}} = { %current } and %current = () if /^\s*$/; + $current{$1} = $2 if /^([^=]+)=(.*)$/; + } + close F; - \%probe; + foreach (values %serialprobe) { + log::l("probed $_->{DESCRIPTION} of class $_->{CLASS} on device $_->{DEVICE}"); + } } +sub probeSerial($) { $serialprobe{$_[0]} } + sub hasModem($) { - my $probe = probe_device($_[0]); - $probe->{CLASS} =~ /MODEM/i && $probe->{DESCRIPTION}; + $serialprobe{$_[0]} and $serialprobe{$_[0]}{CLASS} eq 'MODEM' and $serialprobe{$_[0]}{DESCRIPTION}; } sub hasMousePS2() { |