Configure mtouch subsection

The mtouch subsection specifies the configuration to apply to the touch devices (also called mtouch devices for multitouch devices) supported by the platform.

This section must begin with begin mtouch and end with end mtouch. Include this section in your configuration file only if your system supports touch devices, or if there are applications on your system that require them.

There can be multiple mtouch subsections within a configuration file. The number of mtouch subsections depends on the number of physical displays supported by the platform. If you have multiple displays, you can configure the driver for each display; therefore you would have one mtouch section for each of these displays.

Below is an example of multiple mtouch sections of a graphics.conf file:
begin mtouch
    driver = hid
    options = vid=0x0eef,did=0x0001,max_touchpoints=5
     scaling = /armle-v7/usr/lib/graphics/iMX6/scaling.conf
     display = 1
end mtouch

begin mtouch
     driver = egalax
     options = lvds=1
     scaling = /armle-v7/usr/lib/graphics/iMX6/scaling.conf
     display = 2
end mtouch
   

Once screen is running, run calib-touch with the -display option from either your startup script or from a shell to calibrate your touchscreens.

Subsections

The subsections of the mtouch subsection are:

filter

Filters that are related to the touch devices are specified in the subsection starting with begin filter and ending with end filter.

Parameter

The following are valid parameters that can be configured under the mtouch subsection:

Parameter Description Type Possible value(s)
display The connection type to the display that's associated with the mtouch device. If the configuration is an integer, Screen interprets it as the ID of the display; otherwise, if the configuration is a string that matches one of the valid display connection types, then Screen associates the first display of that type with the mtouch device. Default is 1. String or integer

internal

composite

svideo

YPbPr

rgb

rgbhv

dvi

hdmi

0 to 4,294,967,295

driver
The touch driver loaded by Screen. Screen uses the following algorithm to determine the touch driver to load:
"libmtouch-" + <value of driver> + ".so"
String

egalax

hid

lg-tsc101

min_event_interval The sampling rate (in microseconds) of the touch controller. You won't get two touch samples within a time less than that configured here. The effectiveness of this configuration is driver-dependent. Unsigned long integer 0 to 4,294,967,295
options
The options configuration is driver-dependent. The string that you configure is passed verbatim to the driver itself. For example:
  • It can be used to set the height and width (in pixels) of a rectangular mtouch surface. Typically, you set this to your display resolution (i.e., the configuration you used for the video-mode under the display section). This configuration must be in the form of:

    height=display_height,width=display_width

  • It can be used to set information and the touchpoints using the following form: vid=vendorID ,did=productID ,max_touchpoints=number_of_touchpoints ,lvds=interface
String Examples:height=720,width=1280, vid, did, max_touchpoints, lvds
scaling

The full pathname of the server-side scaling configuration file that defines the scaling to apply to the touch coordinates. See "Scaling configuration file" below.

String NULL (default)
thread-prio The thread priority for the mtouch driver. The value of this thread priority must lie between the minimum and maximum values returned by sched_get_priority_min() and sched_get_priority_max(). Unsigned long integer

Example:21 (default)

Scaling configuration file

The scaling.conf file is a free-form ASCII text file parsed by Screen. The file can contain extra tabs and blank lines for formatting purposes. Keywords in the file are case-sensitive. Comments can be placed anywhere within the file (except within quotes). Comments begin with the # character and end at the end of the line.

You must define a mode for the touch coordinates using a scaling.conf configuration file. You can define only one mode per configuration. The mode recommended is the scale mode configured with the resolution of your display. For example, the entry in the scaling.conf file looks like this:

1280x720:mode=scale

By default, Screen expects the scaling.conf file on your target at this location:

/etc/system/config/scaling.conf

If your scaling.conf file isn't located at the above location or isn't named scaling.conf, you must indicate the correct path and name of your scaling configuration file by using the scaling parameter in your mtouch configuration section.

Here's a sample scaling.conf configuration file:

#
# Configuration file for touch screen to display coordinate mapping.
# 
# The following modes are supported:
#
# - direct: Touch coordinates are reported exactly as they come in from the
#           driver.
#   params: *None*
#
# - scale:  Touch coordinates are scaled to the client screen resolution.
#   params: *None*
#
# - rect:   Touch coordinates are ignored if they fall outside the specified
#           (centered) rectangle. 
#           They are also rebased at the upper left corner of the rectangle.
#           The offset represents the offset of the upper left corner of the
#           rectangle relative to the upper left corner of the display.
#   params: offset_x=N,
#           offset_y=N
#
# - dim:    Touch coordinates are scaled and shifted based on the physical
#           dimensions of the touch panel and display.
#   params: width_mm=N,
#           height_mm=N,
#           border_left_mm=N,
#           border_right_mm=N,
#           border_top_mm=N,
#           border_bottom=N
#
# - calib:  Touch coordinates are scaled and shifted based on calibration data.
#           These parameters can be written out by a libmtouch-calib based utility.
#   params: disp_x=[X1:X2:X3:X4],
#           disp_y=[Y1:Y2:Y3:Y4],
#           mtouch_x=[X1:X2:X3:X4],
#           mtouch_y=[Y1:Y2:Y3:Y4]
#
# The format of entries is as follows:
# WxH:mode=MODE,MODE_PARAMS
#
# Where MODE is one of the above listed mapping modes and MODE_PARAMS is the
# mode's corresponding params string.
#
# You can specify different mapping types for different resolutions.
# You can also specify multiple mapping types for the same resolution, but the
# first valid one will be chosen.
#

# Scaling based on calibration data
#1024x600:mode=calib,disp_x=[102:922:922:102],disp_y=[60:60:540:540], \
                    mtouch_x=[172:1108:1108:172],mtouch_y=[110:110:658:658]

# Scaling based on physical dimensions
#1024x600:mode=dim,width_mm=154,height_mm=90,border_left_mm=5,border_right_mm=5, \
                  border_top_mm=5,border_bottom_mm=5
                  
# Simple scaling to client resolution
1024x600:mode=scale

# No scaling, report coordinates exactly as the driver hands them to the client
#1024x600:mode=direct

# Same as above, except when the client resolution is 1280x768
#1280x768:mode=direct

# Scaling to a centered rectangle, this example was used with the quanta-hid
# driver on a 1920x1080 touch screen running a VMware session at 1312x800
# VMware example, offset_x = (1920 / 2) - (1312 / 2), offset_y = (1080 / 2) - (800 / 2)
1312x800:mode=rect,offset_x=304,offset_y=140