Linux Mint 21 on Asus Transformer Book T102HA

I do own three (!) such Asus x86_64 tables. They're nice little machines with quite a powerful battery, which allows them to stay off grid up to 10 hrs. And that was back in 2014 . Off course, due to normal battery wearing and tearing, now they are hardly can stay more than 6 hrs, but it's still quite good enough to me. I got tiered of Windows 10 on those little machines, so I decided to give it a try and install Linux on one of them.

I started with Mint 21. This post is to capture what kind of issues I encountered and how I was fixing them. 

Running ahead, it probably doesn't make sense to install Mint on this machine and it's better to give it a try couple of other distros like:

  • PopOS
  • Ubuntu
  • Debian
  • Fedora 
  • Manjaro or any Arch-based like RebornOS

And the easiest to do that is to flash your USB stick with Ventoy and collect a bunch of different Linux Distribution Live ISOs to it, so you could test all of them, one-by-one, in a live environment, before making a final decision to install them to your hard drive. 

Issues encountered

  • Screen orientation is wrong
  • Brightness is not configurable from keyboard - fn+F5/F6 
  • System freezes after number of screen rotations (xrandr -o left/right)
  • Issues with audio - playback was "freezing" while playing a single high-pitch loud note
  • Built-in camera is not working
  • Fingerprint reader is not working 
  • Automatic screen rotation didn't work out of the box


System details

Before we move further, let me show you how the system was identified in Mate 21 by inxi:


$ inxi -b
System:
  Host: T102HA Kernel: 5.15.0-58-generic x86_64 bits: 64
    Desktop: Xfce 4.16.0 Distro: Linux Mint 21 Vanessa
Machine:
  Type: Detachable System: ASUSTeK product: T102HA v: 1.0
    serial: <superuser required>
  Mobo: ASUSTeK model: T102HA v: 1.0 serial: <superuser required>
    UEFI: American Megatrends v: T102HA.303 date: 04/12/2017
Battery:
  ID-1: BATC charge: 11.0 Wh (48.7%) condition: 22.6/31.6 Wh (71.4%)
    volts: 3.8 min: 3.8
CPU:
  Info: quad core Intel Atom x5-Z8350 [MCP] speed (MHz): avg: 506
    min/max: 480/1920
Graphics:
  Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx
    Integrated Graphics
    driver: i915 v: kernel
  Display: x11 server: X.Org v: 1.21.1.3 driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: i915 resolution: 1280x800~60Hz
  OpenGL: renderer: Mesa Intel HD Graphics (CHV) v: 4.6 Mesa 22.0.5
Network:
  Device-1: Qualcomm Atheros QCA9377 802.11ac Wireless Network Adapter
    driver: ath10k_pci
Drives:
  Local Storage: total: 72.85 GiB used: 52.17 GiB (71.6%)
Info:
  Processes: 245 Uptime: 13h 59m Memory: 3.67 GiB used: 1.47 GiB (40.1%)
  Shell: Bash inxi: 3.3.13

Screen orientation is wrong

Out of the box, the screen orientation was all wrong:

  • when the grub boot menu comes up, it's rotated 90 degrees counter-clockwise
  • linux mint splash screen logo, which  hides kernel messages upon startup is 90 degrees rotated
  • if you hit ESC to hide the splash screen, you'll see that startup messages are printed to a console, that is also 90 degrees rotated
  • when the desktop manager starts, it's orientation is also rotated 90 degrees right
  • and when you finally login to the desktop environment of your choice (mine is XFCE as it is a lightweight), it's also rotated in there 

First of all some might ask - what the heck? I didn't have that on Windows! The answer appears to be that the screen manufacturer (ASUS) decided to declare the screen orientation is portrait by default. The good news is that you can fix almost everything from the above list.

Fixing screen orientation in Desktop Environment

We will start with something simple, like fixing orientation in Desktop Environment. You just log in to it, go to display settings (or run xfce4-display-settings) and there you're able to change the screen orientation. Hurray!

Alternatively you can run:

xrand -o right 

and that, in theory, should update the local config file for your user, somewhere in ~/.config, like xrand usually does.  So the next time you log in, the desktop environment will be properly oriented.

Fixing touchscreen sensor orientation

Even though our screen is now properly rotated, if you touch it, the cursor is moved like the touchscreen orientation is still wrong. And it is still wrong. Fixing it just a slightly more complicated than the above section, so bear with me.

First of all, you need to know that all the input devices your PC has, like:

  • orientation sensor (this is the one which tells whether your device is in portrait mode or in landscape mode)
  • ambient light sensor -  to turn on brightness, when it's too much light around
  • hardware buttons - like volume up/down, power
  • touchpad below your keyboard
  • touchscreen
  • keyboard
  • mouse
  • ... whatever else

...are explicitly appearing as device files under /dev/input/ and also you can list them by calling xinput but it's kinda hard to map one to another (or I'm an idiot).

In order to understand what is your input sensor device, you need to do something like this:

$ sudo cat /dev/input/mouse0

