Docs/Virtual Buttons

From Apertis
Jump to: navigation, search

Virtual Buttons Daemon

To allow using off-screen touch sensor areas as virtual buttons, a virtual button daemon has been provided.

The virtual button daemon (/usr/bin/buttonsd) requires a configuration file in the following format:

device "VIRTUAL KEYBOARD" 0xf00:1234 from "/dev/input/by-id/usb-QUANTA_OpticalTouchScreen-event-if00" {
        button 1700,0 220x540 KEY_J repeats
        button 1700,540 220x540 KEY_Q

The fields after device are the following:

"NAME" for the name the virtual device will present itself as. this is the name that will appear in xinput's list, and the name that must be used if the device is to be statically configured in xorg.conf

The ####:#### is a vendor id followed by a product id, the two numbers may be given in hexadecimal or decimal.

The string after the word from is the pathname of the real device node on the filesystem. In the example, the touch sensor for the Iiyama multi-touch monitor is used.

On an mx6 sabrelite with an egalax touch panel, "/dev/input/by-path/platform-21a8000.i2c-event" would be appropriate. This string must be enclosed in quotes.

Inside the {} are a list of button definitions. the format is:

button X,Y WxH keycode [repeats]

x, y, w, h specify the x and y co-ordinates from the touch pad for the corner of the button, and wxh specifies the width and height. keycodes come from /usr/include/input.h KEY_A, KEY_B, ... correspond to regular keyboard keys, but there are many other keys listed in the file that might be interesting (such as KEY_HOME, KEY_AUDIO)

The word "repeats" is optional. If present, the key will continue to repeat for as long as it is held, like holding down a key on the keyboard. If it's not present then pressing the area on the touch screen will immediately generate both a key press and key release event, and holding down the virtual key will do nothing.

The button daemon must be started as root in order to have access to input devices. It takes a single command line parameter — the name of the configuration file.

sudo buttonsd conffile

Evdev Calibration

By default, X will scale the touchscreen's input to the display. Off screen areas will be included in this, and if buttonsd is running, generate both the usual touch events and the new button events.

To remove off screen areas, evdev calibration must be used. When calibration is used, touchscreen co-ordinates outside of the calibrated area will act as if they're off screen. moving a finger from inside the area to outside the area will result in a release event at the edge of the screen. Moving from outside to inside will result in a press. The intent is that the screen behave as if the calibrated area was its physical boundary.

Setting this up for the eGalax touch screen on sabrelite can be done by creating a file in /usr/share/X11/xorg.conf.d with the contents:

Section "InputClass"
        Identifier "Calibrated Touch Screen"
        MatchProduct "eGalax Touch Screen"
        Driver "evdev"
        Option "Calibration" "0 16384 0 32768"

or, for the Iiyama touch screen on the intel reference platform:

Section "InputClass"
        Identifier "Calibrated Touch Screen"
        MatchProduct "QUANTA OpticalTouchScreen"
        Driver "evdev"
        Option "Calibration" "0 1000 0 1080"

The calibration numbers are low X, high X, low Y, high Y in unscaled touch sensor co-ordinates. X will scale touch sensor motion inside this range to fill the display.

This can also be done at run-time without changing configuration files by doing the following: (xinput may need to be installed with "apt-get install xinput")

xinput "eGalax Touch Screen" "Evdev Axis Calibration" 0 16384 0 32768

If using different devices, use

xinput list

to find the name.

Personal tools