From: Akshay Gujar <Akshay.Gujar@harman.com>
To: <gregkh@linuxfoundation.org>
Cc: <Akshay.Gujar@harman.com>, <linux-kernel@vger.kernel.org>,
<linux-usb@vger.kernel.org>, <naveen.v@harman.com>,
<oneukum@suse.com>, <stern@rowland.harvard.edu>
Subject: [PATCH v6 3/3] usb: hub: send enumeration failure uevent
Date: Sun, 2 Aug 2026 23:31:08 +0000 [thread overview]
Message-ID: <20260802233108.70950-4-Akshay.Gujar@harman.com> (raw)
In-Reply-To: <20260802233108.70950-1-Akshay.Gujar@harman.com>
Emit a structured uevent when USB device enumeration fails in
hub_port_connect(), supplementing the existing error log with a
notification userspace can act on.
The event is emitted from the port's parent, the hub interface, because
usb_port devices have neither a bus nor a class and dev_uevent_filter()
drops any uevent sent from them. The failing port is named in the
payload.
Signed-off-by: Akshay Gujar <Akshay.Gujar@harman.com>
---
drivers/usb/core/hub.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 5262e11c12cd3..78275dd702ceb 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -5613,9 +5613,21 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus,
if (hub->hdev->parent ||
!hcd->driver->port_handed_over ||
!(hcd->driver->port_handed_over)(hcd, port1)) {
- if (status != -ENOTCONN && status != -ENODEV)
+ if (status != -ENOTCONN && status != -ENODEV) {
+ int ret;
dev_err(&port_dev->dev,
"unable to enumerate USB device\n");
+
+ /* usb_port has no bus or class, so uevents from it
+ * are dropped; emit from the hub interface instead.
+ */
+ ret = device_enumeration_failure_notify(port_dev->dev.parent,
+ dev_name(&port_dev->dev));
+ if (ret)
+ dev_warn(&port_dev->dev,
+ "failed to send enumeration failure uevent: %d\n",
+ ret);
+ }
}
done:
--
2.19.0
prev parent reply other threads:[~2026-08-02 23:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-02 23:31 [PATCH v6 0/3] driver core: add enumeration failure uevent helper Akshay Gujar
2026-08-02 23:31 ` [PATCH v6 1/3] driver core: add device_enumeration_failure_notify() helper Akshay Gujar
2026-08-02 23:31 ` [PATCH v6 2/3] Documentation: ABI: document DEVICE_ENUMERATION_FAILURE uevent Akshay Gujar
2026-08-02 23:31 ` Akshay Gujar [this message]
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=20260802233108.70950-4-Akshay.Gujar@harman.com \
--to=akshay.gujar@harman.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=naveen.v@harman.com \
--cc=oneukum@suse.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