Convertibles (hybrid, 2-in-1): Switching between laptop, tent, and tablet modes needed

Bug #1210823 reported by Till Kamppeter on 2013-08-10
58
This bug affects 12 people
Affects Status Importance Assigned to Milestone
acpid
Unknown
Medium
acpid (Ubuntu)
High
Unassigned

Bug Description

See

https://blueprints.launchpad.net/ubuntu/+spec/client-1305-convertibles-and-touch-desktop

Convertibles (like the Lenovo Thinkpad Twist) have two modes: Laptop mode where the desktop is controlled with the built-in keyboard and the built-in touchpad (or an external mouse) and tablet mode where the keyboard is folded away behind the screen and the desktop is controlled by the touch screen only.

In laptop mode the built-in touchpad must be active and clicking or tapping a text input field should not pop up an on-screen keyboard, whereas in tablet mode the built-in touchpad should be deactivated so that the turned over laptop lid lying on the touchpad does not trigger mouse actions and tapping input fields has to pop-up the on-screen keyboard.

This can be easily done by a an ACPI-triggered script, as described on

http://www.thinkwiki.org/wiki/Installing_Ubuntu_12.10_on_Thinkpad_Twist#Automatic

There are two files in /etc/acpi/events/ which assign the call of a script in /etc/acpi/ when the device is put into laptop mode or into tablet mode. The script should turn on the keyboard pop-up and turn off the touchpad when going into tablet mode and turn off the keyboard pop-up and turn on the touchpad when going into laptop mode.

Some remarks:

- The ACPI events mentioned on the linked site are for the Lenovo Thinkpad Twist, they can be different on other convertibles.

- The script does not activate keyboard pop-up. One needs to add

----------
if [ "$MODE" = "1" ]; then
    sudo -iu $user onboard &
else
    sudo -iu $user killall onboard
fi
----------

to get this.

- The script turns off the touch screen in laptop mode. This is not actually needed.

- The script uses two functionalities which got removed in Saucy. First, /usr/share/acpi-support/power-funcs with the function getXconsole to find out who the user logged in on the desktop is ($user, the script runs as root), and second, xinput support for the touchpad (can also be a bug). Perhaps one needs to use gsettings now.

When finding a way to turn off and on the touchpad and a way to find the desktop user, one could easily update the script so that it works with Saucy. One also needs to find out the ACPI events for mode switching on the different models of convertibles.

Till Kamppeter (till-kamppeter) wrote :

Attaching relevant files for the case that the Thinkwiki article goes away.

Changed in acpid (Ubuntu):
importance: Undecided → High
Till Kamppeter (till-kamppeter) wrote :

This file must be made executable.

Till Kamppeter (till-kamppeter) wrote :

An implementation of mode-switching is also on

https://launchpad.net/magick-rotation

I supports several models of convertibles, so it should contain the appropriate ACPI event information. Not so nice is that it rotates the desktop into portrait mode. The orientation should be automatically set by an orientation sensor or changed by a button press, as in many cases (like video) a tablet is used in landscape orientation.

Changed in acpid:
importance: Unknown → Medium
status: Unknown → New
Till Kamppeter (till-kamppeter) wrote :

I told in the initial description that xinput was not working any more. I checked again today and it is working again. So for the script only a way for root to determine the current desktop user is missing.

Till Kamppeter (till-kamppeter) wrote :

xinput needs the DISPLAY and XAUTHORITY env variables to be set. For the time being one can hard-code all these variables in the script, at least on machines with only one user account.

The script is a hack, a proper fix is expected in Unity 8.

Till Kamppeter (till-kamppeter) wrote :

Attached is a script which works with Saucy, also a hack, but with logind (via loginctl) support added. Works for the time being until we get a real fix.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in acpid (Ubuntu):
status: New → Confirmed
Changed in acpid:
status: New → Incomplete
Changed in acpid:
status: Incomplete → Unknown
Mario Vukelic (mario-vukelic) wrote :

I am currently setting up such a device, Asus ZenBook Flip 15, UX561UD from 2018, and the new Dell XPS 15 9575 2-in-1 will follow in a week or two.
https://www.notebookcheck.net/Asus-ZenBook-Flip-15-i7-8550U-GTX-1050-4K-SSD-HDD-Convertible-Review.295860.0.html
https://www.notebookcheck.net/Dell-XPS-15-9575-i7-8705G-Vega-M-GL-4K-UHD-Convertible-Review.301916.0.html

