fix usb driver

This commit is contained in:
septs 2025-02-26 14:01:42 +08:00
parent 59d6a8f8ea
commit fee4989ad6
Signed by: septs
SSH key fingerprint: SHA256:ElK0p6DNkbsqYUdJ3I9QHDVf21SQD0c2r+hd7s/r5Co

View file

@ -11,6 +11,9 @@ class UsbTransportException(message: String) : Exception(message)
val UsbDevice.interfaces: Iterable<UsbInterface>
get() = (0 until interfaceCount).map(::getInterface)
fun UsbDevice.getSmartCardInterface() =
interfaces.find { it.interfaceClass == UsbConstants.USB_CLASS_CSCID }
val UsbInterface.endpoints: Iterable<UsbEndpoint>
get() = (0 until endpointCount).map(::getEndpoint)
@ -22,6 +25,3 @@ fun UsbInterface.getBulkEndpoints(): Pair<UsbEndpoint?, UsbEndpoint?> {
endpoints.find { it.direction == UsbConstants.USB_DIR_OUT },
)
}
fun UsbDevice.getSmartCardInterface() =
interfaces.find { it.interfaceClass == UsbConstants.USB_CLASS_CSCID }