Commit graph

299 commits

Author SHA1 Message Date
Kevin Mehall
a693c9211c linux: Log submitted transfer sizes 2025-06-15 13:04:15 -06:00
Kevin Mehall
8b5dde13f4
Merge pull request #141 from kevinmehall/io-traits
Add EndpointRead and EndpointWrite
2025-06-15 12:57:32 -06:00
Kevin Mehall
b1cc46e918 Add EndpointRead and EndpointWrite 2025-06-15 12:52:41 -06:00
Kevin Mehall
04e8ddfc30
Merge pull request #147 from kevinmehall/blocking-no-runtime
Panic if awaiting a blocking syscall without `smol` or `tokio` features.
2025-06-15 11:25:07 -06:00
Kevin Mehall
4da8f325b8 Panic if awaiting a blocking syscall without smol or tokio features.
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`.
2025-06-15 11:20:03 -06:00
Kevin Mehall
bb39ff521d
Merge pull request #142 from kevinmehall/errors
Define a new Error type instead of re-exporting std::io::Error
2025-06-14 14:21:11 -06:00
Kevin Mehall
535fc7d458 impl Debug for Device, Interface, and Endpoint 2025-06-01 23:28:45 -06:00
Kevin Mehall
6895347f4b Define a new Error type instead of re-exporting std::io::Error
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.
2025-06-01 23:28:45 -06:00
Kevin Mehall
592f57a3e0 linux: refactor device initial get_configuration 2025-06-01 12:38:58 -06:00
Kevin Mehall
f1f4bec4a1
Merge pull request #140 from kevinmehall/macos-descriptor
macos: Copy configuration descriptors when opening device
2025-06-01 12:38:05 -06:00
Kevin Mehall
f66c262221 macos: Copy config descriptors when opening device
These functions can fail if the device is disconnected, so make our
own copy of the buffer for consistency with other platforms.
2025-05-31 11:46:05 -06:00
Kevin Mehall
7730be5f86
Merge pull request #138 from kevinmehall/info-cleanup
Canonicalize sysfs paths, remove BusInfo::parent_path
2025-05-31 11:41:38 -06:00
Kevin Mehall
03468acd5f linux: Remove BusInfo::parent_path
You can just use the Path method
2025-05-31 11:25:28 -06:00
Kevin Mehall
e09a4ef458 linux: Canonicalize sysfs paths
For consistency with hotplug events
2025-05-31 11:25:28 -06:00
Kevin Mehall
9458831e6e Don't assume bus_id is 3 characters 2025-05-29 23:10:06 -07:00
Kevin Mehall
3ee0e22f81 Actually remove atomic-waker dependency 2025-05-26 12:51:39 -06:00
Kevin Mehall
3d2eb04f55 Docs fix 2025-05-26 12:51:30 -06:00
Kevin Mehall
4edb4a47ca v0.2-beta.1 2025-05-25 12:57:52 -06:00
Kevin Mehall
123ce06efd
Merge pull request #135 from kevinmehall/errors
Error handling fixes
2025-05-25 12:50:37 -06:00
Kevin Mehall
24c7ac5efd Error on IN transfer that is not a multiple of max packet size on all platforms 2025-05-25 11:47:50 -06:00
Kevin Mehall
e02378e556 windows: InvalidArgument for unsupported control recipient interface 2025-05-25 11:47:50 -06:00
Kevin Mehall
00667caa01 windows: fix submit-time error 2025-05-25 11:47:50 -06:00
Kevin Mehall
5ac12ef088 macos: map error type for control timeout 2025-05-25 11:47:50 -06:00
Kevin Mehall
18bb260623 Make TransferError::Unknown hold u32
macOS errors have the high bit set
2025-05-25 11:47:50 -06:00
Kevin Mehall
221867978b
Merge pull request #134 from kevinmehall/clippy
Clippy fixes
2025-05-24 15:16:40 -06:00
Kevin Mehall
700b8da9d8 Clippy fixes 2025-05-24 14:56:33 -06:00
Kevin Mehall
19e540fdd7
Merge pull request #131 from kevinmehall/fixes
Clean up barely-used dependency, fix potential synchronization issues
2025-05-10 13:21:13 -06:00
Kevin Mehall
5a23b845a4 Fix memory ordering for dropping transfers 2025-05-10 13:08:29 -06:00
Kevin Mehall
4a9c3e5bbc Prevent dropping a device while a control transfer is pending 2025-05-04 10:03:53 -06:00
Kevin Mehall
dac6f52c27 Remove atomic-waker 2025-05-03 22:30:37 -06:00
Kevin Mehall
e1796a80dd
Merge pull request #117 from kevinmehall/redesign
Redesign endpoint and transfer API
2025-05-03 22:11:34 -06:00
Kevin Mehall
3f558194da windows: Revert to GetOverlappedResult for completion status
OVERLAPPED.Internal contains NTSTATUS instead of WIN32_ERROR,
and while it seems very unlikely to change, is documented as
subject to change.
2025-05-03 15:57:11 -06:00
Kevin Mehall
b976e91ce8 Docs edits 2025-05-03 14:10:37 -06:00
Kevin Mehall
4a3b5ddf9f Simplify actual_len vs requested_len 2025-05-03 14:10:37 -06:00
Kevin Mehall
6027b5c069 Include error code in TransferError::Unknown 2025-05-03 10:19:44 -06:00
Kevin Mehall
1e3ae0f9be Rename Completion::data -> buffer 2025-04-27 21:54:50 -06:00
Kevin Mehall
6501af522f Move Completion to nusb::transfer 2025-04-27 13:52:20 -06:00
Kevin Mehall
3af56dd8f1 Endpoint::wait_next_complete for blocking wait 2025-04-20 17:02:04 -06:00
Kevin Mehall
2929a10b76 Linux zero-copy 2025-04-20 17:01:40 -06:00
Kevin Mehall
992fd16078 Expose buffer instead of transfer 2025-04-20 17:01:36 -06:00
Kevin Mehall
ba3f7d65cf impl Error for ClaimEndpointError 2025-04-12 13:47:19 -06:00
Kevin Mehall
2aee309cc3 Use TransferError for control transfers 2025-04-12 13:47:19 -06:00
Kevin Mehall
47a1896653 windows: Enable RAW_IO when creating an IN endpoint 2025-04-12 13:47:19 -06:00
Kevin Mehall
ef82f2c7f1 Redesign transfer / endpoint API 2025-04-12 13:47:19 -06:00
Kevin Mehall
3091921075
Merge pull request #125 from kevinmehall/async-rt
Add cargo features for `smol` and `tokio` runtimes
2025-04-12 13:45:47 -06:00
Kevin Mehall
38189baf5c cargo features for smol and tokio blocking executors 2025-04-12 13:29:17 -06:00
Kevin Mehall
413093e181 Bump MSRV to 1.79
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.
2025-04-09 08:23:09 -06:00
Kevin Mehall
25556d7f6b Prepare for not requiring Send on wasm 2025-04-09 08:23:09 -06:00
Kevin Mehall
bd3ba8283d Make MaybeFuture Send 2025-04-02 08:14:26 -06:00
Paweł Gorgoń
873f96b8e1
fix(macos): claiming incorrect interface (#124)
* 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.
2025-04-02 08:11:37 -06:00