mirror of
https://github.com/G2-Games/cross-usb.git
synced 2025-04-20 05:42:53 -05:00
Compare commits
No commits in common. "9667394126b32bd753aa1fb3dc614cf46eda7b6d" and "1b8df6ab26242f6f019297cc86885103119ab1fe" have entirely different histories.
9667394126
...
1b8df6ab26
5 changed files with 8 additions and 9 deletions
|
@ -3,5 +3,5 @@ rustflags = ["--cfg=web_sys_unstable_apis"]
|
||||||
|
|
||||||
[build]
|
[build]
|
||||||
#just comment in the "current" target
|
#just comment in the "current" target
|
||||||
target = "x86_64-unknown-linux-gnu"
|
#target = "x86_64-unknown-linux-gnu"
|
||||||
#target = "wasm32-unknown-unknown"
|
target = "wasm32-unknown-unknown"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "cross_usb"
|
name = "cross_usb"
|
||||||
version = "0.2.2"
|
version = "0.2.1"
|
||||||
authors = ["G2-Games <ke0bhogsg@gmail.com>"]
|
authors = ["G2-Games <ke0bhogsg@gmail.com>"]
|
||||||
repository = "https://github.com/G2-Games/cross-usb"
|
repository = "https://github.com/G2-Games/cross-usb"
|
||||||
documentation = "https://docs.rs/cross_usb"
|
documentation = "https://docs.rs/cross_usb"
|
||||||
|
|
|
@ -70,8 +70,7 @@ pub async fn get_device(device_filter: Vec<DeviceFilter>) -> Result<UsbDevice, U
|
||||||
result
|
result
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
device_info = Some(prelim_dev_inf);
|
device_info = Some(prelim_dev_inf)
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
//! Cross USB is a USB library which works seamlessly across native and WASM targets.
|
//! Cross USB is a USB library which works seamlessly across native and WASM targets.
|
||||||
//!
|
//!
|
||||||
//! The idea is the user only has to write one way to access USB devices, which can be compiled
|
//! The idea is the user only has to write one way to access USB devices, which can be compiled
|
||||||
//! to both WASM and native targets without any additional conditional compilation or configuration.
|
//! to both WASM and native targets without any conditional compilation or configuration.
|
||||||
//!
|
//!
|
||||||
//! For native device support, this library uses [nusb](https://docs.rs/nusb/latest/nusb/), a cross platform USB library written in Rust
|
//! For native device support, this library uses [nusb](https://docs.rs/nusb/latest/nusb/), a cross platform USB library written in Rust
|
||||||
//! 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/)
|
//! 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/)
|
||||||
//! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API).
|
//! with the [Web USB API](https://developer.mozilla.org/en-US/docs/Web/API/WebUSB_API)
|
||||||
//!
|
//!
|
||||||
//! When a [UsbInterface] is dropped, it is automatically released.
|
//! When a [UsbInterface] is dropped, it is automatically released.
|
||||||
//!
|
//!
|
||||||
|
@ -83,7 +83,7 @@ pub use crate::context::DeviceFilter;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use crate::context::get_device;
|
pub use crate::context::get_device;
|
||||||
|
|
||||||
/// Macro to create a device filter more easily.
|
/// Macro to create a device filter easily from data.
|
||||||
///
|
///
|
||||||
/// The only valid keys are fields of the [DeviceFilter] struct.
|
/// The only valid keys are fields of the [DeviceFilter] struct.
|
||||||
/// You may use as many or as few of them as you need, the rest
|
/// You may use as many or as few of them as you need, the rest
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub trait Device {
|
||||||
async fn open_interface(&self, number: u8) -> Result<UsbInterface, UsbError>;
|
async fn open_interface(&self, number: u8) -> Result<UsbInterface, UsbError>;
|
||||||
|
|
||||||
/// Reset the device, which causes it to no longer be usable. You must
|
/// Reset the device, which causes it to no longer be usable. You must
|
||||||
/// request a new device with [crate::get_device]
|
/// request a new device with [crate::get_device] or [crate::get_device_filter]
|
||||||
async fn reset(&self) -> Result<(), UsbError>;
|
async fn reset(&self) -> Result<(), UsbError>;
|
||||||
|
|
||||||
/// Remove the device from the paired devices list, causing it to no longer be usable. You must request to reconnect using [crate::get_device]
|
/// Remove the device from the paired devices list, causing it to no longer be usable. You must request to reconnect using [crate::get_device]
|
||||||
|
|
Loading…
Reference in a new issue