Coder Social home page Coder Social logo

Comments (22)

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@Uup115 Can you share what you changed to make it working?
I am in the same boat now. Using RPI OS Lite

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

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

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

@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:

  1. Start with the Linux port: https://github.com/lvgl/lv_port_linux_frame_buffer
  2. Replace the two attached modified files: main.c and lv_conf.h ( modification(s) are below commented line(s))
  3. Edit the file: /boot/config.txt and comment the line: vc4-fkms-v3d

You can edit the appropriate make files to shorten build time.

Embedded GUI Using Linux Frame Buffer Device with LVGL.tar.gz

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

@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.

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@Uup115 thanks for your help.

My sample project is a clone of that project itself with few changes.

  1. 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.

  2. 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.

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@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.

from lv_port_linux.

kisvegabor avatar kisvegabor commented on July 29, 2024

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.

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

Thank you @kisvegabor
Will test and revert soon.

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

@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

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

CA29B2BD-272C-4058-8D47-D89CF8AFB14A

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.

https://www.waveshare.com/wiki/2.8inch_DPI_LCD

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@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?

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

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.

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

CA29B2BD-272C-4058-8D47-D89CF8AFB14A

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.

https://www.waveshare.com/wiki/2.8inch_DPI_LCD

As explained here:
Edit the file: /boot/config.txt and comment the line which has: vc4-fkms-v3d

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

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

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

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*/

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

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*/

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@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

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

@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

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

@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:

  • OS: Raspberry Pi 64 Lite
  • Default : Portrait with top on the side of USB/Ethernet
  • No rotation applied in config
  • No touch configured

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.

from lv_port_linux.

sukesh-ak avatar sukesh-ak commented on July 29, 2024

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*/

image

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

@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*/

from lv_port_linux.

Uup115 avatar Uup115 commented on July 29, 2024

I think we can close this since the original issue has been resolved.

from lv_port_linux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.