New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 903526 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug-Regression



Sign in to add a comment

Input devices can get incorrectly disabled when flipping into "smart keyboard" mode too fast

Project Member Reported by jwer...@chromium.org, Nov 8

Issue description

Chrome Version: 71.0.3578.27
OS: 11151.17.0 (Official Build) beta-channel kevin

What steps will reproduce the problem?
(1) Have device in clamshell mode, nothing attached
(2) Attach external display cable, then *quickly*...
(3) Turn internal display brightness down to 0
(4) Flip device over in tablet ("smart keyboard") mode
(5) [external display enumeration finishes somewhere around here]

What is the expected result?

After the external display finishes enumerating (and is now the main/only display since the internal one has been turned off), the device is in "smart keyboard" mode, and the mouse and keyboard still work.

What happens instead?

After the external display finishes enumerating, the mouse and keyboard are still disabled. There is no mouse pointer visible. If you instead attach the display, wait for it to fully enumerate, and then disable the internal brightness and flip the device over, everything works as expected.

This used to work before my latest update, when I was at 71.0.3578.21 (11151.11.0). Thankfully, that's a very small bisect range. The only two commits that seem likely culprits are this powerd refactoring

 https://chromium-review.googlesource.com/c/chromiumos/platform2/+/1287021/

and this Chrome tablet mode change

 https://chromium-review.googlesource.com/c/chromium/src/+/1297577

The Chrome change seems slightly more likely to me, so assigning there first.
 
But wait... there is more!

