@ledgerhq/device-transport-kit-react-native-hid 0.0.0-rn-hid-sync-onboarding-behavior-20250519131533 → 0.0.0-rn-hid-fixed-device-id-20250520154115

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.
@@ -117,7 +117,6 @@ internal class DefaultAndroidUsbTransport(
117
117
  return@launch
118
118
  }
119
119
  val (key, deviceConnection) = item
120
- // (deviceConnection.getApduSender() as AndroidUsbApduSender).clear()
121
120
  loggerService.log(
122
121
  buildSimpleInfoLogInfo(
123
122
  "AndroidUsbTransport",
@@ -275,8 +274,17 @@ internal class DefaultAndroidUsbTransport(
275
274
  }
276
275
 
277
276
  override suspend fun connect(discoveryDevice: DiscoveryDevice): InternalConnectionResult {
278
- val usbDevice: UsbDevice? =
279
- usbManager.deviceList.values.firstOrNull { it.deviceId == discoveryDevice.uid.toInt() }
277
+
278
+ val usbDevices = usbManager.deviceList.values
279
+
280
+ var usbDevice: UsbDevice? =
281
+ usbDevices.firstOrNull { it.deviceId == discoveryDevice.uid.toInt() }
282
+
283
+ if (usbDevice == null) {
284
+ // This is useful for LL durin@g the OS update
285
+ usbDevice =
286
+ usbDevices.firstOrNull { it.toLedgerUsbDevice()?.ledgerDevice == discoveryDevice.ledgerDevice }
287
+ }
280
288
 
281
289
  val ledgerUsbDevice = usbDevice?.toLedgerUsbDevice()
282
290
 
@@ -308,7 +316,6 @@ internal class DefaultAndroidUsbTransport(
308
316
  isFatalSendApduFailure = { false }, // TODO: refine this
309
317
  reconnectionTimeoutDuration = 5.seconds,
310
318
  onTerminated = {
311
- // (it.getApduSender() as AndroidUsbApduSender).clear()
312
319
  usbConnections.remove(sessionId)
313
320
  usbConnectionsPendingReconnection.remove(it)
314
321
  eventDispatcher.dispatch(TransportEvent.DeviceConnectionLost(sessionId))
@@ -17,23 +17,16 @@ import com.ledger.devicesdk.shared.androidMainInternal.transport.USB_MTU
17
17
  import com.ledger.devicesdk.shared.androidMainInternal.transport.deviceconnection.DeviceApduSender
18
18
  import com.ledger.devicesdk.shared.api.apdu.SendApduFailureReason
19
19
  import com.ledger.devicesdk.shared.api.apdu.SendApduResult
20
- import com.ledger.devicesdk.shared.api.utils.toHexadecimalString
21
20
  import com.ledger.devicesdk.shared.internal.service.logger.LoggerService
22
- import com.ledger.devicesdk.shared.internal.service.logger.buildSimpleDebugLogInfo
23
21
  import com.ledger.devicesdk.shared.internal.service.logger.buildSimpleErrorLogInfo
24
22
  import com.ledger.devicesdk.shared.internal.transport.framer.FramerService
25
23
  import com.ledger.devicesdk.shared.internal.transport.framer.to2BytesArray
26
24
  import kotlinx.coroutines.CoroutineDispatcher
27
- import kotlinx.coroutines.TimeoutCancellationException
28
- import kotlinx.coroutines.coroutineScope
25
+ import kotlinx.coroutines.cancel
29
26
  import kotlinx.coroutines.delay
30
27
  import kotlinx.coroutines.launch
31
- import kotlinx.coroutines.suspendCancellableCoroutine
32
28
  import kotlinx.coroutines.withContext
33
- import kotlinx.coroutines.withTimeout
34
- import timber.log.Timber
35
29
  import java.nio.ByteBuffer
36
- import kotlin.coroutines.resume
37
30
  import kotlin.random.Random
38
31
  import kotlin.time.Duration
39
32
 
@@ -127,7 +120,6 @@ internal class AndroidUsbApduSender(
127
120
  framerService.serialize(mtu = USB_MTU, channelId = generateChannelId(), rawApdu = rawApdu)
128
121
  .forEach { apduFrame ->
129
122
  val buffer = apduFrame.toByteArray()
130
- Timber.i("APDU sent = ${buffer.toHexadecimalString()}")
131
123
  usbConnection.bulkTransfer(
132
124
  androidToUsbEndpoint,
133
125
  buffer,
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-rn-hid-sync-onboarding-behavior-20250519131533",
3
+ "version": "0.0.0-rn-hid-fixed-device-id-20250520154115",
4
4
  "license": "Apache-2.0",
5
5
  "private": false,
6
6
  "react-native": "src/index.ts",
@@ -35,17 +35,17 @@
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-rn-hid-sync-onboarding-behavior-20250519131533",
38
+ "@ledgerhq/device-management-kit": "0.0.0-rn-hid-fixed-device-id-20250520154115",
39
39
  "@ledgerhq/eslint-config-dsdk": "0.0.2",
40
40
  "@ledgerhq/ldmk-tool": "0.0.1",
41
+ "@ledgerhq/tsconfig-dsdk": "1.0.1",
41
42
  "@ledgerhq/vitest-config-dmk": "0.0.0",
42
- "@ledgerhq/prettier-config-dsdk": "0.0.2",
43
- "@ledgerhq/tsconfig-dsdk": "1.0.1"
43
+ "@ledgerhq/prettier-config-dsdk": "0.0.2"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react-native": ">0.74.1",
47
47
  "rxjs": "^7.8.2",
48
- "@ledgerhq/device-management-kit": "0.0.0-rn-hid-sync-onboarding-behavior-20250519131533"
48
+ "@ledgerhq/device-management-kit": "0.0.0-rn-hid-fixed-device-id-20250520154115"
49
49
  },
50
50
  "scripts": {
51
51
  "prebuild": "rimraf lib",