Touch DDK

To be able to detect events from your touch controller, you need to provide a driver. The mtouch framework requires minimal hardware-specific implementation to provide full multitouch device support. To use the mtouch framework, your driver must communicate with hardware via the hardware interface, provide required and optional callback functions that depend on your driver’s and hardware’s capabilities, and attach driver to the mtouch framework.

The mtouch framework loads the individual drivers as shared object libraries based on the configuration specified during the mtouch executable binary startup, as shown in the following diagram:


Touch driver

The mtouch service starts the resource managers for touch functionality, load configuration and specific hardware drivers, optionally exposes resource manager interface as a new device, and uses the specific hardware drivers to services requests from clients.

Refer to the "Writing a Touch Driver" section of the Input Events Library Reference for more information on the process of developing a new mtouch driver.

The following table consists of the required implementations:

Implementation:Refer to:
Defining the driver parameters using the mtouch_driver_params structure.Connect to the Input Events library
Implementing mandatory callback functions get_coords(), get_contact_id(), and is_contact_down().Provide the callback functions
Implementing optional callback functions, depending on the parameters specified in the mtouch_driver_params structure’s capabilities field:
  • MTOUCH_CAPABILITIES_CONTACT_COUNT - get_down_count()
  • MTOUCH_CAPABILITIES_WIDTH - get_touch_width()
  • MTOUCH_CAPABILITIES_HEIGHT - get_touch_height()
  • MTOUCH_CAPABILITIES_PRESSURE - get_touch_pressure()
  • MTOUCH_CAPABILITIES_SEQ_ID - get_seq_id()
  • MTOUCH_CAPABILITIES_CONTACT_TYPE - get_contact_type()
  • MTOUCH_CAPABILITIES_RATE_SET - set_event_rate()
  • MTOUCH_CAPABILITIES_ORIENTATION - get_touch_orientation()
  • MTOUCH_CAPABILITIES_SELECT - get_select()
Definitions in mtouch_driver.h and Provide the callback functions
Specifying the implementation by assigning implemented functions to fields in the mtouch_driver_funcs_t structure, and leaving all others as NULL.Connect to the Input Events library
Implementing mtouch_driver_init() function.Disconnect from the Input Events library
Implementing mtouch_driver_fini() function, which must call mtouch_driver_detach() function functions.Disconnect from the Input Events library
Compiling the driver and specifying it in the mtouch configuration file.Touch configuration file
Note:

The following capabilities are deprecated and shouldn't be used:

  • MTOUCH_CAPABILITIES_RATE_SET - set_event_rate()

  • MTOUCH_CAPABILITIES_ORIENTATION - get_touch_orientation()

  • MTOUCH_CAPABILITIES_SELECT - get_select()

You must leave the corresponding members in the mtouch_driver_funcs_t structure as NULL.

The implementation of various callback functions must communicate with the specific hardware. Events should be retrieved from the hardware using a separate thread, created in the init function and destroyed in the fini function, and processed using mtouch_driver_process_packet() function provided by the mtouch framework.

Page updated: