@ledgerhq/device-transport-kit-react-native-hid 0.0.0-hid-candidate-20250523130730 → 0.0.0-hid-candidate-2-20250526084932
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/kotlin/com/ledger/devicesdk/shared/androidMain/transport/usb/DefaultAndroidUsbTransport.kt +2 -23
- package/android/src/main/kotlin/com/ledger/devicesdk/shared/androidMainInternal/transport/deviceconnection/DeviceConnectionStateMachine.kt +0 -9
- package/android/src/main/kotlin/com/ledger/devicesdk/shared/api/discovery/DiscoveryDevice.kt +1 -1
- package/package.json +3 -3
|
@@ -275,33 +275,12 @@ internal class DefaultAndroidUsbTransport(
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
override suspend fun connect(discoveryDevice: DiscoveryDevice): InternalConnectionResult {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
buildSimpleDebugLogInfo(
|
|
281
|
-
"AndroidUsbTransport",
|
|
282
|
-
"[connect] discoveryDevice=$discoveryDevice"
|
|
283
|
-
)
|
|
284
|
-
)
|
|
285
|
-
|
|
286
|
-
val usbDevices = usbManager.deviceList.values
|
|
287
|
-
|
|
288
|
-
var usbDevice: UsbDevice? =
|
|
289
|
-
usbDevices.firstOrNull { it.deviceId == discoveryDevice.uid.toInt() }
|
|
290
|
-
|
|
291
|
-
if (usbDevice == null) {
|
|
292
|
-
// This is useful for LL during the OS update
|
|
293
|
-
loggerService.log(buildSimpleDebugLogInfo("AndroidUsbTransport", "[connect] No device found with matching id, looking for device with matching model"))
|
|
294
|
-
usbDevice =
|
|
295
|
-
usbDevices.firstOrNull { it.toLedgerUsbDevice()?.ledgerDevice == discoveryDevice.ledgerDevice }
|
|
296
|
-
} else {
|
|
297
|
-
loggerService.log(buildSimpleDebugLogInfo("AndroidUsbTransport", "[connect] Found device with matching id"))
|
|
298
|
-
}
|
|
278
|
+
val usbDevice: UsbDevice? =
|
|
279
|
+
usbManager.deviceList.values.firstOrNull { it.deviceId == discoveryDevice.uid.toInt() }
|
|
299
280
|
|
|
300
281
|
val ledgerUsbDevice = usbDevice?.toLedgerUsbDevice()
|
|
301
282
|
|
|
302
283
|
return if (usbDevice == null || ledgerUsbDevice == null) {
|
|
303
|
-
loggerService.log(
|
|
304
|
-
buildSimpleDebugLogInfo("AndroidUsbTransport", "[connect] No device found"))
|
|
305
284
|
InternalConnectionResult.ConnectionError(error = InternalConnectionResult.Failure.DeviceNotFound)
|
|
306
285
|
} else {
|
|
307
286
|
val permissionResult = checkOrRequestPermission(usbDevice)
|
|
@@ -3,8 +3,6 @@ package com.ledger.devicesdk.shared.androidMainInternal.transport.deviceconnecti
|
|
|
3
3
|
import com.ledger.devicesdk.shared.api.apdu.SendApduFailureReason
|
|
4
4
|
import com.ledger.devicesdk.shared.api.apdu.SendApduResult
|
|
5
5
|
import com.ledger.devicesdk.shared.internal.service.logger.LoggerService
|
|
6
|
-
import com.ledger.devicesdk.shared.internal.service.logger.buildSimpleDebugLogInfo
|
|
7
|
-
import com.ledger.devicesdk.shared.internal.service.logger.buildSimpleInfoLogInfo
|
|
8
6
|
import kotlinx.coroutines.CoroutineDispatcher
|
|
9
7
|
import kotlinx.coroutines.CoroutineScope
|
|
10
8
|
import kotlinx.coroutines.Job
|
|
@@ -234,13 +232,6 @@ internal class DeviceConnectionStateMachine(
|
|
|
234
232
|
onError(Exception("Unhandled event: $event in state: $currentState"))
|
|
235
233
|
}
|
|
236
234
|
}
|
|
237
|
-
val logMessage = """
|
|
238
|
-
Received event:
|
|
239
|
-
In state: $currentState
|
|
240
|
-
-> Event: $event
|
|
241
|
-
-> New state: $state
|
|
242
|
-
""".trimIndent()
|
|
243
|
-
// loggerService.log(buildSimpleDebugLogInfo("DeviceConnectionStateMachine", logMessage))
|
|
244
235
|
}
|
|
245
236
|
|
|
246
237
|
private var timeoutJob: Job? = null
|
package/android/src/main/kotlin/com/ledger/devicesdk/shared/api/discovery/DiscoveryDevice.kt
CHANGED
|
@@ -8,7 +8,7 @@ package com.ledger.devicesdk.shared.api.discovery
|
|
|
8
8
|
import com.ledger.devicesdk.shared.api.device.LedgerDevice
|
|
9
9
|
import kotlinx.datetime.Clock
|
|
10
10
|
|
|
11
|
-
public
|
|
11
|
+
public class DiscoveryDevice(
|
|
12
12
|
public val uid: String,
|
|
13
13
|
public val name: String,
|
|
14
14
|
public val ledgerDevice: LedgerDevice,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/device-transport-kit-react-native-hid",
|
|
3
|
-
"version": "0.0.0-hid-candidate-
|
|
3
|
+
"version": "0.0.0-hid-candidate-2-20250526084932",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"private": false,
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@types/uuid": "^10.0.0",
|
|
36
36
|
"react-native": "0.76.6",
|
|
37
37
|
"rxjs": "^7.8.2",
|
|
38
|
-
"@ledgerhq/device-management-kit": "0.0.0-hid-candidate-
|
|
38
|
+
"@ledgerhq/device-management-kit": "0.0.0-hid-candidate-2-20250526084932",
|
|
39
39
|
"@ledgerhq/eslint-config-dsdk": "0.0.2",
|
|
40
40
|
"@ledgerhq/ldmk-tool": "0.0.1",
|
|
41
41
|
"@ledgerhq/vitest-config-dmk": "0.0.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react-native": ">0.74.1",
|
|
47
47
|
"rxjs": "^7.8.2",
|
|
48
|
-
"@ledgerhq/device-management-kit": "0.0.0-hid-candidate-
|
|
48
|
+
"@ledgerhq/device-management-kit": "0.0.0-hid-candidate-2-20250526084932"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"prebuild": "rimraf lib",
|