|
发表于 2003-10-7 22:23:49
|
显示全部楼层
呵呵,偶然间发现了一篇好文章:
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 " rotocol" "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. |
|