Closed martenjacobs closed 4 years ago
This issue may be the same as this one, but as I can get it working with an older version of the container, it seems the issue is actually related to the container rather than the OS
@martenjacobs try adding ENV UDEV 1
to your Dockerfile
@danielmahon That works! Can you explain why this is necessary?
@martenjacobs Honestly... I'm not entirely sure 😄. I'd wager it flags something during the image startup to enable udev so that devices (like a touchscreen) are accessible from the container. But one of the Balena peeps will need to chime in here (@shaunmulligan?) because I think it has to do with their supervisor as I couldn't find much info on the flag outside of Balena forums.
Yeah I think I read somewhere it enables UDEV (which is kind of in the name, really). I just didn't expect udev to be required for these inputs because they would be handled by the host OS, but I guess that's not the case. Would be nice to have this documented somewhere though.
@martenjacobs Just came across this in their docs: https://www.balena.io/docs/reference/base-images/base-images/#working-with-dynamically-plugged-devices
Working with Dynamically Plugged Devices
In many IoT projects your containers will want to interact with some hardware, often this hardware is plugged in at runtime, in the case of USB or serial devices. In these cases you will want to enable udevd in your container. In balenalib images this can easily be done either by adding ENV UDEV=1 in your Dockerfile or by setting an environment variable.
You will also need to run your container privileged, by default any balenaCloud projects that don't contain a docker-compose.yml will run their containers privileged. If you are using a multicontainer project you will need to add privileged: true to each of the service definitions for the services that need hardware access.
@danielmahon I just made the same mistake again and re-discovered this solution. You solved my problem again :)
@martenjacobs haha, I once found the perfect answer to a problem I was having on Stack Overflow... only to find out I was the one that posted the answer years ago in the first place... I felt proud and stupid at the same time.
I'm using this boilerplate to develop an app that will run on a balenaFin board with an official Raspberry Pi Touch Display connected. This worked fine before, but today I updated my repo to match the boilerplate in the current version of this repo because some apt repos were not available anymore so the old Dockerfile didn't build anymore.
Now, the screen works fine, but there are no touch events registered. Reverting to my previous commit solves the issue, so it's definitely not hardware related.
My previous Dockerfile was an exact match with this one, and now I'm using this one.
Any ideas on what I can do to get it working again?