Compare commits
No commits in common. "6b4723daeed139404946997857e8c6b3f609ce0d" and "31d595a6b19f54d6bb70a04f561d41f8d80f77f6" have entirely different histories.
6b4723daee
...
31d595a6b1
8 changed files with 5 additions and 38 deletions
|
@ -1,5 +0,0 @@
|
||||||
package im.angry.openeuicc.core
|
|
||||||
|
|
||||||
interface ApduInterfaceAtrProvider {
|
|
||||||
val atr: ByteArray?
|
|
||||||
}
|
|
|
@ -16,11 +16,6 @@ interface EuiccChannel {
|
||||||
|
|
||||||
val valid: Boolean
|
val valid: Boolean
|
||||||
|
|
||||||
/**
|
|
||||||
* Answer to Reset (ATR) value of the underlying interface, if any
|
|
||||||
*/
|
|
||||||
val atr: ByteArray?
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Intrinsic name of this channel. For device-internal SIM slots,
|
* Intrinsic name of this channel. For device-internal SIM slots,
|
||||||
* this should be null; for USB readers, this should be the name of
|
* this should be null; for USB readers, this should be the name of
|
||||||
|
|
|
@ -11,7 +11,7 @@ class EuiccChannelImpl(
|
||||||
override val type: String,
|
override val type: String,
|
||||||
override val port: UiccPortInfoCompat,
|
override val port: UiccPortInfoCompat,
|
||||||
override val intrinsicChannelName: String?,
|
override val intrinsicChannelName: String?,
|
||||||
private val apduInterface: ApduInterface,
|
apduInterface: ApduInterface,
|
||||||
verboseLoggingFlow: Flow<Boolean>,
|
verboseLoggingFlow: Flow<Boolean>,
|
||||||
ignoreTLSCertificateFlow: Flow<Boolean>
|
ignoreTLSCertificateFlow: Flow<Boolean>
|
||||||
) : EuiccChannel {
|
) : EuiccChannel {
|
||||||
|
@ -22,9 +22,6 @@ class EuiccChannelImpl(
|
||||||
override val lpa: LocalProfileAssistant =
|
override val lpa: LocalProfileAssistant =
|
||||||
LocalProfileAssistantImpl(apduInterface, HttpInterfaceImpl(verboseLoggingFlow, ignoreTLSCertificateFlow))
|
LocalProfileAssistantImpl(apduInterface, HttpInterfaceImpl(verboseLoggingFlow, ignoreTLSCertificateFlow))
|
||||||
|
|
||||||
override val atr: ByteArray?
|
|
||||||
get() = (apduInterface as? ApduInterfaceAtrProvider)?.atr
|
|
||||||
|
|
||||||
override val valid: Boolean
|
override val valid: Boolean
|
||||||
get() = lpa.valid
|
get() = lpa.valid
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,6 @@ class EuiccChannelWrapper(orig: EuiccChannel) : EuiccChannel {
|
||||||
get() = channel.valid
|
get() = channel.valid
|
||||||
override val intrinsicChannelName: String?
|
override val intrinsicChannelName: String?
|
||||||
get() = channel.intrinsicChannelName
|
get() = channel.intrinsicChannelName
|
||||||
override val atr: ByteArray?
|
|
||||||
get() = channel.atr
|
|
||||||
|
|
||||||
override fun close() = channel.close()
|
override fun close() = channel.close()
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class OmapiApduInterface(
|
||||||
private val service: SEService,
|
private val service: SEService,
|
||||||
private val port: UiccPortInfoCompat,
|
private val port: UiccPortInfoCompat,
|
||||||
private val verboseLoggingFlow: Flow<Boolean>
|
private val verboseLoggingFlow: Flow<Boolean>
|
||||||
): ApduInterface, ApduInterfaceAtrProvider {
|
): ApduInterface {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "OmapiApduInterface"
|
const val TAG = "OmapiApduInterface"
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,6 @@ class OmapiApduInterface(
|
||||||
override val valid: Boolean
|
override val valid: Boolean
|
||||||
get() = service.isConnected && (this::session.isInitialized && !session.isClosed)
|
get() = service.isConnected && (this::session.isInitialized && !session.isClosed)
|
||||||
|
|
||||||
override val atr: ByteArray?
|
|
||||||
get() = session.atr
|
|
||||||
|
|
||||||
override fun connect() {
|
override fun connect() {
|
||||||
session = service.getUiccReaderCompat(port.logicalSlotIndex + 1).openSession()
|
session = service.getUiccReaderCompat(port.logicalSlotIndex + 1).openSession()
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@ package im.angry.openeuicc.core.usb
|
||||||
import android.hardware.usb.UsbDeviceConnection
|
import android.hardware.usb.UsbDeviceConnection
|
||||||
import android.hardware.usb.UsbEndpoint
|
import android.hardware.usb.UsbEndpoint
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import im.angry.openeuicc.core.ApduInterfaceAtrProvider
|
|
||||||
import im.angry.openeuicc.util.*
|
import im.angry.openeuicc.util.*
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import net.typeblog.lpac_jni.ApduInterface
|
import net.typeblog.lpac_jni.ApduInterface
|
||||||
|
@ -13,7 +12,7 @@ class UsbApduInterface(
|
||||||
private val bulkIn: UsbEndpoint,
|
private val bulkIn: UsbEndpoint,
|
||||||
private val bulkOut: UsbEndpoint,
|
private val bulkOut: UsbEndpoint,
|
||||||
private val verboseLoggingFlow: Flow<Boolean>
|
private val verboseLoggingFlow: Flow<Boolean>
|
||||||
) : ApduInterface, ApduInterfaceAtrProvider {
|
): ApduInterface {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "UsbApduInterface"
|
private const val TAG = "UsbApduInterface"
|
||||||
}
|
}
|
||||||
|
@ -23,8 +22,6 @@ class UsbApduInterface(
|
||||||
|
|
||||||
private var channelId = -1
|
private var channelId = -1
|
||||||
|
|
||||||
override var atr: ByteArray? = null
|
|
||||||
|
|
||||||
override fun connect() {
|
override fun connect() {
|
||||||
ccidDescription = UsbCcidDescription.fromRawDescriptors(conn.rawDescriptors)!!
|
ccidDescription = UsbCcidDescription.fromRawDescriptors(conn.rawDescriptors)!!
|
||||||
|
|
||||||
|
@ -35,9 +32,7 @@ class UsbApduInterface(
|
||||||
transceiver = UsbCcidTransceiver(conn, bulkIn, bulkOut, ccidDescription, verboseLoggingFlow)
|
transceiver = UsbCcidTransceiver(conn, bulkIn, bulkOut, ccidDescription, verboseLoggingFlow)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 6.1.1.1 PC_to_RDR_IccPowerOn (Page 20 of 40)
|
transceiver.iccPowerOn()
|
||||||
// https://www.usb.org/sites/default/files/DWG_Smart-Card_USB-ICC_ICCD_rev10.pdf
|
|
||||||
atr = transceiver.iccPowerOn().data
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
throw e
|
throw e
|
||||||
|
|
|
@ -41,7 +41,7 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
||||||
@StringRes
|
@StringRes
|
||||||
val titleResId: Int,
|
val titleResId: Int,
|
||||||
val content: String?,
|
val content: String?,
|
||||||
val copiedToastResId: Int? = null,
|
val copiedToastResId: Int? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -134,13 +134,6 @@ class EuiccInfoActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
||||||
}
|
}
|
||||||
add(Item(R.string.euicc_info_ci_type, getString(resId)))
|
add(Item(R.string.euicc_info_ci_type, getString(resId)))
|
||||||
}
|
}
|
||||||
add(
|
|
||||||
Item(
|
|
||||||
R.string.euicc_info_atr,
|
|
||||||
channel.atr?.encodeHex() ?: getString(R.string.euicc_info_atr_unavailable),
|
|
||||||
copiedToastResId = R.string.toast_atr_copied,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun formatByBoolean(b: Boolean, res: Pair<Int, Int>): String =
|
private fun formatByBoolean(b: Boolean, res: Pair<Int, Int>): String =
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
<string name="toast_profile_delete_confirm_text_mismatched">Confirmation string mismatch</string>
|
<string name="toast_profile_delete_confirm_text_mismatched">Confirmation string mismatch</string>
|
||||||
<string name="toast_iccid_copied">ICCID copied to clipboard</string>
|
<string name="toast_iccid_copied">ICCID copied to clipboard</string>
|
||||||
<string name="toast_eid_copied">EID copied to clipboard</string>
|
<string name="toast_eid_copied">EID copied to clipboard</string>
|
||||||
<string name="toast_atr_copied">ATR copied to clipboard</string>
|
|
||||||
|
|
||||||
<string name="usb_permission">Grant USB permission</string>
|
<string name="usb_permission">Grant USB permission</string>
|
||||||
<string name="usb_permission_needed">Permission is needed to access the USB smart card reader.</string>
|
<string name="usb_permission_needed">Permission is needed to access the USB smart card reader.</string>
|
||||||
|
@ -133,8 +132,6 @@
|
||||||
<string name="euicc_info_ci_gsma_live">GSMA Live CI</string>
|
<string name="euicc_info_ci_gsma_live">GSMA Live CI</string>
|
||||||
<string name="euicc_info_ci_gsma_test">GSMA Test CI</string>
|
<string name="euicc_info_ci_gsma_test">GSMA Test CI</string>
|
||||||
<string name="euicc_info_ci_unknown">Unknown eSIM CI</string>
|
<string name="euicc_info_ci_unknown">Unknown eSIM CI</string>
|
||||||
<string name="euicc_info_atr">ATR (Answer To Reset)</string>
|
|
||||||
<string name="euicc_info_atr_unavailable">ATR unavailable</string>
|
|
||||||
|
|
||||||
<string name="yes">Yes</string>
|
<string name="yes">Yes</string>
|
||||||
<string name="no">No</string>
|
<string name="no">No</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue