I'm running Ubuntu 20.04.3 LTS with kernel 5.13.0-28-generic.
The Lenovo Yoga 12 has a 180 degree foldable display.
When folding the screen it changes into what I call
tabletmode and the keyboard and touchpad turn automatically off.
There is a small led on my 'Fn' key which indicates which mode
it is in. When it's on it is in keyboardmode, when it's off
it is in tabletmode.
The problem arises when I fold it back, it doesn't go back to normal
mode, it like stays in tabletmode and I can not use my keyboard.
To turn it normal again I have to reboot,
or mess around a little bit with opening and closing, but
it really goes haywire from that point on, it's a bit messy to
describe it, it also seems to have to do something with the angle
I'm holding the laptop.
Also really annoying is that it changes the screen brightness when
moving the screen around. When I have the laptop on my knees and move
around a little it constantly changes screen brightness.
What do I have to do to recalibrate this behavior,
I assume the Yoga firmware sends some key instructions to ubuntu
and ubuntu processes it somewhere. Where is the file where it
is written down what to do when the screen is flipped?
Also a manual solution like a simple script just to turn
the laptop into keyboardmode again would also be ok...
Oh and the keyboard even turns itself off when I'm on console with strg+alt+F3 or so,
so it isn't just an X problem...
Edit: I unloaded the hid_sensor_hub module via /etc/modprobe.d/blacklist-hid_sensor_hub.conf file...
The annoying screenbrightness thing is gone, as well as other
gyroscope functionality, which I do not care about.
But the main problem still stays the same.
It also stays in bugged mode when I just reboot,
I have to turn it off completely, then turn it on again
for it work, so I suspect this might even have to do something
with the bios?
Anyways, I'm still looking where instructions are written down
for all the hid rotation events and also how I can listen to
them firing...
Edit2: This is really weird, all the functionality I blacklisted
gets loaded when my laptop enters the weird bugged state.
Suddenly lsmod shows all the advanced hid modules and automatic
screen rotation and stuff works again.
Something, somewhere is telling ubuntu to load the modules...