For the Asus, the generic laptop functions work out of the box with just two small niggles (bugs are filed) and very little is missing to make conversion features work out of the box. Rotation sensors and touch works perfectly fine (this is on Wayland, X has fewer working touch gestures but basics work too). What is missing is just:

1. Automatically deactivate touchpad when folding to tablet. (The keyboard already turns off. The keyboard has a working key to deactivate the touchpad, these two things only have to be wired together)

2. The new on-screen keyboard (from Gnome 2.28) activates automatically (even when deactivated in Accessibility settings) when touching the search box in the Gnome Activities menu and the applications overview menu. I found no other place where it triggers, not even the first-class Gnome applications like Web. It just has to trigger for every text entry box and we are good.

3. Important and not yet mentioned: This device type has a tent mode, typically for video watching. (It's great because most laptops have air intake grills and speakers at the bottom, which sucks e.g. in bed. Tent mode solves this nicely). However, in tent mode the stereo speakers swap positions relative to the screen, so the stereo channels have to be swapped. This is quite simple on the fly without touching a config file by:

pactl load-module module-remap-sink sink_name=reverse-stereo master=0 channels=2 master_channel_map=front-right,front-left channel_map=front-left,front-right

Then switch to it by:
pactl set-default-sink reverse-stereo

One can also switch in the sound control panel. It will disappear after pulseaudio restart

I didn't come up with the pulseaudio stuff or try it out yet. Credit goes to @ulidtko on https://superuser.com/questions/59481/how-to-swap-stereo-channels-in-ubuntu

Mario Vukelic (mario-vukelic) wrote :

And these convertibles are now starting to pop up all over the place, so getting this to work would be a thing now.

Mario Vukelic (mario-vukelic) wrote :

Linking the bug about the Gnome on-screen keyboard as is seems to be a general issue that this here bug depends on, and not device specific: https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1760399

summary: - Convertibles: Switching between laptop mode and tablet mode needed
+ Convertibles: Switching between laptop, tent, and tablet modes needed
tags: added: cosmic touch

Found out that the on-screen keyboard in Gnome 3.30 behaves differently under X and Wayland. Non-gnome toolkits can't trigger it automatically when selecting text widgets, so it needs to be manually activated.
- Wayland: Swipe up from bottom of screen. Works but difficult to discover
- X: This gesture does not work and another way to activate is needed, discussed in bug #1760399 (the one from the prev. comment.)
- Both: In Gnome 3.30 even selecting Gnome text widgets only rarely triggers it automatically

These usability issues filed as bug #1791551

Mario Vukelic (mario-vukelic) wrote :

The above instructions for swapping stereo channels with pulseaudio worked out. The reversed audio sink can easily be made persistent in /etc/pulse/default.pa (as explained in above link). Automation of stereo channel swapping based on sensors would be neat but I didn't figure it out yet, currently I'm using buttons to run scripts. It is also possible to go into Gnome sound settings and choose between the regular and swapped audio sinks.

Automation would have to take into account at least the following configurations:

- Laptop mode:
Regular stereo (left channel on left speaker, right channel on right speaker)

- Display in a kind of flat table position, i.e., at 180 degrees to keyboard, both the display and keyboard facing upward:
Is this a thing that would be used in practice? Should probably default to regular stereo.

- Tent mode:
Swap stereo channels (left channel on right speaker, right channel on left speaker)

- Presentation mode, for want of a better word. Display and keyboard are at similar angle as tent mode i.e. > 180 degrees, but keyboard faces down, keys resting on surface. Effectively the keyboard part functions just a stand for a touchscreen. (Think touch phone or digital photo frame). In the end tent mode achieves the same effect, but e.g. Asus shows off this mode in the first image on https://www.asus.com/2-in-1-PCs/ASUS-ZenBook-Flip-UX561UD):
Regular (left channel on left speaker, right channel on right speaker)

- Tablet mode, display folded back completely:
In landscape orientation, sound follows display rotation, i.e., regular or swapped depending on screen rotation
In portrait orientation, mono sound would probably work best

Mario Vukelic (mario-vukelic) wrote :

Vendor's names and articles for this device class use any of convertible, hybrid, or 2-in-1, so I added the terms to title for easier searching

summary: - Convertibles: Switching between laptop, tent, and tablet modes needed
+ Convertibles (hybrid, 2-in-1): Switching between laptop, tent, and
+ tablet modes needed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.