Auto screen rotation - accelerometer not working in Linux

Hello,

I am trying to get the screen rotation working in Linux, but it seems like the accelerometer readings do not update.

I believe this is most likely a low level driver type of problem, as iio-sensor-proxy shows no update to the orientation when the tablet is rotated. The orientation always reports “left-up”.

I see that the mxc4005 driver is loaded, which appears to be the “correct” driver to support the mxc6655 sensor I see on the udev information. It appears support for this sensor was added in 2020 per this git commit I found.

It also appears that at one point, somebody had this sensor working on Linux on their Hi10 X.

I have also tried checking the raw data in /sys/bus/iio/devices/ and I’m not seeing any numbers update when the tablet is rotated.

I have been testing heavily with Linux Mint, but I also did try Fedora, the issue is not distro specific. I am running the GNOME desktop, but I am fairly certain the DWM is not the problem, since that would not cause the symptoms I’m seeing with the raw sensor data in /sys/ nor from the iio-sensor-proxy.

Does anyone have auto screen rotate working on a Linux install on one of these UBook X machines?

I’m open to reporting a bug to the Linux kernel developers and helping to work on a patch, but was wondering if there is something obvious I am overlooking, as this is my first time troubleshooting a sensor like this.

Thanks!

Chuwi YUbok XCW3H240104963
Purchased from Amazon this week

maybe @leledumbo could help?

Nope, this is simply something that must be fixed at kernel (module) level, nothing normal users can do. So yes, please report the missing functionality.

Okay, thanks. I was hoping a community member might be able to chime in and say they got it working, haha. I guess I have a long road ahead.

I submitted a kernel bug report: 218578 – MXC6655 accelerometer not working with MXC4005 driver

Hi @Kirk

I am looking to buy a tab that runs Linux. As you have been testing Linux distro on the UBook X. It would be really very helpful if you can share your experience on running Linux on the tab.
Can we dual boot Linux alongside Window? What is the battery life on the Linux? Which Linux environment is best? Is there heating problem or any specific big issue that hinder the basic usage?

I found this thread because I’m looking at buying a Ubook X and installing Linux (Fedora) on it.

There’s a post below, where someone appears to have working rotation? :-

I was really hoping to get screen rotation working.

Hello @chinu and @butmonkeh,

I do now have screen rotation working, with a couple caveats. You have to create a hwdb file to override the default accelerometer orientation, otherwise the screen rotation is off. Some people are saying it is off by 90 degrees, for me, my screen was always upside down lol. I have gotten this working now.

My original issue in this post was concerning the accelerometer not working at all. There does appear to be a bug in the Linux driver that is currently implemented for this accelerometer, but hopefully the bug will be patched now that I’ve identified it in my open bug ticket on the kernel.org bug tracker. Some very helpful people there were instrumental in diagnosing the actual problem. The accelerometer driver does not reset the chip at the time of initial probe. As a result, the accelerometer does not always work when rebooting the system, and also does not always work after coming out of a sleep state. The accelerometer does seem to work reliably when cold booting the tablet from a powered off state into Linux. It’s just that in all of my attempts at using it up to that point, I was installing then rebooting (because, of course, that’s how you usually flow when you install an OS) and finding a non-working accelerometer.

I also now have a way which I was provided through my troubleshooting that I can run a command to manually reset the acclerometer.

I am planning to do a comprehensive write-up soon, because I’ve learned a lot more than I care to know about how the accelerometer drivers work and how the orientation of the screen is calibrated. I’ll post a link here once I write up a post.

Hello @chinu,

To address your more specific questions… I have only just gotten the screen rotation working so I haven’t been using it full time on the tablet for very long.

Can we dual boot Linux alongside Window?

Yes, but… I haven’t yet found a boot loader which allows you to pick the OS from the touch screen. You must use a physical keyboard to interact with GRUB or open the BIOS. rEFInd’s touch screen support doesn’t work with this touch screen. That’s going to be my next “bug report” I plan to file and pursue.

What is the battery life on the Linux?

Not sure I have enough information to comment yet, but the power states (like the tablet going to sleep) do seem to work as intended on Fedora. The battery life to begin with varies a lot based on what you’re doing. If left overnight asleep, the battery basically doesn’t move at all (maybe 1%). I also ran it from 100% to 10% in less than 2 hours at one point on Windows by installing Steam games and watching YouTube while I was out for a 5 mile walk. I think the same will be true with Linux, that it’s all down to the workload. The battery life does seem to be better than my ThinkPad overall so far, but not as good as my iPad.

Which Linux environment is best?

