Eunice Thompson wrote:
> 
> Hi,
> I'm using MDK 7.1 beta
>  I have an MS intellimouse ,ps/2.
> I would like to have imwheel start automatically, or even be able to start
> it as a regular user (It worked fine in v.7.02). The only way I seem to get
> the wheel working is to change to 'su' in a terminal ,and type imwheel -k
> and then it starts. I've tried changing the permissions but still no luck as
> anyone other than the superuser starting this process.
>  **I have asked this question before, but didn't get a response.
> 
> Eunice Thompson
> ----- Original Message -----
> From: "OS" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, May 09, 2000 3:44 PM
> Subject: Re: [Cooker] scroll wheel on logitech mouse ?
> 
> > Hello,
> >
> > So far I have tried EVERYTHING posted on the cooker site to try and
> persuade X
> > to use the wheel with absolutely no luck.
> >
> > Has anyone got any more suggestions ?!?!
> >
> > Owen
> >

try my patch....


-- 
Yours Sincerly,                          __   _
              Christian Zoffoli         / /  (_)__  __ ____  __
                                       / /__/ / _ \/ // /\ \/ /  
 http://www.littlepenguin.org         /____/_/_//_/_,_/ /_/_\ 
  [EMAIL PROTECTED]     * *  LittlePenguin H 1   L.U.G.  * *
package mouse;

# Wheel patch by Christian Zoffoli <[EMAIL PROTECTED]>


#-######################################################################################
#- misc imports
#-######################################################################################
use common qw(:common :system :functional :file);
use modules;
use detect_devices;
use run_program;
use devices;
use commands;
use modules;
use log;

