Just did some GPIO investigation related to the Xiaomi Pad 5 Pro's keyboard case. On the mainline sm8250 kernel it is just powered on at boot and this causes the keyboard to show up no matter if the case is attached or not, forcing the tablet into docked mode in Phosh. Looking at the downstream kernel, there are three different GPIOs - power, reset, and interrupt, that govern the keyboard behavior. Using the gpioset utility, I can power off or hold the keyboard in reset...
=> More informations about this toot | More toots from CalcProgrammer1@mastodon.social
When the keyboard is powered off or held in reset, iio-sensor-proxy rotation works as expected and the Phosh is no longer in docked mode. The interrupt GPIO pulses whenever the keyboard case is attached or detached, but only when the keyboard MCU is powered on and not in reset. I'm still trying to figure out how you would detect the keyboard is attached if the keyboard MCU is powered down.
=> More informations about this toot | More toots from CalcProgrammer1@mastodon.social
After a bunch of experiments with the keyboard, I don't see any means to detect whether the keyboard is attached at boot or not. Unfortunately, the keyboard MCU uses an interrupt to indicate when the keyboard state changes, but when the keyboard MCU is powered on it always generates 4 interrupts regardless of whether the keyboard is present. Attaching or removing the keyboard causes it to spew out either an even or odd number depending on whether attached or removed, correcting the state.
=> More informations about this toot | More toots from CalcProgrammer1@mastodon.social This content has been proxied by September (ba2dc).Proxy Information
text/gemini