* [PATCH] usb: core: Notify through uevent when not enough bandwidth available
@ 2026-06-15 14:35 Nícolas F. R. A. Prado
2026-07-10 13:01 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2026-06-15 14:35 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: kernel, linux-usb, linux-kernel, Nícolas F. R. A. Prado
Currently, when a new device is plugged in and the host controller can't
find enough bandwidth for it, an error message is printed:
usb 1-3: Not enough bandwidth for new device state.
In order to allow userspace to react to this and suggest the user to use
a different host controller, send a uevent with
'USB_NOT_ENOUGH_BANDWIDTH=1' to the root hub device.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
---
drivers/usb/core/hcd.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 8e8a5f59b319..a71605398540 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1825,6 +1825,13 @@ void usb_hcd_flush_endpoint(struct usb_device *udev,
}
}
+static void not_enough_bandwidth_notify(struct usb_hcd *hcd)
+{
+ static char *envp[2] = { "USB_NOT_ENOUGH_BANDWIDTH=1", NULL };
+
+ kobject_uevent_env(&hcd->self.root_hub->dev.kobj, KOBJ_CHANGE, envp);
+}
+
/**
* usb_hcd_alloc_bandwidth - check whether a new bandwidth setting exceeds
* the bus bandwidth
@@ -1954,6 +1961,8 @@ int usb_hcd_alloc_bandwidth(struct usb_device *udev,
}
}
ret = hcd->driver->check_bandwidth(hcd, udev);
+ if (ret == -ENOSPC)
+ not_enough_bandwidth_notify(hcd);
reset:
if (ret < 0)
hcd->driver->reset_bandwidth(hcd, udev);
---
base-commit: c425609d6ac4012c8bbf01ec2e10e801b1923a7b
change-id: 20260615-usb-notify-not-enough-bandwidth-5f39ccf6754b
Best regards,
--
Nícolas F. R. A. Prado <nfraprado@collabora.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] usb: core: Notify through uevent when not enough bandwidth available
2026-06-15 14:35 [PATCH] usb: core: Notify through uevent when not enough bandwidth available Nícolas F. R. A. Prado
@ 2026-07-10 13:01 ` Greg Kroah-Hartman
2026-07-21 13:14 ` Nícolas F. R. A. Prado
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-07-10 13:01 UTC (permalink / raw)
To: Nícolas F. R. A. Prado; +Cc: kernel, linux-usb, linux-kernel
On Mon, Jun 15, 2026 at 10:35:33AM -0400, Nícolas F. R. A. Prado wrote:
> Currently, when a new device is plugged in and the host controller can't
> find enough bandwidth for it, an error message is printed:
>
> usb 1-3: Not enough bandwidth for new device state.
>
> In order to allow userspace to react to this and suggest the user to use
> a different host controller, send a uevent with
> 'USB_NOT_ENOUGH_BANDWIDTH=1' to the root hub device.
Where is this new user/kernel api now documented? And what tool is
going to be looking for it?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: core: Notify through uevent when not enough bandwidth available
2026-07-10 13:01 ` Greg Kroah-Hartman
@ 2026-07-21 13:14 ` Nícolas F. R. A. Prado
0 siblings, 0 replies; 3+ messages in thread
From: Nícolas F. R. A. Prado @ 2026-07-21 13:14 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: kernel, linux-usb, linux-kernel
On Fri, 2026-07-10 at 15:01 +0200, Greg Kroah-Hartman wrote:
> On Mon, Jun 15, 2026 at 10:35:33AM -0400, Nícolas F. R. A. Prado
> wrote:
> > Currently, when a new device is plugged in and the host controller
> > can't
> > find enough bandwidth for it, an error message is printed:
> >
> > usb 1-3: Not enough bandwidth for new device state.
> >
> > In order to allow userspace to react to this and suggest the user
> > to use
> > a different host controller, send a uevent with
> > 'USB_NOT_ENOUGH_BANDWIDTH=1' to the root hub device.
>
> Where is this new user/kernel api now documented? And what tool is
> going to be looking for it?
Sorry I missed that, I'll add the documentation at
Documentation/ABI/testing/usb-uevent in v2.
As for the user, Steam will use it.
--
Thanks,
Nícolas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-21 13:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-15 14:35 [PATCH] usb: core: Notify through uevent when not enough bandwidth available Nícolas F. R. A. Prado
2026-07-10 13:01 ` Greg Kroah-Hartman
2026-07-21 13:14 ` Nícolas F. R. A. Prado
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.