diff options
author | Francois Pons <fpons@mandriva.com> | 1999-11-16 15:54:57 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 1999-11-16 15:54:57 +0000 |
commit | c34d56dace9c34ca9986d75e462aa8395f546ece (patch) | |
tree | d1aee35e02d9ca3a7a8b3f86d8715856c705cb81 /perl-install | |
parent | 68446bf48bc000cf485267ce0419d2d3f7caec5a (diff) | |
download | drakx-backup-do-not-use-c34d56dace9c34ca9986d75e462aa8395f546ece.tar drakx-backup-do-not-use-c34d56dace9c34ca9986d75e462aa8395f546ece.tar.gz drakx-backup-do-not-use-c34d56dace9c34ca9986d75e462aa8395f546ece.tar.bz2 drakx-backup-do-not-use-c34d56dace9c34ca9986d75e462aa8395f546ece.tar.xz drakx-backup-do-not-use-c34d56dace9c34ca9986d75e462aa8395f546ece.zip |
*** empty log message ***
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rw-r--r-- | perl-install/detect_devices.pm | 19 | ||||
-rw-r--r-- | perl-install/mouse.pm | 27 |
3 files changed, 41 insertions, 7 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 87df7183b..af5c289a3 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -9,7 +9,7 @@ STAGE2 = $(ROOTDEST)/Mandrake/base/mdkinst_stage2 BASE = $(ROOTDEST)/Mandrake/base DESTREP4PMS = $(DEST)$(REP4PMS) PERL = perl -LOCALFILES = pnp_serial mouseconfig +LOCALFILES = pnp_serial LOCALFILES2 = extract_archive DIRS = c Newt po pci_probing resize_fat EXCLUDE = $(LOCALFILES) boot.img keymaps consolefonts install diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index a7fe2ed86..a6ce0575b 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -206,12 +206,23 @@ sub whatPrinterPort() { grep { tryWrite($_)} qw(/dev/lp0 /dev/lp1 /dev/lp2); } -sub hasModem($) { - my ($device) = @_; +sub probe_device($) { + my $device = devices::make($_[0]); my %probe; - local *F; open F, "pnp_serial $device |"; + + #- TODO cache hash result of probe according to device. + local *F; + open F, "pnp_serial $device 2>/dev/null |" if $device =~ /ttyS/; + foreach (<F>) { $probe{$1} = $2 if /^\s+(.*?)\s*:\s*\"(.*)\"\s*$/ } - $probe{CLASS} =~ /Modem/i && $probe{DESCRIPTION}; + log::l("probing $device find class: $probe{CLASS}"); + + \%probe; +} + +sub hasModem($) { + my $probe = probe_device($_[0]); + $probe->{CLASS} =~ /MODEM/i && $probe->{DESCRIPTION}; } sub hasMousePS2() { diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index 9dd539623..92d6683b5 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -86,13 +86,36 @@ sub write($;$) { symlinkf $mouse->{device}, "$prefix/dev/mouse" or log::l("creating $prefix/dev/mouse symlink failed"); } +sub mouseconfig { + my ($t, $mouse); + + foreach (0..1) { #- probe only ttyS0 and ttyS1. + $t = detect_devices::probe_device(devices::make("/dev/ttyS$_")); + if ($t->{CLASS} =~ /MOUSE/i) { + $t->{MFG} ||= $t->{MANUFACTURER}; + + $mouse = name2mouse("Microsoft IntelliMouse (serial)") if $t->{MFG} eq 'MSH' && $t->{MODEL} eq '0001'; + $mouse = name2mouse("Logitech MouseMan/FirstMouse (serial)") if $t->{MFG} eq 'LGI' && $t->{MODEL} =~ /^80/; + $mouse = name2mouse("Genius NetMouse (serial)") if $t->{MFG} eq 'KYE' && $t->{MODEL} eq '0003'; + + $mouse ||= name2mouse("Generic Mouse (serial)"); #- generic by default. + $mouse->{device} = "ttyS$_"; + last; + } + } + $mouse; +} + sub detect() { detect_devices::hasMousePS2 and return name2mouse("Generic Mouse (PS/2)"); - my %l; eval { commands::modprobe("serial") }; - @l{qw(FULLNAME nbuttons MOUSETYPE XMOUSETYPE device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) and return \%l; + my $r; $r = mouseconfig(); return $r if $r; modules::unload("serial"); + #- my %l; + #- eval { commands::modprobe("serial") }; + #- @l{qw(FULLNAME nbuttons MOUSETYPE XMOUSETYPE device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) and return \%l; + #- modules::unload("serial"); if (my ($c) = pci_probing::main::probe("SERIAL_USB")) { eval { modules::load($c->[1], 'usbmouse') }; |