Updated: April 19, 2023 |
The mtouch service starts the resource managers for touch functionality and loads the configuration
mtouch [-c configfile] [-d] [-q queuebool] [-r] [-U user] [-v]
QNX Neutrino
... mtouch -rd ls /dev/mtouch/ touch_display0
This information that's associated with the touch driver (e.g., touch_display0) is presented as a data structure of type mtouch_event_t. The information includes:
To retrieve the touch event information, you can open resource manager and read the file descriptor. For example:
... int fd, nCount; mtouch_event_t touch_packet; ... fd = open("/dev/mtouch/touch_display0", O_RDWR | O_NONBLOCK); ... while(1) { nCount = read(fd, &touch_packet, sizeof(touch_packet)); if (0 >= nCount) { delay (100); } else { printf("Timestamp: %llu Sequence ID: %u Contact ID:%d X:%u, Y:%u Event: ", touch_packet.timestamp, touch_packet.seq_id, touch_packet.contact_id, touch_packet.x, touch_packet.y); switch (touch_packet.event_type) { case INPUT_EVENT_MTOUCH_TOUCH: printf("Touch event.\n"); break; case INPUT_EVENT_MTOUCH_MOVE: printf("Move event.\n"); break; case INPUT_EVENT_MTOUCH_RELEASE: printf("Release event.\n"); break; default: printf("Other...\n"); break; } } } return 0; ...
Nov 09 15:38:16 5 9 200 touch_display[INFO]: x 21 y 400 width 1 height 1 Nov 09 15:38:16 5 9 200 touch_display[INFO]: x 22 y 410 width 1 height 1 Nov 09 15:38:16 5 9 200 touch_display[INFO]: x 19 y 413 width 1 height 1 Nov 09 15:38:16 5 9 200 touch_display[INFO]: x 23 y 402 width 1 height 1 Nov 09 15:38:16 5 9 200 touch_display[INFO]: x 20 y 401 width 1 height 1
The mtouch service starts the touch drivers that are specified in the mtouch.conf file. To run this service, you must first have Screen started. Other dependencies may vary based on your touch device.
Use a Human Interface Device (HID) that uses a USB-based controller:
You need to ensure that the shared objects and configuration files that mtouch depends on are included in your system image. For example:
See the Shared libraries section of the Building Embedded Systems guide for more information on how to determine which shared objects you need.
On your target system, you typically require the USB drivers to be started before touch can be used. For example:
io-usb-otg -d hcd-dm816x-mg ioport=0x47401c00,irq=19
Start screen.
screen
Start mtouch.
mtouch