jon2023
November 27, 2023, 6:07pm
1
Hardware:
Colibri iMX6DL
with Viola Carrier Board Rev 1.2
TorizonCore 5.7.2
Hi there,
Created a new Avalonia .NET application, setup and tested the Touch display (with custom device tree overlays) with the weston examples.
Run the Avalonia .NET application and noticed the following error…
After a bit of researching… traced the reported error to…
GitHub
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using Avalonia.Input;
using Avalonia.Input.Raw;
using static Avalonia.LinuxFramebuffer.Input.LibInput.LibInputNativeUnsafeMethods;
namespace Avalonia.LinuxFramebuffer.Input.LibInput
{
public partial class LibInputBackend : IInputBackend
{
private IScreenInfoProvider _screen;
private IInputRoot _inputRoot;
private TouchDevice _touch = new TouchDevice();
private const string LibInput = nameof(Avalonia.LinuxFramebuffer) + "/" + nameof(Avalonia.LinuxFramebuffer.Input) + "/" + nameof(LibInput);
private Action<RawInputEventArgs> _onInput;
private Dictionary<int, Point> _pointers = new Dictionary<int, Point>();
public LibInputBackend()
{
This file has been truncated. show original
using System;
using System.Runtime.InteropServices;
namespace Avalonia.LinuxFramebuffer.Input.LibInput
{
unsafe class LibInputNativeUnsafeMethods
{
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate int OpenRestrictedCallbackDelegate(IntPtr path, int flags, IntPtr userData);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
delegate void CloseRestrictedCallbackDelegate(int fd, IntPtr userData);
static int OpenRestricted(IntPtr path, int flags, IntPtr userData)
{
var fd = NativeUnsafeMethods.open(Marshal.PtrToStringAnsi(path), flags, 0);
if (fd == -1)
return -Marshal.GetLastWin32Error();
return fd;
This file has been truncated. show original
Library libinput
File: path-seat.c
Function: libinput_path_add_device
I’m guessing its some missing permissions on the “docker-compose.yml” settings
I’ve currently setup the following sections to see if that helps…
…
volumes:
- type: bind
source: /tmp
target: /tmp
- type: bind
source: /dev
target: /dev
- type: bind
source: /run/udev
target: /run/udev
- type: bind
source: /dev/input
target: /dev/input
- type: bind
source: /dev/input/event0
target: /dev/input/event0
- type: bind
source: /dev/input/event1
target: /dev/input/event1
- type: bind
source: /dev/input/touchscreen0
target: /dev/input/touchscreen0
- type: bind
source: /run/udev/data
target: /run/udev/data
- type: bind
source: /etc/xdg/weston
target: /etc/xdg/weston
- type: bind
source: /etc/xdg/weston-dev
target: /etc/xdg/weston-dev
devices:
- "/dev/input:/dev/input"
- "/dev/input/event0:/dev/input/event0"
- "/dev/input/event1:/dev/input/event1"
- "/dev/input/touchscreen0:/dev/input/touchscreen0"
device_cgroup_rules:
# ... for tty0
- "c 4:0 rmw"
# ... for tty7
- "c 4:7 rmw"
- "c 4:1 rmw"
# ... for /dev/input devices
- "c 13:* rmw"
# ... for /dev/dri devices
- "c 226:* rmw"
- "c 199:* rmw"
# ... for /dev/fb0
- "c 29:* rmw"
# ... for /dev/input/touchscreen0 devices
- "c 6:* rmw"
Any advice would be most appreciated
Cheers Jon
Hi @jon2023 ,
Just to confirm, you’re using the Torizon IDE Extension 2, right? If so, which Avalonia .NET template are you using: the Frame Buffer DRM one?
On the board, can you enter the running container with
docker exec -it <container name> bash
And check if /dev/input/event0
and /dev/input/event1
are there? They should be there, but I want to make sure that’s case here.
Best regards,
Lucas Akira
jon2023
November 28, 2023, 10:12am
3
Hi lucas,
I’ve included the details below. Let me know if there’s any more details that might help.
Yeah, its using the Torizon IDE Extension 2 and the Frame Buffer DRM one
I’ve also tried with the two differen launch.json settings
Step 1
$ docker ps
Step 2 - On the board, can you enter the running container with…
$ docker exec -it torizon_avalonia13-debug_1 bash
Step 3
root@colibri-imx6-11096746:/dev/input# ls -la
The ownership seems to be set to the “root” user.
Would this require some permission settings?
Cheers Jon
Hi @jon2023 ,
Thank you for confirming the information.
/dev/input/event*
should be owned by root, yes. In fact, all system-related files should be owned by root. Don’t try to change their permissions or ownership as otherwise you may break your OS. I don’t think it’s a permission problem.
The Colibri iMX6 you’re using is running TorizonCore/Torizon OS 5.7.2, right? By default when you create a new project from one of our templates it defaults to use the bookworm
version of them, which are meant to be used on Torizon OS 6.
For Torizon OS 5 you should use the bullseye
versions of Dockerfile
and Dockerfile.debug
, found here:
Try replacing them and see if the touch input works.
You can also try using Torizon OS 6 instead of changing the Dockerfiles.
Best regards,
Lucas Akira
jon2023
November 28, 2023, 10:11pm
5
Thanks Lucas for looking into the details.
Yeah, we’re been running on TorizonCore 5.7.2.
I’m just in the process of upgrading the bootloader and Torizon OS 6.4.0
The upgrade steps look easy to follow (with just a couple of additional steps to enable the spi, LCD display & Touch device).
Will try the Avalonia wizard with the new Torizon OS 6.4.0, and hopefully it will work
Cheers Jon
Hi there,
Updating the bootloader and Torizon OS (v6.4.0) seems to fix the touch input.
Cheers Jon
Glad the problem was solved!
Best regards,
Lucas Akira
1 Like