diff options
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/ChangeLog | 10 | ||||
-rw-r--r-- | perl-install/Makefile | 4 | ||||
-rw-r--r-- | perl-install/Makefile.config | 2 | ||||
-rw-r--r-- | perl-install/Makefile.drakxtools | 4 | ||||
-rw-r--r-- | perl-install/detect_devices.pm | 36 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 1 | ||||
-rw-r--r-- | perl-install/mouse.pm | 10 |
7 files changed, 48 insertions, 19 deletions
diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 5ec2486c4..ed51b61a9 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,13 @@ +2000-04-07 François Pons <fpons@mandrakesoft.com> + + * tools/serial_probe: obsoleting pnp_serial which is now replaced + by this one, taken from kudzu, really faster and probe all serial + devices at one time. modified to probe correctly modem :-) + * mouse.pm: updated to use serial_probe interface of + detect_devices.pm. + * detect_devices.pm: modified to use serial_probe, cache probed + devices to avoid reprobing. + 2000-04-06 François Pons <fpons@mandrakesoft.com> * install_steps_interactive.pm, install_steps.pm: added support diff --git a/perl-install/Makefile b/perl-install/Makefile index 46c477d18..01f1786b4 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -14,9 +14,9 @@ clean: tar-drakxtools: clean $(MAKE) -C ../tools clean - cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/pnp_serial drakxtools + cd .. ; rm -rf drakxtools ; cp -af perl-install drakxtools ; cp -af tools/ddcprobe tools/serial_probe drakxtools cd ../drakxtools ; rm -rf install* pkgs.pm ftp.pm t.pm */CVS ; mv Makefile.drakxtools Makefile ; mv -f standalone/* . - cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile Makefile.config share/MonitorsDB share/Cards+ share/CardsNames Newt c ddcprobe pnp_serial share/po pci_probing resize_fat share/diskdrake.rc $(STANDALONEPMS) icons *.pm) + cd .. ; tar cfy drakxtools.tar.bz2 --exclude CVS $(patsubst %,drakxtools/%,Makefile Makefile.config share/MonitorsDB share/Cards+ share/CardsNames Newt c ddcprobe serial_probe share/po pci_probing resize_fat share/diskdrake.rc $(STANDALONEPMS) icons *.pm) cd .. ; rm -rf drakxtools $(DIRS): diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index bfd64e562..14a71573a 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -14,7 +14,7 @@ STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)$(REP4PMS) PERL = perl -LOCALFILES = $(patsubst %, ../tools/%,$(ARCH)/e2fsck.shared ddcprobe/ddcxinfos pnp_serial/pnp_serial xhost+) +LOCALFILES = $(patsubst %, ../tools/%,$(ARCH)/e2fsck.shared ddcprobe/ddcxinfos serial_probe/serial_probe xhost+) DIRS = c Newt pci_probing resize_fat #po CFLAGS = -Wall override CFLAGS += -pipe diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools index 3037d996c..3f191cde4 100644 --- a/perl-install/Makefile.drakxtools +++ b/perl-install/Makefile.drakxtools @@ -1,6 +1,6 @@ include Makefile.config -DIRS = ddcprobe pnp_serial share/po Newt c pci_probing resize_fat +DIRS = ddcprobe serial_probe share/po Newt c pci_probing resize_fat PREFIX = SBINDEST = $(PREFIX)/usr/sbin ETCDEST = $(PREFIX)/etc/gtk @@ -23,7 +23,7 @@ install: install -d $(BINDEST) $(ETCDEST) $(SBINDEST) $(LIBDEST) $(BINX11DEST) $(LIBX11DEST) $(LIBDEST)/po $(DIRS:%=$(LIBDEST)/%) install $(STANDALONEPMS) $(SBINDEST) mv -f $(SBINDEST)/lspcidrake $(BINDEST) - install -s ddcprobe/ddcxinfos pnp_serial/pnp_serial $(SBINDEST) + install -s ddcprobe/ddcxinfos serial_probe/serial_probe $(SBINDEST) ln -s ../../$(patsubst $(PREFIX)/usr%,%,$(SBINDEST))/XFdrake $(BINX11DEST)/Xdrakres for i in *.pm ; do perl -pe '$$_ = "\n" if /\s*use\s+(diagnostics|vars|strict)/' $$i > $(LIBDEST)/$$i ; done 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() { diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 052dbf312..7d5069ce5 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -481,6 +481,7 @@ sub pppConfig { my $m = $o->{modem} ||= {}; unless ($m->{device} || $::expert && !$o->ask_yesorno('', _("Try to find a modem?"), 1)) { + detect_devices::probeSerialDevices(); foreach (0..3) { next if $o->{mouse}{device} =~ /ttyS$_/; detect_devices::hasModem("$o->{prefix}/dev/ttyS$_") diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index a16c0b1d7..1239ae99f 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -101,9 +101,13 @@ sub write($;$) { sub mouseconfig { my ($t, $mouse, $wacom); - foreach (0..1) { #- probe only ttyS0 and ttyS1. - $t = detect_devices::probe_device("/dev/ttyS$_"); - if ($t->{CLASS} =~ /MOUSE/i) { + #- Whouah! probing all devices from ttyS0 to ttyS3 once a time! + detect_devices::probeSerialDevices(); + + #- check new probing methods keep everything used here intact! + foreach (0..3) { + $t = detect_devices::probeSerial("/dev/ttyS$_"); + if ($t->{CLASS} eq 'MOUSE') { $t->{MFG} ||= $t->{MANUFACTURER}; $mouse = name2mouse("Microsoft IntelliMouse (serial)") if $t->{MFG} eq 'MSH' && $t->{MODEL} eq '0001'; |