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

Bug #1210823 reported by Till Kamppeter
62
This bug affects 13 people
Affects Status Importance Assigned to Milestone
acpid
Unknown
Medium
acpid (Ubuntu)
Confirmed
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.

Tags: cosmic touch
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

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

Changed in acpid (Ubuntu):
importance: Undecided → High
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

This file must be made executable.

Revision history for this message
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
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
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
Revision history for this message
Mario Vukelic (kreuzsakra) 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

Revision history for this message
Mario Vukelic (kreuzsakra) wrote :

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

Revision history for this message
Mario Vukelic (kreuzsakra) 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
Revision history for this message
Mario Vukelic (kreuzsakra) wrote : Re: Convertibles: Switching between laptop, tent, and tablet modes needed

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

Revision history for this message
Mario Vukelic (kreuzsakra) 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

Revision history for this message
Mario Vukelic (kreuzsakra) 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
Revision history for this message
Mario Vukelic (kreuzsakra) wrote :

A little update. In the meantime I did create the solution as outlined above, and it works like a charm and super reliably for more than a year now.

It made a Windows-using friend with the same machine envy me because Windows does not do this, and he had been immediately annoyed by this as soon as he used the machine for video watching in tent mode for the first time, being his main purpose.

Revision history for this message
claudiosala80 (claudiosala80) wrote :

I have the same with a Lenevo laptop, but is is not clear if there is a workaroud.
When I turn the screen, tablet mode is working fine: phisical keyboard is turned off and virtual one appears. Touchpad get disabled too.

But when I back in laptob mode, keybord is ok, touchpad no: I need to manually re-enable.

What is boring is that sometimes, also when I close the monitor to put pc in standby, it seems the laptop goes in tabled mode and touchpad get disabled.

Is there a workaroud?
IS there info I can provide to help?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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