USB Device plugin
Developed with 💙 by Apparence.io
This plugin provide access to USB devices from web pages with WebUSB.
Platform Support
Android | iOS | MacOS | Web | Linux | Windows |
---|---|---|---|---|---|
➖ | ➖ | ➖ | ✔️ | ➖ | ➖ |
Usage
import 'package:usb_device/usb_device.dart';
final UsbDevice usbDevice = UsbDevice();
var pairedDevices = await usbDevice.pairedDevices; // get paired devices
var pairedDevice = await usbDevice.requestDevices([DeviceFilter(vendorId : 0x00, productId: 0x00)]); // par a device
List<USBConfiguration> availableConfigurations = await usbDevice.getAvailableConfigurations(pairedDevice); // get device's configurations
USBDeviceInfo deviceInfo = await usbDevice.getPairedDeviceInfo(pairedDevice); // get device's info
await usbDevice.open(pairedDevice); // start session
await usbDevice.close(pairedDevice); // close session
Implementation
USB
x
getDevices() : Get paired attached devicesx
requestDevice(filters): pair a device with filter or not
USBDevice
x
Get device info with configurationx
open(): Start sessionx
close(): Close sessionx
selectConfiguration(configurationValue): Select a specified configurationx
claimInterface(interfaceNumber): Claim an interface for exclusive accessx
releaseInterface(interfaceNumber): Release a claimed interfacex
controlTransferIn(setup, length): Return result of a commandx
controlTransferOut(setup, data) : Send a command to devicex
transferIn(): Return data from devicex
transferOut(): Send data to devicex
clearHalt()x
reset(): Reset devicex
isochronousTransferIn()x
isochronousTransferOut()
Events
x
OnConnectx
OnDisconnect