How to use touchscreen or mouse as an input device with BSD FB?

Description

What MCU/Processor/Board and compiler are you using?

Beaglebone Black with RTEMS (FreeBSD FrameBuffer)
Waveshare 5inch HDMI LCD (H)

What do you want to achieve?

Be able to use touchscreen or mouse as an input device

What have you tried so far?

I tried to work with evdev drivers but I think linux/input.h and some of the other headers undefined in RTEMS.

Code to reproduce

lv_drive_conf.h

#ifndef USE_EVDEV
#  define USE_EVDEV	1           
#endif

#if USE_EVDEV
#  define EVDEV_NAME   "/dev/input/event0"        /*You can use the "evtest" Linux tool to get the list of devices and test them*/
#  define EVDEV_SWAP_AXES         0               /*Swap the x and y axes of the touchscreen*/

#  define EVDEV_SCALE             0               /* Scale input, e.g. if touchscreen resolution does not match display resolution */
#  if EVDEV_SCALE
#    define EVDEV_SCALE_HOR_RES     (800)          /* Horizontal resolution of touchscreen */
#    define EVDEV_SCALE_VER_RES     (480)          /* Vertical resolution of touchscreen */
#  endif  /*EVDEV_SCALE*/

#  define EVDEV_CALIBRATE         0               /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
#  if EVDEV_CALIBRATE
#    define EVDEV_HOR_MIN   3800                    /*If EVDEV_XXX_MIN > EVDEV_XXX_MAX the XXX axis is automatically inverted*/
#    define EVDEV_HOR_MAX   200
#    define EVDEV_VER_MIN   200
#    define EVDEV_VER_MAX   3800
#  endif  /*EVDEV_SCALE*/
#endif  /*USE_EVDEV*/


My evdev code

#include <fbdev.h>
#include "lvgl/lvgl.h"
#include "evdev.h"
.
.
.
evdev_init();
	
    lv_indev_drv_t indev_drv;
    lv_indev_drv_init(&indev_drv);
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = evdev_read;
    lv_indev_drv_register(&indev_drv);      

I am trying to make an HMI system with RTEMS on BBB. I am using one of the samples in lv_tutorials but I can’t use any widget’s event. Is there any way to use touchscreen or mouse with BSD fb?

I think you are the first person to try this (and report about it). How similar is the RTEMS input system to the Linux evdev system?

Thanks for the reply. I am newbie both of the RTMS and LvGL. I don’t know exactly similarities of input system. I’ll look into it.
But is there any solution except the evdev? Am I have to write my own code for this?

You’ll most likely have to create a new driver for RTEMS. It shouldn’t be too difficult, however; most operating systems use very similar interfaces.

The input device porting template will probably be helpful. You should only need the touchpad or mouse sections.