Bug 86223

Summary: RFE: Expose SW_LID and SW_TABLET_MODE to compositors
Product: Wayland Reporter: william.jon.mccann
Component: libinputAssignee: Wayland bug list <wayland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: bugzilla, davide, peter.hutterer
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 88993, 92674, 97288, 101008    

Description william.jon.mccann 2014-11-12 22:31:30 UTC
Some convertible systems send a SW_TABLET_MODE key with a value of 1 or 0 to
indicate if there is a physical keyboard present. It would be nice to adapt the
system to that. For instance, bringing up an OSK when no physical keyboard is
present and text input is required.

Testing ... (interrupt to exit)
Event: time 1415830290.595756, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 1
Event: time 1415830290.595756, -------------- SYN_REPORT ------------
Event: time 1415830353.295884, type 5 (EV_SW), code 1 (SW_TABLET_MODE), value 0
Event: time 1415830353.295884, -------------- SYN_REPORT ------------
Comment 1 william.jon.mccann 2014-11-12 22:32:20 UTC
https://bugzilla.gnome.org/show_bug.cgi?id=740037
Comment 2 Bastien Nocera 2015-02-05 11:23:48 UTC
logind doesn't actually expose the lid status directly to third-party applications, and UPower only exposes lid status because it itself needed it to make power related decisions.

Seeing as UPower doesn't use the lid status internally anymore, there's a good chance it will get removed from UPower, and a better place would be somewhere in the session.

Which is where we could put the tablet mode status as well.

Reassigning to libinput to keep track, and expose SW_LID and SW_TABLET_MODE values to compositors. I'll file a bug against gnome-shell as well.
Comment 3 Peter Hutterer 2015-02-26 07:45:57 UTC
IMO the best approach for this in libinput would be to add it to the buttonset interface that we're working on anyway. As a separate event/interface for switches. Would that work for you?

The other option that came up in a related discussion: would it be worth having a small daemon that provides that value over dbus to the session or whatever needs it? instead of providing it through libinput.
Comment 4 Bastien Nocera 2015-02-26 11:24:49 UTC
(In reply to Peter Hutterer from comment #3)
> IMO the best approach for this in libinput would be to add it to the
> buttonset interface that we're working on anyway. As a separate
> event/interface for switches. Would that work for you?

That would work for me.

> The other option that came up in a related discussion: would it be worth
> having a small daemon that provides that value over dbus to the session or
> whatever needs it? instead of providing it through libinput.

I've discounted adding yet another daemon because this is only really useful to the compositor itself. If it's needed within the session, the compositor can export it.
Comment 5 Peter Hutterer 2016-01-11 00:02:58 UTC
fwiw, there's a patch set as RFC on the list, any comments are appreciated:
http://lists.freedesktop.org/archives/wayland-devel/2016-January/026349.html
Comment 6 Peter Hutterer 2017-01-09 21:56:08 UTC
updated patchset: https://lists.freedesktop.org/archives/wayland-devel/2017-January/032540.html
Comment 7 Peter Hutterer 2017-02-17 06:01:23 UTC
missing SW_TABLET_MODE until we have a concrete use case for it

commit 45d7794de2fb8c24fddd5cd91d946900e4bb4495
Merge: 65c4b27 2dc6534
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date:   Wed Feb 1 13:56:32 2017 +1000

    Merge branch 'wip/switch-interface

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.