v0.2.0 #159
kevinmehall
announced in
Announcements
v0.2.0
#159
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
v0.2 is an API redesign based on what we learned in v0.1. It makes the API less error prone, enables new optimizations, and prepares the API for a planned WebUSB backend.
New Features
EndpointRead/EndpointWriteadapters that manage transfers and implementstd::ioand corresponding async IO traits. These are now the "high-level" API recommended unless you want to manage individual transfers. (Add EndpointRead and EndpointWrite #141)MaybeFuture. If you are using them asynchronously, you need to enable thesmolortokiofeatures to defer the blocking syscalls to the corresponding runtime's blocking thread pool. (Make blocking APIs optionally async #100)DeviceInfo::port_chainwith the path of port numbers from the root hub to this device. (Add DeviceInfo::port_chain #71)list_buses()andBusInfofor information on USB buses. (List root hubs function #77)TransferError::Unknown. (TransferError::Unknownshould contain OS error #64)Device::device_descriptorfor access to device details from an opened device. (Add support for getting device information from opened device on Linux #102)RAW_IOfor bulk IN endpoints for improved performance. (Use RAW_IO on Windows for bulk and interrupt IN endpoints #6)Endpoint::allocate. (Linux usbfs zero-copy support #11)Fixes
Breaking Changes
list_devicesDeviceInfo::open,Device::from_fd,Device::set_configuration,Device::reset,Interface::set_alt_setting,Device::claim_interfaceDevice::detach_and_claim_interface, andEndpoint::clear_haltnow returnimpl MaybeFuture. Adduse nusb::MaybeFutureand call.wait()for previous blocking functionality. Or, to use them from async code, enable thetokioorsmolcargo feature of nusb and use.await.Queuehas been replaced byEndpointwith changes to the buffer type. (Redesign endpoint and transfer API #117)Interfacemethods for single bulk and interrupt transfers andTransferFuturehave been removed because they had subtle pitfalls regarding cancellation. UseEndpoint::submitfollowed bynext_complete, or switch to theEndpointRead/EndpointWriteadapters.InterfaceandDevicemethodscontrol_in_blocking+control_out_blockinghave been replaced withcontrol_in/control_outwith.wait()fromMaybeFuture.InterfaceandDevicemethodscontrol_in+control_outnow accept a timeout. Dropping the returnedFutureno longer cancels the transfer.DeviceInfo::bus_number(integer) has been replaced withDeviceInfo::bus_id(string).EndpointTypetoTransferType.NonZeroU8for string descriptor indexes.Optioninstead of panic.TransferError::Unknownhas an integer field for the error code.nusb::Erroris now a custom error type instead of a re-export ofstd::io::Error. It still implementsInto<std::io::Error>for?.Minimum Rust version is now 1.79.
Contributors
@kevinmehall @pgorgon-hem @kirisauce @tuna-f1sh @CCnut @cstrahan @martinling
This discussion was created from the release v0.2.0.
Beta Was this translation helpful? Give feedback.
All reactions