readBytes method
Reads up to maxBytes from the bulk-IN endpoint. Returns the actual
bytes read (may be 0). Throws UsbTransferTimeoutException on timeout.
Implementation
@override
Future<Uint8List> readBytes({
required int handleId,
required int maxBytes,
required int timeoutMs,
}) async {
if (readError != null) throw readError!;
final h = _handles[handleId];
if (h == null) throw StateError('Invalid handle $handleId');
if (h.readQueue.isEmpty) return Uint8List(0);
return h.readQueue.removeFirst();
}