summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-10-09 15:07:44 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-11 08:55:57 -0700
commit399bc14a001e2e12c158233081948f10ef885f6d (patch)
treeab2411240dbb6f29520c0513b39e9223fa3683a9
parent220729bbb66febef5d4eaa03803025cc2c7869fc (diff)
downloadchrome-ec-399bc14a001e2e12c158233081948f10ef885f6d.tar.gz
chip/stm32/usb_hid_keyboard: Reload keyboard endpoint on reset
After the USB device is reset, force sending the keyboard data at least once to make sure the host is aware of the curreny key/switches status. In particular, this is necessary for the host to be aware that we are in tablet mode on host boot (this is not a problem on attach, as other routines in the EC init sequence cause the endpoint to be loaded anyway). BRANCH=nocturne BUG=b:117439202 TEST=Reboot nocturne with whiskers attached in tablet mode, see that nocturne is still in tablet mode after reboot: evtest --query /dev/input/event6 EV_SW SW_TABLET_MODE; echo $? => 10 Change-Id: I4b0e20a9f78c5262d7effd8bd37ace0d033b3f5a Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1270297 Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
-rw-r--r--chip/stm32/usb_hid_keyboard.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c
index efc02b48a4..f30eedde13 100644
--- a/chip/stm32/usb_hid_keyboard.c
+++ b/chip/stm32/usb_hid_keyboard.c
@@ -407,6 +407,13 @@ static void hid_keyboard_event(enum usb_ep_event evt)
NULL, 0
#endif
);
+
+ /*
+ * Reload endpoint on reset, to make sure we report accurate
+ * state to host (this is especially important for tablet mode
+ * switch).
+ */
+ write_keyboard_report();
return;
}