Crates.io | usbd-webusb |
lib.rs | usbd-webusb |
version | 1.0.2 |
source | src |
created_at | 2020-02-01 23:32:57.16224 |
updated_at | 2021-01-30 18:43:20.264223 |
description | WebUSB class for use with usb-device. |
homepage | |
repository | https://github.com/redpfire/usbd-webusb |
max_upload_size | |
id | 204047 |
size | 17,751 |
WebUSB implementation for usb-device.
WebUSB is a proposed JavaScript API standard for securely providing access to USB devices from web pages.
Licensed under either of
A full example requires the use of a hardware driver, but the hardware independent part looks like that:
use usbd_webusb::*;
// Creates a WebUSB class instance with URL "https://google.com"
// You can also provide a custom URL with scheme url_scheme::CUSTOM
let wusb = WebUsb::new(&usb_bus, url_scheme::HTTPS, "google.com");
let mut usb_dev = UsbDeviceBuilder::new(&usb_bus, UsbVidPid(0x16c0, 0x27dd))
.product("Test product")
.build();
loop {
if !usb_dev.poll(&mut [&mut wusb]) {
continue;
}
}