diff options
author | Francois Pons <fpons@mandriva.com> | 2001-03-23 16:46:13 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2001-03-23 16:46:13 +0000 |
commit | 49a30a0dab8208e578e7e1b74a8a7a38c89a261d (patch) | |
tree | f16a60338eab52349655b2852bc79077560067e2 /perl-install | |
parent | 55588554b612a7a951aa22165c7381e81f3ce4a0 (diff) | |
download | drakx-49a30a0dab8208e578e7e1b74a8a7a38c89a261d.tar drakx-49a30a0dab8208e578e7e1b74a8a7a38c89a261d.tar.gz drakx-49a30a0dab8208e578e7e1b74a8a7a38c89a261d.tar.bz2 drakx-49a30a0dab8208e578e7e1b74a8a7a38c89a261d.tar.xz drakx-49a30a0dab8208e578e7e1b74a8a7a38c89a261d.zip |
added multiple tablet support (wacom), moved usb probe for mouse and tablet
at the beginning.
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/Xconfig.pm | 6 | ||||
-rw-r--r-- | perl-install/Xconfigurator.pm | 101 | ||||
-rw-r--r-- | perl-install/detect_devices.pm | 3 | ||||
-rw-r--r-- | perl-install/install2.pm | 2 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 2 | ||||
-rw-r--r-- | perl-install/mouse.pm | 67 |
6 files changed, 125 insertions, 56 deletions
diff --git a/perl-install/Xconfig.pm b/perl-install/Xconfig.pm index 72590f212..c003340e9 100644 --- a/perl-install/Xconfig.pm +++ b/perl-install/Xconfig.pm @@ -60,7 +60,7 @@ sub getinfoFromXF86Config { if $c{driver} =~ /keyboard/i; @mouse{qw(XMOUSETYPE device chordmiddle nbuttons)} = @c{qw(XMOUSETYPE device chordmiddle nbuttons)} if $c{driver} =~ /mouse/i; - @wacom{qw(device)} = @c{qw(device)} + $wacom{$c{device}} = undef; if $c{driver} =~ /wacom/i; } } elsif (/^Section "Monitor"/ .. /^EndSection/) { @@ -100,7 +100,7 @@ sub getinfoFromXF86Config { $mouse{nbuttons} = 7 if m/^\s*ZAxisMapping\s.*7/; } elsif (/^Section "XInput"/ .. /^EndSection/) { if (/^\s*SubSection "Wacom/ .. /^\s*EndSubSection/) { - $wacom{device} ||= $1 if /^\s*Port\s+"\/dev\/(.*?)"/; + $wacom{$1} = undef if /^\s*Port\s+"\/dev\/(.*?)"/; } } elsif (/^Section "Monitor"/ .. /^EndSection/) { $monitor{type} ||= $1 if /^\s*Identifier\s+"(.*?)"/; @@ -157,7 +157,7 @@ sub getinfoFromXF86Config { #- try to merge with $o, the previous has been obtained by ddcxinfos. add2hash($o->{keyboard} ||= {}, \%keyboard); add2hash($o->{mouse} ||= {}, \%mouse); - $o->{wacom} ||= $wacom{device}; + @{$o->{wacom}} > 0 or $o->{wacom} = [ keys %wacom ]; add2hash($o->{monitor} ||= {}, \%monitor); $o; diff --git a/perl-install/Xconfigurator.pm b/perl-install/Xconfigurator.pm index 701ba190e..ab185daf4 100644 --- a/perl-install/Xconfigurator.pm +++ b/perl-install/Xconfigurator.pm @@ -873,10 +873,10 @@ sub write_XF86Config { print G "EndSection\n\n\n"; #- write module section for version 3. - if ($o->{wacom} || $o->{card}{Utah_glx}) { + if (@{$o->{wacom}} || $o->{card}{Utah_glx}) { print F qq(Section "Module" ); - print F qq( Load "xf86Wacom.so"\n) if $o->{wacom}; + print F qq( Load "xf86Wacom.so"\n) if @{$o->{wacom}}; print F qq( Load "glx-3.so"\n) if $o->{card}{Utah_glx}; #- glx.so may clash with server version 4. print F qq(EndSection @@ -884,50 +884,109 @@ sub write_XF86Config { } #- write wacom device support. - print F qq( + foreach (@{$o->{wacom}}) { + my $dev = "/dev/" . $o->{wacom}[$_-1]; + print F $dev =~ /input\/event/ ? qq( +Section "XInput" + SubSection "WacomStylus" + DeviceName "stylus$_" + Port "$dev" + USB + AlwaysCore + Mode Absolute + EndSubSection + SubSection "WacomCursor" + DeviceName "cursor$_" + Port "$dev" + USB + AlwaysCore + Mode Relative + EndSubSection + SubSection "WacomEraser" + DeviceName "eraser$_" + Port "$dev" + USB + AlwaysCore + Mode Absolute + EndSubSection +EndSection + +) : qq( Section "XInput" SubSection "WacomStylus" - Port "/dev/$o->{wacom}" + DeviceName "stylus$_" + Port "$dev" AlwaysCore Mode Absolute EndSubSection SubSection "WacomCursor" - Port "/dev/$o->{wacom}" + DeviceName "cursor$_" + Port "$dev" AlwaysCore Mode Relative EndSubSection SubSection "WacomEraser" - Port "/dev/$o->{wacom}" + DeviceName "eraser$_" + Port "$dev" AlwaysCore Mode Absolute EndSubSection EndSection -) if $o->{wacom}; +); + } - print G qq( + foreach (1..@{$o->{wacom}}) { + 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/$o->{wacom}" + Option "Device" "$dev" Option "Mode" "Absolute" + Option "USB" "on" EndSection Section "InputDevice" - Identifier "eraser" + Identifier "eraser$_" Driver "wacom" Option "Type" "eraser" - Option "Device" "/dev/$o->{wacom}" + Option "Device" "$dev" Option "Mode" "Absolute" + Option "USB" "on" EndSection Section "InputDevice" - Identifier "cursor" + Identifier "cursor$_" Driver "wacom" Option "Type" "cursor" - Option "Device" "/dev/$o->{wacom}" + Option "Device" "$dev" Option "Mode" "Relative" + Option "USB" "on" EndSection -) if $o->{wacom}; +) : qq( +Section "InputDevice" + Identifier "stylus$_" + Driver "wacom" + Option "Type" "stylus" + Option "Device" "$dev" + Option "Mode" "Absolute" +EndSection +Section "InputDevice" + Identifier "eraser$_" + Driver "wacom" + Option "Type" "eraser" + Option "Device" "$dev" + Option "Mode" "Absolute" +EndSection +Section "InputDevice" + Identifier "cursor$_" + Driver "wacom" + Option "Type" "cursor" + Option "Device" "$dev" + Option "Mode" "Relative" +EndSection +); + } #- write modules section for version 4. print G qq( @@ -1158,11 +1217,13 @@ Section "ServerLayout" print G ' InputDevice "Mouse1" "CorePointer" '; - print G ' - InputDevice "stylus" "AlwaysCore" - InputDevice "eraser" "AlwaysCore" - InputDevice "cursor" "AlwaysCore" -' if $o->{wacom}; + foreach (1..@{$o->{wacom}}) { + print G ' + InputDevice "stylus$_" "AlwaysCore" + InputDevice "eraser$_" "AlwaysCore" + InputDevice "cursor$_" "AlwaysCore" +'; + } print G ' InputDevice "Keyboard1" "CoreKeyboard" EndSection diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index dc623da68..a4bda9cb5 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -273,7 +273,8 @@ sub whatParport() { @res; } -sub usbMice { grep { $_->{type} =~ /\|Mouse/ } usb_probe() } +sub usbMice { grep { $_->{type} =~ /\|Mouse/ && $_->{driver} !~ /Tablet:wacom/} usb_probe() } +sub usbWacom { grep { $_->{driver} =~ /Tablet:wacom/ } usb_probe() } sub usbKeyboards { grep { $_->{type} =~ /\|Keyboard/ } usb_probe() } sub usbZips { grep { $_->{type} =~ /Mass Storage\|/ } usb_probe() } diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 05ef24962..66894980c 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -482,7 +482,7 @@ sub main { #- needed very early for install_steps_gtk modules::load_thiskind("usb"); - eval { ($o->{mouse}, $o->{wacom}) = mouse::detect() } unless $o->{nomouseprobe} || $o->{mouse}; + eval { ($o->{mouse}, @{$o->{wacom} = []}) = mouse::detect() } unless $o->{nomouseprobe} || $o->{mouse}; lang::set($o->{lang}); #- mainly for defcfg diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index cdd84d41b..609de6b14 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -38,7 +38,7 @@ sub new($$) { if ($ENV{DISPLAY} eq ":0" && !$::live) { my $f = "/tmp/Xconf"; - install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{wacom}); + install_gtk::createXconf($f, @{$o->{mouse}}{"XMOUSETYPE", "device"}, $o->{wacom}[0]); devices::make("/dev/kbd"); local (*T1, *T2); diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index ec8571f39..e8a648c4e 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -166,7 +166,7 @@ sub write { } sub mouseconfig { - my ($t, $mouse, $wacom); + my ($t, $mouse, @wacom); #- Whouah! probing all devices from ttyS0 to ttyS3 once a time! detect_devices::probeSerialDevices(); @@ -185,10 +185,10 @@ sub mouseconfig { $mouse->{device} = "ttyS$_"; last; } elsif ($t->{CLASS} eq "PEN" || $t->{MANUFACTURER} eq "WAC") { - $wacom = "ttyS$_"; + push @wacom, "ttyS$_"; } } - $mouse, $wacom; + $mouse, @wacom; } sub detect() { @@ -202,41 +202,48 @@ sub detect() { # find one whether or not I had one installed! So.. default to it. "busmouse|1 button"); } - - if ($::isStandalone) { - detect_devices::hasMousePS2("psaux") and return fullname2mouse("PS/2|Standard", unsafe => 1); - } - - #- probe serial device to make sure a wacom has been detected. - eval { modules::load("serial") }; - my ($r, $wacom) = mouseconfig(); return ($r, $wacom) if $r; - if (!$::isStandalone) { - detect_devices::hasMousePS2("psaux") and return fullname2mouse("PS/2|Standard", unsafe => 1), $wacom; - } + my @wacom; + my $fast_mouse_probe = sub { + 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"), @wacom; + eval { modules::unload("mousedev"); modules::unload("usbmouse"); }; + } + } + detect_devices::hasMousePS2("psaux") and return fullname2mouse("PS/2|Standard", unsafe => 1), @wacom; + }; 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"), $wacom; - eval { - modules::unload("mousedev"); - modules::unload("usbmouse"); + if (my (@l) = detect_devices::usbWacom()) { + log::l("found usb wacom $_->{driver} $_->{description} ($_->{type})") foreach @l; + eval { modules::load("wacom"); modules::load("evdev"); }; + unless ($@) { + foreach (0..$#l) { + detect_devices::tryOpen("input/event$_") and push @wacom, "input/event$_"; + } } + eval { modules::unload("evdev"); modules::unload("wacom"); }; } } + $::isStandalone and $fast_mouse_probe->(); + + #- 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; + + $::isStandalone or $fast_mouse_probe->(); + #- in case only a wacom has been found, assume an inexistant mouse (necessary). - $wacom and return { CLASS => 'MOUSE', - nbuttons => 2, - device => "nothing", - MOUSETYPE => "Microsoft", - XMOUSETYPE => "Microsoft"}, $wacom; + @wacom and return { CLASS => 'MOUSE', + nbuttons => 2, + device => "nothing", + MOUSETYPE => "Microsoft", + XMOUSETYPE => "Microsoft"}, @wacom; #- defaults to generic serial mouse on ttyS0. #- Oops? using return let return a hash ref, if not using it, it return a list directly :-) |