From bdf63164ca42e5f2260ab44ad9507637db144e6e Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sun, 28 Jul 2002 21:55:25 +0000 Subject: (detect): return wacom inside $mouse (mouseconfig): reduce the number of "Use of undefined value" (set_xfree_conf): created --- perl-install/mouse.pm | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) (limited to 'perl-install') diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index f2fb1fd57..fe154592b 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -229,7 +229,7 @@ sub mouseconfig { #- check new probing methods keep everything used here intact! foreach (0..3) { - $t = detect_devices::probeSerial("/dev/ttyS$_"); + $t = detect_devices::probeSerial("/dev/ttyS$_") or next; if ($t->{CLASS} eq 'MOUSE') { $t->{MFG} ||= $t->{MANUFACTURER}; @@ -296,7 +296,7 @@ sub detect() { #- which takes a while for its probe. if ($::isStandalone) { my $mouse = $fast_mouse_probe->(); - $mouse and return ($mouse, @wacom); + $mouse and return { wacom => \@wacom, %$mouse }; } #- probe serial device to make sure a wacom has been detected. @@ -306,10 +306,10 @@ sub detect() { if (!$::isStandalone) { my $mouse = $fast_mouse_probe->(); $r && $mouse and $r->{auxmouse} = $mouse; #- we kept the auxilliary mouse as PS/2. - $r and return ($r, @wacom); - $mouse and return ($mouse, @wacom); + $r and return { wacom => \@wacom, %$r }; + $mouse and return { wacom => \@wacom, %$mouse }; } else { - $r and return ($r, @wacom); + $r and return { wacom => \@wacom, %$r }; } #- in case only a wacom has been found, assume an inexistant mouse (necessary). @@ -317,7 +317,7 @@ sub detect() { nbuttons => 2, device => "nothing", MOUSETYPE => "Microsoft", - XMOUSETYPE => "Microsoft"}, @wacom; + XMOUSETYPE => "Microsoft", wacom => \@wacom }; if (!modules::get_probeall("usb-interface") && detect_devices::is_a_recent_computer() && $::isInstall) { #- special case for non detected usb interface on a box with no mouse. @@ -335,6 +335,21 @@ sub detect() { return fullname2mouse("serial|Generic 2 Button Mouse", unsafe => 1); } +sub set_xfree_conf { + my ($mouse, $xfree_conf) = @_; + + my @mice = map { + { + Protocol => $_->{XMOUSETYPE}, + Device => "/dev/$_->{device}", + if_($_->{nbuttons} > 3, ZAxisMapping => [ '4 5', if_($_->{nbuttons} > 5, '6 7') ]), + if_($_->{nbuttons} < 3, Emulate3Buttons => undef, Emulate3Timeout => 50), + }; + } ($mouse, if_($mouse->{auxmouse}, $mouse->{auxmouse})); + + $xfree_conf->set_mice(@mice); +} + #- write_conf : write the mouse infos into the Xconfig files. #- input : #- $mouse : the hashtable containing the informations @@ -354,17 +369,7 @@ sub write_conf { require Xconfig::xfree; my $xfree_conf = Xconfig::xfree->read; - - my @mice = map { - { - Protocol => $_->{XMOUSETYPE}, - Device => "/dev/$_->{device}", - if_($_->{nbuttons} > 3, ZAxisMapping => [ '4 5', if_($_->{nbuttons} > 5, '6 7') ]), - if_($_->{nbuttons} < 3, Emulate3Buttons => undef, Emulate3Timeout => 50), - }; - } ($mouse, $mouse->{auxmouse}); - - $xfree_conf->set_mice(@mice); + set_xfree_conf($mouse, $xfree_conf); $xfree_conf->write; } -- cgit v1.2.1