Project Proposal

This page is a scratch pad for the "[http://open.utoronto.ca/index.php?option=com_content&task=view&id=145&Itemid=191 "Using USB switch devices with the GNOME On-Screen Keyboard on Linux Project"] funded by [http://open.utoronto.ca/index.php Project Open Source|Open Access].

Background Info

Introduction

USB accessibility devices, such as switch input devices and head trackers, are often designed to emulate mouse devices. In GNU/Linux, these devices are currently configured so that desktop environments, such as GNOME, sees them as secondary mice which are multiplexed with the primary pointing device. With switch input devices, the switches appear as mouse buttons and with head tracker devices, head movements appear as mouse movements.

Configuring Mice in GNU/Linux

There are several ways to multiplex the mice for the desktop environment. One method uses /dev/input/mice, a special device that multiplexes all of the USB mice plugged into the system. The multiplexing happens in the kernel USB mouse driver and as a result, the x-server only needs to configure one mouse to be the "CorePointer". In this case, the relevant xorg.conf would look something like:

    Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ImPS/2"
    EndSection

Another way to configure multiple mice in GNU/Linux is to have the x-server multiplex the mice. In this case, one mouse is configured as the "CorePointer" and other mouse or mice are configured to "SendCoreEvents". In this case, the relevant xorg.conf would look something like:

    Section "InputDevice"
        Identifier      "Configured Mouse 1"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mouse0"
        Option          "Protocol"              "ImPS/2"
    EndSection

    Section "InputDevice"
        Identifier      "Configured Mouse 2"
        Driver          "mouse"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/input/mouse1"
        Option          "Protocol"              "ImPS/2"
    EndSection

The disadvantage to this approach is that the user must edit their xorg.conf and restart the x-server every time they want to add or remove a device. When the kernel handles the multiplexing, the device will work as soon as it is plugged in.

It is also possible to combine the two method of mice multiplexing. For example, my laptop has a builtin touchpad and an external USB mouse. The USB mouse is configured as the "CorePointer" and the touchpad is configured as a secondary mouse that "SendsCoreEvents". The relevant sections of my /etc/X11/xorg.conf are as follows:

    Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Device"                "/dev/input/mice"
        Option          "Protocol"              "ImPS/2"
    EndSection

    Section "InputDevice"
        Identifier      "Synaptics Touchpad"
        Driver          "synaptics"
        Option          "SendCoreEvents"        "true"
        Option          "Device"                "/dev/psaux"
        Option          "Protocol"              "auto-dev"
    EndSection

How GOK Currently Uses Accessibility Devices

The configuration behaviour described above presents a couple of problems for GOK, the biggest being the use of the CorePointer to send events to GOK. This problem comes about because GTK+ applications are permitted to do pointer grabs, that is, applications are permitted to grab the pointer so that all mouse events are passed to the application. If GOK is used to put an application into a pointer grab state, the user will not be able to use GOK to bring the application to a pointer ungrab state because all mouse events are being sent to the application, not GOK. Users of accessibility devices may not be able to recover from such a situation.

To get around this problem, GOK detaches any mice configured as the "CorePointer" when it is started. This allows GOK to receive mice events even when an application does a pointer grab. When a mouse is detached from the CorePointer, it operates as a "gok pointer"; the mouse cursor becomes cross-hairs and the movements are confined to the gok window (see screenshot below).

http://www.bagu.org/pictures/gok-pointer.png

Another problem with accessibly device configuration on GNU/Linux is that it is difficult to distinguish accessibility devices from regular mice because they emulate regular mice. To ensure that accessibility devices are configured correctly, GOK will detach any mouse that is configured as the CorePointer. Users are prompted when gok is started so that they can disable this action if for some reason they do not want the CorePointer detached.

With my laptop configuration (described above), the USB mouse is configured as the CorePointer so it is detached and becomes the "gok pointer" when I start GOK. My touchpad remains configured as a normal mouse cursor. Because the CorePointer is configured with /dev/input/mice, GOK will detach all the USB mice plugged into the system. These detached devices will act as a multiplexed "gok pointers".

Questions

The only issue that I encountered was that occationally my corepointer will not re-attach when I quit gok. This seems like more of a problem with X than a problem with gok.

== Possible Solutions == -- still working on.

One

Linux evdev

Two

libusb

Three

custom X driver

GOK Input related Bugs

Acknowledgments

Thanks to [http://cia.navi.cx/stats/author/billh Bill Haneman], Sun Microsystems, and [http://cia.navi.cx/stats/author/dtb David Bolter], University of Toronto, for answering all of my questions and generally helping me out with this document.

TODO List

GokAccessibilityDevices (last edited 2005-11-23 17:04:36 by DavidBolter)