GNOME, by a landslide. I say this as someone who ridiculed GNOME’s UI decisions and someone who would never install the current version of GNOME on a desktop. I think it might be the only Linux desktop environment currently out there that is actually optimized for touch screen use. I tested Linux Mint Cinnamon and there wasn’t even an on screen keyboard that pops up to type, like there is in GNOME. Sure, you could manually use an accessibility tool keyboard, but GNOME has all of this polished out of the box already. I suspect that any other UI will require a lot of manual customization to be competent on a touch screen.

Is there heating problem or any specific big issue that hinder the basic usage?

Not really, although I have noticed that on Windows I have no problem playing 4K YouTube, and on Fedora it seems to struggle to playback anything higher than 1080p. I suspect some hardware acceleration is missing and I am going to look into that further at some point.

There also seem to be some general quality of life improvements still needed to GNOME. Using Windows on this tablet feels surprisingly effortless and natural as someone who has used an iPad for many years. Using GNOME, I am still very aware that I’m using a tablet. There are just some things (like lack of any sound\feedback when the keyboard buttons are pressed on screen, the relatively small size of the keys in landscape mode, the lack of a voice\dictation feature on the keyboard, the lack of any sort of autocorrect on the keyboard) which make it a lot less convenient to type in Linux than on Windows 11. Hopefully one day the keyboard will be more feature complete. It’s usable, sure, but it’s still easier to do things on this device on Windows. I also installed a Flatpak application and it seems like the on screen keyboard is unreliable in that application. Just little things like that…

But those aren’t device-specific problems, those are “Linux on a tablet is still a niche thing and not very refined” problems. I’m very impressed with the device, especially for the price.

Thanks Kirk, that’s really helpful.

It’s good to hear that the rotation is working for you. I’m not 100% decided between the Ubook X and the Minibook X yet.

Regarding your reply to Chinu about which DE is best, have you tried KDE’s Plasma Mobile? I’ve been running that on my Chuwu Hi10 Air (until it recently died) with great results. I found the GNOME onscreen keyboard wasn’t 100% at detecting a text input box, and there was no way to ‘summon’ it, if it didn’t appear.

Thanks for the information. :slight_smile:

@Kirk ,

Would you be able to run ( GitHub - svartalf/rust-battop: Interactive batteries viewer ) and let the machine idle at the desktop for a few minutes? Sorry to derail the thread, but I’m curious how low the machine will idle with the i5 CPU, as ebook reading would be one of the uses I have for a tablet.

Thanks in advance. :slight_smile:

Hello @butmonkeh, Thank you for the intriguing recommendation to try KDE Plasma Mobile. It actually did occur to me to try KDE Plasma, and I installed it on one of my prior test installs, but I was completely unaware that they had a Mobile version with a different package name. I think I also installed that test on Ubuntu rather than Fedora, and it looks like the mobile version might be exclusively available in Fedora and a few other niches…

I am testing the Mobile KDE Plasma now. It’s interesting. Out of the box, the virtual keyboard was disabled, which strikes me as a really stupid default, but I was able to enable it easily enough. Only one of the two included virtual keyboard options seems to work. I don’t really like the way the keyboard looks visually, and I wish it had outlines around the keys at least, but once I started to actually test it, I do think it is more natural to type on than the GNOME virtual keyboard and I feel like I was making far less mistakes, so, the ugly keyboard is growing on me.

Fortunately on a Linux system you are free to switch back and forth between UI’s, haha. I think this KDE Mobile UI might be better when I’m in tablet mode. I like to take the tablet on long walks outside and typing while walking is always a challenge. I think the KDE keyboard is a bit better.

KDE’s Mobile Plasma really feels designed for a tablet, I have mixed feelings about the Android-like gray control bar and buttons. They seem to be useful. This almost feels a little too much like a tablet, something I definitely miss is GNOME’s workspaces. I could swipe left and right with 3 fingers and get different blank desktops where I could layout whatever windows I was working with. This was a convenient way to switch between full screen apps without fumbling around with other controls. I suppose the square button on the control pad which opens the ALT+TAB view is similar enough.

I’m going to give both of them a try for awhile and switch back and forth and see what I arrive at liking. I definitely think that when I am sitting down at my desk with the accessory keyboard attached, I still like GNOME better. But I can see the appeal of the KDE Mobile Plasma too, and it might be better for me in tablet mode…

Definitely more to experiment with.

Battop is pretty cool, didn’t know this was a thing. I’ll post a screenshot soon, I’m now realizing I have no screenshot application or image editor installed. LOL

1 Like

If you’re missing Gnome’s Workspaces, then you could try KDE’s Overview. It’s a Desktop Effect, which can also be triggered from a screen-edge swipe, then you can 4 finger swipe to the next Virtual Desktop (if you have some enabled). On my main laptop, it looks like this…

