Compare commits
2 commits
e31200d142
...
b090bb007c
Author | SHA1 | Date | |
---|---|---|---|
b090bb007c | |||
384270f57b |
3 changed files with 7 additions and 10 deletions
|
@ -55,7 +55,7 @@ open class DefaultEuiccChannelManager(
|
||||||
parseIsdrAidList(appContainer.preferenceRepository.isdrAidListFlow.first())
|
parseIsdrAidList(appContainer.preferenceRepository.isdrAidListFlow.first())
|
||||||
|
|
||||||
return isdrAidList.firstNotNullOfOrNull {
|
return isdrAidList.firstNotNullOfOrNull {
|
||||||
Log.i(TAG, "Opening channel, trying ISDR AID ${it.encodeHex()}")
|
Log.i(TAG, "Opening channel, trying ISD-R AID: ${it.encodeHex()}")
|
||||||
|
|
||||||
openFn(it)?.let { channel ->
|
openFn(it)?.let { channel ->
|
||||||
if (channel.valid) {
|
if (channel.valid) {
|
||||||
|
@ -277,11 +277,7 @@ open class DefaultEuiccChannelManager(
|
||||||
)
|
)
|
||||||
try {
|
try {
|
||||||
val channel = tryOpenChannelFirstValidAid {
|
val channel = tryOpenChannelFirstValidAid {
|
||||||
euiccChannelFactory.tryOpenUsbEuiccChannel(
|
euiccChannelFactory.tryOpenUsbEuiccChannel(device, iface, it)
|
||||||
device,
|
|
||||||
iface,
|
|
||||||
it
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
if (channel != null && channel.lpa.valid) {
|
if (channel != null && channel.lpa.valid) {
|
||||||
usbChannel = channel
|
usbChannel = channel
|
||||||
|
|
|
@ -53,7 +53,7 @@ class UsbApduInterface(
|
||||||
"A9088100820101830107".decodeHex(),
|
"A9088100820101830107".decodeHex(),
|
||||||
le = null,
|
le = null,
|
||||||
)
|
)
|
||||||
transmitApduByChannel(terminalCapabilities, 0,)
|
transmitApduByChannel(terminalCapabilities, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disconnect() {
|
override fun disconnect() {
|
||||||
|
@ -70,12 +70,12 @@ class UsbApduInterface(
|
||||||
transmitApduByChannel(req, 0)
|
transmitApduByChannel(req, 0)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
return -1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isSuccessResponse(resp)) {
|
if (!isSuccessResponse(resp)) {
|
||||||
Log.d(TAG, "OPEN LOGICAL CHANNEL failed: ${resp.encodeHex()}")
|
Log.d(TAG, "OPEN LOGICAL CHANNEL failed: ${resp.encodeHex()}")
|
||||||
return -1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
val channelId = resp[0].toInt()
|
val channelId = resp[0].toInt()
|
||||||
|
@ -87,7 +87,7 @@ class UsbApduInterface(
|
||||||
|
|
||||||
if (!isSuccessResponse(selectAidResp)) {
|
if (!isSuccessResponse(selectAidResp)) {
|
||||||
Log.d(TAG, "Select DF failed : ${selectAidResp.encodeHex()}")
|
Log.d(TAG, "Select DF failed : ${selectAidResp.encodeHex()}")
|
||||||
return -1
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
channels.add(channelId)
|
channels.add(channelId)
|
||||||
|
|
|
@ -36,6 +36,7 @@ fun formatFreeSpace(size: Int): String =
|
||||||
fun parseIsdrAidList(s: String): List<ByteArray> =
|
fun parseIsdrAidList(s: String): List<ByteArray> =
|
||||||
s.split('\n').map(String::trim).filter { !it.startsWith('#') }
|
s.split('\n').map(String::trim).filter { !it.startsWith('#') }
|
||||||
.map(String::trim)
|
.map(String::trim)
|
||||||
|
.filter(String::isNotEmpty)
|
||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
try {
|
try {
|
||||||
it.decodeHex()
|
it.decodeHex()
|
||||||
|
|
Loading…
Add table
Reference in a new issue