Has anyone been able to successfully rotate the display and/or touchscreen with an Intel NUC running resin? Normally setting the rotation in xorg.conf would work but the intel drivers don’t seem to like it. Running xrandr -o right via ssh kinda works but Im unable to access the DISPLAY inside my start.sh script or Dockerfile so I havent been able to run that on start. Thoughts?
If that does the trick you can always export DISPLAY=:0 at the start of your script so any other commands related to X will get the right display.
@danielmahon, where are you trying to access $DISPLAY? I would not expect it to be set in the Dockerfile (as that will run on the builder rather than on the device) so if you are trying to access it there it will likely fail.
So I was working on this with @craig earlier and this is where I left it… for now:
FROM resin/nuc-node:6.9
CMD ["bash", "/usr/src/app/start.sh"]
ENV DISPLAY :0 in Dockerfile and export DISPLAY=:0 in start.sh both correctly make the DISPLAY variable available. The problem is when running something like:
in start.sh, xrandr returns a “Cannot open display at :0” error. This works fine when I ssh into the device, with one caveat that the display rotates but the resolution/window size doesnt seem to adjust properly, cutting off half the screen. That made me think that there might be a problem trying to run xrandr before running startx (not sure why). So I moved the xrandr and xinput commands to a child process spawned by Electron’s main.js and it works great. Both the display and touchscreen rotate and fill the monitor properly.
So right now this way works fine but I’m still not sure why my start.sh scripts cannot OPEN the display.
Yeah, xrandr communicates with the running X process, so I don’t think it will behave correctly (or maybe not function at all?) if X is not running. That would explain why it can’t open the display in your script – the display just isn’t there yet.
If you move those lines to after your startx command they should work. You might want to add a sleep in there just to give X time to start up before you do it, e.g.
# Start application
startx /usr/src/app/node_modules/electron/dist/electron /usr/src/app --enable-logging
# Wait for X to come up
sleep 3
# Rotate display and touchscreen
xrandr -o right
xinput set-prop "ELAN Touchscreen" --type=float "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1