summaryrefslogtreecommitdiffstats
path: root/perl-install/mouse.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-03-23 16:46:13 +0000
committerFrancois Pons <fpons@mandriva.com>2001-03-23 16:46:13 +0000
commit49a30a0dab8208e578e7e1b74a8a7a38c89a261d (patch)
treef16a60338eab52349655b2852bc79077560067e2 /perl-install/mouse.pm
parent55588554b612a7a951aa22165c7381e81f3ce4a0 (diff)
downloaddrakx-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/mouse.pm')
-rw-r--r--perl-install/mouse.pm67
1 files changed, 37 insertions, 30 deletions
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 :-)