/asus-accel-tablet-mode-driver

Linux configurable driver for 2-in-1 Asus laptops. Driver detects change to tablet/laptop using accelerometer data and send appropriate events.

Primary LanguageShellGNU General Public License v2.0GPL-2.0

Asus Accel Tablet Mode Driver

License: GPLv2 Maintainer GitHub Release GitHub commits Hits

The driver is written in python and runs as a systemctl service. Driver allow to configure flip events using accelerometer.

If you find this project useful, please do not forget to give it a GitHub stars People already did!

Changelog

CHANGELOG.md

Features

  • Is allowed to configure key press & release for each flip (default is KEY_PROG2)
  • Is allowed to configure event with different state for each mode (default is SWITCH_TOGGLE : switch tablet-mode state 0 or switch tablet-mode state 1)
$ sudo libinput debug-events
...
-event7   DEVICE_ADDED            Asus WMI accel tablet mode        seat0 default group9  cap:kS
...
 event7   KEYBOARD_KEY            +0.000s	KEY_PROG2 (149) pressed
 event7   KEYBOARD_KEY            +0.000s	KEY_PROG2 (149) released
 event7   SWITCH_TOGGLE           +0.000s	switch tablet-mode state 1
 event7   KEYBOARD_KEY            +1.004s	KEY_PROG2 (149) pressed
 event7   KEYBOARD_KEY            +1.004s	KEY_PROG2 (149) released
 event7   SWITCH_TOGGLE           +1.004s	switch tablet-mode state 0
$ sudo acpi_listen
video/tabletmode TBLT 0000008A 00000001
video/tabletmode TBLT 0000008A 00000000

Limitations

  • This driver identifies tablet mode by accelerometer data which means when is laptop's display almost in the horizontal position it is recognized as tablet mode and does not matter whether is laptop flipped or not

Installation

Get latest dev version using git

$ git clone https://github.com/asus-linux-drivers/asus-accel-tablet-mode-driver
$ cd asus-accel-tablet-mode-driver

and install

$ bash install.sh

or run separately parts of the install script

  • run notifier every time when the user log in (do NOT run as $ sudo, works via systemctl --user)
$ bash install_service.sh

Uninstallation

To uninstall run

$ bash uninstall.sh

or run separately parts of the uninstall script

$ bash uninstall_service.sh

Troubleshooting

To activate logger, do in a console:

LOG=DEBUG sudo -E ./asus_accel_driver.py "default"

Why was this project created? For laptops which do not indicate tablet modes (e.g. Zenbook UN5401QAB or Vivobook TM420 do not send EV_SW.SW_TABLET_MODE or EV_KEY.KEY_PROG2 either) (see the reported issue for Kernel)