Skip to content

Commit dd950f1

Browse files
jwrdegoedeandy-shev
authored andcommitted
platform/x86: intel-vbtn: Detect switch position before registering the input-device
Setting the initial state of input-device switches must be done before registering the input-device. Otherwise the initial state will get send out as an event as soon as input_sync() gets called. E.g. when undocking a tablet using intel-vbtn to report SW_TABLET_MODE and SW_DOCK before this commit we would get (evemu-record output): E: 0.000001 0005 0005 0001 # EV_SW / SW_DOCK 1 E: 0.000001 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms E: 0.000109 0005 0005 0000 # EV_SW / SW_DOCK 0 E: 0.000109 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms E: 0.000133 0005 0001 0001 # EV_SW / SW_TABLET_MODE 1 E: 0.000133 0000 0000 0000 # ------------ SYN_REPORT (0) ---------- +0ms The first SW_DOCK=1 report is spurious, setting the initial switch state before registering the input-device fixes this. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
1 parent f913c30 commit dd950f1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/platform/x86/intel-vbtn.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ static int intel_vbtn_input_setup(struct platform_device *device)
111111
priv->input_dev->name = "Intel Virtual Button driver";
112112
priv->input_dev->id.bustype = BUS_HOST;
113113

114+
if (priv->has_switches)
115+
detect_tablet_mode(device);
116+
114117
return input_register_device(priv->input_dev);
115118
}
116119

@@ -217,9 +220,6 @@ static int intel_vbtn_probe(struct platform_device *device)
217220
return err;
218221
}
219222

220-
if (priv->has_switches)
221-
detect_tablet_mode(device);
222-
223223
status = acpi_install_notify_handler(handle,
224224
ACPI_DEVICE_NOTIFY,
225225
notify_handler,

0 commit comments

Comments
 (0)