Closed Uup115 closed 2 years ago
@Uup115 Can you share what you changed to make it working? I am in the same boat now. Using RPI OS Lite
Any help appreciated @kisvegabor @Uup115
Device/OS : Raspberry Pi with Desktop SDL version working fine - Display & Touch
Device/OS : Raspberry Pi Lite Display : Working Touch : Not working yet
Getting the following compiler error with touch is enabled using evdev
/usr/bin/ld: ./main.o: in function `main':
main.c:(.text.startup+0x74): undefined reference to `evdev_init'
/usr/bin/ld: main.c:(.text.startup+0x80): undefined reference to `evdev_read'
/usr/bin/ld: main.c:(.text.startup+0x90): undefined reference to `evdev_read'
collect2: error: ld returned 1 exit status
make: *** [Makefile:38: default] Error 1
Full Project is here for review https://github.com/sukesh-ak/LINUX-LVGL-FRAME-BUFFER
Code for touch here
@Uup115 Can you share what you changed to make it working? I am in the same boat now. Using RPI OS Lite
The simplest route:
You can edit the appropriate make files to shorten build time.
Embedded GUI Using Linux Frame Buffer Device with LVGL.tar.gz
@sukesh-ak Looks like you're using the main repository for lvgl. I think it's best to clone from the Linux port: https://github.com/lvgl/lv_port_linux_frame_buffer
Kisvegabor already setup everything for Linux. You can edit the make files as needed.
@Uup115 thanks for your help.
My sample project is a clone of that project itself with few changes.
Local lv_drv_conf.h is still old which does not have the latest SDL (SDL display & touch works already now) and other updates from drivers folder. So the latest is copied from drivers repo.
I removed the demos since that repo is deprecated and have a label+2 buttons inside main.c for testing. Display works already.
I will check the attached files and revert soon.
@Uup115 Looks like the file you attached only has display and not touch. Like I mentioned above display is already working.
I need help to get touch working. Compiler error is when touch is enabled.
I've have updated both the blog post and this rrepo.
It uses lvgl v8.2 (last release) but you can update to latest master without any issues.
Thank you @kisvegabor Will test and revert soon.
@kisvegabor Thanks for the updates.
@sukesh-ak Run evtest to find where your touchscreen is mapped.
In my case: /dev/input/event1. This needs to be set in file: "lv_drv_conf.h" @ line #397.
Be sure to #define USE_EVDEV 1 @ line #389.
In addition, I needed to #define EVDEV_CALIBRATE 1 @ line #400.
See attached "lv_drv_conf.h". lv_drv_conf.h.gz
Any idea why this could be happening with colors?
This happens if I use the instructions for Bullseye branch. Surprisingly, someone updated the Wiki page yesterday.
@kisvegabor Thanks for the updates.
@sukesh-ak Run evtest to find where your touchscreen is mapped. In my case: /dev/input/event1. This needs to be set in file: "lv_drv_conf.h" @ line #397. Be sure to #define USE_EVDEV 1 @ line #389. In addition, I needed to #define EVDEV_CALIBRATE 1 @ line #400.
See attached "lv_drv_conf.h". lv_drv_conf.h.gz
Thank you @Uup115 Do you know why touch screen changes between event0 and event1 after reboot? How do I fix it?
Current status
evtest output
Available devices:
/dev/input/event0: Goodix Capacitive TouchScreen
Display: working
Touch:
unable to open evdev interface:: No such file or directory
If I run like below, this error doesn't show up but touch doesn't work
DISPLAY=:0 ./demo
If I run evtest, it detects touch so hardware is fine.
Any idea why this could be happening with colors?
This happens if I use the instructions for Bullseye branch. Surprisingly, someone updated the Wiki page yesterday.
As explained here: Edit the file: /boot/config.txt and comment the line which has: vc4-fkms-v3d
As explained here: Edit the file: /boot/config.txt and comment the line which has: vc4-fkms-v3d
I don't have the 'f'kms but have dtoverlay=vc4-kms-v3d
as per Waveshare documentation. I have written to them as well and waiting.
With the new OS version (Raspberry Pi OS Bullseye branch) if I disable kms nothing shows up. It was a workaround for legacy version as I understand discussed here
Have now reverted to Raspberry Pi OS Buster branch
now, so that display works as expected.
How do I rotate the touch? Tried enabling this but does not work.
# define EVDEV_SWAP_AXES 1 /*Swap the x and y axes of the touchscreen*/
Have now reverted to
Raspberry Pi OS Buster branch
now, so that display works as expected.How do I rotate the touch? Tried enabling this but does not work.
# define EVDEV_SWAP_AXES 1 /*Swap the x and y axes of the touchscreen*/
Maybe this (see comments):
# define EVDEV_CALIBRATE 1 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
# if EVDEV_CALIBRATE
# define EVDEV_HOR_MIN 0 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/
# define EVDEV_HOR_MAX 4096 /*"evtest" Linux tool can help to get the correct calibraion values>*/
# define EVDEV_VER_MIN 0
# define EVDEV_VER_MAX 4096
# endif /*EVDEV_CALIBRATE*/
@Uup115
Yes I have already tried changing it. Its still won't swap.
I also tried
# define EVDEV_SWAP_AXES 1 /*Swap the x and y axes of the touchscreen*/
Reviewing this now https://github.com/lvgl/lv_drivers/blob/af07f57390ec50fb8cd2a52590141c2ab3ce6bee/indev/evdev.c#L112
Output of evtest. What should be the values of EVDEV_HOR_MIN
etc?
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min 0
Max 639
Event code 1 (ABS_Y)
Value 0
Min 0
Max 479
Event code 47 (ABS_MT_SLOT)
Value 0
Min 0
Max 4
Event code 48 (ABS_MT_TOUCH_MAJOR)
Value 0
Min 0
Max 255
Event code 50 (ABS_MT_WIDTH_MAJOR)
Value 0
Min 0
Max 255
Event code 53 (ABS_MT_POSITION_X)
Value 0
Min 0
Max 639
Event code 54 (ABS_MT_POSITION_Y)
Value 0
Min 0
Max 479
Event code 57 (ABS_MT_TRACKING_ID)
Value 0
Min 0
Max 65535
Btw, other than swapped X & Y, touch works
@sukesh-ak Not sure. This is the output when I touch my screen:
Event: time 1648425830.433049, -------------- SYN_REPORT ------------
Event: time 1648425830.441088, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 1836
Event: time 1648425830.441088, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 444
Event: time 1648425830.441088, type 3 (EV_ABS), code 60 (ABS_MT_TOOL_X), value 1836
Event: time 1648425830.441088, type 3 (EV_ABS), code 61 (ABS_MT_TOOL_Y), value 444
Event: time 1648425830.441088, type 3 (EV_ABS), code 0 (ABS_X), value 1836
Event: time 1648425830.441088, type 3 (EV_ABS), code 1 (ABS_Y), value 444
Event: time 1648425830.441088, type 4 (EV_MSC), code 5 (MSC_TIMESTAMP), value 1336100
@Uup115 Thanks for the details. I think there is an issue with hardware/driver itself. Not sure how this gets fixed in the RPI Desktop UI.
Scenario:
When display is in portrait (default), X max should be 480 and Y max should be 640
. Isn’t it?
But as per output of evtest command, its switched. See below output
Output of evtest Available devices: /dev/input/event0: Goodix Capacitive TouchScreen Select the device event number [0-0]: 0
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x416 product 0x38f version 0x1060
Input device name: "Goodix Capacitive TouchScreen"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 59 (KEY_F1)
Event code 60 (KEY_F2)
Event code 61 (KEY_F3)
Event code 62 (KEY_F4)
Event code 63 (KEY_F5)
Event code 64 (KEY_F6)
Event code 125 (KEY_LEFTMETA)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X
)
Value 0
Min 0
Max 639
Event code 1 (ABS_Y
)
Value 0
Min 0
Max 479
I am working with Waveshare support to figure this out first.
This is how the touch cordinates from evtest looks like right now.
@kisvegabor
Is this supposed to fix it? Because I tried and it does not work. A bug?
# define EVDEV_SWAP_AXES 1 /*Swap the x and y axes of the touchscreen*/
@sukesh-ak Touch resolution isn't necessarily equal to the resolution of the display. My display resolution is configured to 800x600. Per evtest, the touch resolution is higher. In my case, I use the following settings:
# define EVDEV_CALIBRATE 1 /*Scale and offset the touchscreen coordinates by using maximum and minimum values for each axis*/
# if EVDEV_CALIBRATE
# define EVDEV_HOR_MIN 0 /*to invert axis swap EVDEV_XXX_MIN by EVDEV_XXX_MAX*/
# define EVDEV_HOR_MAX 4096 /*"evtest" Linux tool can help to get the correct calibraion values>*/
# define EVDEV_VER_MIN 0
# define EVDEV_VER_MAX 4096
# endif /*EVDEV_CALIBRATE*/
I think we can close this since the original issue has been resolved.
The tutorial is not compatible with 8.0. Noobs might have difficulty. I made several modifications to get it working.
https://blog.lvgl.io/2018-01-03/linux_fb