[PATCH v1] usb: core: Add boot delay for DH34 board in restore mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On certain DH34-model motherboards, USB keyboards may fail to respond
during the restore mode confirmation prompt due to the usbhid driver
not being fully initialized when device registration occurs. This
results in inability to input 'y'/'n' confirmation.

Detect this scenario by:
1. Checking DMI_BOARD_NAME for "DH34" substring
2. Verifying "restore" in kernel command line

Introduce a 200ms delay before device registration when both conditions
are met. This allows sufficient time for the usbhid driver to properly
initialize before user interaction is required.

Signed-off-by: Jiayi Li <lijiayi@xxxxxxxxxx>
---
 drivers/usb/core/hub.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index a76bb50b6202..b81b518f438b 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -36,6 +36,7 @@
 #include <linux/bitfield.h>
 #include <linux/uaccess.h>
 #include <asm/byteorder.h>
+#include <linux/dmi.h>
 
 #include "hub.h"
 #include "phy.h"
@@ -2610,6 +2611,7 @@ static void set_usb_port_removable(struct usb_device *udev)
 int usb_new_device(struct usb_device *udev)
 {
 	int err;
+	const char *board_name;
 
 	if (udev->parent) {
 		/* Initialize non-root-hub device wakeup to disabled;
@@ -2656,6 +2658,17 @@ int usb_new_device(struct usb_device *udev)
 	/* check whether the hub or firmware marks this port as non-removable */
 	set_usb_port_removable(udev);
 
+	/* get board manufacturer information (DMI_BOARD_VENDOR) */
+	board_name = dmi_get_system_info(DMI_BOARD_NAME);
+
+	/* In order to load the usbhid driver on a specific model motherboards
+	 * before the restore mode confirmation, add 200ms of latancy.
+	 */
+	if (board_name && strstr(board_name, "DH34") &&
+		(strstr(saved_command_line, "restore") != NULL))
+		msleep(200);
+
+
 	/* Register the device.  The device driver is responsible
 	 * for configuring the device and invoking the add-device
 	 * notifier chain (used by usbfs and possibly others).
-- 
2.47.1





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux