GalliumOS / galliumos-distro

Docs, issues, and artwork sources for GalliumOS
https://galliumos.org/
GNU General Public License v2.0
347 stars 11 forks source link

ChromeOS Tablet Switch Controller #411

Open StephanvanSchaik opened 6 years ago

StephanvanSchaik commented 6 years ago

Hi,

I'd like to thank the community for their work on GalliumOS and making it possible to run Linux on Chromebooks. Even though, I am not a GalliumOS user, the work is also helpful for running other distributions such as Linux Gentoo in my case.

I am not sure if it is of use to anyone, but I have figured out how to get the laptop/table mode switch detection to work on the ASUS Chromebook Flip C302CA (codename: Cave). Since the CrosEC microcontroller is responsible for determining whether the laptop is in laptop or tablet mode based on the lid angle, this should work for all Chromebooks that implement the MotionSense feature (you can detect this by running ectool inventory on your Chromebook; the tool can be found at https://chromium.googlesource.com/chromiumos/platform/ec/). Switching between these two modes is reported to ACPI by means of a button (similar to opening and closing the laptop lid). Using a tool like acpid you can script these events to disable/enable the keyboard/touchscreen and do other things to create a more suitable environment for the laptop and tablet modes.

As far as I am aware, the required drivers have not landed in the upstream Linux kernel yet, but there are public patches that can be applied to the Linux 4.14 tree:

After applying these patches and enabling CONFIG_CHROMEOS_TBMC, the event can be detected: image

Yours sincerely, Stephan.

ghost commented 6 years ago

Thank you for bringing this to our attention. Tablet support has never been a primary focus of our project, but we're not much for declining simple solutions when they pop up.

wassname commented 6 years ago

Using a tool like acpid you can script these events to disable/enable the keyboard/touchscreen and do other things to create a more suitable environment for the laptop and tablet modes.

FYI: examples of that here and here

StephanvanSchaik commented 4 years ago

It seems that the patches have landed in mainline since Linux 4.18. I haven't tested whether they work yet, but it seems that the only step that is required now is to enable CONFIG_CHROMEOS_TBMC.

delipunch commented 4 years ago

CONFIG_CHROMEOS_TBMC has been compiled as a module (setting m) by default in at least Linux 5.3, so you just modprobe chromeos_tbmc. It doesn't seem to actually work, but that's beyond the scope of this discussion I believe.

GlazedBelmont commented 2 years ago

Sorry to revive this issue but has anyone looked more in depth into it? I also have a c302ca and I've been looking into it with no good results

delipunch commented 2 years ago

I used https://github.com/devendor/c302ca/blob/main/src/modewatcher.py on my CAVE.

Needs python and kernel 5.10 or later (I think. I know the default kernel for GalliumOS doesn't have the needed features, but the Ubuntu hardware-enablement kernel package does), and you should replace the numeric IDs for "keyboard" and similar values with the actual xinput device names if you don't want an external mouse to bork the script.

GlazedBelmont commented 2 years ago

coming back to this issue, I edited the script to my liking by adding a way to get the ID of the keyboard and trackpad since they seemed to constantly change

Also stopped using Gallium as it was feature-lacking on top of just being outdated as hell