0

I’m trying to use the raspberry pi 3 in kisok mode on a 27" hdmi/touchscreen display on portrait mode

I’ve managed to rotate the display with the configuration BALENA_HOST_CONFIG_display_hdmi_rotate=1 (equivalant to putting display_hdmi_rotate=1 in /boot/config.txt)

but I struggle to rotate the touchscreen inputs.

  • should it be possible with configuration in /boot/config.txt ? I tried various lcd_rotate=... and display_rotate=... but it changes nothing

  • should I be able to do that with udev rules ? if so how do I figure how to write the rule (selector and transformation matrice) ? and, can I try to apply a rule from the command line without restarting the device ?

1
  • you may have better luck if you do not restrict your search to RPi related websites ... do your search in the Linux realm – jsotola Aug 7 '20 at 23:08
1

Touchscreens use a separate coordinate system which is not synchronized with the underlying display. You should be using xinput to apply the correct transformation matrix, e.g. for an input device named Touchscreen and a 90-degree rotation that would be:

xinput set-prop 'Touchscreen' 'Coordinate Transformation Matrix' '0 -1, 1, 1, 0, 0, 0, 0, 1'

Another option is to redo a calibration on a rotated screen (if the touchscreen comes with a calibration tool) and hope that the calibration process will take care of the orientation.

Although such a command can be run from an udev rule, it would be an odd place for it. I would try to make Xorg or the touchscreen driver take the transformation into account via a config file (for Xorg, that would be xorg.conf). If that doesn't work, the next best place would be the desktop environment startup script, e.g. the Balena's equivalent of /etc/xdg/lxsession/LXDE-pi/autostart.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.