From 324d696b5370d1e388265f0e0b0408645e05c7d1 Mon Sep 17 00:00:00 2001 From: stsp Date: Sat, 24 Oct 2015 14:01:40 +0000 Subject: [PATCH] Wait a short while between setting a USB device's address and reloading its descriptor. Fixes flaky attach of USB devices (most importantly the detachable keyboard) on the Thinkpad Helix 2, and perhaps elsewhere. Problem diagnosed by mpi; ok mpi@ --- sys/dev/usb/usb_subr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index dfdeaf99cd0..cd3dc2916f1 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.117 2015/03/23 22:26:01 jsg Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.118 2015/10/24 14:01:40 stsp Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1151,6 +1151,9 @@ usbd_new_device(struct device *parent, struct usbd_bus *bus, int depth, return (USBD_SET_ADDR_FAILED); } + /* Wait for device to settle before reloading the descriptor. */ + usbd_delay_ms(dev, 10); + /* * If this device is attached to an xHCI controller, this * address does not correspond to the hardware one. -- 2.20.1