[PATCH v6 3/3] usb: hub: send enumeration failure uevent
From: Akshay Gujar
Date: Sun Aug 02 2026 - 19:32:46 EST
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@xxxxxxxxxx>
---
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