USB Mouse Configuration in Linux


  • USB MOUSE CONFIGURATION FOR X11 KDE and Console
  • DUAL MOUSE OPERATION ON LAPTOP (touchpad + usb)
  • S/2 + USB

USB Mouse Notes for Debian, Knoppix (and many distributions)

After installing Knoppix on a Dell laptop with a touchpad pointer and then later connecting a usb mouse, the use mouse did nto work. I was able to get the usb mouse to work, and here is the process!

1. First I verified that the appropriate modules were loaded with 'lsmod'. Those modules that are required are: usbcore, usb-uhci, and input. Note however that usbmouse is not required, I suspect it is in the kernl.

2. Next I checked /etc/X11/XF86Conf-4 to see if both identifiers exist.

3. As the start of the XF86Conf-4 I noticed under Section "ServerLayout" the only pointer was PS/2 Mouse. A text remark below this said "# USB Mouse not detected". I didn't have the USB mouse connected when I did the install. To fix this I added the line:

InputDevice    "USB Mouse" "CorePointer" 

4. It is possible to get both working at the same time. I remarked out the PS/2 Core Pointer line and restarted with successful USB mouse operation but the touchpad disabled. This is ok because I hate touchpad. However, if the USB mouse is not present, then X will fail. The 'CorePointer' really needs to be the one that is there all of the time.

5. To get both working, enable the PS/2 and set it to CorePointer, enable the USB Mouse also (both referring to the ServerLayout section). Make sure on both InputDevice entries there is 'Option "SendCoreEvents" "true"' and under the ServerFlags section a line that says 'Option "AllowMouseOpenFail" "true" EndSection'

That will get both the touchpad and USB mouse working at the same time.

Excerpts from XF86Conf-4 file for getting Touchpad + PS/2 Mouse Available:

Section "ServerLayout"
        Identifier     "XFree86 Configured"
        Screen      0  "Screen0" 0 0
        InputDevice    "Keyboard0" "CoreKeyboard"
        InputDevice    "PS/2 Mouse" "CorePointer"
        InputDevice    "USB Mouse" 
EndSection

Section "ServerFlags"
        Option "AllowMouseOpenFail"  "true"
EndSection

Section "InputDevice"
        Identifier  "PS/2 Mouse"
        Driver      "mouse"
        Option      "Protocol" "auto"
        Option      "ZAxisMapping"          "4 5"
        Option      "Device" "/dev/psaux"
        Option      "Emulate3Buttons" "true"
        Option      "Emulate3Timeout" "70"
        Option      "SendCoreEvents"  "true"
EndSection

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "SendCoreEvents"        "true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"
EndSection

 

USB Mouse Notes for Redhat, Fedora (and many distributions)

  • KDE Control Center
  • Peripherals Tree
  • Mouse
  • Advanced Tab
1. Pointer acceleration 1x
2. Pointer threshold 20 pixels

Manually edit:

vi /home/nicolep/.kde/share/config/kcminputrc

Manually edit:

 vi /etc/X11/XF86Config
 Resolution 800 <- but this doesn't work on USB mouse
Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "Protocol" "IMPS/2"
        Option      "Device" "/dev/input/mice"
        Option      "ZAxisMapping" "4 5"
        Option      "Emulate3Buttons" "no"
        Option      "Resolution" "800"
EndSection

Section "InputDevice"

# If the normal CorePointer mouse is not a USB mouse then
# this input device can be used in AlwaysCore mode to let you
# also use USB mice at the same time.
        Identifier  "DevInputMice"
        Driver      "mouse"
        Option      "Protocol" "IMPS/2"
        Option      "Device" "/dev/input/mice"
        Option      "ZAxisMapping" "4 5"
        Option      "Emulate3Buttons" "no"
        Option      "Resolution" "800"
EndSection

Make a usbmouse device node

 mknod /dev/usbmouse c 10 32
 rm mouse
 ln -s usbmouse mouse

If you cat /dev/input/mice you should see some bizarre looking characters as you move the mouse or click any of the buttons. /proc/bus/usb

lsmod
dmesg


Preferably, use the 2.4.x kernel. You first need to configure your kernel for the USB mouse support. Turn on the 'USB Human Interface Device (HID)" in the USB support and 'Mouse Support" in the Input Core support. Make sure you do NOT turn on the HIDBP mouse support. The HIDBP (boot protocol) way is intended for embedded systems with resource constraints and is inferior for normal desktop systems. Do

"insmod input; insmod usbcore; insmod usb-uhci; insmod hid"

How do I have mouse running in both console mode and X?

You can have your X and gpm cooperate on the single mouse. This is a little difficult, but you can try this. Have these lines also in your /etc/gpm.conf should contain at least these lines (alongwith other stuff):

device=/dev/psaux
repeat_type=raw
type=ps2

The repeat_type line tells gpm to repeat the data exactly as it gets it. Other programs (i.e., X), can read that data from /dev/gpmdata. Then edit the XF86Config (or XF86Config-4) file to change /dev/psaux to /dev/gpmdata. Restart both gpm and X, and you are done.

extra information:

mknod /dev/usbmouse c 13 63
USB mice should be grouped at /dev/input/mice

test or troubleshoot:

cat /dev/input/mice
/dev/input/mice or /dev/input/mouse0

check with "lsmod" if there is an usbmouse module present

Entry in XF86Config-4

Section "InputDevice"
        Identifier      "USB Mouse"
        Driver          "mouse"
        Option          "Device"                "/dev/input/mice"
        Option          "SendCoreEvents"        "true"
        Option          "Protocol"              "IMPS/2"
        Option          "ZAxisMapping"          "4 5"
        Option          "Buttons"               "5"
EndSection

If 'lsmod|grep mouse' shows no usbmouse then the module is not present. The module must be present for the usbmouse to work in X11.

 insmod usbcore
 insmod usb-uhci
 insmod input
 insmod usbmouse

I then created /dev/usbmouse with:

               mknod /dev/usbmouse c 13 32

It uses major device 13 based on the result of doing a cat of /proc/devices, which listed

               13 input

Anyway, after doing that on my non-X console screen, I then did

       gpm -k
       gpm -t ps2 -m /dev/usbmouse

 

USB Mouse additional X11 data

1. Recompile the Kernel. You need to turn on:

    • "USB Human Interface Device (HID) support"
    • "USB support"
    • "Mouse Support (in input core support)"

Do _not_ turn on "USB HIDBP Mouse support"

If you build modules, you need to load "input.o", "hid.o" and "mousedev.o".

2. Plug in the Mouse and check if it was detected (kernel message)

3. Create the mouse nodes by running the following commands:

mkdir /dev/input \
mknod /dev/input/mice c 13 63

4. You probably want to use the mouse under X, you need to edit your XF86Config (/etc/X11/XF86Config). Change your InputDevice and ServerLayout sections to something like that:

Section "InputDevice"
    Identifier   "USB Mice"
    Driver   "mouse"
    Option "Protocol"     "IMPS/2"
    Option "Device"       "/dev/input/mice"
    Option "ZAxisMapping"  "4 5"
    Option "Buttons"    "5"
EndSection

Section "ServerLayout"
...
    InputDevice  "USB Mice"    "CorePointer"
...
EndSection

related

 

 

 

Last modified on 13 July 2019, at 16:51