Allows clearing a halt/stall condition by raw endpoint address without
needing to construct a typed Endpoint object. Implemented on all three
platform backends (Linux usbfs, macOS IOKit, Windows WinUSB).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace EndpointBitSet with EndpointRefCount in the Linux backend to
allow multiple Endpoint/IsoEndpoint objects at the same USB endpoint
address. This enables concurrent pipelined URB submission from
independent threads, which is needed for USB/IP proxies that forward
multiple isochronous URBs simultaneously.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This fixes a race condition for users that drop the Endpoint immediately after a transfer
completes, and then might immediately try and re-open the endpoint. The event thread
still held an Arc reference after marking the transfer complete, and so the endpoint
was still considered in use and re-opening occasionally failed.
It also means the `Notify` lock is not held when calling the waker function, which fixes
a deadlock if it were to call back into endpoint methods.
This isn't exposed on WebUSB or Android, and isn't useful as a criteria for filtering devices.
Control endpoint packet size is fully abstracted by the OS, so the only use case is for
re-constructing the device descriptor, and now we offer the full device descriptor
for an opened device.
IOUSBInterfaceInterface700 was added in macOS 10.10+ and
IOUSBDeviceInterface650 in macOS 10.9+, both older than Rust's
minimum of 10.12 so technically the breaking change was already
broken by Rust, but might as well get this in on the nusb v0.2
semver bump.
Co-authored-by: Charles Strahan <charles@cstrahan.com>
This ensures the `tokio` feature is additive, because `tokio::task::spawn_blocking`
will panic if called from a thread without an active tokio runtime. If you
intentionally want the blocking behavior, you can always use `.wait()` instead
of `.await`.
The default mapping from OS error codes to io::Error's messages is often wrong
or misleading. We can do a lot better, but it takes a lot of error-handling code.