.. and then do something with your device, like touch your screen (if you're searching for touchscreen / rotate your device / cover the light sensor if you know where it is). If the device is responding to Linux Kernel, you'll see something starts printing on the console. If nothing happens, then CTRL+C and proceed with next device. 

Alternatively you can run xinput to see what device ids are there:

$ xinput
⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ ASUS HID Device ASUS HID Device Touchpad    id=13    [slave  pointer  (2)]
⎜   ↳ ASUS HID Device ASUS HID Device Consumer Control    id=14    [slave  pointer  (2)]
⎜   ↳ ELAN22A6:00 04F3:22A6                       id=15    [slave  pointer  (2)]
⎜   ↳ ASUS HID Device ASUS HID Device Mouse       id=12    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
    ↳ Power Button                                id=6    [slave  keyboard (3)]
    ↳ Video Bus                                   id=7    [slave  keyboard (3)]
    ↳ Power Button                                id=8    [slave  keyboard (3)]
    ↳ Sleep Button                                id=9    [slave  keyboard (3)]
    ↳ ASUS HID Device ASUS HID Device System Control    id=10    [slave  keyboard (3)]
    ↳ ASUS HID Device ASUS HID Device Keyboard    id=11    [slave  keyboard (3)]
    ↳ ELAN22A6:00 04F3:22A6 Stylus                id=16    [slave  keyboard (3)]
    ↳ chtdc_ti_pwrbtn                             id=17    [slave  keyboard (3)]
    ↳ Intel HID events                            id=18    [slave  keyboard (3)]
    ↳ gpio-keys                                   id=19    [slave  keyboard (3)]
    ↳ gpio-keys                                   id=20    [slave  keyboard (3)]
    ↳ Asus WMI hotkeys                            id=21    [slave  keyboard (3)]
    ↳ ASUS HID Device ASUS HID Device Consumer Control    id=22    [slave  keyboard (3)]

and then run the below command for each device, trying to do the same:

xinput test 15

where 15 is for device id=15, but you'll need to test them all one by one to find the touchscreen device. 

In my case, the touchscreen was the device with id=15 so my output looked like this, when I touched the screen:

$ xinput test 15
motion a[0]=28260 a[1]=36430
button press   1 a[0]=28260 a[1]=36430
motion a[0]=28293 a[1]=36410
motion a[0]=28392 a[1]=36390
motion a[0]=28591 a[1]=36370
....

So it's just a last step here. We'll need to configure that device with using xinput to apply a "transformation matrix" to it - see more details here - https://wiki.ubuntu.com/X/InputCoordinateTransformation

If you're the same as me, just want to rotate the touchscreen to the right, run the below command:

xinput set-prop 15 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1  

Screen & touchscreen autorotation

If you ever want to rotate your screen back to portrait mode (there's an orientation sensor in this laptop, remember?) we can do that via monitor-sensor cli tool in a dirty and quick way:

$ sudo apt install inotify-tools
$ cat autorotate.sh
#!/bin/sh

killall monitor-sensor
monitor-sensor > /dev/shm/sensor.log &
while inotifywait -e modify /dev/shm/sensor.log; do

ORIENTATION=$(tail /dev/shm/sensor.log | grep 'orientation' | tail -1 | grep -oE '[^ ]+$')

case "$ORIENTATION" in
normal)
xinput set-prop 15 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
xrandr -o normal;;
right-up)
xinput set-prop 15 'Coordinate Transformation Matrix' 0 1 0 -1 0 1 0 0 1
xrandr -o right;;
left-up)
xrandr -o left;;
bottom-up)
xrandr -o inverted;;
esac
done

Fixing logon manager (LightDM) screen orientation 

But we still have a desktop manager (aka login manager - lightdm) in wrong orientation. For that we create an additional config file, that will be executed by lightdm upon startup - /etc/lightdm/lightdm.conf.d/50-rotate.conf - with the below content:

[SeatDefaults]
display-setup-script=xrandr -o right

Fixing screen orientation in console

Then, in order to fix the orientation in console (after the GRUB menu is passed - I couldn't fix orientation in there) you need to edit few lines in /etc/default/grub file and then run update-grub command to regenerate grub configs:

GRUB_CMDLINE_LINUX_DEFAULT="quiet fbcon=rotate:1"
GRUB_CMDLINE_LINUX="fbcon=rotate:1"

As you can see, I removed the "splash" word out of the parameters, so I don't care to rotate the splash screen with Mint logo - I'd rather to hide it altogether. 

Fixing GRUB menu orientation

Unfortunately I didn't find an easy solution so far. It looks like there's a long-standing issue with some of the Intel devices (https://bugzilla.kernel.org/show_bug.cgi?id=201553) and there's even a patch exists, but I was too lazy to recompile the kernel or kernel module to get it applied. I didn't want to drift from the stock kernel, just because I want to receive updates to it through the package manager, without the need of recompiling it again and again, as the new version appears.

No comments:

Post a Comment

Start here

Disable Firefox from updating itself and flash those annoying "Restart to Keep Using Firefox" messages on you

I recently switched from Brave to Firefox. Just because Brave appeared to be some proprietary shit, even though they're masking themselv...