Skip to content

Commit

Permalink
HID: google: whiskers: signal tablet mode on connect
Browse files Browse the repository at this point in the history
When we receive "keyboard position" event from Whiskers we can
conclude that the base is attached, even if we did not get EC event
for that. We may miss EC event because there are some units which
have a lot of leakage on the ADC pins that the EC uses to determine
whether or not a base is attached.

Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Dmitry Torokhov authored and Jiri Kosina committed Oct 1, 2019
1 parent 79085c7 commit b543db4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/hid/hid-google-hammer.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,16 +402,16 @@ static int hammer_event(struct hid_device *hid, struct hid_field *field,
usage->hid == WHISKERS_KBD_FOLDED) {
spin_lock_irqsave(&cbas_ec_lock, flags);

/*
* If we are getting events from Whiskers that means that it
* is attached to the lid.
*/
cbas_ec.base_present = true;
cbas_ec.base_folded = value;
hid_dbg(hid, "%s: base: %d, folded: %d\n", __func__,
cbas_ec.base_present, cbas_ec.base_folded);

/*
* We should not get event if base is detached, but in case
* we happen to service HID and EC notifications out of order
* let's still check the "base present" flag.
*/
if (cbas_ec.input && cbas_ec.base_present) {
if (cbas_ec.input) {
input_report_switch(cbas_ec.input,
SW_TABLET_MODE, value);
input_sync(cbas_ec.input);
Expand Down

0 comments on commit b543db4

Please sign in to comment.