Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOW-TO] Mouse support in console
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 10 Sep 2002
Posts: 585
Location: Arendal, Norway

PostPosted: Thu Oct 02, 2003 2:40 am    Post subject: [HOW-TO] Mouse support in console Reply with quote

[HOW-TO] Mouse support in console

This document is based on my Console + Intellimouse Explorer USB Mouse + gpm solution post. I've finally rewritten it to be more of a HOW-TO without all the "noise".

This is for a 2.4.xx kernel.

Table of contents
  1. Kernel setup (2.4.xx kernel)
  2. Userspace programs
  3. Configuration
    1. Kernel
    2. Userspace programs
  4. Support in a 2.6 kernel

1. Kernel setup
I'm using a 2.4.22 kernel, but this should work just fine on the last 2.4.x kernels.

For PS/2 supprt, make sure these settings are enabled in your kernel:
Character devices --->
Mice --->
<*> Mouse Support (not serial and bus mice)
----- [*] PS/2 mouse (aka "auxiliary device) support

If you want USB mouse support, you need to activate the following options in your kernel. You can make them modules or compiled-in, I use modules. If you only have a PS/2 mouse, this USB settings are not nessesary to get mouse support in console.
Input core support --->
<M> Input Core support
----- <M> Mouse Support
----- (1024) Horizontal screen resolution
----- (768)  Vertical screen resolution

Depending on your motherboard and chipset, there are a few different options for you to choose from. The 2.4 kernel supports 3 different USB 1.1 HCD (Host Controller Drivers), together with the USB 2.0 HCD.

You decide your USB 1.1 HCD from your motherboard, by checking the maker of your USB controller:
lspci | grep -i usb
Doing so on my system, results in this:
00:1d.0 USB Controller: Intel Corp. 92901DB USB (Hub #1) (rev 01)
00:1d.1 USB Controller: Intel Corp. 92901DB USB (Hub #2) (rev 01)
00:1d.2 USB Controller: Intel Corp. 92901DB USB (Hub #3) (rev 01)
00:1d.7 USB Controller: Intel Corp. 92901DB USB2 (rev 01)
This tells me that Intel made my USB Controllers.
Looking at the kernel, you have as I said three different HCDs:
< > UHCI (Intel PIIX4, VIA, ...) support
< > UHCI Alternate Driver (JE) support
< > OHCI (Compaq, iMacs, OPTi, ALi, ...) support

Please read the < help > on each of the drivers for detailed information, but a short round-up would be for Intel and VIA chips, choose the first UHCI driver, and for others (including SiS), choose the OHCI driver. (I've got no experience with the alternate UHCI JE driver..).

You should also enable EHCI HCD (USB 2.0) If you have an USB 2.0 capable computer/chip, which I do.

So, for my setup, I would also configure my kernel with these options:
USB support --->
<M> Support for USB
----- <M> EHCI HCD (USB 2.0) support
----- <M> UHCI (Intel PIIX4, VIA, ...) support
----- <M> USB Human Interface Device (Full HID) support
----- [*] HID input layer support

If you got a SiS, ALi, Compaq etc (check the help info) computer (with USB 2.0), your USB support kernel setup would look like this:
USB support --->
<M> USB support
----- <M> EHCI HCD (USB 2.0) support
----- <M> OHCI (Compaq, iMac, Opti, SiS, ALi, ...) support
----- <M> USB Human Interface Device (Full HID) support
----- [*] HID input layer support

2. Userspace programs
We will be using the 'gpm' as our console-based mouse driver. Install gpm if you haven't done so already:
emerge -pv gpm
# if all looks good (no ekstra packages you don't want etc), install gpm
emerge gpm

Thats it. If you didn't get any error messages, you've got 'gpm' installed and are now ready to configure your mouse support.

3. Configuration
3.a Kernel
This setting is only nessesary if you are using an USB mouse and you did as I did - compile USB support as modules. If not, skip to the next section.

The modules that need to be loaded are:
usb-uhci # if you use the Intel driver
uhci #if you use the alternate JE driver
usb-ohci # if you use the Compaq, iMacs, ALi, SiS... driver
ehci-hcd #if you have usb 2.0

You could either edit '/etc/modules.autoload.d/kernel-2.4' by hand or just append them by writing as follows:
  • In my case, with Intel driver:
    echo -e "usb-uhci\nehci-hcd\ninput\nmousedev\nhid" >> /etc/modules.autoload.d/kernel-2.4
  • With Compaq, iMacs, ALi, SiS driver:
    echo -e "usb-ohci\nehci-hcd\ninput\nmousedev\nhid" >> /etc/modules.autoload.d/kernel-2.4
Now, the USB modules will autoload each time you start your computer. But, in the good spirit og Linux, you don't want to reboot just to have USB support (unless you also remade your kernel and need to reboot to activate your new kernel), so lets load these modules:
modprobe usb-uhci ehci-hcd input mousedev hid
(replace 'usb-uhci' with 'usb-ohci' if you use the 'Compaq etc' driver. Run
to check that your modules were loaded.

3.b Userspace program
'gpm' needs to know which device and protocol to use. This depends on your mouse.

The most used mouse devices (that I know of):
/dev/mouse       #mostly a symlink to your mouse device
/dev/psaux       #device for a ps/2 mouse
/dev/misc/psaux  #alternate device for ps/2 mouse
/dev/input/mice  #device for USB mouse
/dev/tts/0       #device for a mouse on COM1

The most used protocols (that I know of):
ps2    #PS/2 mice
imps2  #Microsoft Intellimouse (USB)
mman   #mouse man

Having this list in mind, head over to /etc/conf.d/gpm and configure 'gpm':
nano -w /etc/conf.d/gpm

I'm using a USB MS Intellimouse Explorer, so my gpm config file looks like this:
# Config file for /etc/init.d/gpm

# Please uncomment the type of mouse you have and the appropriate MOUSEDEV entry


# Extra settings

The extra settings is beyond this HOW-TO. Please refeer to the man pages ('man gpm'). (The three dots are ofcourse not in the config file, I just put them there to indicate there are more options in the config file).

We want mouse support each time we start our computer, so lets add gpm to the default runlevel:
rc-update add gpm default
Again, as in good Linux spirit, we won't be booting our computer to have mouse support, so lets start 'gpm' right away:
/etc/init.d/gpm start
If all went well, you would see:
 * Starting gpm...        [ Ok]

4. Support in a 2.6 kernel
This section will be updated shortly with better info...
I'm now using mm-sources-beta9-mm2, which is the latest development sources with the mm patchset - kernel 2.6.0_test9.

It seems that the way to get mouse support in console with a 2.6 kernel is like a 2.4 kernel, at least it works, but there might be a better way(?).

One interesting thing is that my laptop enabled a usb mouse and the mousepad even though I only added one mousedevice to the gpm config, and both work just fine. I've got Synaptic support compiled into my kernel though, so that might be the reason. This ofcourse if you got usb support compiled into your kernel, or you usb modules loaded at startup.

There. If everything went well, you now have mouse support in console, letting you copy and paste text as you like. Developers and programmers should also look into the '-S' option.

If you are using Gentoo on a laptop, you might want support for both touchpad and a second mouse. Please see my [HOW-TO] Dual-mouse (Touchpad & USB) setup on a laptop post for instructions.

Please comment or correct my mistakes if any...

20031002 - Initial posting
20031002#2 - Added link to dual-mouse setup
20031002#3 - Added kernel info about PS/2 mouse support
20031112 - Added a small notice about this being for a 2.4.xx kernel
20031112#2 - Added a paragraph about support in a 2.6 kernel

Last edited by Joffer on Wed Nov 12, 2003 1:02 pm; edited 3 times in total
Back to top
View user's profile Send private message

Joined: 01 Jun 2002
Posts: 1057

PostPosted: Fri Oct 03, 2003 1:24 am    Post subject: Reply with quote

If anyone's using an IBM ThinkPad with the tp-scroll utility, used to allow scrolling by holding down the middle button, keep in mind that gpm will not behave properly while tp-scroll is running.
s/(?<!gnu\/)linux(?! kernel)/GNU\/Linux/gi

Don't blame me. I didn't vote for him.
Back to top
View user's profile Send private message

Joined: 05 May 2002
Posts: 320
Location: Australia

PostPosted: Fri Nov 14, 2003 2:00 am    Post subject: Reply with quote

Thanks for the HOWTO - this was something I always wanted to get around to setting up - didnt realize how easy it was.

Just for information - I have a 2.6 kernel and none of my HID, USB or Mouse stuff are modules, everything is compiled into the kernel and this HOWTO works fine - just skip the part about modprobing and it will work.
We used to have hominid cousins that were vegetarian. The palæontological record suggests that our ancestors killed them and ate them.
Back to top
View user's profile Send private message

Joined: 12 Apr 2003
Posts: 1145
Location: Coimbra, Portugal

PostPosted: Fri Nov 14, 2003 12:10 pm    Post subject: Reply with quote

It helped me a lot, thanx :wink:


Linux Gandalf 3.2.35-grsec
Gentoo Base System version 2.2
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum