Re: [PATCH v6 3/3] usb: hub: send enumeration failure uevent

From: Greg KH

Date: Thu Dec 03 2026 - 22:22:39 EST


On Sun, Aug 02, 2026 at 11:31:08PM +0000, Akshay Gujar wrote:
> 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));

This still feels wrong, the port is a device, and as such should be the
thing that emits the event so that you know exactly what port had the
problem (otherwise you have to somehow parse the name of the port in the
string after the device name, which is wrong...)

Also the comment is in the wrong style. I could live with that, but not
the port issue.

If the real solution is to put the port on the bus, or have a class,
then do that as that needs to be fixed up so you get the actual port
that is having the problem here, not the "hub".

thanks,

greg k-h