From 7e8fa9773839843c9d8def81ec2ef1315115825a Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 21 Jul 2004 00:16:04 +0000 Subject: - %modules::conf is no more a global, so many functions need passing $modules_conf - $modules_conf is a class choosing modules.conf or modprobe.conf (esp. useful after install) (but not working yet!) - modules::load() doesn't use $modules_conf, use modules::load_and_configure() - modules::load() doesn't allow options, use either modules::load_raw() or modules::load_and_configure() - some functions used to want an array ref for modules options and some a string, now every functions use a string - many functions (like modules::get_alias()) are now methods on $modules_conf - some functions in mouse.pm needed a $in where a $do_pkgs is enough - some perl_checker compliance - small fixes --- perl-install/mouse.pm | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'perl-install/mouse.pm') diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm index ec76d388c..2f1cd6b29 100644 --- a/perl-install/mouse.pm +++ b/perl-install/mouse.pm @@ -201,7 +201,7 @@ sub read() { } sub write { - my ($in, $mouse) = @_; + my ($do_pkgs, $mouse) = @_; local $mouse->{FULLNAME} = qq("$mouse->{type}|$mouse->{name}"); #-" local $mouse->{XEMU3} = bool2yesno($mouse->{nbuttons} < 3); local $mouse->{WHEEL} = bool2yesno($mouse->{nbuttons} > 3); @@ -214,7 +214,7 @@ sub write { any::devfssymlinkf($mouse->{auxmouse}, 'mouse1') if $mouse->{auxmouse}; - various_xfree_conf($in, $mouse); + various_xfree_conf($do_pkgs, $mouse); if (arch() =~ /ppc/) { my $s = join('', @@ -229,8 +229,10 @@ sub write { } } -sub probe_wacom_devices() { - modules::get_probeall("usb-interface") or return; +sub probe_wacom_devices { + my ($modules_conf) = @_; + + $modules_conf->get_probeall("usb-interface") or return; my (@l) = detect_devices::usbWacom() or return; log::l("found usb wacom $_->{driver} $_->{description} ($_->{type})") foreach @l; @@ -268,7 +270,9 @@ sub detect_serial() { $mouse, @wacom; } -sub detect() { +sub detect { + my ($modules_conf) = @_; + if (arch() =~ /^sparc/) { return fullname2mouse("sunmouse|Sun - Mouse"); } @@ -280,10 +284,10 @@ sub detect() { "busmouse|1 button"); } - my @wacom = probe_wacom_devices(); + my @wacom = probe_wacom_devices($modules_conf); if (c::kernel_version() =~ /^\Q2.6/) { - modules::get_probeall("usb-interface") and eval { modules::load('usbhid') }; + $modules_conf->get_probeall("usb-interface") and eval { modules::load('usbhid') }; if (cat_('/proc/bus/input/devices') =~ /^H: Handlers=mouse/m) { return fullname2mouse('Universal|Any PS/2 & USB mice', wacom => \@wacom); } @@ -296,7 +300,7 @@ sub detect() { $ps2_mouse and detect_devices::hasMousePS2("psaux"); #- fake another open in order for XFree to see the mouse. } - if (modules::get_probeall("usb-interface")) { + if ($modules_conf->get_probeall("usb-interface")) { sleep 2; if (my (@l) = detect_devices::usbMice()) { log::l(join('', "found usb mouse $_->{driver} $_->{description} (", if_($_->{type}, $_->{type}), ")")) foreach @l; @@ -371,7 +375,7 @@ sub set_xfree_conf { } sub various_xfree_conf { - my ($in, $mouse) = @_; + my ($do_pkgs, $mouse) = @_; { my $f = "$::prefix/etc/X11/xinit.d/mouse_buttons"; @@ -386,7 +390,7 @@ sub various_xfree_conf { if (!$mouse->{auxmouse} || $mouse->{auxmouse}{nbuttons} <= 5) { unlink($f); } else { - $in->do_pkgs->install('xinput'); + $do_pkgs->install('xinput'); output_with_perm($f, 0755, "xinput set-button-map Mouse2 1 2 3 6 7 4 5\n"); } } @@ -404,10 +408,10 @@ sub various_xfree_conf { #- $mouse->{MOUSETYPE} : type of the mouse : string : ex "ps/2" #- $mouse->{XEMU3} : emulate 3rd button : string : 'yes' or 'no' sub write_conf { - my ($in, $mouse, $b_keep_auxmouse_unchanged) = @_; + my ($do_pkgs, $modules_conf, $mouse, $b_keep_auxmouse_unchanged) = @_; - &write($in, $mouse); - modules::write_conf() if $mouse->{device} eq "usbmouse" && !$::testing; + &write($do_pkgs, $mouse); + $modules_conf->write if $mouse->{device} eq "usbmouse" && !$::testing; require Xconfig::xfree; my $xfree_conf = Xconfig::xfree->read; @@ -567,8 +571,7 @@ mouse - Perl functions to handle mice require modules; require mouse; - modules::mergein_conf(); - mouse::detect(); + mouse::detect(modules::any_conf->read); =head1 DESCRIPTION -- cgit v1.2.1