blob: 77a51c16ee445b89d11b5e68d53eca5e17da118c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
==================
Linux Evdev Driver
==================
Overview
--------
The Linux event device (evdev) is a hardware-independent API that gives access to input events from,
for example, a mouse or touchscreen. It is exposed via the Linux device file system interface.
Prerequisites
-------------
Your system has an input device configured (usually under ``/dev/input/`` such as ``/dev/input/event0``).
Configuring the driver
----------------------
Enable the Linux LVGL evdev driver support in ``lv_conf.h``.
.. code:: c
#define LV_USE_EVDEV 1
Usage
-----
To set up an event input, first create an input device with ``lv_edev_create`` setting it to the correct Linux event device.
Then link this to the LVGL display with ``lv_indev_set_display``.
.. code:: c
lv_indev_t *touch = lv_evdev_create(LV_INDEV_TYPE_POINTER, "/dev/input/event0");
lv_indev_set_display(touch, disp);
Ensure that an ``lv_display_t`` object is already created for ``disp``. An example for this is shown below, using the Linux framebuffer driver.
.. code:: c
lv_display_t * disp = lv_linux_fbdev
lv_linux_fbdev_set_file(disp, "/dev/fb0");_create();
Locating your input device
--------------------------
If you can't determine your input device, first run
```$cat /proc/bus/input/devices```
This should show input devices and there will be entries with the word ``event`` which give a clue as to the device to use eg. ``event1`` would be ``/dev/input/event1``.
You can use ``evtest`` to show data from that event source to see if it is actually the one you want.
Try:
``$evtest /dev/input/event1`` replacing ``eventX`` with your event device from above.
|