@@ -991,8 +991,17 @@ static int __i2c_hid_core_probe(struct i2c_hid *ihid)
struct hid_device *hid = ihid->hid;
int ret;
+ /*
+ * Some STM-based devices need 400µs after a rising clock edge to wake
+ * from deep sleep, which in turn means that our first command will
+ * fail on a bus error. Retry the command in this case.
+ */
ret = i2c_hid_fetch_hid_descriptor(ihid);
- if (ret < 0) {
+ if (ret == -ENXIO) {
+ usleep_range(400, 500);
+ ret = i2c_hid_fetch_hid_descriptor(ihid);
+ }
+ if (ret) {
i2c_hid_dbg(ihid, "failed to fetch HID descriptor: %d\n", ret);
return ret;
}