Skip to content

Commit 538103c

Browse files
committed
Fixed made native get_device() properly grab the first one
1 parent 1b8df6a commit 538103c

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

.cargo/config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ rustflags = ["--cfg=web_sys_unstable_apis"]
33

44
[build]
55
#just comment in the "current" target
6-
#target = "x86_64-unknown-linux-gnu"
7-
target = "wasm32-unknown-unknown"
6+
target = "x86_64-unknown-linux-gnu"
7+
#target = "wasm32-unknown-unknown"

src/backend/native.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ pub async fn get_device(device_filter: Vec<DeviceFilter>) -> Result<UsbDevice, U
7070
result
7171
})
7272
{
73-
device_info = Some(prelim_dev_inf)
73+
device_info = Some(prelim_dev_inf);
74+
break
7475
}
7576
}
7677

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
//! Cross USB is a USB library which works seamlessly across native and WASM targets.
22
//!
33
//! The idea is the user only has to write one way to access USB devices, which can be compiled
4-
//! to both WASM and native targets without any conditional compilation or configuration.
4+
//! to both WASM and native targets without any additional conditional compilation or configuration.
55
//!
66
//! For native device support, this library uses [nusb](https://docs.rs/nusb/latest/nusb/), a cross platform USB library written in Rust
77
//! and comparable to the very popular `libusb` C library. Web Assembly support is provided by [web-sys](https://docs.rs/web-sys/latest/web_sys/)
8-
//! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API)
8+
//! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
99
//!
1010
//! When a [UsbInterface] is dropped, it is automatically released.
1111
//!
@@ -83,7 +83,7 @@ pub use crate::context::DeviceFilter;
8383
#[doc(inline)]
8484
pub use crate::context::get_device;
8585

86-
/// Macro to create a device filter easily from data.
86+
/// Macro to create a device filter more easily.
8787
///
8888
/// The only valid keys are fields of the [DeviceFilter] struct.
8989
/// You may use as many or as few of them as you need, the rest

src/usb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait Device {
1717
async fn open_interface(&self, number: u8) -> Result<UsbInterface, UsbError>;
1818

1919
/// Reset the device, which causes it to no longer be usable. You must
20-
/// request a new device with [crate::get_device] or [crate::get_device_filter]
20+
/// request a new device with [crate::get_device]
2121
async fn reset(&self) -> Result<(), UsbError>;
2222

2323
/// Remove the device from the paired devices list, causing it to no longer be usable. You must request to reconnect using [crate::get_device]

0 commit comments

Comments
 (0)