New CHUWI Minibook X Linux kernel module & daemons!
I’m proud to announce the first public release of the “cmx” module and related daemons I’ve put together for the CHUWI Minibook X.
What does it provide or do?
At a high level, it generates tablet mode events (automatically disabling keyboard and mouse “the linux kernel way”), and supports rotation and tablet mode detection. The system is event driven, and not polling, all the way from reading IIO device data in an evented way through the user session daemon responding to event broadcasts.
- Kernel patches allow the second mxc4005 module for the accelerometer to load automatically and correctly.
- The cmx module primarily exists to create an input device for SW_TABLET_MODE, and generates that input event when the laptop enters tablet mode. It also identifies the platform and creates sysfs files for the supporting daemon to read and write from.
- cmxd is the system level daemon that does the math and calculates hinge angles and detects lid orientation, and writes those values to the sysfs files the cmx module manages. It also broadcasts these events on a UNIX Domain socket and (optionally) DBus.
- cmxsd is the user session daemon which receives events from cmxd and responds accordingly through editable scripts.
CAVEAT 1
This release is likely targeted towards slightly more advanced users as it involves a new kernel module, kernel configuration, and kernel install. If you are comfortable with that – please give it a whirl!
If you are not, you should wait to use or test this. My plan is to submit a Linux kernel patch for the kernel related code, which would mean the kernel components of this release wouldn’t be needed anymore once your distribution updates the kernel.
CAVEAT 2
I am suspect of the DMI information (what a machine tells the OS about itself like Brand, Model, Serial Number, etc) being able to distinguish between different model revisions of the CHUWI Minibook X which may have a different assortment of accelerometers per model.
If you find that the module doesn’t load and bring up two mxc4005 accelerometers, I’d be curious to know the output of the following:
ls -1d /sys/bus/iio/devices/iio\:device*cat /sys/bus/iio/devices/iio\:device*/namedmidecode -t system
Why would this info be helpful?
- Getting this to work with Minibook X revisions that have different DMI info and the same hardware should be very straightforward.
- Stopping this from attempting to load on Minibook X systems that have the same DMI information but different hardware configurations should be straightforward.
- Getting this to work with other dual accelerometer setups (ie other drivers beyond mxc4005) should be straightforward (assuming it has the same problems my revision had – if the system already loads two IIO devices, the daemons should be able to work as-is.)
Caveat 3
You will have to configure the user-support cmxsd scripts (tablet on, tablet off, rotate) to support your specific needs and environment. The example scripts work for me under Hyprland. If you want to use wvkbd as an on-screen keyboard, you’ll need the fixes from my fork to fix crashes from rotation triggering bad code in the program, available at: GitHub - greymouser/wvkbd: On-screen keyboard for wlroots
Caveat 4
The cmxd daemon should emit DBus notifications compatible with IIO Sensor Proxy. If you are using IIO Sensor Proxy, you’ll need to turn it off while testing. I’d be curious to know if those notifications from cmxd work for environments that already support IIO Sensor Proxy a bit (GNOME?).
Thanks!
Thanks to any and all that try this out!