From: Greg KH <gregkh@linuxfoundation.org>
To: Jiayi Li <lijiayi@kylinos.cn>
Cc: stern@rowland.harvard.edu, stefan.eichenberger@toradex.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
jiayi_dec@163.com
Subject: Re: [PATCH v1] usb: core: Add boot delay for DH34 board in restore mode
Date: Thu, 6 Mar 2025 16:44:28 +0100 [thread overview]
Message-ID: <2025030659-backspace-skimmer-2f01@gregkh> (raw)
In-Reply-To: <20250306061749.1502029-1-lijiayi@kylinos.cn>
On Thu, Mar 06, 2025 at 02:17:49PM +0800, Jiayi Li wrote:
> 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@kylinos.cn>
> ---
> 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);
What about platforms that do not have DMI?
> +
> + /* 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);
> +
> +
Always use scripts/checkpatch.pl before sending patches out.
thanks,
greg k-h
next prev parent reply other threads:[~2025-03-06 15:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-06 6:17 [PATCH v1] usb: core: Add boot delay for DH34 board in restore mode Jiayi Li
2025-03-06 13:29 ` Alan Stern
2025-03-06 15:44 ` Greg KH [this message]
2025-03-07 9:38 ` kernel test robot
2025-03-19 6:00 ` [PATCH WITHDRAWN] " Jiayi Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025030659-backspace-skimmer-2f01@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jiayi_dec@163.com \
--cc=lijiayi@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stefan.eichenberger@toradex.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox