Re: [RFC PATCH v2 10/11] rust: usb: keep usb::Device private and gate transfers on Interface<Bound>
From: Oliver Neukum
Date: Mon Jul 06 2026 - 08:03:28 EST
On 03.07.26 05:00, Mike Lothian wrote:
Address the v1 RFC review (Danilo Krummrich):
- Do not make `usb::Device` public. Writing a `usb::Interface` driver should
not require naming the underlying `usb::Device` (cf. commit 22d693e45d4a
("rust: usb: keep usb::Device private for now")), so the struct is
private again and the device-wide transfer operations are exposed on
the interface.
Hi,
I would say that this is just conceptually wrong.
1. drivers talk to the common control endpoint of the _device_
not their interface
2. drivers ought to be able to set a configuration (That's a device property)
3. Drivers need to be able to claim secondary interfaces (we have an API for that)
4. Devices and links (and functions) have states, not interfaces.
These operations operate on the device level. Hiding that fact behind an
interface (which may not even be accepted at that point) is just a layering
violation. Even calling a device reset through an interface is strictly speaking
wrong.
We even have a driver that can ride piggyback on another driver's interface
and use only control transfers to endpoint 0.
This patch is fundamentally flawed because it operates on assumptions
that are just not true. USB does device level operations. Just drop it.
Regards
Oliver