AndroidFirmwareUsbManager

Manages USB-related interactions for firmware updates.

Constructors

Link copied to clipboard
constructor(context: Context, usbRepository: UsbRepository)

Functions

Link copied to clipboard
open override fun deviceDetachFlow(): Flow<Unit>

Observe when a USB device is detached.

Link copied to clipboard
open suspend override fun ensureSerialPermission(waitMillis: Long): Boolean

Waits up to waitMillis for a serial device to be present and ensures the app holds USB permission for it, prompting the user when needed.

Link copied to clipboard
open suspend override fun serialPortKeys(): Set<String>

Records which serial ports are present, so a port that appears after a UF2 write can be told apart from one that was already there.

Link copied to clipboard
open suspend override fun unblockCdcPort(excluding: Set<String>, waitMillis: Long, holdMillis: Long): Boolean

Opens the port that appeared since excluding was captured and holds DTR asserted, so firmware waiting on a host will run.