From 1e495ca482a29b8baeb85f56654a3bd3d108b64a Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Tue, 27 Mar 2001 12:01:39 +0000 Subject: added support for two mice (laptop). The second mice is generally PS/2 as probe can says it is present. --- perl-install/Xconfig.pm | 4 +- perl-install/Xconfigurator.pm | 104 +++++++++++++++++++---------------- perl-install/Xconfigurator_consts.pm | 12 ---- perl-install/mouse.pm | 20 +++++-- 4 files changed, 76 insertions(+), 64 deletions(-) diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index a40251ea5..a98abdccb 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -58,8 +58,10 @@ sub getinfoFromXF86Config { if ($i =~ /E0/) { @keyboard{qw(xkb_keymap)} = @c{qw(xkb_keymap)} if $c{driver} =~ /keyboard/i; + @{$mouse{auxmouse}}{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)} + if $c{driver} =~ /mouse/i && $mouse{device}; @mouse{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)} - if $c{driver} =~ /mouse/i; + if $c{driver} =~ /mouse/i && !$mouse{device}; $wacom{$c{device}} = undef if $c{driver} =~ /wacom/i; } diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 8c37dce50..fe5b05764 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -2,7 +2,7 @@ package Xconfigurator; # $Id$ use diagnostics; use strict; -use vars qw($in $install @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $pointersection_text_v4 $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $good_default_monitor $low_default_monitor $layoutsection_v4); +use vars qw($in $install @window_managers @depths @monitorSize2resolution @hsyncranges %min_hsync4wres @vsyncranges %depths @resolutions %serversdriver @svgaservers @accelservers @allbutfbservers @allservers %vgamodes %videomemory @ramdac_name @ramdac_id @clockchip_name @clockchip_id %keymap_translate %standard_monitors $XF86firstchunk_text $keyboardsection_start $keyboardsection_start_v4 $keyboardsection_part2 $keyboardsection_part3 $keyboardsection_part3_v4 $keyboardsection_end $pointersection_text $monitorsection_text1 $monitorsection_text2 $monitorsection_text3 $monitorsection_text4 $modelines_text_Trident_TG_96xx $modelines_text $devicesection_text $devicesection_text_v4 $screensection_text1 %lines @options %xkb_options $good_default_monitor $low_default_monitor $layoutsection_v4); use common qw(:common :file :functional :system); use log; @@ -844,37 +844,46 @@ sub write_XF86Config { print G $keyboardsection_end; #- Write pointer section. - $O = $o->{mouse}; + my $pointer = sub { + my ($O, $id) = @_; + print F qq(Section "Pointer"\n); + print G qq(Section "InputDevice"\n\n); + print F qq( DeviceName "Mouse$id"\n); + print G qq( Identifier "Mouse$id"\n); + print G qq( Driver "mouse"\n); + print F qq( Protocol "$O->{XMOUSETYPE}"\n); + print G qq( Option "Protocol" "$O->{XMOUSETYPE}"\n); + print F qq( Device "/dev/$O->{device}"\n); + print G qq( Option "Device" "/dev/$O->{device}"\n); + #- this will enable the "wheel" or "knob" functionality if the mouse supports it + print F " ZAxisMapping 4 5\n" if $O->{nbuttons} > 3; + print F " ZAxisMapping 6 7\n" if $O->{nbuttons} > 5; + print G qq( Option "ZAxisMapping" "4 5"\n) if $O->{nbuttons} > 3; + print G qq( Option "ZAxisMapping" "6 7"\n) if $O->{nbuttons} > 5; + + print F "#" unless $O->{nbuttons} < 3; + print G "#" unless $O->{nbuttons} < 3; + print F qq( Emulate3Buttons\n); + print G qq( Option "Emulate3Buttons"\n); + print F "#" unless $O->{nbuttons} < 3; + print G "#" unless $O->{nbuttons} < 3; + print F qq( Emulate3Timeout 50\n\n); + print G qq( Option "Emulate3Timeout" "50"\n\n); + print F "# ChordMiddle is an option for some 3-button Logitech mice\n\n"; + print G "# ChordMiddle is an option for some 3-button Logitech mice\n\n"; + print F "#" unless $O->{chordmiddle}; + print G "#" unless $O->{chordmiddle}; + print F qq( ChordMiddle\n\n); + print G qq( Option "ChordMiddle"\n\n); + print F " ClearDTR\n" if $O->{cleardtrrts}; + print F " ClearRTS\n\n" if $O->{cleardtrrts}; + print F "EndSection\n\n\n"; + print G "EndSection\n\n\n"; + }; print F $pointersection_text; - print G $pointersection_text_v4; - print F qq( Protocol "$O->{XMOUSETYPE}"\n); - print G qq( Option "Protocol" "$O->{XMOUSETYPE}"\n); - print F qq( Device "/dev/$O->{device}"\n); - print G qq( Option "Device" "/dev/$O->{device}"\n); - #- this will enable the "wheel" or "knob" functionality if the mouse supports it - print F " ZAxisMapping 4 5\n" if $O->{nbuttons} > 3; - print F " ZAxisMapping 6 7\n" if $O->{nbuttons} > 5; - print G qq( Option "ZAxisMapping" "4 5"\n) if $O->{nbuttons} > 3; - print G qq( Option "ZAxisMapping" "6 7"\n) if $O->{nbuttons} > 5; - - print F "#" unless $O->{nbuttons} < 3; - print G "#" unless $O->{nbuttons} < 3; - print F qq( Emulate3Buttons\n); - print G qq( Option "Emulate3Buttons"\n); - print F "#" unless $O->{nbuttons} < 3; - print G "#" unless $O->{nbuttons} < 3; - print F qq( Emulate3Timeout 50\n\n); - print G qq( Option "Emulate3Timeout" "50"\n\n); - print F "# ChordMiddle is an option for some 3-button Logitech mice\n\n"; - print G "# ChordMiddle is an option for some 3-button Logitech mice\n\n"; - print F "#" unless $O->{chordmiddle}; - print G "#" unless $O->{chordmiddle}; - print F qq( ChordMiddle\n\n); - print G qq( Option "ChordMiddle"\n\n); - print F " ClearDTR\n" if $O->{cleardtrrts}; - print F " ClearRTS\n\n" if $O->{cleardtrrts}; - print F "EndSection\n\n\n"; - print G "EndSection\n\n\n"; + print G $pointersection_text; + $pointer->($o->{mouse}, 1); + $o->{mouse}{auxmouse} and $pointer->($o->{mouse}{auxmouse}, 2); #- write module section for version 3. if (@{$o->{wacom}} || $o->{card}{Utah_glx}) { @@ -893,21 +902,21 @@ sub write_XF86Config { print F $dev =~ /input\/event/ ? qq( Section "XInput" SubSection "WacomStylus" - DeviceName "stylus$_" + DeviceName "Stylus$_" Port "$dev" USB AlwaysCore Mode Absolute EndSubSection SubSection "WacomCursor" - DeviceName "cursor$_" + DeviceName "Cursor$_" Port "$dev" USB AlwaysCore Mode Relative EndSubSection SubSection "WacomEraser" - DeviceName "eraser$_" + DeviceName "Eraser$_" Port "$dev" USB AlwaysCore @@ -918,19 +927,19 @@ EndSection ) : qq( Section "XInput" SubSection "WacomStylus" - DeviceName "stylus$_" + DeviceName "Stylus$_" Port "$dev" AlwaysCore Mode Absolute EndSubSection SubSection "WacomCursor" - DeviceName "cursor$_" + DeviceName "Sursor$_" Port "$dev" AlwaysCore Mode Relative EndSubSection SubSection "WacomEraser" - DeviceName "eraser$_" + DeviceName "Eraser$_" Port "$dev" AlwaysCore Mode Absolute @@ -944,7 +953,7 @@ EndSection my $dev = "/dev/" . $o->{wacom}[$_-1]; print G $dev =~ /input\/event/ ? qq( Section "InputDevice" - Identifier "stylus$_" + Identifier "Stylus$_" Driver "wacom" Option "Type" "stylus" Option "Device" "$dev" @@ -952,7 +961,7 @@ Section "InputDevice" Option "USB" "on" EndSection Section "InputDevice" - Identifier "eraser$_" + Identifier "Eraser$_" Driver "wacom" Option "Type" "eraser" Option "Device" "$dev" @@ -960,7 +969,7 @@ Section "InputDevice" Option "USB" "on" EndSection Section "InputDevice" - Identifier "cursor$_" + Identifier "Cursor$_" Driver "wacom" Option "Type" "cursor" Option "Device" "$dev" @@ -969,21 +978,21 @@ Section "InputDevice" EndSection ) : qq( Section "InputDevice" - Identifier "stylus$_" + Identifier "Stylus$_" Driver "wacom" Option "Type" "stylus" Option "Device" "$dev" Option "Mode" "Absolute" EndSection Section "InputDevice" - Identifier "eraser$_" + Identifier "Eraser$_" Driver "wacom" Option "Type" "eraser" Option "Device" "$dev" Option "Mode" "Absolute" EndSection Section "InputDevice" - Identifier "cursor$_" + Identifier "Cursor$_" Driver "wacom" Option "Type" "cursor" Option "Device" "$dev" @@ -1220,12 +1229,15 @@ Section "ServerLayout" print G ' InputDevice "Mouse1" "CorePointer" +'; + $o->{mouse}{auxmouse} and print G ' + InputDevice "Mouse2" "SendCoreEvents" '; foreach (1..@{$o->{wacom}}) { print G ' - InputDevice "stylus$_" "AlwaysCore" - InputDevice "eraser$_" "AlwaysCore" - InputDevice "cursor$_" "AlwaysCore" + InputDevice "Stylus$_" "AlwaysCore" + InputDevice "Eraser$_" "AlwaysCore" + InputDevice "Cursor$_" "AlwaysCore" '; } print G ' diff --git a/perl-install/Xconfigurator_consts.pm b/perl-install/Xconfigurator_consts.pm index 918f1d415..9c6e67c5f 100644 --- a/perl-install/Xconfigurator_consts.pm +++ b/perl-install/Xconfigurator_consts.pm @@ -596,18 +596,6 @@ $pointersection_text = ' # Pointer section # ********************************************************************** -Section "Pointer" -'; - -$pointersection_text_v4 = ' -# ********************************************************************** -# Pointer section -# ********************************************************************** - -Section "InputDevice" - - Identifier "Mouse1" - Driver "mouse" '; $monitorsection_text1 = ' diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index ac5498407..0a09d0ae9 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -205,17 +205,21 @@ sub detect() { my @wacom; my $fast_mouse_probe = sub { + my $auxmouse = detect_devices::hasMousePS2("psaux") && fullname2mouse("PS/2|Standard", unsafe => 1); + if (modules::get_alias("usb-interface")) { if (my (@l) = detect_devices::usbMice()) { log::l("found usb mouse $_->{driver} $_->{description} ($_->{type})") foreach @l; eval { modules::load("usbmouse"); modules::load("mousedev"); }; - !$@ && detect_devices::tryOpen("usbmouse") and - return fullname2mouse($l[0]{driver} =~ /Mouse:(.*)/ ? $1 : "USB|Generic"); + if (!$@ && detect_devices::tryOpen("usbmouse")) { + my $mouse = fullname2mouse($l[0]{driver} =~ /Mouse:(.*)/ ? $1 : "USB|Generic"); + $auxmouse and $mouse->{auxmouse} = $auxmouse; #- for laptop, we kept the PS/2 as secondary (symbolic). + return $mouse; + } eval { modules::unload("mousedev"); modules::unload("usbmouse"); }; } } - detect_devices::hasMousePS2("psaux") and return fullname2mouse("PS/2|Standard", unsafe => 1); - undef; + $auxmouse; }; if (modules::get_alias("usb-interface")) { @@ -231,6 +235,8 @@ sub detect() { } } + #- at this level, not all possible mice are detected so avoid invoking serial_probe + #- which takes a while for its probe. if ($::isStandalone) { my $mouse = $fast_mouse_probe->(); $mouse and return ($mouse, @wacom); @@ -238,11 +244,15 @@ sub detect() { #- probe serial device to make sure a wacom has been detected. eval { modules::load("serial") }; - my ($r, @serial_wacom) = mouseconfig(); push @wacom, @serial_wacom; return ($r, @wacom) if $r; + my ($r, @serial_wacom) = mouseconfig(); push @wacom, @serial_wacom; 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); + } else { + $r and return ($r, @wacom); } #- in case only a wacom has been found, assume an inexistant mouse (necessary). -- cgit v1.2.1