Commit graph

101 commits

Author SHA1 Message Date
John Whittington
cf2ecf0d88 append _0 to max_packet_size 2024-08-09 19:07:40 +02:00
John Whittington
9fd90b6b3e add bMaxPacketSize0 to DeviceInfo 2024-08-09 15:48:42 +02:00
Kevin Mehall
1795a92780 linux: improve logging 2024-08-03 18:57:42 -06:00
Kevin Mehall
cb82728e03 linux: enumeration: filter non-devices from sysfs
* Avoids logging errors when probing USB interfaces that don't have
device properties
* Ignores root hubs (they're not useful to open, not exposed on other
platforms, and sometimes slow to read properties from for some reason)
2024-08-03 18:57:42 -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
Ryan Butler
f1dd76fe75
address review comments 2024-08-01 13:46:12 -04:00
Kevin Mehall
9272da1de3 windows: hotplug: note that interfaces may not be ready 2024-07-28 18:32:39 -06:00
Kevin Mehall
70f7c22870 linux: hotplug: Use libc for now, because rustix hasn't merged my PR 2024-07-28 18:32:39 -06:00
Kevin Mehall
cecdf88c86 linux: hotplug 2024-07-28 18:32:39 -06:00
Kevin Mehall
cc0d44a68f macos: hotplug 2024-07-28 18:32:33 -06:00
Kevin Mehall
15af931665 windows: Hotplug 2024-07-28 14:45:03 -06:00
Kevin Mehall
4ddd81b8f1 windows: Obtain serial number from ioctl instead of instance ID
The instance ID is capitalized if the string descriptor contains
lower case characters, and also uses a generated ID in place
of the actual serial number if the serial number is a duplicate.
2024-07-28 13:52:57 -06:00
Kevin Mehall
905313e704 windows: List interfaces using descriptor if driver is not usbccgp 2024-07-28 13:52:57 -06:00
Kevin Mehall
d5ec7144ff windows: Allow claiming interfaces that require WinUsb_GetAssociatedInterface 2024-07-28 13:52:52 -06:00
Kevin Mehall
e361ae79fa Show location ID and registry entry ID in hex in debug format 2024-07-26 18:46:16 -07:00
Kevin Mehall
6b1f182d3c macos: Convert iokit number properties with wrapping as.
32-bit values such as locationID are always encoded as
kCFNumberSInt32Type where large values are returned
as negative numbers that fail in `try_from`.
2024-07-26 18:36:17 -07: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
Martin Ling
d42ad0673d Handle ERROR_OPERATION_ABORTED result when a transfer is cancelled.
Seen on Windows 10 while shutting down a bulk Queue.
2024-07-09 20:53:42 +01:00
Kevin Mehall
28f9aa71a2 windows: Fix speed detection for SuperSpeed and SuperSpeed+
These were misdetected as high speed and Windows requires
IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX_V2 to detect them.

Co-authored-by: wangxiaochuTHU <wangxiaochu@tsinghua.org.cn>
2024-06-01 12:15:50 -06:00
Arthur Gautier
c20d2d7d02 fixup bulk_out_queue documentation 2024-05-28 21:59:24 -07:00
Kevin Mehall
8916126e04 Add Interface::{interface_number, descriptors} 2024-04-28 17:50:10 -06:00
Kevin Mehall
84ddf9091d Consistent naming of platform interface fields 2024-04-28 17:50:10 -06:00
Kevin Mehall
85f7645b38 Extend lifetime of descriptors 2024-04-28 16:51:44 -06:00
Kevin Mehall
fe17c187d3 macos: Don't panic on invalid endpoint 2024-04-28 15:41:03 -07:00
Alex Moon
4adf6114bb Refine mutex spans 2024-04-24 14:50:30 -04:00
Alex Moon
134b654f96 Mac: Update endpoints when interface alt setting is changed
The set of available endpoints can change when an interface's alt setting is changed, so on Mac we need to refresh our cached set of endpoints.
2024-04-23 16:42:18 -04:00
Kevin Mehall
dae0db79bd Fix non-public doc comment 2024-04-21 11:11:39 -06:00
Kevin Mehall
40f27ccf16 Fix RequestBuffer::reuse
The bug leads to a transfer writing out-of-bounds if
`RequestBuffer::reuse` is called with a larger `len` than the passed
Vec's capacity.

Fixes #49
2024-04-21 10:32:30 -06:00
Kevin Mehall
3a26de9499 Docs edits 2024-03-03 12:21:46 -07:00
Kevin Mehall
083eb65a2d Add Queue::clear_halt 2024-03-03 10:51:05 -07:00
Kevin Mehall
59a17c817c windows: fix set_alt_setting 2024-03-03 10:37:10 -07:00
Kevin Mehall
94621931a2 Add Interface::clear_halt 2024-03-03 10:37:10 -07:00
Kevin Mehall
63809b97be Document and warn on case where WinUSB changes the passed control transfer index field to the interface number 2024-03-02 21:23:56 -07:00
Jon Lamb
9e8a6e01ea
Cast RawOpcode to the internal ioctl_code type
The rustix `RawOpcode` type can vary depending on the target.
For example, targets that use the libc Linux configuration in rustix, the
`RawOpcode` type is a type alias to `c_ulong` rather than `c_uint`.
2024-03-01 04:36:36 -08:00
Kevin Mehall
c583caf63c windows: Search for interface when claiming, not on device open
This allows providing a better error message when failing to claim
an interface, and may fix claiming a non-zero interface when a whole
composite device is bound to WinUSB.
2024-02-25 13:12:15 -07:00
Kevin Mehall
9c9993d6bb Lower log level to debug!() for errors in enumeration.
These may not invove a device the app cares about, which results
in noisy yet useless logs.
2024-02-25 11:35:22 -07:00
Ein Terakawa
cd4aed7932 windows: Also try to read DeviceInterfaceGUID 2024-02-24 18:25:41 +09:00
Kevin Mehall
b7cb0b6ef0 macos: try both "kUSBString" and "USB Interface Name" 2024-01-31 07:54:54 -08:00
Charles Strahan
1c0d566854
Fix interface string on macOS 2024-01-31 07:19:55 -06:00
Kevin Mehall
61b7eda403 linux: Retry epoll::wait on EINTR 2024-01-30 18:56:12 -07:00
Kevin Mehall
6ded9244d0 remove detach-then-claim fallback
not needed for any modern kernel
2024-01-30 09:02:43 -07:00
Kevin Mehall
63a696f27c get_driver fails with ENODATA when there is no driver 2024-01-28 16:53:22 -07:00
Kevin Mehall
abd9363c33 Fix ioctl opcodes 2024-01-28 16:50:43 -07:00
Kevin Mehall
9387649340 Keep usbfs module just ioctl wrappers, implement policy elsewhere 2024-01-28 16:48:58 -07:00
Dániel Buga
a94b39a533 Try to detach drivers separately 2024-01-28 10:48:30 +01:00
Dániel Buga
4a80b782f9 Implement detach_and_claim_interface 2024-01-28 09:39:33 +01:00
Kevin Mehall
462edbe4a5 windows: Stop returning manufacturer string
This comes from the INF used to install the driver, not the descriptor.
2024-01-15 13:51:16 -07:00
Kevin Mehall
d7fdda3535 windows: Fix parsing of interface numbers > 10 2024-01-15 11:46:35 -07:00
Kevin Mehall
5bc83f56b8 Add DeviceInfo::interfaces for OS cached interface information 2024-01-15 11:46:35 -07:00