my @mouses_fields = qw(nbuttons device MOUSETYPE XMOUSETYPE Nwheels FULLNAME);
my @mouses = (
arch() =~ /^sparc/ ? (
  [ 3, "sunmouse", "sun",       "sun",            0,    __("Sun - Mouse") ],
) : arch() eq "ppc" ? (
  [ 1, "adbmouse", "Busmouse",  "BusMouse",       0,    __("Apple ADB Mouse") ],
  [ 2, "adbmouse", "Busmouse",  "BusMouse",       0,    __("Apple ADB Mouse (2 
Buttons)") ],
  [ 3, "adbmouse", "Busmouse",  "BusMouse",       0,    __("Apple ADB Mouse (3+ 
Buttons)") ],
  [ 1, "usbmouse", "imps2",     "IMPS/2",         0,    __("Apple USB Mouse") ],
  [ 2, "usbmouse", "imps2",     "IMPS/2",         0,    __("Apple USB Mouse (2 
Buttons)") ],
  [ 3, "usbmouse", "imps2",     "IMPS/2",         0,    __("Apple USB Mouse (3+ 
Buttons)") ],
) : (
  [ 2, "psaux", "ps/2",         "PS/2",           0,    __("Generic Mouse (PS/2)") ],
  [ 3, "psaux", "ps/2",         "PS/2",           0,    __("Logitech 
MouseMan/FirstMouse (ps/2)") ],
  [ 3, "psaux", "ps/2",         "PS/2",           0,    __("Generic 3 Button Mouse 
(PS/2)") ],
  [ 2, "psaux", "ps/2",      "GlidePointPS/2",    0,    __("ALPS GlidePoint (PS/2)") ],
  [ 5, "psaux", "ps/2",      "MouseManPlusPS/2",  1,    __("Logitech 
MouseMan+/FirstMouse+ (PS/2)") ],
  [ 5, "psaux", "ps/2",      "ThinkingMousePS/2", 1,    __("Kensington Thinking Mouse 
(PS/2)") ],
  [ 5, "psaux", "ps/2",         "NetMousePS/2",   1,    __("ASCII MieMouse (PS/2)") ],
  [ 5, "psaux", "netmouse",     "NetMousePS/2",   1,    __("Genius NetMouse (PS/2)") ],
  [ 5, "psaux", "netmouse",     "NetMousePS/2",   1,    __("Genius NetMouse Pro 
(PS/2)") ],
  [ 5, "psaux", "netmouse",     "NetScrollPS/2",  1,    __("Genius NetScroll (PS/2)") 
],
  [ 5, "psaux", "imps2",        "IMPS/2",         1,    __("Microsoft IntelliMouse 
(PS/2)") ],
  [ 2, "atibm",    "Busmouse",  "BusMouse",       0,    __("ATI Bus Mouse") ],
  [ 2, "inportbm", "Busmouse",  "BusMouse",       0,    __("Microsoft Bus Mouse") ],
  [ 3, "logibm",   "Busmouse",  "BusMouse",       0,    __("Logitech Bus Mouse") ],
  [ 2, "usbmouse", "ps/2",      "PS/2",           0,    __("USB Mouse") ],
  [ 3, "usbmouse", "ps/2",      "PS/2",           0,    __("USB Mouse (3 buttons or 
more)") ],
  [ 3, "usbmouse", "ps/2",      "IMPS/2",         1,    __("Logitech TrackMan Marble 
Wheel (USB)") ],
  [ 3, "usbmouse", "ps/2",      "PS/2",           0,    __("Logitech TrackMan Marble 
(USB)") ],
  [ 3, "psaux",    "ps/2",      "IMPS/2",         1,    __("Logitech TrackMan Marble 
Wheel ") ],

),
  [ 0, "none",  "none",         "Microsoft",      0,    __("No Mouse") ],
  [ 2, "ttyS",  "pnp",          "Auto",           0,    __("Microsoft Rev 2.1A or 
higher (serial)") ],
  [ 3, "ttyS",  "logim",        "MouseMan",       0,    __("Logitech CC Series 
(serial)") ],
  [ 5, "ttyS",  "pnp",          "IntelliMouse",   1,    __("Logitech 
MouseMan+/FirstMouse+ (serial)") ],
  [ 5, "ttyS",  "ms3",          "IntelliMouse",   1,    __("ASCII MieMouse (serial)") 
],
  [ 5, "ttyS",  "ms3",          "IntelliMouse",   1,    __("Genius NetMouse (serial)") 
],
  [ 5, "ttyS",  "ms3",          "IntelliMouse",   1,    __("Microsoft IntelliMouse 
(serial)") ],
  [ 2, "ttyS",  "MMSeries",     "MMSeries",       0,    __("MM Series (serial)") ],
  [ 2, "ttyS",  "MMHitTab",     "MMHittab",       0,    __("MM HitTablet (serial)") ],
  [ 3, "ttyS",  "Logitech",     "Logitech",       0,    __("Logitech Mouse (serial, 
old C7 type)") ],
  [ 3, "ttyS",  "MouseMan",     "MouseMan",       0,    __("Logitech 
MouseMan/FirstMouse (serial)") ],
  [ 2, "ttyS",  "Microsoft",    "Microsoft",      0,    __("Generic Mouse (serial)") ],
  [ 2, "ttyS",  "Microsoft",    "Microsoft",      0,    __("Microsoft compatible 
(serial)") ],
  [ 3, "ttyS",  "Microsoft",    "Microsoft",      0,    __("Generic 3 Button Mouse 
(serial)") ],
  [ 2, "ttyS",  "MouseSystems", "MouseSystems",   0,    __("Mouse Systems (serial)") ],
);
map_index {
    my %l; @l{@mouses_fields} = @$_;
    $mouses[$::i] = \%l;
} @mouses;

sub names { map { $_->{FULLNAME} } @mouses }

sub name2mouse {
    my ($name) = @_;
    foreach (@mouses) {
        return { %$_ } if $name eq $_->{FULLNAME};
    }
    die "$name not found";
}

sub serial_ports_names() {
    map { "ttyS" . ($_ - 1) . " / COM$_" } 1..4;
}
sub serial_ports_names2dev {
    local ($_) = @_;
    first(/(\w+)/);
}

sub read($) {
    my ($prefix) = @_;
    my %mouse = getVarsFromSh "$prefix/etc/sysconfig/mouse";
    $mouse{device} = readlink "$prefix/dev/mouse" or log::l("reading $prefix/dev/mouse 
symlink failed");
    %mouse;
}

sub write($;$) {
    my ($prefix, $mouse) = @_;
    local $mouse->{FULLNAME} = qq("$mouse->{FULLNAME}");
    local $mouse->{WHEEL} = bool2yesno($mouse->{Nwheels} > 0);
    setVarsInSh("$prefix/etc/sysconfig/mouse", $mouse, qw(MOUSETYPE XMOUSETYPE 
FULLNAME XEMU3 WHEEL device));
    symlinkf $mouse->{device}, "$prefix/dev/mouse" or log::l("creating 
$prefix/dev/mouse symlink failed");
}

sub mouseconfig {
    my ($t, $mouse, $wacom);

    #- Whouah! probing all devices from ttyS0 to ttyS3 once a time!
    detect_devices::probeSerialDevices();

    #- check new probing methods keep everything used here intact!
    foreach (0..3) {
        $t = detect_devices::probeSerial("/dev/ttyS$_");
        if ($t->{CLASS} eq 'MOUSE') {
            $t->{MFG} ||= $t->{MANUFACTURER};

            $mouse = name2mouse("Microsoft IntelliMouse (serial)") if $t->{MFG} eq 
'MSH' && $t->{MODEL} eq '0001';
            $mouse = name2mouse("Logitech MouseMan/FirstMouse (serial)") if $t->{MFG} 
eq 'LGI' && $t->{MODEL} =~ /^80/;
            $mouse = name2mouse("Genius NetMouse (serial)") if $t->{MFG} eq 'KYE' && 
$t->{MODEL} eq '0003';

            $mouse ||= name2mouse("Generic Mouse (serial)"); #- generic by default.
            $mouse->{device} = "ttyS$_";
            last;
        } elsif ($t->{CLASS} eq "PEN" || $t->{MANUFACTURER} eq "WAC") {
            $wacom = "ttyS$_";
        }
    }
    $mouse, $wacom;
}

sub detect() {
    return name2mouse("Sun - Mouse") if arch() =~ /^sparc/;

    if (arch() eq "ppc") {
        return name2mouse("Apple USB Mouse") if detect_devices::hasMouseMacUSB;
        # No need to search for an ADB mouse.  If I did, the PPC kernel would
        # find one whether or not I had one installed!  So..  default to it.
        return name2mouse("Apple ADB Mouse");
    }

    detect_devices::hasMousePS2 and return { unsafe => 1, %{name2mouse("Generic Mouse 
(PS/2)")} };

    eval { commands::modprobe("serial") };
    my ($r, $wacom) = mouseconfig(); return ($r, $wacom) if $r;

    if (detect_devices::probeUSB()) {
        eval { 
            modules::load("usbmouse");
            modules::load("mousedev");
           };
        sleep(2);
        if (!$@ && detect_devices::tryOpen("usbmouse")) {
            $wacom or modules::unload("serial"); 
            return name2mouse("USB Mouse"), $wacom;
        }
        modules::unload("mousedev");
        modules::unload("usbmouse");
    }

    #- defaults to generic ttyS0
    { device => "ttyS0", unsafe => 1, %{name2mouse("Generic Mouse (serial)")} };
}
#!/usr/bin/perl


# Wheel patch by Christian Zoffoli <[EMAIL PROTECTED]>


use lib qw(/usr/lib/libDrakX);

use common qw(:system);
use interactive;
use mouse;
use c;

local $_ = join '', @ARGV;

/-h/ and die "usage: mousedrake [--auto] [--noauto] [--testing]\n";

$::auto = /-auto/;
$::noauto = /-noauto/;
$::testing = /-testing/;
$::isStandalone = 1;

my $in = vnew interactive('su');

my $mouse = eval { mouse::detect() } unless $::noauto;

if (!(my $name = $mouse && $mouse->{FULLNAME}) || !$::auto) {
    $name ||= "Generic Mouse (serial)";
    $name = $in->ask_from_list_('', _("What is the type of your mouse?"), [ 
mouse::names() ], $name);
    $mouse = mouse::name2mouse($name);

    if ($mouse->{device} eq "usbmouse") {
        require pci_probing::main;
        my ($c) = pci_probing::main::probe("serial_usb") or die _("no serial_usb 
found\n");
        eval { modules::load($c->[1], "serial_usb") };
    }
}

$mouse->{XEMU3} = 'yes' if $mouse->{nbuttons} < 3 && (!$::noauto || 
$in->ask_yesorno('', _("Emulate third button?"), 1));

$mouse->{device} = mouse::serial_ports_names2dev(
        $in->ask_from_list(_("Mouse Port"),
                           _("Which serial port is your mouse connected to?"),
                           [ mouse::serial_ports_names() ])) if $mouse->{device} eq 
"ttyS";

mouse::write('', $mouse);
modules::write_conf("/etc/conf.modules") if $mouse->{device} eq "usbmouse" && 
!$::testing;

my $f = "/etc/X11/XF86Config";
my $g = "/etc/X11/XF86Config-4";
substInFile {
    if (/^Section "Pointer"/ .. /^EndSection/) {
        s|^(\s*Protocol\s+).*|$1"$mouse->{XMOUSETYPE}"|;
        s|^(\s*Device\s+).*|$1"/dev/mouse"|;
        if ($mouse->{Nwheels} == 1 ) 
                { s|^([#]\s*ZAxisMapping\s+).*|    ZAxisMapping\t4 5\n|; } 
        elsif ($mouse->{Nwheels} >= 2 ) 
                { s|^([#]\s*ZAxisMapping\s+).*|    ZAxisMapping\t4 5 6 7\n|; }
        else
                { s|^([#]\s*ZAxisMapping\s+).*|#    ZAxisMapping\t\n|; }

    }
} $f if -e $f && !$::testing;
substInFile {
    if (/^Identifier "Mouse1"/ .. /^EndSection/) {
        s|^(\s*Option\s+"Protocol"\s+).*|$1"$mouse->{XMOUSETYPE}"|;
        s|^(\s*Option\s+"Device"\s+).*|$1"/dev/mouse"|;
    }
} $g if -e $g && !$::testing;

$in->exit(0);

Reply via email to