From 6b8801f914e374526c14a0c580439a876d95f879 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Wed, 28 Mar 2001 14:19:05 +0000 Subject: fixed for standalone XFdrake and mousedrake (multi-mouse and correct probe (USB)). --- perl-install/Xconfig.pm | 10 +++++-- perl-install/mouse.pm | 60 +++++++++++++++++++++++--------------- perl-install/standalone/XFdrake | 7 +++-- perl-install/standalone/mousedrake | 3 ++ 4 files changed, 51 insertions(+), 29 deletions(-) diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index a98abdccb..52e4edb5c 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -27,7 +27,9 @@ sub getinfo { getinfoFromDDC($o); getinfoFromSysconfig($o); - add2hash($o->{mouse}, mouse::detect()) unless $o->{mouse}{XMOUSETYPE}; + my ($mouse) = mouse::detect(); + add2hash($o->{mouse}, $mouse) unless $o->{mouse}{XMOUSETYPE}; + add2hash($o->{mouse}{auxmouse}, $mouse->{auxmouse}) unless $o->{mouse}{auxmouse}{XMOUSETYPE}; $o->{mouse}{device} ||= "mouse" if -e "/dev/mouse"; $o; @@ -46,6 +48,7 @@ sub getinfoFromXF86Config { %c = () if $i == 1; $c{driver} = $1 if /^\s*Driver\s+"(.*?)"/; + $c{id} = $1 if /^\s*Identifier\s+"[^\d"]*(\d*)"/; $c{xkb_keymap} ||= $1 if /^\s*Option\s+"XkbLayout"\s+"(.*?)"/; $c{XMOUSETYPE} ||= $1 if /^\s*Option\s+"Protocol"\s+"(.*?)"/; $c{device} ||= $1 if /^\s*Option\s+"Device"\s+"\/dev\/(.*?)"/; @@ -59,9 +62,9 @@ sub getinfoFromXF86Config { @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}; + if $c{driver} =~ /mouse/i && $c{id} > 1; @mouse{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)} - if $c{driver} =~ /mouse/i && !$mouse{device}; + if $c{driver} =~ /mouse/i && $c{id} < 1; $wacom{$c{device}} = undef if $c{driver} =~ /wacom/i; } @@ -159,6 +162,7 @@ sub getinfoFromXF86Config { #- try to merge with $o, the previous has been obtained by ddcxinfos. add2hash($o->{keyboard} ||= {}, \%keyboard); add2hash($o->{mouse} ||= {}, \%mouse); + add2hash($o->{mouse}{auxmouse} ||= {}, $mouse{auxmouse}); @{$o->{wacom}} > 0 or $o->{wacom} = [ keys %wacom ]; add2hash($o->{monitor} ||= {}, \%monitor); diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index 0a09d0ae9..3c79e9a51 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -287,27 +287,41 @@ sub write_conf { my $f = "/etc/X11/XF86Config"; my $g = "/etc/X11/XF86Config-4"; - my @zaxis = ( - $mouse->{nbuttons} > 3 ? [ "ZAxisMapping", "4 5" ] : (), - $mouse->{nbuttons} > 5 ? [ "ZAxisMapping", "6 7" ] : (), - $mouse->{nbuttons} < 3 ? ([ "Emulate3Buttons" ], [ "Emulate3Timeout", "50" ]) : () - ); - - my $zaxis = join('', map { qq(\n $_->[0]) . ($_->[1] && qq( $_->[1])) } @zaxis); - substInFile { - if (/^Section\s+"Pointer"/ .. /^EndSection/) { - $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line - s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; - s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; - } - } $f if -e $f && !$::testing; - - $zaxis = join('', map { qq(\n Option "$_->[0]") . ($_->[1] && qq( "$_->[1]")) } @zaxis); - substInFile { - if (/Identifier\s+"Mouse1"/ .. /^EndSection/) { - $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line - s|^(\s*Option\s+"Protocol"\s+).*|$1"$mouse->{XMOUSETYPE}"|; - s|^(\s*Option\s+"Device"\s+).*|$1"/dev/mouse"$zaxis|; - } - } $g if -e $g && !$::testing; + my $update_mouse = sub { + my ($mouse, $id) = @_; + + my @zaxis = ( + $mouse->{nbuttons} > 3 ? [ "ZAxisMapping", "4 5" ] : (), + $mouse->{nbuttons} > 5 ? [ "ZAxisMapping", "6 7" ] : (), + $mouse->{nbuttons} < 3 ? ([ "Emulate3Buttons" ], [ "Emulate3Timeout", "50" ]) : () + ); + + my $zaxis = join('', map { qq(\n $_->[0]) . ($_->[1] && qq( $_->[1])) } @zaxis); + substInFile { + if ($id > 1) { + if (/^DeviceName\s+"Mouse$id"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; + } + } else { + if (/^Section\s+"Pointer"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Device\s+).*|$1"/dev/mouse"$zaxis|; + } + } + } $f if -e $f && !$::testing; + + $zaxis = join('', map { qq(\n Option "$_->[0]") . ($_->[1] && qq( "$_->[1]")) } @zaxis); + substInFile { + if (/Identifier\s+"Mouse$id"/ .. /^EndSection/) { + $_ = '' if /(ZAxisMapping|Emulate3)/; #- remove existing line + s|^(\s*Option\s+"Protocol"\s+).*|$1"$mouse->{XMOUSETYPE}"|; + s|^(\s*Option\s+"Device"\s+).*|$1"/dev/mouse"$zaxis|; + } + } $g if -e $g && !$::testing; + }; + $update_mouse->($mouse, 1); + $mouse->{auxmouse} and $update_mouse->($mouse->{auxmouse}, 2); } diff --git a/perl-install/standalone/XFdrake b/perl-install/standalone/XFdrake index a4b4145e1..34d5f742b 100755 --- a/perl-install/standalone/XFdrake +++ b/perl-install/standalone/XFdrake @@ -21,6 +21,7 @@ use lib qw(/usr/lib/libDrakX); use interactive; use standalone; +use modules; use Xconfigurator; use Xconfig; use c; @@ -43,6 +44,8 @@ $i->{skiptest} = /-skiptest/; my $in = interactive->vnew('su'); +-r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf'); + my $f = "/usr/X11R6/lib/X11/Cards"; $in->standalone::pkgs_install('XFree86', 'XFree86-75dpi-fonts') if (! -e $f); -e $f or die "install XFree86 first!\n"; @@ -51,11 +54,9 @@ $in->standalone::pkgs_install('XFree86', 'XFree86-75dpi-fonts') if (! -e $f); system("mount /proc 2>/dev/null"); # ensure /proc is mounted for pci probing -Xconfig::getinfoFromXF86Config($i) if $0 =~ Xdrakres; - begin: Xconfig::getinfo($i); -Xconfig::getinfoFromXF86Config($i, ''); #- take default from here at least. +Xconfig::getinfoFromXF86Config($i); #- take default from here at least. $::isEmbedded and kill USR2, $::CCPID; Xconfigurator::main('', $i, $in, 0, sub { $in->standalone::pkgs_install(@_) }); diff --git a/perl-install/standalone/mousedrake b/perl-install/standalone/mousedrake index 62af16ded..2c6acde75 100755 --- a/perl-install/standalone/mousedrake +++ b/perl-install/standalone/mousedrake @@ -5,6 +5,7 @@ use lib qw(/usr/lib/libDrakX); use common qw(:common :system); use interactive; use standalone; +use modules; use detect_devices; use mouse; use c; @@ -19,6 +20,8 @@ $::testing = /-testing/; my $in = vnew interactive('su'); +-r '/etc/modules.conf' and modules::mergein_conf('/etc/modules.conf'); + begin: my ($mouse) = mouse::detect() unless $::noauto; -- cgit v1.2.1