USB Mouse and Linux: possible combination

In this tutorial we will discuss the use of USB mouse with Linux. These are, for example, those small optical mouse for laptops. The problem is mainly the kernel level, and then serve the changes to the X configuration file, but nothing tragic.

Usually these devices, as USB, are HID devices (Human Interface Devices). We already have, therefore, an idea of what we will have to enable in the kernel. Obviously it is necessary that, before, know to do a recompile of the kernel.
Let’s see how. At level kernel Well, first of all, we access to the kernel configuration (I prefer “make menuconfig”). In order to enable HID devices, we must first enable Input core support . We enter then in this item and activate “Input core support” (preferably as built-in) and “Mouse Support” (which appears after selecting input core support). At this point we need to compile USB support. Let’s go back to the main menu and enter into USB support . Here we must enable “Support for USB” (always better as built-in). We go down with the cursor and posizioniamoci on the “USB Human Interface Device Support (HID)”. Here we have the choice to enable “USB Human Interface Device (full HID) support” OR “USB Mouse HIDBP (basic) support”. The two choices can not coexist and in fact if you compile as built-in the first option, the second automatically disappears. The first includes all the drivers for the most advanced HID devices, while the second is a simplified and restricted version to support for HID mouse. You can try which one works with your mouse. My mouse Typhoon Anubis supports only support HID Boot Protocol (HIDBP, the second). We can now return to the main menu. Finally, we must ensure that it is built in support for PS / 2 mouse, since any HID USB mouse is emulated as a PS / 2 mouse. To do this we enter the menu Character Devices and let the voice Mice–> . Enter it and verify that it completed the “Mouse Support (not serial and bus mice)” and, below it, the “PS / 2 mouse (aka” auxiliary device “) support”. If they are not, compilatele, preferably built-in. At this point we can save our configuration, compile the kernel and reboot the PC. Check operation Once rebooted, issue command: #dmesg | grep [Mm] ouse usb.c: registered new driver usb_mouse usbmouse.c: v1.6: USB HID Boot Protocol mouse driver mice: PS / 2 mouse device common for all mice input0: Combo Mouse Combo Mouse on usb1: 2.0 should get an output similar to this. In particular check that you have the last two lines (not because the others are less important). A simple way to check if your USB mouse has been recognized and emulated perfectly is controlling a character device which is made to correspond with the USB mouse . Each mouse emulated by HID leans to the Input Core Support to emulate the device to a character device. These devices are present in the / dev / input / and usually, for the mouse device is / dev / input / mice. It could also be emulated as / dev / input / mouse0, so try a little ‘with both. To check if it works we give the command: #cat / dev / input / mice moving the mouse or pressing a few buttons should appear on the screen various unreadable characters. If you did not appear on then you can try another device file, or change the kernel support for HID devices opting for the other hypothesis (the two made above). At this point there remains more that configure X: We configure X We open the X configuration file, usually / etc / X11 / XF86Config and look the part relating to “Input Devices” refers to the mouse. We insert, instead of the old one, these new lines: Section “InputDevice”   Identifier “nome_mouse”   driver “mouse”   Option “Protocol” “ImPS / 2”   Option “Device” “/ dev / input / mice”   Option “ZAxisMapping” “4 5” EndSection This is the basic configuration. Instead of “nome_mouse” you have to put (always between “”), a name with which you want to identify your mouse. The second line is to be left intact. Regarding the third, it is said to X to use the mouse as a device that uses the PS / 2 protocol (not identical, however, because it uses Im). This configuration should work with all USB mouse, but if you have a particular (perhaps treated specifically by the XFree86 team) is good to use a different protocol. You can read the X-page guide on the internet is both the documentation attached to the package to view other specific protocols for various types of mouse (but in no case they are treated if not 2 or 3 and in any case it is best to keep this configuration). The “device” option refers to the mouse device file. The last line, the ZAxisMapping, enables the use of the wheel to scroll web pages. This is all to use your USB mouse. Start X and try. To note is that once configured X to use your USB mouse, with this configuration you may no longer use the trackpoint in laptops, such as the TouchPad (the only type of pointing device on which I’m sure). Bye!


Leave Your Reply

Your email address will not be published. Required fields are marked *