menu
DeviceUsbBinding
import { DeviceUsbBinding } from "destack:device/binding";
Usb binding family.
1export interface DeviceUsbBinding {2 listUsbDevices(): Result<UsbDevice[], HostError>;3 openUsbWatch(): Result<UsbWatchHandle, HostError>;4 closeUsbWatch(watch: UsbWatchHandle): Result<void, HostError>;5 readUsbWatch(watch: UsbWatchHandle, timeoutNs?: uint64 | undefined): Result<UsbWatchEvent, HostError>;6 openUsbDevice(id: &'a readonly string): Result<UsbDeviceHandle, HostError>;7 closeUsbDevice(device: UsbDeviceHandle): Result<void, HostError>;8 describeUsbDevice(device: UsbDeviceHandle): Result<UsbDevice, HostError>;9 listUsbConfigurations(device: UsbDeviceHandle): Result<UsbConfiguration[], HostError>;10 getUsbConfiguration(device: UsbDeviceHandle): Result<uint8, HostError>;11 setUsbConfiguration(device: UsbDeviceHandle, configuration: uint8): Result<void, HostError>;12 listUsbInterfaces(device: UsbDeviceHandle, configuration: uint8): Result<UsbInterface[], HostError>;13 claimUsbInterface(device: UsbDeviceHandle, interfaceNumber: uint8): Result<void, HostError>;14 releaseUsbInterface(device: UsbDeviceHandle, interfaceNumber: uint8): Result<void, HostError>;15 setUsbAlternateInterface(device: UsbDeviceHandle, interfaceNumber: uint8, alternateSetting: uint8): Result<void, HostError>;16 listUsbEndpoints(device: UsbDeviceHandle, interfaceNumber: uint8, alternateSetting: uint8): Result<UsbEndpoint[], HostError>;17 clearUsbHalt(device: UsbDeviceHandle, endpoint: UsbEndpointSelector): Result<void, HostError>;18 resetUsbDevice(device: UsbDeviceHandle): Result<void, HostError>;19 readUsbDescriptor(device: UsbDeviceHandle, descriptorType: uint8, descriptorIndex: uint8, languageId: uint16, buffer: &'a [uint8]): Result<uint64, HostError>;20 readUsbControl(device: UsbDeviceHandle, setup: UsbControlSetup, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;21 writeUsbControl(device: UsbDeviceHandle, setup: UsbControlSetup, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;22 readUsbBulk(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;23 writeUsbBulk(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;24 readUsbInterrupt(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;25 writeUsbInterrupt(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;26 readUsbIsochronous(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], packetByteCounts: &'b readonly [uint32], packets: &'c [UsbIsochronousPacket], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;27 writeUsbIsochronous(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], packetByteCounts: &'b readonly [uint32], packets: &'c [UsbIsochronousPacket], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>;28 cancelUsbTransfers(device: UsbDeviceHandle, endpoint?: UsbEndpointSelector | undefined): Result<void, HostError>;29}Members
openUsbWatch(): Result<UsbWatchHandle, HostError>Open a USB topology watch.
closeUsbWatch(watch: UsbWatchHandle): Result<void, HostError>Close a USB topology watch.
readUsbWatch(watch: UsbWatchHandle, timeoutNs?: uint64 | undefined): Result<UsbWatchEvent, HostError>Read one USB topology event.
openUsbDevice(id: &'a readonly string): Result<UsbDeviceHandle, HostError>Open a USB device.
closeUsbDevice(device: UsbDeviceHandle): Result<void, HostError>Close a USB device.
describeUsbDevice(device: UsbDeviceHandle): Result<UsbDevice, HostError>Describe an open USB device.
listUsbConfigurations(device: UsbDeviceHandle): Result<UsbConfiguration[], HostError>List USB configurations.
getUsbConfiguration(device: UsbDeviceHandle): Result<uint8, HostError>Read the active USB configuration.
setUsbConfiguration(device: UsbDeviceHandle, configuration: uint8): Result<void, HostError>Select the active USB configuration.
listUsbInterfaces(device: UsbDeviceHandle, configuration: uint8): Result<UsbInterface[], HostError>List USB interfaces.
claimUsbInterface(device: UsbDeviceHandle, interfaceNumber: uint8): Result<void, HostError>Claim a USB interface.
releaseUsbInterface(device: UsbDeviceHandle, interfaceNumber: uint8): Result<void, HostError>Release a USB interface.
setUsbAlternateInterface(device: UsbDeviceHandle, interfaceNumber: uint8, alternateSetting: uint8): Result<void, HostError>Select one USB interface alternate setting.
listUsbEndpoints(device: UsbDeviceHandle, interfaceNumber: uint8, alternateSetting: uint8): Result<UsbEndpoint[], HostError>List USB endpoints.
clearUsbHalt(device: UsbDeviceHandle, endpoint: UsbEndpointSelector): Result<void, HostError>Clear one halted USB endpoint.
resetUsbDevice(device: UsbDeviceHandle): Result<void, HostError>Reset one USB device.
readUsbDescriptor(device: UsbDeviceHandle, descriptorType: uint8, descriptorIndex: uint8, languageId: uint16, buffer: &'a [uint8]): Result<uint64, HostError>Read one raw USB descriptor.
readUsbControl(device: UsbDeviceHandle, setup: UsbControlSetup, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Read bytes with a USB control transfer.
writeUsbControl(device: UsbDeviceHandle, setup: UsbControlSetup, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Write bytes with a USB control transfer.
readUsbBulk(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Read bytes from a USB bulk endpoint.
writeUsbBulk(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Write bytes to a USB bulk endpoint.
readUsbInterrupt(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Read bytes from a USB interrupt endpoint.
writeUsbInterrupt(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Write bytes to a USB interrupt endpoint.
readUsbIsochronous(device: UsbDeviceHandle, endpoint: uint8, buffer: &'a [uint8], packetByteCounts: &'b readonly [uint32], packets: &'c [UsbIsochronousPacket], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Read USB isochronous packets.
writeUsbIsochronous(device: UsbDeviceHandle, endpoint: uint8, bytes: &'a readonly [uint8], packetByteCounts: &'b readonly [uint32], packets: &'c [UsbIsochronousPacket], timeoutNs?: uint64 | undefined): Result<UsbTransferResult, HostError>Write USB isochronous packets.
cancelUsbTransfers(device: UsbDeviceHandle, endpoint?: UsbEndpointSelector | undefined): Result<void, HostError>Cancel pending USB transfers.