The associated type bounds feature, stabilized in 1.79 allows adding
an implied Send bound on all IntoFuture types used with MaybeFuture,
so every function doesn't have to be marked as Send.
This is going to be especially useful with wasm, because it allows the
Send bound to be turned on and off in one place.
* fix(macos): claiming interface on macOS treats interface number as index
Bug is exposed when connected device has not continuous interface numbers. Then getting nth interface is not the same as getting interface of specific number.
This commit fixes it by getting and comparing bInterfaceNumber instead of using `nth(interface_number)` function on iterator.
* refactor: reformatted find closure in claim_interface
Extracted `get_integer_property` usage into a local variable for clarity and improved readability. This refactor maintains existing functionality while simplifying the comparison logic.
* feat: Add debug logging for interface discovery in macOS IOKit
This change introduces a debug log to provide more visibility during the interface discovery process. It logs the target interface number and the current interface being examined, noting whether a match was found. This aids debugging and troubleshooting in device enumeration scenarios.
* refactor: Rephrase debug log for interface claim process.
Introduced a new `usb_version` field to represent the encoded USB specification version (`bcdUSB`) in DeviceInfo struct. This change includes updates to data structure, a new accessor method, and enhanced debug formatting to display the `usb_version` field.
* Make blocking APIs optionally async
`DeviceInfo::open`, `Device::from_fd`, `Device::set_configuration`,
`Device::reset`, `Interface::set_alt_setting`, `Interface::clear_halt`
all perform IO but are currently blocking because the underlying OS APIs
are blocking.
`list_devices`,`list_buses`, `Device::claim_interface`
`Device::detach_and_claim_interface` theoretically don't perform IO, but
are also included here because they need to be async on WebUSB.
The `MaybeFuture` trait allows deferring these actions to the thread pool
from the `blocking` crate when used asynchronously with `.await` /
`IntoFuture`, or directly runs the blocking syscall synchronously with a
`.wait()` method.
We'll log if the ioctl failed, but there's probably not a use case to
determine why it failed to justify Result<Option<>>. It'll be
infallible (besides unknown values) on other platforms.
Unlike the Configuration descriptor, it does not contain nested
descriptors.
It's also made infallible, because the kernel wouldn't enumerate
the device without it.