LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-10-2006, 02:49 AM   #1
zhy2111314
Member
 
Registered: Aug 2005
Location: China
Distribution: redhat(Fedora Core)->Debian Sid->Slackware
Posts: 91

Rep: Reputation: 15
Setting up a USB mouse in Slackware


http://vanguard.submoron.org/docs/USBMOUSE-HOWTO.html

Setting up a USB mouse in Slackware
Setting up your shiny usb mouse in Slackware isn't tough.



Reason for existance
Basically, I got really tired of repeating this over and over in the #slackware IRC channel. So, to make it short and simple, and in case I'm not in the channel when I am, I've written up these instructions to quickly set up your usb mouse in X and in gpm. To contact me, hit the #slackware IRC channel on irc.oftc.net, I'm Pungent in that room, or fire me an email at cbacot@runbox.com

Loading the modules
First things first, loading the kernel modules. Note, this is for the stock kernel, if you are compiling a custom kernel, make sure that the appropriate modules are compiled or made part of the kernel. I'd recommend modules.

mousedev 3864 1
hid 19300 0 (unused)
input 3360 0 [mousedev hid]
usb-uhci 21516 0 (unused)
usbcore 56288 0 [hid usb-uhci]

Substitute usb-ohci for usb-uhci if you have a usb controller that uses it. For example, my old Compaq used ohci, my new Via based motherboard uses uhci. Most Intel motherboards are also uhci. If you can't figure out which one to load, try each one and see if it works. Now, you should have modprobe'd those modules in, if you haven't, hurry up, I don't have all day. The command is:

modprobe [modulename]

And make sure you modprobe those starting from the bottom up.

Now, if you have an optical mouse, the light should be on right now. If you have a regular ball mouse, then you'll have to wait until the next section to test it with gpm. If those modules worked for you, then lets stick that in /etc/rc.d/rc.modules so they start up every time you boot. There should be an entry for the relevant ones, just uncomment them out (remove the '#' at the beginning of the line containing the modprobe command)

Setting up and testing with gpm
Now that the modules are running, lets test it out using gpm on the console. If gpm is already running, (the Slackware install offers to set it up) then kill it using:

gpm -k

as root. Now, lets try to fire it back up again. As root, run

gpm -m /dev/input/mice -t imps2

Note the options here. -m refers to the device that the mouse is accessed on. Now, I know that there is an option in the default setup for a usb mouse, but sometimes it doesn't work, as it uses /dev/input/mouse0, which doesn't always work. Using /dev/input/mice WILL work, as that is straight from the kernel documentation. The -t option is the protocol the mouse should use, which most usb mice are the scroll wheel type, so imps2 is the right one. If the cursor doesn't follow the mouse using that protocol, try a few others. Kill the current gpm if it's running, and run

gpm -t help

for a list of protocols. Now, lets assume all went well, the cursor is following your mouse. If you have an /etc/rc.d/rc.gpm, then open that up in your favorite text editor, such as vim or pico, as root. If you don't have this file, create it, and paste the following into it:

#!/bin/sh
# Start/stop the GPM mouse server:

if [ "$1" = "stop" ]; then
echo "Stopping gpm..."
gpm -k
else # assume $1 = start:
echo "Starting gpm..."
gpm -m /dev/mouse -t imps2
fi


Then make sure this file is executable, by running:

chmod +x /etc/rc.d/rc.gpm

and gpm will be set up every time you boot.
One last thing. Note that this script uses /dev/mouse as its device. Since we used /dev/input/mice to test earlier, we need to set this up. Run the command:

ls -l /dev/mouse

If /dev/mouse points to something other than /dev/input/mice, then execute the following commands:

rm /dev/mouse
ln -s /dev/input/mice /dev/mouse

And thats all there is to it! Now you can use your usb mouse in the console, just highlight some text by holding down the left mouse button while dragging, then paste it to the cursor location with the right mouse button.

Now, lets move on to setting up X to use it.
Setting up XF86Config
Ok, time to get X up using the usb mouse. Open up /etc/X11/XF86Config in your favorite text editor (Note: this howto does NOT explain how to configure X. Maybe in a future howto, but for now, if this file doesn't exist, go read the manpage for XF86Config). Locate the section that says:

Section "InputDevice"
Identifier "Mouse0"

Under this should be something like:

Driver "mouse"
Option "Protocol" "imps/2"
Option "Device" "/dev/mouse"

If the device isn't /dev/mouse, then make it /dev/mouse, and you may change "imps/2" to whatever protocol you set in the gpm setup earlier. Now, if this next part isn't present, add it if you have a wheel mouse:

Option "ZAxisMapping" "4 5"

And thats all there is too it. Fire up X and you should be set.
 
Old 01-10-2006, 02:55 AM   #2
zhy2111314
Member
 
Registered: Aug 2005
Location: China
Distribution: redhat(Fedora Core)->Debian Sid->Slackware
Posts: 91

Original Poster
Rep: Reputation: 15
If something wrong with your keyboard, mouse, screen or video card, first try "xorgconfig" and choose the best answer for your hardware situation and remember to save to /etc/X11/xorg.conf and then restart X for a try.

PS2 mouse configuration in /etc/X11/xorg.conf just like:
Code:
Section "InputDevice"

# Identifier and driver

    Identifier  "Mouse1"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/mouse"
    Option "ZAxisMapping" "4 5"
welcome to modify and add ^_^
 
Old 01-13-2006, 10:38 AM   #3
hrp2171
Member
 
Registered: Aug 2004
Location: California, USA
Distribution: Ubuntu
Posts: 243
Blog Entries: 3

Rep: Reputation: 30
Awesome! Thanks! Very precise and to the point! No fuzz at all!

I'm going to add all the commands and steps sans comments to my blog.

I started a Slackware blog just so eventually I could share it with everyone.

Forgot to mention that these instructions worked for 10.0 on a Dell Latitude C610 laptop.

Last edited by hrp2171; 01-13-2006 at 11:19 AM.
 
Old 01-13-2006, 02:43 PM   #4
Melkor
Member
 
Registered: Aug 2003
Location: MN
Distribution: Linux Mint
Posts: 179

Rep: Reputation: 34
I actually wrote something very similar to this up for myself last year because I have had to re-figure this out like three or four times, and I always forget wtf I did the next time I have to do it.

*bookmarks thread*
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Mouse in Slackware jp_ Slackware 2 12-31-2005 05:17 AM
Setting up a USB mouse. adds2one Linux - Newbie 2 08-27-2005 11:28 PM
usb mouse on slackware 10.1 kr5 Linux - Hardware 1 06-07-2005 01:52 PM
slackware 9.1 USB mouse and other usb devices not working jimMC Linux - Hardware 11 01-24-2004 10:58 AM
USB Mouse in Slackware Iceman Cometh Linux - Hardware 9 01-08-2003 09:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration