LF Tip: USB mice and laptops

ArticleCategory:

SystemAdministration

AuthorImage:[Here we need a little image from you]

[Photo of the Author]

TranslationInfo:[Author + translation history. mailto: or http://homepage]

original in en Guido Socher

AboutTheAuthor:[A small biography about the author]

Guido really likes it when a computer is tailored to his needs and looks like he wants it. That's why he is using Linux.

Abstract:

This is a small tip. From now on LinuxFocus will have at least one new tip every month. If you have some ideas for a new tip then send them to guido("at" sign)linuxfocus.org

ArticleIllustration:

idea

ArticleBody:

Introduction

I have recently noticed that my friends were impressed when I plugged in a usb mouse into my Linux laptop that was already running X11. The mouse just works and I don't need to restart the X-server. For me this was normal but I must admit that I have never seen a linux distribution until today where this is the default behavior.

So here is the solution.

PS/2 and USB mouse under XF86

My linux distributions are not the latest therefore I have XF86. I guess that this will also apply to any other X-server but I have not tried it.

This "usb mouse hotplugging" makes really only sense on laptops which have an internal ps/2 mouse and a usb connector. Why do you need the internal mouse? Well you don't need it. You can set a server flag but generally it makes not much sense to use X11 without a mouse.
Section "ServerFlags"
Option     "AllowMouseOpenFail"
EndSection
The X-server can handle the adding and removal of a usb mouse without any problems. However it has to be able to open the software device (in /dev) at startup. The problem is that most distributions have the usb mouse compiled as a module. In other words it is loaded only when you plug in the mouse. To solve this you need to force load those modules even if there is no mouse connected at startup.

# put this into an init script e.g
# /etc/rc.d/rc.local for fedora or
# /etc/conf.d/local.start for gentoo or ....

# load the kernel modules needed for a usb mouse even if there
# is no mouse connected yet:
modprobe hid
modprobe input
modprobe mousedev
That's all.

mirror server hosted at Truenetwork, Russian Federation.