Releases: kevinmehall/nusb
Releases · kevinmehall/nusb
v0.2.1
Bug fixes
- Fix a race condition where
Interface::endpointwould returnBusywhen re-opening an endpoint that was just dropped immediately after a previous transfer completed (#163)
New features
- Add
Endpoint::transfer_blockingconvenience method to submit and wait for a single transfer with timeout (#164)
Contributors
v0.2.0
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. (#141)- Functions that were previously blocking are available as blocking or async via
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. (#100) - Add
DeviceInfo::port_chainwith the path of port numbers from the root hub to this device. (#71) - Add
list_buses()andBusInfofor information on USB buses. (#77) - Include error code in
TransferError::Unknown. (#64) - Add
Device::device_descriptorfor access to device details from an opened device. (#102) - Windows: Enable
RAW_IOfor bulk IN endpoints for improved performance. (#6) - Linux: Enable zero-copy IO with buffers allocated by
Endpoint::allocate. (#11)
Fixes
- Windows: Allow claiming associated interfaces of multi-interface functions.
- Windows: List interfaces of composite devices that are bound to WinUSB at the device level.
- Windows: Include hubs in the device list. (#85)
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. (#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.- Bulk and Interrupt IN transfers that are not a multiple of the max packet size return an error. (#135)
DeviceInfo::bus_number(integer) has been replaced withDeviceInfo::bus_id(string).- Renamed
EndpointTypetoTransferType. - Renamed descriptor types (#115)
- Use
NonZeroU8for string descriptor indexes. - Descriptor constructors return
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?.- Linux: Root hubs are no longer included in the device list.
Minimum Rust version is now 1.79.
Contributors
@kevinmehall @pgorgon-hem @kirisauce @tuna-f1sh @CCnut @cstrahan @martinling
v0.2.0-beta.2
Changes since v0.2.0-beta.1
- Add
EndpointReadandEndpointWritetypes that wrap anEndpointand buffer data to implementstd::io::{Read, Write}and related async traits from Tokio and Smol (#141) - Define a new
Errortype instead of re-exportingstd::io::Error(#142) - Panic if awaiting a blocking syscall without
smolortokiofeatures. (#147) - Linux: Canonicalize sysfs paths (#138)
- Linux: remove
BusInfo::parent_path(#138) - macOS: Copy configuration descriptors when opening device (#140)
- macOS: Update core-foundation, switch to IOUSBInterfaceInterface700 and IOUSBDeviceInterface650 (#148)
v0.2.0-beta.1
This is a pre-release for anyone interested in testing the new functionality and APIs in v0.2.
New Features
- Redesigned
EndpointAPI. (#117) - Configuration functions that were previously blocking are available as blocking or async via
MaybeFuture. If you are using them asynchronously, you will want to enable thesmolortokiofeatures to defer the blocking syscalls to the corresponding runtime's blocking thread pool. (#100) - Add
DeviceInfo::port_chainwith the path of port numbers from the root hub to this device. (#71) - Add
list_buses()andBusInfofor information on USB buses. (#77) - Include error code in
TransferError::Unknown. (#64) - Add
Device::device_descriptorfor access to device details from an opened device. (#102) - Windows: Enable
RAW_IOfor bulk IN endpoints for improved performance. (#6) - Linux: Enable zero-copy IO with buffers allocated by
Endpoint::allocate. (#11)
Fixes
- Windows: Allow claiming associated interfaces of multi-interface functions.
- Windows: List interfaces of composite devices that are bound to WinUSB at the device level.
- Windows: Include hubs in the device list. (#85)
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.Queuehas been replaced byEndpoint.Interfacemethods for single bulk and interupt transfers withTransferFuturehave been removed -- useEndpointor upcoming IO wrappers.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.- Bulk and Interrupt IN transfers that are not a multiple of the max packet size return an error.
DeviceInfo::bus_number(integer) has been replaced withDeviceInfo::bus_id(string).- Renamed
EndpointTypetoTransferType. - Renamed descriptor types (#115)
- Use
NonZeroU8for string descriptor indexes. - Descriptor constructors return
Optioninstead of panic. TransferError::Unknownhas an integer field for the error code.- Linux: Root hubs are no longer included in the device list.
Minimum Rust version is now 1.79.
Remaining for v0.2
- High-level transfer APIs wrapping
Endpointand managing transfers and buffers to implementBufRead,AsyncBufRead,Write,AsyncWriteto replace removedInterfacemethods for simple use cases. - Comprehensive tests.
- Control transfer timeouts for Windows.
- Ensure API is compatible with WebUSB.
Contributors
@kevinmehall @pgorgon-hem @kirisauce @tuna-f1sh @CCnut @martinling
v0.1.14
Fixes
- Fix race condition in transfer cancellation that could lead to a crash on any OS when a transfer is cancelled at the exact moment it completes, and additionally on macOS when cancelling several transfers simultaneously by dropping or cancelling a Queue. (#130)
- macOS: Fix claiming interfaces on a device where interfaces are not numbered contiguously (#132)
Contributors
@kevinmehall @pgorgon-hem
v0.1.13
v0.1.12
v0.1.11
Fixes
- macOS: Fix
Device::set_configurationandDevice::reset(#88) - macOS: Fix detection of
TransferError::Stall(#88)
New Features
- Hotplug events:
nusb::watch_devices()API for device connect / disconnect event notifications, supported on Windows, macOS, and Linux. (#20) Device::from_fdfor wrapping an already-opened usbfs file descriptor. This can be used with the Android APIs for requesting USB device permissions on a non-rooted Android device. (#80)Device::detach_kernel_driverandDevice::attach_kernel_driverfor controlling kernel drivers on Linux without claiming an interface (#65)
Contributors
v0.1.10
Fixes
- windows: Fix speed detection for SuperSpeed and SuperSpeed+ by @kevinmehall and @wangxiaochuTHU in #56
- windows: Handle
ERROR_OPERATION_ABORTEDresult when a transfer is cancelled by @martinling in #63 - macos: Fix listing of devices where bus number > 0x80 by @kevinmehall in #67
New Contributors
- @baloo made their first contribution in #55
- @martinling made their first contribution in #62
- @wangxiaochuTHU made their first contribution inhttps://github.com//pull/56
Full Changelog: v0.1.9...v0.1.10
v0.1.9
Fixes
- macOS: Update endpoints when interface alt setting is changed by @alexmoon in #50
- macOS: Don't panic when passed an invalid endpoint address
Improvements
- Extend the lifetime of objects returned from
Configuration::descriptors,Configuration::interface_alt_settings, andConfiguration::interfacesby @kevinmehall in #51 - Add
Interface::interface_numberandInterface::descriptorsmethods by @kevinmehall in #51
Full Changelog: v0.1.8...v0.1.9