accel: Add support for udev ACCEL_INITIAL_ORIENTATION property
Hi Bastien,
I know we discussed this a while back and you then said that this should be fixed in the kernel. The problem is that the kernel cannot transparently hide that a lcd is mounted upside-down or 90 degrees rotated. I've been talking to the Intel kernel people about this and hiding this transparently is not possible because not all hardware planes support rotation. E.g. the cursor overlay plane does not support this, so userspace needs to be aware that rotation is being applied and the Xserver or Wayland-compositor needs to pre-rotate the mouse cursor/sprite in software before uploading it to the hardware, which makes it impossible to compensate for a wrongly mounted LCD transparently inside the kernel.
TL;DR: this cannot be fixed in the kernel and needs to be dealt with in userspace, luckily dealing with this is actually quite easy iio-sensor-proxy + the existing rotation code already takes care of everything except for the initial rotation when the device is sitting flat on a table (or other horizontal surface), so this patch adds an udev ACCEL_INITIAL_ORIENTATION property which takes care of this. Note this requires only 6 lines of code :)
As mentioned in the commit message some kernel work is needed to get the text console to not change from the usually proper orientation provided by efifb to the wrong orientation when e.g. the i915 driver loads. There are some patches for this by one of the Intel engineers I will see if I can clean these up one of these days and submit them upstream.
Regards,
Hans