[LinuxFocus-icon]
LinuxFocus article number 383
http://linuxfocus.org

[Photo of the Author]
by Guido Socher (homepage)

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.

LF Tip: USB mice and laptops

idea

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

_________________ _________________ _________________

 

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.

Webpages maintained by the LinuxFocus Editor team
© Guido Socher
"some rights reserved" see linuxfocus.org/license/
http://www.LinuxFocus.org
Translation information:
en --> -- : Guido Socher (homepage)

2005-07-25, generated by lfparser_pdf version 2.51