Re: [PATCH v3 0/5] rust: usb: host-side abstractions for a bulk-endpoint driver

From: Mike Lothian

Date: Fri Oct 30 2026 - 03:59:29 EST


Hi Shuai,

Thank you for reading it properly, both of those are real

On Fri, 30 Oct 2026, Shuai Liu wrote:
> set_alternate_setting() invalidates Endpoint<K> without the type
> system noticing

Right. Binding the proof to the setting would mean threading a
generation through every Endpoint and checking it at transfer time, and
I haven't got a version of that I like yet, so v4 documents it: both
Endpoint and set_alternate_setting() now say that every Endpoint obtained
earlier must be looked up again after a switch. If you have a shape for
the Altsetting token in mind I'd like to see it

> set_alternate_setting() with transfers in flight is undefined

v4 refuses it. The window already knows about every queue URB registered
against it, so set_alternate_setting() returns EBUSY while any queue is
alive, and the doc says to drop the queues and build them again on the new
setting. That puts the cancellation in the queue's Drop, which is where
you suggested

The one in-tree caller selects setting 0 once at bring-up, before any
queue exists, so it isn't affected

Mike