@ledgerhq/device-transport-kit-react-native-hid 0.0.0-rn-hid-fixed-device-id-20250521093943 → 0.0.0-rn-hid-fixed-device-id-20250521115949
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/androidtransporthid/TransportHidModule.kt +0 -4
- package/android/src/main/kotlin/com/ledger/devicesdk/shared/androidMain/transport/usb/DefaultAndroidUsbTransport.kt +7 -6
- package/android/src/main/kotlin/com/ledger/devicesdk/shared/internal/transport/Transport.kt +1 -2
- package/package.json +5 -5
|
@@ -172,10 +172,6 @@ class TransportHidModule(
|
|
|
172
172
|
@ReactMethod()
|
|
173
173
|
fun connectDevice(uid: String, promise: Promise) {
|
|
174
174
|
val device = discoveryDevices.firstOrNull { it.uid == uid }
|
|
175
|
-
if (device == null) {
|
|
176
|
-
promise.reject(Exception("[TransportHidModule][connectDevice] Device not found"))
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
175
|
|
|
180
176
|
coroutineScope.launch {
|
|
181
177
|
try {
|
|
@@ -17,6 +17,7 @@ import com.ledger.devicesdk.shared.androidMain.transport.usb.utils.toLedgerUsbDe
|
|
|
17
17
|
import com.ledger.devicesdk.shared.androidMain.transport.usb.utils.toScannedDevice
|
|
18
18
|
import com.ledger.devicesdk.shared.androidMain.transport.usb.utils.toUsbDevices
|
|
19
19
|
import com.ledger.devicesdk.shared.androidMainInternal.transport.deviceconnection.DeviceConnection
|
|
20
|
+
import com.ledger.devicesdk.shared.api.discovery.ConnectivityType
|
|
20
21
|
import com.ledger.devicesdk.shared.api.discovery.DiscoveryDevice
|
|
21
22
|
import com.ledger.devicesdk.shared.internal.connection.InternalConnectedDevice
|
|
22
23
|
import com.ledger.devicesdk.shared.internal.connection.InternalConnectionResult
|
|
@@ -273,7 +274,7 @@ internal class DefaultAndroidUsbTransport(
|
|
|
273
274
|
}
|
|
274
275
|
}
|
|
275
276
|
|
|
276
|
-
override suspend fun connect(discoveryDevice: DiscoveryDevice): InternalConnectionResult {
|
|
277
|
+
override suspend fun connect(discoveryDevice: DiscoveryDevice?): InternalConnectionResult {
|
|
277
278
|
|
|
278
279
|
loggerService.log(
|
|
279
280
|
buildSimpleDebugLogInfo(
|
|
@@ -285,13 +286,13 @@ internal class DefaultAndroidUsbTransport(
|
|
|
285
286
|
val usbDevices = usbManager.deviceList.values
|
|
286
287
|
|
|
287
288
|
var usbDevice: UsbDevice? =
|
|
288
|
-
usbDevices.firstOrNull { it.deviceId == discoveryDevice
|
|
289
|
+
usbDevices.firstOrNull { it.deviceId == discoveryDevice?.uid?.toInt() }
|
|
289
290
|
|
|
290
291
|
if (usbDevice == null) {
|
|
291
292
|
// This is useful for LL during the OS update
|
|
292
293
|
loggerService.log(buildSimpleDebugLogInfo("AndroidUsbTransport", "[connect] No device found with matching id, looking for device with matching model"))
|
|
293
294
|
usbDevice =
|
|
294
|
-
usbDevices.firstOrNull { it.toLedgerUsbDevice()
|
|
295
|
+
usbDevices.firstOrNull { it.toLedgerUsbDevice() != null }
|
|
295
296
|
} else {
|
|
296
297
|
loggerService.log(buildSimpleDebugLogInfo("AndroidUsbTransport", "[connect] Found device with matching id"))
|
|
297
298
|
}
|
|
@@ -339,9 +340,9 @@ internal class DefaultAndroidUsbTransport(
|
|
|
339
340
|
val connectedDevice =
|
|
340
341
|
InternalConnectedDevice(
|
|
341
342
|
sessionId,
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
ledgerUsbDevice.name,
|
|
344
|
+
ledgerUsbDevice.ledgerDevice,
|
|
345
|
+
ConnectivityType.Usb,
|
|
345
346
|
sendApduFn = { apdu: ByteArray, triggersDisconnection: Boolean, abortTimeoutDuration: Duration ->
|
|
346
347
|
deviceConnection.requestSendApdu(apdu, triggersDisconnection, abortTimeoutDuration)
|
|
347
348
|
}
|
|
@@ -14,8 +14,7 @@ internal interface Transport {
|
|
|
14
14
|
|
|
15
15
|
fun stopScan()
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
suspend fun connect(discoveryDevice: DiscoveryDevice): InternalConnectionResult
|
|
17
|
+
suspend fun connect(discoveryDevice: DiscoveryDevice?): InternalConnectionResult
|
|
19
18
|
|
|
20
19
|
suspend fun disconnect(deviceId: String)
|
|
21
20
|
}
|
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-fixed-device-id-
|
|
3
|
+
"version": "0.0.0-rn-hid-fixed-device-id-20250521115949",
|
|
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-fixed-device-id-
|
|
38
|
+
"@ledgerhq/device-management-kit": "0.0.0-rn-hid-fixed-device-id-20250521115949",
|
|
39
39
|
"@ledgerhq/eslint-config-dsdk": "0.0.2",
|
|
40
40
|
"@ledgerhq/ldmk-tool": "0.0.1",
|
|
41
|
-
"@ledgerhq/vitest-config-dmk": "0.0.0",
|
|
42
41
|
"@ledgerhq/prettier-config-dsdk": "0.0.2",
|
|
43
|
-
"@ledgerhq/tsconfig-dsdk": "1.0.1"
|
|
42
|
+
"@ledgerhq/tsconfig-dsdk": "1.0.1",
|
|
43
|
+
"@ledgerhq/vitest-config-dmk": "0.0.0"
|
|
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-fixed-device-id-
|
|
48
|
+
"@ledgerhq/device-management-kit": "0.0.0-rn-hid-fixed-device-id-20250521115949"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"prebuild": "rimraf lib",
|