diff options
Diffstat (limited to 'perl-install/mouse.pm')
| -rw-r--r-- | perl-install/mouse.pm | 85 |
1 files changed, 58 insertions, 27 deletions
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index ec76d388c..8b6167d86 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -32,9 +32,9 @@ my %mice = [ 5, 'ps/2', 'MouseManPlusPS/2', N_("Logitech MouseMan+") ], [ 5, 'imps2', 'IMPS/2', N_("Generic PS2 Wheel Mouse") ], [ 5, 'ps/2', 'GlidePointPS/2', N_("GlidePoint") ], - if_(c::kernel_version() !~ /^\Q2.6/, - [ 5, 'imps2', 'auto', N_("Automatic") ], - ), + if_(c::kernel_version() !~ /^\Q2.6/, + [ 5, 'imps2', 'auto', N_("Automatic") ] + ), '', [ 5, 'ps/2', 'ThinkingMousePS/2', N_("Kensington Thinking Mouse") ], [ 5, 'netmouse', 'NetMousePS/2', N_("Genius NetMouse") ], @@ -86,6 +86,7 @@ my %mice = N_("Universal") => [ [ 'input/mice' ], [ [ 7, 'ps/2', 'ExplorerPS/2', N_("Any PS/2 & USB mice") ], + [ 5, 'ps/2', 'auto-dev', N_("Synaptics Touchpad") ], ] ], ), @@ -201,7 +202,7 @@ sub read() { } sub write { - my ($in, $mouse) = @_; + my ($do_pkgs, $mouse) = @_; local $mouse->{FULLNAME} = qq("$mouse->{type}|$mouse->{name}"); #-" local $mouse->{XEMU3} = bool2yesno($mouse->{nbuttons} < 3); local $mouse->{WHEEL} = bool2yesno($mouse->{nbuttons} > 3); @@ -214,7 +215,7 @@ sub write { any::devfssymlinkf($mouse->{auxmouse}, 'mouse1') if $mouse->{auxmouse}; - various_xfree_conf($in, $mouse); + various_xfree_conf($do_pkgs, $mouse); if (arch() =~ /ppc/) { my $s = join('', @@ -229,8 +230,10 @@ sub write { } } -sub probe_wacom_devices() { - modules::get_probeall("usb-interface") or return; +sub probe_wacom_devices { + my ($modules_conf) = @_; + + $modules_conf->get_probeall("usb-interface") or return; my (@l) = detect_devices::usbWacom() or return; log::l("found usb wacom $_->{driver} $_->{description} ($_->{type})") foreach @l; @@ -268,7 +271,9 @@ sub detect_serial() { $mouse, @wacom; } -sub detect() { +sub detect { + my ($modules_conf) = @_; + if (arch() =~ /^sparc/) { return fullname2mouse("sunmouse|Sun - Mouse"); } @@ -280,12 +285,21 @@ sub detect() { "busmouse|1 button"); } - my @wacom = probe_wacom_devices(); + my @wacom = probe_wacom_devices($modules_conf); if (c::kernel_version() =~ /^\Q2.6/) { - modules::get_probeall("usb-interface") and eval { modules::load('usbhid') }; - if (cat_('/proc/bus/input/devices') =~ /^H: Handlers=mouse/m) { - return fullname2mouse('Universal|Any PS/2 & USB mice', wacom => \@wacom); + $modules_conf->get_probeall("usb-interface") and eval { modules::load('usbhid') }; + my @input_devices = cat_('/proc/bus/input/devices'); + my $synaptics_mouse; + if (my $mouse_nb = grep { /^H: Handlers=mouse/ } @input_devices) { + my $univ_mouse = fullname2mouse('Universal|Any PS/2 & USB mice', wacom => \@wacom); + if (any { m!^N: Name="(?:SynPS/2 Synaptics TouchPad|AlpsPS/2 ALPS TouchPad)"$! } @input_devices) { + $synaptics_mouse = fullname2mouse('Universal|Synaptics Touchpad'); + $::isInstall and $synaptics_mouse->{alternate_install} = $univ_mouse; #- don't try to use synpatics at beginning of install + $mouse_nb < 2 and return $synaptics_mouse; + $univ_mouse->{auxmouse} = $synaptics_mouse; + } + return $univ_mouse; } } else { my $ps2_mouse = detect_devices::hasMousePS2("psaux") && fullname2mouse("PS/2|Automatic", unsafe => 0); @@ -296,7 +310,7 @@ sub detect() { $ps2_mouse and detect_devices::hasMousePS2("psaux"); #- fake another open in order for XFree to see the mouse. } - if (modules::get_probeall("usb-interface")) { + if ($modules_conf->get_probeall("usb-interface")) { sleep 2; if (my (@l) = detect_devices::usbMice()) { log::l(join('', "found usb mouse $_->{driver} $_->{description} (", if_($_->{type}, $_->{type}), ")")) foreach @l; @@ -342,12 +356,18 @@ sub load_modules { /ttyS/ and push @l, qw(serial); /event/ and push @l, qw(wacom evdev); } + if (member(N_("Synaptics Touchpad"), $mouse->{name}, $mouse->{auxmouse} && $mouse->{auxmouse}{name})) { + push @l, qw(evdev); + } eval { modules::load(@l) }; } sub set_xfree_conf { my ($mouse, $xfree_conf, $b_keep_auxmouse_unchanged) = @_; - + + my ($synaptics, $mouse_) = partition { $_->{name} eq N_("Synaptics Touchpad") } + ($mouse, if_($mouse->{auxmouse}, $mouse->{auxmouse})); + delete $mouse->{auxmouse} if $synaptics && $synaptics == $mouse->{auxmouse}; my @mice = map { { Protocol => $_->{XMOUSETYPE}, @@ -356,8 +376,8 @@ sub set_xfree_conf { if_($_->{nbuttons} < 3, Emulate3Buttons => undef, Emulate3Timeout => 50), if_($_->{EMULATEWHEEL}, Emulate3Buttons => undef, Emulate3Timeout => 50, EmulateWheel => undef, EmulateWheelButton => 2), }; - } ($mouse, if_($mouse->{auxmouse}, $mouse->{auxmouse})); - + } @$mouse_; + if (!$mouse->{auxmouse} && $b_keep_auxmouse_unchanged) { my (undef, @l) = $xfree_conf->get_mice; push @mice, @l; @@ -368,10 +388,16 @@ sub set_xfree_conf { if (my @wacoms = @{$mouse->{wacom} || []}) { $xfree_conf->set_wacoms(map { { Device => "/dev/$_", USB => m|input/event| } } @wacoms); } + + $synaptics and $xfree_conf->set_synaptics(map { { + Device => "/dev/$_->{device}", + Protocol => $_->{XMOUSETYPE}, + Primary => $_ != $mouse->{auxmouse}, + } } @$synaptics); } sub various_xfree_conf { - my ($in, $mouse) = @_; + my ($do_pkgs, $mouse) = @_; { my $f = "$::prefix/etc/X11/xinit.d/mouse_buttons"; @@ -386,10 +412,14 @@ sub various_xfree_conf { if (!$mouse->{auxmouse} || $mouse->{auxmouse}{nbuttons} <= 5) { unlink($f); } else { - $in->do_pkgs->install('xinput'); + $do_pkgs->install('xinput'); output_with_perm($f, 0755, "xinput set-button-map Mouse2 1 2 3 6 7 4 5\n"); } } + + if (member(N_("Synaptics Touchpad"), $mouse->{name}, $mouse->{auxmouse} && $mouse->{auxmouse}{name})) { + $do_pkgs->install("synaptics"); + } } #- write_conf : write the mouse infos into the Xconfig files. @@ -404,15 +434,17 @@ sub various_xfree_conf { #- $mouse->{MOUSETYPE} : type of the mouse : string : ex "ps/2" #- $mouse->{XEMU3} : emulate 3rd button : string : 'yes' or 'no' sub write_conf { - my ($in, $mouse, $b_keep_auxmouse_unchanged) = @_; + my ($do_pkgs, $modules_conf, $mouse, $b_keep_auxmouse_unchanged) = @_; - &write($in, $mouse); - modules::write_conf() if $mouse->{device} eq "usbmouse" && !$::testing; + &write($do_pkgs, $mouse); + $modules_conf->write if $mouse->{device} eq "usbmouse" && !$::testing; - require Xconfig::xfree; - my $xfree_conf = Xconfig::xfree->read; - set_xfree_conf($mouse, $xfree_conf, $b_keep_auxmouse_unchanged); - $xfree_conf->write; + eval { + require Xconfig::xfree; + my $xfree_conf = Xconfig::xfree->read; + set_xfree_conf($mouse, $xfree_conf, $b_keep_auxmouse_unchanged); + $xfree_conf->write; + } } sub change_mouse_live { @@ -567,8 +599,7 @@ mouse - Perl functions to handle mice require modules; require mouse; - modules::mergein_conf(); - mouse::detect(); + mouse::detect(modules::any_conf->read); =head1 DESCRIPTION |