When I lock the screen while in "smart keyboard" mode and wait for the (external) display to be turned off from idling, the input devices also get disabled after wakeup. I can still wake the device up by hitting a key on the keyboard, but then afterwards I can no longer use it to type my password. (Note that the device didn't suspend to RAM here... it just turned the display off.)
Thanks for reporting the bug. I suspect this might be fixed with the latest beta update, which contains my another cl https://chromium-review.googlesource.com/c/chromium/src/+/1318180. The fix is in 71.0.3578.38. 

Can you update to the latest beta to see if you still can see this issue? Thanks!
Owner: jwer...@chromium.org
Looks like it's not pushed out yet, let's wait a couple of days and I'll report back once I can get the update.
Owner: x...@chromium.org
Nope, it's still broken with the same behavior in 71.0.3578.49. PTAL.
Labels: -M-71 ReleaseBlock-Stable M-72
*ping*

Have you had a chance to reproduce this? It's a pretty annoying regression for someone using external monitors a lot, so it would be nice if it doesn't stay broken for more than one stable release cycle.
No I haven't got time to look into this. I don't quite understand your repro steps:
(3) Turn internal display brightness down to 0

How do you turn the internal display brightness down to 0?

(4) Flip device over in tablet ("smart keyboard") mode

Do you mean flip the device's lid to 360 degrees or close the device lid?

(5) [external display enumeration finishes somewhere around here]

And also, I don't know what "smart keyboard mode" really means.
> How do you turn the internal display brightness down to 0?

Just press and hold the "lower brightness" (F6) button on the keyboard. If you have an external monitor attached, it will allow you to turn it all the way off.

> Do you mean flip the device's lid to 360 degrees or close the device lid?

I mean flip it into "tablet" mode (360 degrees), but use it with the keyboard facing up and the internal display facing down on the desk. That's what I mean with "smart keyboard mode"... you use keyboard and touchpad for input, and the external display for output.
I don't think we support "smart keyboard mode". +Omri to confirm

Currently, if the device is in tablet mode (i.e., the keyboard is flipped over), no matter which side faces up (I doubt if we can get this information), the internal keyboard and touchpad are supposed to be disabled. The device is meant to be act like a tablet. 

As for your case, I believe it worked before because of a race condition in the code, and was fixed later. 

I don't see anything needs to be fixed for this issue. If we want to support "smart keyboard mode" in the future, we can take another look into it. 
> I don't think we support "smart keyboard mode". +Omri to confirm

This has been working fine since the first convertible devices in 2015 (and it's still working in general, after all, it just has a bug in a specific case right now).

> Currently, if the device is in tablet mode (i.e., the keyboard is flipped over), no matter which side faces up (I doubt if we can get this information), the internal keyboard and touchpad are supposed to be disabled. The device is meant to be act like a tablet. 

This is not determined by angle or gravity, it is determined by whether the internal display is enabled. When the internal display is disabled, the device can by definition not be useful as a tablet, so it assumes you're trying to use the trackpad/keyboard together with an external display instead. I believe this is called "presentation mode" in Chrome, although I'm not quite sure about the details... derat might know more.

> As for your case, I believe it worked before because of a race condition in the code, and was fixed later. 

Just to be clear again, the basic use case still works and has always worked. If you follow the repro instructions but you wait long enough between (2) and (4), it still works just fine (i.e. you can use keyboard and mouse on your external display). The only two bugs that were now introduced are that it doesn't work if you flip the device over too fast, and that it doesn't correctly resume back into this state after going to S3 and waking back up.
edit: See the code in https://chromium-review.googlesource.com/c/chromium/src/+/1297577/3/ash/wm/tablet_mode/tablet_mode_controller.cc#266 (OnDisplayConfigurationChanged()), where it ignores the normal tablet mode switch when HasInternalDisplay() is false. That looks like code specifically meant to support this use case. From the comments, it looks like the correct Chrome terminology here might be "docked mode" instead... (I think the terms "docked mode" and "presentation mode" have both been used to confusingly describe slightly different things in the past, so I usually call it "smart keyboard" to make it clear that I mean this, as opposed to "docked" with internal display on. But they have always both been supported with appropriate behavior for each.)
Status: Assigned (was: Untriaged)
This issue has an owner, a component and a priority, but is still listed as untriaged or unconfirmed. By definition, this bug is triaged. Changing status to "assigned". Please reach out to me if you disagree with how I've done this.
This issue has an owner, a component and a priority, but is still listed as untriaged or unconfirmed. By definition, this bug is triaged. Changing status to "assigned". Please reach out to me if you disagree with how I've done this.

Comment 13 by x...@chromium.org, Jan 17 (5 days ago)

I took another look at this issue and found the current behavior has changed (I tested on eve with chrome version: 73.0.3674.0 Platform: 11599.0.0): 

The behavior is now the same no matter how I turn internal display brightness to 0. It does not have any difference whether I wait the external display to be on or not, before turning off the internal display brightness:
* if the device is in tent mode (the lid angle is larger than 200 degree but less then 300 degree), the mouse and keyboard are still working.
* if the device is fully flipped or almost fully flipped (i.e., larger than 300 degree), only the mouse is still working. keyboard can't be used.

And I also verified that the behavior in the original report (comment#0) and here are both unrelated to Chrome side change. From the local log, the input device blocking status on Chrome side is not changed during the entire process.

And I think it's caused by platform side change: Since when the device angle is larger than 300 degree, TabletMode value is changed in powerd. And internal keyboard/touchscreen will have different rules while in laptop mode and tablet mode, see https://cs.corp.google.com/chromeos_public/src/platform2/power_manager/udev/92-powerd-tags.rules. Could it be related?

Comment 14 by x...@chromium.org, Jan 18 (5 days ago)

jwerner@, can you check if your behavior is now the same as what I described in #13? If so, it should be caused by powerd inhibit the internal keyboard when the device is in tablet mode.

Comment 15 by jwer...@chromium.org, Jan 18 (5 days ago)

> * if the device is in tent mode (the lid angle is larger than 200 degree but less then 300 degree), the mouse and keyboard are still working.

This is odd... I'm definitely not seeing this on my Kevin (note I'm still on 71 stable). When I flip my device over ~200 degrees, the mouse and keyboard are immediately blocked. Where is this behavior implemented? I am not aware that'd we'd distinguish between tent mode and full tablet mode in any code.

> And I think it's caused by platform side change: Since when the device angle is larger than 300 degree, TabletMode value is changed in powerd. And internal keyboard/touchscreen will have different rules while in laptop mode and tablet mode, see https://cs.corp.google.com/chromeos_public/src/platform2/power_manager/udev/92-powerd-tags.rules. Could it be related?

In this configuration powerd uses the usable_when_display_off rules, not usable_when_tablet, so the mouse and keyboard should still be available from powerd's side. Here's a powerd log I captured while doing the repro steps from #0 again:

[0117/160950:INFO:internal_backlight_controller.cc(591)] Got user-triggered request to set brightness to 0%
[0117/160950:INFO:internal_backlight_controller.cc(757)] Setting brightness to 0 (0%) over 200 ms
[0117/160951:INFO:daemon.cc(750)] On AC (USB_PD, 19.8V, max 2.0A at 20.0V) with battery at 97% (displayed as 100%), 4.744/4.869Ah at 0.897A, full
[0117/160952:INFO:daemon.cc(494)] Tablet mode on
[0117/160952:INFO:input_device_controller.cc(287)] Configuring devices for mode "tablet"
[0117/160952:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/platform/ff120000.i2c/i2c-2/2-0009/0018:2D1F:0163.0001/input/input4
[0117/160952:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/platform/ff130000.i2c/i2c-3/3-004b/input/input3
[0117/160952:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/platform/ff140000.i2c/i2c-5/5-004a/input/input2
[0117/160952:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/platform/ff200000.spi/spi_master/spi5/spi5.0/ff200000.spi:ec@0:keyboard-controller/input/input0

< this is before the external monitor has finished enumerating, so powerd treats it as normal tablet mode here and inhibits keyboard and touchpad >

[0117/160952:WARNING:input_device_controller.cc(199)] No power/wakeup sysattr available for /sys/devices/platform/ff120000.i2c/i2c-2/2-0009/0018:2D1F:0163.0001/input/input4
[0117/160952:INFO:input_device_controller.cc(203)] Disabling wakeup for /sys/devices/platform/ff140000.i2c/i2c-5/5-004a/input/input2 through /sys/devices/platform/ff140000.i2c/i2c-5/5-004a
[0117/160952:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/gpio-keys/input/input7 through /sys/devices/platform/gpio-keys
[0117/160952:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/gpio-keys/input/input7/event7 through /sys/devices/platform/gpio-keys
[0117/160952:INFO:daemon.cc(709)] Enabling tablet mode wifi transmit power
[0117/160952:INFO:main.cc(247)] Launching "/usr/bin/powerd_setuid_helper --action=set_wifi_transmit_power --wifi_transmit_power_tablet"
[0117/160952:INFO:daemon.cc(1077)] Chrome is using presentation display mode
[0117/160952:INFO:state_controller.cc(944)] Updated settings: dim=7m screen_off=7m30s lock=7m40s idle_warn=0s idle=8m30s (suspend) lid_closed=no-op use_audio=1 use_video=1 wake_locks=
[0117/160952:INFO:input_device_controller.cc(287)] Configuring devices for mode "display_off"
[0117/160952:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/platform/ff120000.i2c/i2c-2/2-0009/0018:2D1F:0163.0001/input/input4
[0117/160952:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/platform/ff130000.i2c/i2c-3/3-004b/input/input3
[0117/160952:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/platform/ff140000.i2c/i2c-5/5-004a/input/input2
[0117/160952:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/platform/ff200000.spi/spi_master/spi5/spi5.0/ff200000.spi:ec@0:keyboard-controller/input/input0

< this is where powerd heard from Chrome that we have an external display, so it switches to "display_off" mode and enables the keyboard and mouse again. but they still don't show up in Chrome for me afterwards >

[0117/160952:INFO:input_device_controller.cc(203)] Disabling wakeup for /sys/devices/platform/ff140000.i2c/i2c-5/5-004a/input/input2 through /sys/devices/platform/ff140000.i2c/i2c-5/5-004a
[0117/160952:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/gpio-keys/input/input7 through /sys/devices/platform/gpio-keys
[0117/160952:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/gpio-keys/input/input7/event7 through /sys/devices/platform/gpio-keys
[0117/160952:INFO:ec_wakeup_helper.cc(71)] EC wake angle set to 360
[0117/160952:INFO:udev.cc(435)] Adding device /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2/7-1.1.2:1.3/0003:0572:1703.0031/input/input23 with tags usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off wakeup wakeup_only_when_usable inhibit role_external_input
[0117/160952:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2/7-1.1.2:1.3/0003:0572:1703.0031/input/input23
[0117/160952:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2/7-1.1.2:1.3/0003:0572:1703.0031/input/input23 through /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2
[0117/160952:INFO:input_watcher.cc(499)] Monitoring input device event8 with wakeup path /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2 to identify the wake source
[0117/160953:INFO:udev.cc(435)] Adding device /sys/devices/platform/usb@fe800000/fe800000.dwc3/xhci-hcd.3.auto/usb7/7-1/7-1.1/7-1.1.2/7-1.1.2:1.3/0003:0572:1703.0031/input/input23/event8 with tags usable_when_docked usable_when_laptop usable_when_tablet usable_when_display_off role_external_input
[0117/160953:INFO:display_power_setter.cc(81)] Asking DisplayService to turn internal display off and external displays on
[0117/160954:INFO:daemon.cc(1077)] Chrome is using presentation display mode

Comment 16 by x...@chromium.org, Jan 18 (5 days ago)

This is powerd log from my device: (selected logs, but in order):

[0117/164621.949191:INFO:internal_backlight_controller.cc(586)] Got user-triggered request to set brightness to 0%
[0117/164622.004282:INFO:audio_client.cc(162)] Updated audio devices: headphones unplugged, HDMI active
[0117/164622.013119:INFO:daemon.cc(1078)] Chrome is using presentation display mode
[0117/164622.013160:INFO:state_controller.cc(944)] Updated settings: dim=10m screen_off=10m30s lock=10m40s idle_warn=0s idle=11m30s (no-op) lid_closed=no-op use_audio=1 use_video=1 wake_locks=
[0117/164622.013197:INFO:input_device_controller.cc(287)] Configuring devices for mode "display_off"
[0117/164622.013308:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/i2c-WCOM50C1:00/0018:2D1F:5142.0001/input/input4
[0117/164622.013488:INFO:input_device_controller.cc(216)] Inhibiting /sys/devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/i2c-WCOM50C1:00/0018:2D1F:5142.0001/input/input5
[0117/164622.013637:INFO:input_device_controller.cc(216)] Un-inhibiting /sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8/i2c-ACPI0C50:00/0018:18D1:5028.0003/input/input9
[0117/164622.013783:WARNING:input_device_controller.cc(199)] No power/wakeup sysattr available for /sys/devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8/i2c-ACPI0C50:00/0018:18D1:5028.0003/input/input9
[0117/164622.013807:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/i8042/serio0/input/input3 through /sys/devices/platform/i8042/serio0
[0117/164622.013901:INFO:input_device_controller.cc(203)] Enabling wakeup for /sys/devices/platform/i8042/serio0/input/input3/event3 through /sys/devices/platform/i8042/serio0

>>>> display is off, we're in presentation mode. The lid is flipped over (but not fully flipped). The mouse and keyboard are still usable

[0117/165225.746498:INFO:daemon.cc(494)] Tablet mode on
[0117/165225.746598:INFO:daemon.cc(710)] Enabling tablet mode wifi transmit power
[0117/165225.746632:INFO:main.cc(248)] Launching "/usr/bin/powerd_setuid_helper --action=set_wifi_transmit_power --wifi_transmit_power_tablet"
[0117/165233.478649:INFO:daemon.cc(751)] On battery at 78% (displayed as 80%), 4.909/6.257Ah at 0.367A, 12h42m6s until empty (12h12m58s until shutdown)

>>>> The lid is fully flipped over. Tablet mode is on. Mouse is still usable. Keyboard stops working.

[0117/165343.556387:INFO:daemon.cc(494)] Tablet mode off
[0117/165343.556472:INFO:daemon.cc(710)] Disabling tablet mode wifi transmit power
[0117/165343.556498:INFO:main.cc(248)] Launching "/usr/bin/powerd_setuid_helper --action=set_wifi_transmit_power --nowifi_transmit_power_tablet"

>>>> Flip back a bit. Now Tablet mode is off. Mouse and keyboard are usable again.


Comment 17 by jwer...@chromium.org, Jan 18 (5 days ago)

The powerd code is a bit confusing here, but "Tablet mode on" doesn't necessarily mean it's not in "display off" mode. In daemon.cc (and most other parts of powerd), there's only the distinction of tablet mode or no tablet mode. But in input_device_controller.cc, there is a separate distinction between five different states (closed, docked, display_off, laptop, tablet). That is what counts for disabling input devices.

In your example, since you didn't see another "Inhibiting"/"Un-inhibiting" message, powerd didn't modify the input device state again after you flipped the device into full tablet mode. If the keyboard stopped working at that point, it must have come from something else.

It may be that Eve is doing something weird here (maybe on its EC). Any chance you could test this on a Kevin?

Comment 18 by x...@chromium.org, Jan 18 (4 days ago)

I managed to get a kevin and tested on it. I managed to repro what you reported in the original report with a bit different steps:

(1) Have device in clamshell mode, nothing attached
(2) Attach external display cable, then *quickly*...
(3) Turn internal display brightness down to 0, and also *quickly*...
(4) Flip device over in tablet mode without waiting the external monitor to be turned on

After after, external monitor is turned on and mouse/keyboard can not be used. Note step (2) and (3) both needs to be done very quickly before external display turns on. otherwise everything works fine.

In this particular case, the issue is in Chrome side. I'll have a fix.

Sign in to add a comment