Posted by khk

USB and the Vaio

Since today my Vaio even can do USB… I just received my first USB device: A mouse. I´m running the kernel version 2.2.13, which does not come with a recent version of the USB code. The state of the art code can only be found in the development kernel… So it´s a good thing that Vojtech Pavlik did a back port of the new stuff to the stable kernel tree. The patches can be found at http://www.suse.cz/development/usb-backport/.

The process to get USB running is pretty straight forward:

  • Get the patch and apply it to the 2.2.13 kernel source tree.
  • Go into the kernel configuration utility – I use a “make menuconfig”, but I hope that the xconfig or the plain old config will also work.
  • If you want to build the USB support as modules then make sure that in “Loadable Module Support” the setting for “Set version information on all symbols for modules” is DISABLED. Otherwise you will get an error message about a missing symbol when trying to load the UHCI module.
  • In the USB section select “UHCI support” plus all the devices you intend to attach to the computer. The /proc/bus/usb support is also useful for debugging purposes.
  • Do the usual make dep bzImage modules modules_install – or whatever you are using to compile and install a new version of the kernel.
  • Reboot
  • While rebooting the machine go into the BIOS setup and make sure that the “Plug&Play” support in the BIOS is NOT enabled
  • Start up the USB sub-system – I´m using the following shell script:
    #!/bin/sh
    /sbin/modprobe usbcore
    /sbin/modprobe usb-uhci
    /sbin/modprobe hub
    /sbin/modprobe mouse
    /sbin/modprobe usb-keyboard
    /sbin/modprobe printer
  • Connect your mouse or whatever device you want to use … Shake, Rattle & USB …

OK, the setup is not yet complete. In order to use the mouse or a printer or any other device you first have to create certain device files and at least for the mouse add an entry in the XF86Config file. It does not make a lot of sense to repeat all the information here that´s already covered in the USB HowTo.

Another good starting point to look for Linux and USB information is the Linux USB Page.

USB Mouse and XFree86

In order to use a USB mouse and the touchpad either at the same time, or the mouse instead of the touchpad there is still a little work to do.

The following section needs to be added to /etc/XF86Config so that XFree86 “knows” where to find the USB mouse:

Section "Xinput"
    SubSection "Mouse"
        DeviceName   "USB Mouse"
        Protocol     "IMPS/2"
        Port         "/dev/usbmouse0"
        AlwaysCore
    EndSubSection
EndSection

The device file in the /dev directory needs to be created using the following command:
  mknod /dev/usbmouse0 c 180 16

This works well as long as the mouse is connected when the X server is started. If it’s not there, the server will run into a problem opening the mouse device and will exit with an error message.

… just add the following lines to /etc/XF86Config and the server will ignore the error condition and will start up even without a mouse attached:

Section "ServerFlags"
   AllowMouseOpenFail
EndSection

At this time we know have a working USB mouse, as long as it was connected when the X server was first started. After that the mouse can be disconnected and reconnected as many times as you want and the X server will use it whenever it’s there. If the mouse was not connected when the X server was started, all connecting and disconnecting will not make it work.

It took me a while to find a cure for that. The solution is only documented in the source code of the USB mouse driver: Just add one line to /etc/modules.conf (or /etc/conf.modules if you are still running an old system):

   # for USB mice
   options mouse force=1

This will initialize the mouse device driver even if no mouse is connected. The X server will then be able to open the mouse device and will not receive an error message. After that you can connect your mouse and it will be picked up by the server.