Commit graph

33 commits

Author SHA1 Message Date
Kevin Mehall
371b91c85f EndpointRead / EndpointWrite examples with tokio and smol 2025-07-16 21:47:22 -06:00
Kevin Mehall
b1cc46e918 Add EndpointRead and EndpointWrite 2025-06-15 12:52:41 -06:00
Kevin Mehall
9458831e6e Don't assume bus_id is 3 characters 2025-05-29 23:10:06 -07:00
Kevin Mehall
700b8da9d8 Clippy fixes 2025-05-24 14:56:33 -06:00
Kevin Mehall
1e3ae0f9be Rename Completion::data -> buffer 2025-04-27 21:54:50 -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
ef82f2c7f1 Redesign transfer / endpoint API 2025-04-12 13:47:19 -06:00
Kevin Mehall
14a8f171e5
Make blocking APIs optionally async (#100)
* 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.
2025-02-11 18:53:07 -07:00
Kevin Mehall
8e4caaa5b2 Use Device::device_descriptor in string_descriptors example 2025-01-19 21:00:03 -08:00
Kevin Mehall
de5771030c Simplify Device::speed API
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.
2025-01-19 19:03:06 -07:00
Kevin Mehall
c6f2812671 Make DeviceDescriptor contain a fixed size array
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.
2025-01-19 19:01:15 -07:00
John Whittington
d4e12206ec specific BusInfo type for 'root hubs'
root hubs are a Linuxism - an abstract USB device capturing
information about a system USB bus; connected to a Host Controller.  Bus
data is useful for system profiling so a BusInfo type is added to crate
a more portable 'root hub' type.

Considering whether to use a HostControllerInfo highlighted the place
for root hubs. There can be multiple system USB buses on a Host
  Controller Interface (HCI), so it makes sense to have a separate type.
  Multiple buses can share the same PciInfo for example because they sit
  on the same HCI.
2024-09-23 13:34:04 +02:00
John Whittington
9a30fe8740 experimental list_root_hubs 2024-09-23 13:34:04 +02:00
Kevin Mehall
2ad365e99b Replace DeviceInfo::bus_number with bus_id 2024-08-10 17:38:52 -06:00
Kevin Mehall
7218b387ef
Merge pull request #65 from TheButlah/thebutlah/implement-detach
implement equivalent to libusb_detach_kernel_driver
2024-08-03 16:38:01 -06:00
Kevin Mehall
15af931665 windows: Hotplug 2024-07-28 14:45:03 -06:00
Ryan Butler
ca8b2edc9a
Rewrite to not use RAII 2024-07-23 18:40:06 -04:00
Ryan Butler
984c3b1bc7
implement equivalent to libusb_detach_kernel_driver 2024-07-23 16:24:19 -04:00
Kevin Mehall
5aeca69d76 Add detach_claim example for testing 2024-01-30 09:02:58 -07:00
Kevin Mehall
bf0db93029 API to make a GET_DESCRIPTOR request 2023-12-17 20:25:26 -07:00
Kevin Mehall
e153fd0fc0 Blocking control transfers 2023-12-17 20:25:22 -07:00
Kevin Mehall
de7881821c impl Debug for descriptors 2023-12-16 23:05:03 -07:00
Kevin Mehall
767d81131e linux: Add Device::active_configuration 2023-12-16 21:50:57 -07:00
Kevin Mehall
95751f5cb1 Descriptors API 2023-12-16 21:50:45 -07:00
Kevin
d75a640d3e macos: Implement transfers
Includes code from ktemkin's `usrs` at commit 1800f8739c9fae47be13703525a7329dffe3891f
2023-11-18 20:11:58 -07:00
Kevin Mehall
8b146a98b1 Allow control transfers on Linux without claiming interface 2023-10-29 19:16:39 -06:00
Kevin Mehall
efd9c3484f Make error handling more idiomatic 2023-10-08 14:29:45 -06:00
Kevin Mehall
81cb48daa5 Strongly-typed IN vs OUT buffer types 2023-10-05 22:27:03 -06:00
Kevin Mehall
21cc94ebd6 Implement Queue API 2023-10-01 14:45:05 -06:00
Kevin Mehall
4dc0c511f6 Refactor transfers, add control transfers 2023-10-01 11:34:42 -06:00
Kevin Mehall
85551a9779 Initial commit: bulk transfers on Linux usbfs 2023-09-30 16:51:13 -06:00