Hello @butmonkeh, Thanks, I shall give that a try. Here’s my results from Battop…

Thank you! :slight_smile:

@Kirk and @butmonkeh thanks for the informative comments.
Sorry for the late reply. I ordered U Book 2023 and was waiting to test it with Linux.
I have installed KDE Neon on the tablet as I use KDE on all my devices.
@Kirk Can you explain how you made the accelerometer working? Further, have you been able to use the cameras of the tablet? Both the cameras are not working.

Once again thanks for all the suggestions and detailed answers.

@Kirk I followed your bug report and was able to make the accelerometer work. I made adjustments from your commit to fix the screen orientation. Now everything works fine.
Thanks for taking out time and making efforts to fix the bug.

I have usable Linux distro now, and I am able to do most the day to day work.
The only thing I miss in the KDE desktop is the tab key for the keyboard. It is one of the most important thing while using terminal. Do you have the option for tab in the Gnome keyboard?

I don’t use the camera a lot but having it would be an advantage. One of the user has already opened a post on stackexchange about it, hopefully it gets fixed soon.

Hi Kirk, it’s another Kirk here.
I have the chuwi freebook i3 and the accelerometer doesn’t seem to be working at all as far as I can tell.
I’m running current mainline kernel on Manjaro.
I’m new to linux and i tried to follow your bug report.
The only difference i noticed with mine and yours is that ls -l /sys/bus/i2c/devices/ shows i2c-MDA6655:00 and not i2c-MXC6655:00.

I just got my Freebook N100. I read the kernel bugreport of Kirk, and this is what I’ve understood:

  1. the fix has been upstreamed in kernel 6.9 and higher
  2. I have 6.9.x here and I can confirm the following:

However, a few things differs from Kirk’s setting:

  • ls /etc/udev/hwdb.d is empty. Noone made an offset orientation settings file for the Freebook yet. This should be upstreamed to systemd/hwdb.d/60-sensor.hwdb at main · systemd/systemd · GitHub, before you will get it in your linux distribution

  • these sensor readings are not available yet in my Freebook - The path /sys/bus/iio/devices/iio:device0/in_mount_matrix didn’t exist but I
    found /sys/bus/iio/devices/iio:device0/in_accel_mount_matrix which does contain
    the matrix.

I don’t know what needs to be done to update these files and what effect it has on the Gnome desktop to act on it

Due to the differences, screen orientation on my Freebook with 6.9 and Gnome 46 Wayland still does not work

I got screen rotate working following step 2 and 3 of this hack.

As you can see it has a proposal for the hwdb file for Minibook X, which also work for Freebook.

Unfortunately it needs the gnome shell extension. For me I had to change the orientation offset of this extension [see picture]

Sorry if this has already been answered. Here is what worked for me. In my case I have a Chuwi Ubook X sn unknown unless it is 214-230132. My accelerometer worked but consistently was incorrect by 90 degrees counterclockwise.

Open a terminal window, ctrl-alt-T will do it- there are other ways. Get to the directory that holds (apparently) all kinds of notes on specific hardware configurations- use the cd for change directory command, like this

cd /lib/udev/hwdb.d

then if you want you can list everything that’s in there to see what there is- the command is ls (that is lower case L and s, not cap i or 1 :slight_smile: )

I created a new item in there by using sudo nano (new file’s name)
New file name should be
61-sensor-local.hwdb
contents of this file should be
sensor:modalias:acpi:MXC6655*:dmi::svnCHUWIInnovationAndTechnology:pnUBookX:*
ACCEL_MOUNT_MATRIX=0, -1, 0; -1, 0, 0; 0, 0, -1

NOTICE: The string in the middle of the sensor etc line above should be *:dmi: no space * no space :svnCHUWIInnovationAndTechnology etc etc but when I post it to this forum it takes the asterisk between the two colons as a command to change the text after to italic rather than just showing the asterisk in place as I wished. Sorry about that, don’t know how to fix it

The Youtube video I stole all the basics for this from is

And the values for the mount matrix I stole somewhere else online. Because I don’t know ANY of this- this is the first work of this sort I’ve done since the last Unix machine I worked on about… oh gods, I doubt too many of you were even alive back then. Maybe not even your parents. I’m just joyously stealing everyone else’s work.
Anyhoo what you’re doing is telling Ubuntu what accelerometer, what manufacturer, what model from that manufacturer, and a little bit of matrix multiplication which I once knew all about even farther back than the Unix work I did. Gods, I’m so old

Hope this helps a bit. --hafoc, bill, whatever