summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/detect_devices.pm8
-rw-r--r--perl-install/mouse.pm18
2 files changed, 16 insertions, 10 deletions
diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm
index f03bbd596..b8a1ff707 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -219,13 +219,7 @@ sub hasModem($) {
}
sub hasMousePS2() {
- my $t; sysread(tryOpen("psaux"), $t, 1) != 1 || $t ne "\xFE";
-}
-
-sub hasMouseUSB(;$) {
- my @modules = map { "usb-$_" } qw(uhci ohci ohci-hcd);
- my ($first) = @_;
-# modprobe(
+ my $t; sysread(tryOpen("psaux"), $t, 256) != 1 || $t ne "\xFE";
}
#-######################################################################################
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index 795d859b1..ecedfff9a 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -8,6 +8,10 @@ use strict;
#-######################################################################################
use common qw(:common :system :functional :file);
use modules;
+use pci_probing::main;
+use detect_devices;
+use run_program;
+use commands;
use log;
my @mouses_fields = qw(nbuttons device MOUSETYPE XMOUSETYPE FULLNAME);
@@ -80,8 +84,16 @@ sub write($;$) {
}
sub detect() {
+ detect_devices::hasMousePS2 and return name2mouse("Generic Mouse (PS/2)");
+
my %l;
- eval { modules::load("serial") };
- @l{qw(FULLNAME nbuttons MOUSETYPE XMOUSETYPE device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) or die "mouseconfig failed";
- \%l;
+ eval { commands::modprobe("serial") };
+ @l{qw(FULLNAME nbuttons MOUSETYPE XMOUSETYPE device)} = split("\n", `mouseconfig --nointeractive 2>/dev/null`) and return \%l;
+ eval { run_program::run("rmmod", "serial") };
+
+ if (my ($c) = pci_probing::main::probe("SERIAL_USB")) {
+ eval { modules::load($c->[1]) };
+ return name2mouse("Generic Mouse (PS/2)") if !$@ && detect_devices::tryOpen("usbmouse");
+ }
+ die "mouseconfig failed";
}