NordicSemiconductor / Android-nRF-Connect-Device-Manager

A mobile management library for devices running Apache Mynewt and Zephyr (DFU, logs, stats, config, etc.)
Apache License 2.0
85 stars 40 forks source link

Trying to do a Firmware-Update, but nothing is written. #202

Open lsh-silpion opened 1 week ago

lsh-silpion commented 1 week ago

Hi,

I am trying to implement a Firmware-Update capability for a custom device employing the Nordic 5340 chip, in a Jetpack-Compose Android app.

For that purpose I use the following dependency:

    // nordic update manager
    implementation("no.nordicsemi.android:mcumgr-ble:2.2.2")

and this Kotlin code:

val updateButtonLabelMutableStateFlow = MutableStateFlow("")

fun setUpdateButtonLabel(value: String) {
    updateButtonLabelMutableStateFlow.value = value
}

val updateButtonEnabledMutableStateFlow = MutableStateFlow(false)

fun setUpdateButtonEnabled(value: Boolean) {
    updateButtonEnabledMutableStateFlow.value = value
}

…

fun onUpdateButtonClicked(context: Context, bluetoothDevice: BluetoothDevice, mainViewModel: MainViewModel) {
    val bluetoothDeviceAddress = bluetoothDevice.address

    val firmwareFile = mainViewModel.getFirmwareFile()
    if (firmwareFile.exists()) {

        val transport: McuMgrTransport = McuMgrBleTransport(context, bluetoothDevice)

        val dfuCallback = object : FirmwareUpgradeCallback<FirmwareUpgradeManager.State> {
            override fun onUpgradeStarted(controller: FirmwareUpgradeController?) {
                Timber.d("onUpgradeStarted(): controller: $controller")

                setUpdateButtonLabel(context.getString(R.string.update_starting))
                setUpdateButtonEnabled(false)
            }

            override fun onUpgradeCompleted() {
                Timber.d("onUpgradeCompleted()")

                // reconnect to device after reboot
                mainViewModel.onConnect(bluetoothDeviceAddress)

                setUpdateButtonLabel(context.getString(R.string.update_complete))
            }

            override fun onUploadProgressChanged(bytesSent: Int, imageSize: Int, timestamp: Long) {
                Timber.d("onUploadProgressChanged(): bytesSent: $bytesSent, imageSize: $imageSize, timestamp: $timestamp")

                setUpdateButtonLabel("${bytesSent / (imageSize / 100)} %")
            }

            override fun onUpgradeCanceled(state: FirmwareUpgradeManager.State?) {
                Timber.d("onUpgradeCanceled(): state: $state")

                setUpdateButtonLabel(context.getString(R.string.update_canceled))
            }

            override fun onUpgradeFailed(
                state: FirmwareUpgradeManager.State?,
                error: McuMgrException?
            ) {
                Timber.d("onUpgradeFailed(): state: $state, error: $error")

                setUpdateButtonLabel(context.getString(R.string.update_failed))
            }

            override fun onStateChanged(
                previousState: FirmwareUpgradeManager.State?,
                newState: FirmwareUpgradeManager.State?
            ) {
                Timber.d("onStateChanged(): previousState: $previousState, newState: $newState")

                if (previousState == FirmwareUpgradeManager.State.VALIDATE && newState == FirmwareUpgradeManager.State.RESET) {
                    setUpdateButtonLabel(context.getString(R.string.rebooting))
                }

            }
        }

        val dfuManager = FirmwareUpgradeManager(transport, dfuCallback)
        val dfuManagerSettings = FirmwareUpgradeManager.Settings.Builder()
            .setEstimatedSwapTime(10_000)
            .setEraseAppSettings(false)
            .setWindowCapacity(10)
            .setMemoryAlignment(4)
            .build()

        val imageSet = ZipPackage(firmwareFile.readBytes()).binaries

        dfuManager.setMode(FirmwareUpgradeManager.Mode.TEST_AND_CONFIRM)

        try {
            dfuManager.start(imageSet, dfuManagerSettings)
        } catch (e: Exception) {
            Timber.e(e)
        }
    } else {
        Timber.e("firmwareFile: $firmwareFile doesn't exist")
    }
}

the code does something, but it is not updating the firmware. We also have an iOS app for that purpose (using your iOSMcuManagerLibrary) and this is working with the same firmware file. It also takes quite a time longer than the stuff the "no.nordicsemi.android:mcumgr-ble:2.2.1" is doing, it finishes way to fast on Android. Also, the callback function onUploadProgressChanged seems never to be called, here is a log output (filtered for those callback functions):

2024-11-07 12:18:32.749 26433-26433 FirmwareUp...deStarted:          D  onUpgradeStarted(): controller: io.runtime.mcumgr.dfu.mcuboot.FirmwareUpgradeManager@75ee5ab
2024-11-07 12:18:34.162 26433-26433 FirmwareUp...teChanged:          D  onStateChanged(): previousState: VALIDATE, newState: RESET
2024-11-07 12:18:35.092 26433-26433 FirmwareUp...Completed:          D  onUpgradeCompleted()

Am I missing something? Did I omit something important in my code?

Kind regards,

Lars

philips77 commented 4 days ago

Hello, You are using nRF5340, which has 2 cores - app core and net core. I assume, you're only trying to update the app core. Why? You're using TEST_AND_CONFIRM mode, which doesn't work with the net core (its fw cannot be reverted, so doesn't allow "test"). If you have both binaries, change the mode to TEST_ONLY.

Also, nothing gets uploaded. Why? The firmware that is currently running on your device has the same hash as the one you're trying to send. The validate state sends image list command and checks what's on the device. Then it compares returned hashes with those from the given binary/zip and - if hashes match - reports success. In nRF Connect Device Manager load the ZIP/bin file in Image tab / Basic and note printed hashes. Then, switch to Advanced and tap Read button to get the images. Compare the returned hashes with the previous ones. If that's not the case, please paste here the logs (either from LogCat from your app, from nRF Connect Device Manager app, or from nRF Logger app when using nRFCDM to do the DFU).

Try modifying anything (e.g. a version number) in the firmware or signing process to generate firmware with different hashes and try updating.

lsh-silpion commented 1 day ago

Hello, You are using nRF5340, which has 2 cores - app core and net core. I assume, you're only trying to update the app core. Why? You're using TEST_AND_CONFIRM mode, which doesn't work with the net core (its fw cannot be reverted, so doesn't allow "test"). If you have both binaries, change the mode to TEST_ONLY.

Yes, I am trying to update just the app core with my above code. Is it better to use TEST_ONLY in that case too?

Also, nothing gets uploaded. Why? The firmware that is currently running on your device has the same hash as the one you're trying to send. The validate state sends image list command and checks what's on the device. Then it compares returned hashes with those from the given binary/zip and - if hashes match - reports success. In nRF Connect Device Manager load the ZIP/bin file in Image tab / Basic and note printed hashes. Then, switch to Advanced and tap Read button to get the images. Compare the returned hashes with the previous ones. If that's not the case, please paste here the logs (either from LogCat from your app, from nRF Connect Device Manager app, or from nRF Logger app when using nRFCDM to do the DFU).

Well, I also got the upload working with the example app (nRF Connect Device Manager) but not with my code. We need the code in our app to be working since we don't want to deliver nRF Connect Device Manager to our customers. So what I am missing in my code?

Try modifying anything (e.g. a version number) in the firmware or signing process to generate firmware with different hashes and try updating.

I'll try this and report back.

Thanks again for your help!

philips77 commented 1 day ago

Is it better to use TEST_ONLY in that case too?

Sorry, I meant CONFIRM_ONLY. My mistake. Then the lib won't try to reconnect to the device to send confirm command, but it will do this in the first connection and report success after the device reboots + "estimated swap time".

lsh-silpion commented 1 day ago

Is it better to use TEST_ONLY in that case too?

Sorry, I meant CONFIRM_ONLY. My mistake. Then the lib won't try to reconnect to the device to send confirm command, but it will do this in the first connection and report success after the device reboots + "estimated swap time".

I tried both and none worked in my code.

On the other hand I just realized that the nRF Connect Device Manager app only allows me to downgrade the firmware, from 0.3.4+0 down to 0.3.1+0, but not the other way around.

lsh-silpion commented 1 day ago

Please let me know, if you need some additional information!

philips77 commented 1 day ago

Could you share the logs from LogCat?

lsh-silpion commented 1 day ago

Could you share the logs from LogCat?

Which logCat? That of my app or the one from the nRF Connect Device Manager app?

philips77 commented 1 day ago

From your app, as it's not working. I may compare it with logs from nRFCDM.

lsh-silpion commented 1 day ago

This should be the relevant section from LogCat:

2024-11-18 13:06:59.836 11915-11915 BluetoothAdapter                 D  STATE_ON
2024-11-18 13:06:59.837 11915-11915 BluetoothGatt                    D  connect() - device: EB:A3:43:8E:4B:5D, auto: false
2024-11-18 13:06:59.837 11915-11915 BluetoothAdapter                 D  isSecureModeEnabled
2024-11-18 13:06:59.838 11915-11915 BluetoothGatt                    D  registerApp()
2024-11-18 13:06:59.838 11915-11915 BluetoothGatt                    D  registerApp() - UUID=0d1dacf8-7130-4da2-b904-bdc34cc0828a
2024-11-18 13:06:59.842 11915-12002 BluetoothGatt                    D  onClientRegistered() - status=0 clientIf=16
2024-11-18 13:06:59.854 11915-11915 ViewRootImpl                     I  updatePointerIcon pointerType = 1000, calling pid = 11915
2024-11-18 13:06:59.854 11915-11915 InputManager                     D  setPointerIconType iconId = 1000, callingPid = 11915
2024-11-18 13:06:59.861 11915-12002 BluetoothGatt                    D  onClientConnectionState() - status=0 clientIf=16 device=EB:A3:43:8E:4B:5D
2024-11-18 13:06:59.876 11915-11915 Choreographer                    I  Skipped 1382 frames!  The application may be doing too much work on its main thread.
2024-11-18 13:06:59.884 11915-11915 FirmwareUp...deStarted:          D  onUpgradeStarted(): controller: io.runtime.mcumgr.dfu.mcuboot.FirmwareUpgradeManager@b83d366
2024-11-18 13:07:00.192 11915-12149 BluetoothGatt                    D  discoverServices() - device: EB:A3:43:8E:4B:5D
2024-11-18 13:07:00.226 11915-12002 BluetoothGatt                    D  onSearchComplete() = Device=EB:A3:43:8E:4B:5D Status=0
2024-11-18 13:07:00.303 11915-11915 BluetoothGatt                    D  configureMTU() - device: EB:A3:43:8E:4B:5D mtu: 498
2024-11-18 13:07:00.394 11915-12002 BluetoothGatt                    D  onConfigureMTU() - Device=EB:A3:43:8E:4B:5D mtu=498 status=0
2024-11-18 13:07:00.401 11915-11915 BluetoothGatt                    D  setCharacteristicNotification() - uuid: da2e7828-fbce-4e01-ae9e-261174997c48 enable: true
2024-11-18 13:07:00.702 11915-12002 BleGatt.kt...icChanged:          D  characteristic changed: 1,0,0,6,0,0,-1,6,-65,98,114,99,8,-1
2024-11-18 13:07:00.708 11915-12002 DeviceChar...ification:          D  fromNotify: [B@34586fd
2024-11-18 13:07:00.719 11915-12002 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:07:00.720 11915-12002 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[1, 0, 0, 6, 0, 0, -1, 6, -65, 98, 114, 99, 8, -1], notificationBytes=null)])]
2024-11-18 13:07:00.814 11915-11915 MainViewMo...reVersion:          D  latestFirmwareVersionString: 0.3.4+0
2024-11-18 13:07:00.817 11915-11915 CUBOx.kt:3...reVersion:          D  CUBOx.firmwareVersionString: 0.3.1+0
2024-11-18 13:07:00.940 11915-11927 er.cubo.androi                   I  Background concurrent copying GC freed 46218(3460KB) AllocSpace objects, 17(2188KB) LOS objects, 50% free, 6083KB/11MB, paused 191us total 154.081ms
2024-11-18 13:07:00.952 11915-11929 System                           W  A resource failed to call end. 
2024-11-18 13:07:00.957 11915-11929 System                           W  A resource failed to call end. 
2024-11-18 13:07:00.962 11915-12002 BleGatt.kt...icChanged:          D  characteristic changed: 9,0,0,6,0,0,0,8,-65,98,114,99,8,-1
2024-11-18 13:07:00.965 11915-11929 System                           W  A resource failed to call end. 
2024-11-18 13:07:00.967 11915-12002 DeviceChar...ification:          D  fromNotify: [B@4aea643
2024-11-18 13:07:00.976 11915-12002 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:07:00.976 11915-12002 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[9, 0, 0, 6, 0, 0, 0, 8, -65, 98, 114, 99, 8, -1], notificationBytes=null)])]
2024-11-18 13:07:01.186 11915-11915 MainViewMo...reVersion:          D  latestFirmwareVersionString: 0.3.4+0
2024-11-18 13:07:01.187 11915-11915 CUBOx.kt:3...reVersion:          D  CUBOx.firmwareVersionString: 0.3.1+0
2024-11-18 13:07:01.381 11915-12002 BleGatt.kt...icChanged:          D  characteristic changed: 9,0,0,-12,0,1,1,0,-65,102,105,109,97,103,101,115,-97,-65,100,115,108,111,116,0,103,118,101,114,115,105,111,110,101,48,46,51,46,50,100,104,97,115,104,88,32,-90,63,-13,-75,-43,-94,-48,67,-56,34,45,68,-42,79,49,-78,48,-102,125,116,-102,-49,-47,50,-28,-91,-75,-87,-102,8,-19,-71,104,98,111,111,116,97,98,108,101,-11,103,112,101,110,100,105,110,103,-12,105,99,111,110,102,105,114,109,101,100,-11,102,97,99,116,105,118,101,-11,105,112,101,114,109,97,110,101,110,116,-12,-1,-65,100,115,108,111,116,1,103,118,101,114,115,105,111,110,101,48,46,51,46,52,100,104,97,115,104,88,32,33,-106,46,32,104,29,-15,-90,19,117,121,-7,18,19,-57,-96,38,-55,-116,50,-74,0,-34,-3,91,-77,10,4,-56,19,25,-112,104,98,111,111,116,97,98,108,101,-11,103,112,101,110,100,105,110,103,-12,105,99,111,110,102,105,114,109,101,100,-12,102,97,99,116,105,118,101,-12,105,112,101,114,109,97,110,101,110,116,-12,-1,-1,107,115,112,108,105,116,83,116,97,116,117,115,0,-1
2024-11-18 13:07:01.382 11915-12002 DeviceChar...ification:          D  fromNotify: [B@390f611
2024-11-18 13:07:01.385 11915-12002 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:07:01.386 11915-12002 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[9, 0, 0, -12, 0, 1, 1, 0, -65, 102, 105, 109, 97, 103, 101, 115, -97, -65, 100, 115, 108, 111, 116, 0, 103, 118, 101, 114, 115, 105, 111, 110, 101, 48, 46, 51, 46, 50, 100, 104, 97, 115, 104, 88, 32, -90, 63, -13, -75, -43, -94, -48, 67, -56, 34, 45, 68, -42, 79, 49, -78, 48, -102, 125, 116, -102, -49, -47, 50, -28, -91, -75, -87, -102, 8, -19, -71, 104, 98, 111, 111, 116, 97, 98, 108, 101, -11, 103, 112, 101, 110, 100, 105, 110, 103, -12, 105, 99, 111, 110, 102, 105, 114, 109, 101, 100, -11, 102, 97, 99, 116, 105, 118, 101, -11, 105, 112, 101, 114, 109, 97, 110, 101, 110, 116, -12, -1, -65, 100, 115, 108, 111, 116, 1, 103, 118, 101, 114, 115, 105, 111, 110, 101, 48, 46, 51, 46, 52, 100, 104, 97, 115, 104, 88, 32, 33, -106, 46, 32, 104, 29, -15, -90, 19, 117, 121, -7, 18, 19, -57, -96, 38, -55, -116, 50, -74, 0, -34, -3, 91, -77, 10, 4, -56, 19, 25, -112, 104, 98, 111, 111, 116, 97, 98, 108, 101, -11, 103, 112, 101, 110, 100, 105, 110, 103, -12, 105, 99, 111, 110, 102, 105, 114, 109, 101, 100, -12, 102, 97, 99, 116, 105, 118, 101, -12, 105, 112, 101, 114, 109, 97, 110, 101, 110, 116, -12, -1, -1, 107, 115, 112, 108, 105, 116, 83, 116, 97, 116, 117, 115, 0, -1], notificationBytes=null)])]
2024-11-18 13:07:01.478 11915-11915 FirmwareUp...Completed:          D  onUpgradeCompleted()
2024-11-18 13:07:01.478 11915-11915 ScanViewMo...onConnect:          D  onConnect
lsh-silpion commented 1 day ago

From your app, as it's not working. I may compare it with logs from nRFCDM.

Btw. the nRF Connect Device Manager app currently allows me only to downgrade the firmware, for upgrading I currently use our iOS-App.

philips77 commented 1 day ago

You may use https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/blob/e15a45d78061d363d627e62b5255e21bff0e99b0/mcumgr-ble/src/main/java/io/runtime/mcumgr/ble/McuMgrBleTransport.java#L286-L293 to enable transport logs.

When using nRF Connect Device Manager you may also see the runtime logs in nRF Logger app, if you have it installed.

philips77 commented 1 day ago

OK, so based on your logs from ^ here's what you get in response:

{ 
  "images": 
     [ 
        { 
           "slot": 0, 
           "version": "0.3.2", 
           "hash": 0xA63FF3B5D5A2D043C8222D44D64F31B2309A7D749ACFD132E4A5B5A99A08EDB9,
           "bootable": true, 
           "pending": false, 
           "confirmed": true, 
           "active": true, 
           "permanent": false
        }, 
        {
           "slot": 1, 
           "version": "0.3.4", 
           "hash": 0x21962E20681DF1A6137579F91213C7A026C98C32B600DEFD5BB30A04C8131990,
           "bootable": true, 
           "pending": false, 
           "confirmed": false, 
           "active": false, 
           "permanent": false
        }
    ], 
  "splitStatus": 0
}

It seems, like the fw has been successfully uploaded (it's in secondary slot (1)) and the library should send Confirm request at that moment (assuming CONFIRM_ONLY). Try going to nRF Connect Device Manager -> Image tab -> Advanced -> Image Control pane -> tap READ and CONFIRM.

Will it show the "perding" and "permanent" flags as true? If so, tap RESET button at the bottom to restart the device. It should make the swap.

lsh-silpion commented 1 day ago

Here is the LogCat from my app with

        val transport = McuMgrBleTransport(context, bluetoothDevice)
        transport.setLoggingEnabled(true)
2024-11-18 13:52:34.632 16943-16943 BluetoothAdapter                 D  STATE_ON
2024-11-18 13:52:34.634 16943-16943 BluetoothGatt                    D  connect() - device: EB:A3:43:8E:4B:5D, auto: false
2024-11-18 13:52:34.634 16943-16943 BluetoothAdapter                 D  isSecureModeEnabled
2024-11-18 13:52:34.635 16943-16943 BluetoothGatt                    D  registerApp()
2024-11-18 13:52:34.635 16943-16943 BluetoothGatt                    D  registerApp() - UUID=908f827a-1582-458f-92ee-ebf09ef89168
2024-11-18 13:52:34.638 16943-16973 BluetoothGatt                    D  onClientRegistered() - status=0 clientIf=16
2024-11-18 13:52:34.642 16943-16943 ViewRootImpl                     I  updatePointerIcon pointerType = 1000, calling pid = 16943
2024-11-18 13:52:34.643 16943-16943 InputManager                     D  setPointerIconType iconId = 1000, callingPid = 16943
2024-11-18 13:52:34.659 16943-16973 BluetoothGatt                    D  onClientConnectionState() - status=0 clientIf=16 device=EB:A3:43:8E:4B:5D
2024-11-18 13:52:34.670 16943-16943 Choreographer                    I  Skipped 1635 frames!  The application may be doing too much work on its main thread.
2024-11-18 13:52:34.677 16943-16943 FirmwareUp...deStarted:          D  onUpgradeStarted(): controller: io.runtime.mcumgr.dfu.mcuboot.FirmwareUpgradeManager@b41e6e
2024-11-18 13:52:34.984 16943-17921 BluetoothGatt                    D  discoverServices() - device: EB:A3:43:8E:4B:5D
2024-11-18 13:52:35.014 16943-16973 BluetoothGatt                    D  onSearchComplete() = Device=EB:A3:43:8E:4B:5D Status=0
2024-11-18 13:52:35.098 16943-16943 BluetoothGatt                    D  configureMTU() - device: EB:A3:43:8E:4B:5D mtu: 498
2024-11-18 13:52:35.167 16943-16973 BluetoothGatt                    D  onConfigureMTU() - Device=EB:A3:43:8E:4B:5D mtu=498 status=0
2024-11-18 13:52:35.174 16943-16943 BluetoothGatt                    D  setCharacteristicNotification() - uuid: da2e7828-fbce-4e01-ae9e-261174997c48 enable: true
2024-11-18 13:52:35.475 16943-16973 BleGatt.kt...icChanged:          D  characteristic changed: 1,0,0,6,0,0,-1,6,-65,98,114,99,8,-1
2024-11-18 13:52:35.485 16943-16973 DeviceChar...ification:          D  fromNotify: [B@86c73a5
2024-11-18 13:52:35.500 16943-16973 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:52:35.500 16943-16973 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[1, 0, 0, 6, 0, 0, -1, 6, -65, 98, 114, 99, 8, -1], notificationBytes=null)])]
2024-11-18 13:52:35.641 16943-16943 MainViewMo...reVersion:          D  latestFirmwareVersionString: 0.3.4+1
2024-11-18 13:52:35.642 16943-16943 CUBOx.kt:3...reVersion:          D  CUBOx.firmwareVersionString: 0.3.1+0
2024-11-18 13:52:35.752 16943-16973 BleGatt.kt...icChanged:          D  characteristic changed: 9,0,0,6,0,0,0,8,-65,98,114,99,8,-1
2024-11-18 13:52:35.756 16943-16973 DeviceChar...ification:          D  fromNotify: [B@fb4ab07
2024-11-18 13:52:35.772 16943-16973 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:52:35.772 16943-16973 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[9, 0, 0, 6, 0, 0, 0, 8, -65, 98, 114, 99, 8, -1], notificationBytes=null)])]
2024-11-18 13:52:35.966 16943-16943 MainViewMo...reVersion:          D  latestFirmwareVersionString: 0.3.4+1
2024-11-18 13:52:35.968 16943-16943 CUBOx.kt:3...reVersion:          D  CUBOx.firmwareVersionString: 0.3.1+0
2024-11-18 13:52:36.024 16943-16966 System                           W  A resource failed to call end. 
2024-11-18 13:52:36.027 16943-16966 chatty                           I  uid=10371() FinalizerDaemon identical 1 line
2024-11-18 13:52:36.028 16943-16966 System                           W  A resource failed to call end. 
2024-11-18 13:52:36.180 16943-16973 BleGatt.kt...icChanged:          D  characteristic changed: 9,0,0,-12,0,1,1,0,-65,102,105,109,97,103,101,115,-97,-65,100,115,108,111,116,0,103,118,101,114,115,105,111,110,101,48,46,51,46,50,100,104,97,115,104,88,32,-90,63,-13,-75,-43,-94,-48,67,-56,34,45,68,-42,79,49,-78,48,-102,125,116,-102,-49,-47,50,-28,-91,-75,-87,-102,8,-19,-71,104,98,111,111,116,97,98,108,101,-11,103,112,101,110,100,105,110,103,-12,105,99,111,110,102,105,114,109,101,100,-11,102,97,99,116,105,118,101,-11,105,112,101,114,109,97,110,101,110,116,-12,-1,-65,100,115,108,111,116,1,103,118,101,114,115,105,111,110,101,48,46,51,46,52,100,104,97,115,104,88,32,33,-106,46,32,104,29,-15,-90,19,117,121,-7,18,19,-57,-96,38,-55,-116,50,-74,0,-34,-3,91,-77,10,4,-56,19,25,-112,104,98,111,111,116,97,98,108,101,-11,103,112,101,110,100,105,110,103,-12,105,99,111,110,102,105,114,109,101,100,-12,102,97,99,116,105,118,101,-12,105,112,101,114,109,97,110,101,110,116,-12,-1,-1,107,115,112,108,105,116,83,116,97,116,117,115,0,-1
2024-11-18 13:52:36.182 16943-16973 DeviceChar...ification:          D  fromNotify: [B@b0d1a2c
2024-11-18 13:52:36.185 16943-16973 ParseNotif...26:invoke:          D  newList: [DeviceService(uuid=00001801-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a05-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_INDICATE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a05-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_INDICATE, readBytes=null)], canRead=false, canWrite=false, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=00002b29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ, PROPERTY_WRITE], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=true, readBytes=[0], notificationBytes=null), DeviceCharacteristics(uuid=00002b2a-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[73, 48, -103, -126, 68, 57, -22, 85, 14, -54, 62, -40, -42, 32, -109, 88], notificationBytes=null)]), DeviceService(uuid=00001800-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a00-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 85, 66, 79, 116, 105, 108, 105, 116, 121, 32, 66, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a01-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[0, 0], notificationBytes=null), DeviceCharacteristics(uuid=00002a04-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[24, 0, 40, 0, 0, 0, 42, 0], notificationBytes=null)]), DeviceService(uuid=0000180f-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a19-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null), DeviceDescriptor(uuid=00002904-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=00002a19-0000-1000-8000-00805f9b34fb, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[100], notificationBytes=null)]), DeviceService(uuid=0000180a-0000-1000-8000-00805f9b34fb, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=00002a24-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[67, 117, 98, 111, 120], notificationBytes=null), DeviceCharacteristics(uuid=00002a29-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[83, 105, 108, 112, 105, 111, 110], notificationBytes=null), DeviceCharacteristics(uuid=00002a25-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[], notificationBytes=null), DeviceCharacteristics(uuid=00002a26-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=nu
2024-11-18 13:52:36.185 16943-16973 ParseNotif...26:invoke:          D  ll, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[48, 46, 51, 46, 49, 43, 48], notificationBytes=null), DeviceCharacteristics(uuid=00002a27-0000-1000-8000-00805f9b34fb, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[], canRead=true, canWrite=false, readBytes=[82, 101, 118, 46, 48], notificationBytes=null)]), DeviceService(uuid=6e400001-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400003-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[1, 0, 0, 0], notificationBytes=null), DeviceCharacteristics(uuid=6e400002-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_WRITE, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[], canRead=false, canWrite=true, readBytes=null, notificationBytes=null), DeviceCharacteristics(uuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_READ], writeTypes=[WRITE_TYPE_DEFAULT], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=6e400004-b5a3-f393-e0a9-e50e24dcca9e, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=true, canWrite=false, readBytes=[0, 0, 0, 0], notificationBytes=null)]), DeviceService(uuid=8d53dc1d-1db7-4cd3-868b-8a527460aa84, name=Mfr Service, characteristics=[DeviceCharacteristics(uuid=da2e7828-fbce-4e01-ae9e-261174997c48, name=Mfr Characteristic, descriptor=null, permissions=0, properties=[PROPERTY_NOTIFY, PROPERTY_WRITE_NO_RESPONSE], writeTypes=[WRITE_TYPE_NO_RESPONSE], descriptors=[DeviceDescriptor(uuid=00002902-0000-1000-8000-00805f9b34fb, name=Unknown, charUuid=da2e7828-fbce-4e01-ae9e-261174997c48, permissions=[], notificationProperty=PROPERTY_NOTIFY, readBytes=null)], canRead=false, canWrite=true, readBytes=[9, 0, 0, -12, 0, 1, 1, 0, -65, 102, 105, 109, 97, 103, 101, 115, -97, -65, 100, 115, 108, 111, 116, 0, 103, 118, 101, 114, 115, 105, 111, 110, 101, 48, 46, 51, 46, 50, 100, 104, 97, 115, 104, 88, 32, -90, 63, -13, -75, -43, -94, -48, 67, -56, 34, 45, 68, -42, 79, 49, -78, 48, -102, 125, 116, -102, -49, -47, 50, -28, -91, -75, -87, -102, 8, -19, -71, 104, 98, 111, 111, 116, 97, 98, 108, 101, -11, 103, 112, 101, 110, 100, 105, 110, 103, -12, 105, 99, 111, 110, 102, 105, 114, 109, 101, 100, -11, 102, 97, 99, 116, 105, 118, 101, -11, 105, 112, 101, 114, 109, 97, 110, 101, 110, 116, -12, -1, -65, 100, 115, 108, 111, 116, 1, 103, 118, 101, 114, 115, 105, 111, 110, 101, 48, 46, 51, 46, 52, 100, 104, 97, 115, 104, 88, 32, 33, -106, 46, 32, 104, 29, -15, -90, 19, 117, 121, -7, 18, 19, -57, -96, 38, -55, -116, 50, -74, 0, -34, -3, 91, -77, 10, 4, -56, 19, 25, -112, 104, 98, 111, 111, 116, 97, 98, 108, 101, -11, 103, 112, 101, 110, 100, 105, 110, 103, -12, 105, 99, 111, 110, 102, 105, 114, 109, 101, 100, -12, 102, 97, 99, 116, 105, 118, 101, -12, 105, 112, 101, 114, 109, 97, 110, 101, 110, 116, -12, -1, -1, 107, 115, 112, 108, 105, 116, 83, 116, 97, 116, 117, 115, 0, -1], notificationBytes=null)])]
2024-11-18 13:52:36.267 16943-16943 FirmwareUp...Completed:          D  onUpgradeCompleted()
2024-11-18 13:52:36.267 16943-16943 ScanViewMo...onConnect:          D  onConnect
lsh-silpion commented 1 day ago

It seems, like the fw has been successfully uploaded (it's in secondary slot (1)) and the library should send Confirm request at that moment (assuming CONFIRM_ONLY). Try going to nRF Connect Device Manager -> Image tab -> Advanced -> Image Control pane -> tap READ and CONFIRM.

Will it show the "perding" and "permanent" flags as true? If so, tap RESET button at the bottom to restart the device. It should make the swap.

Tried that with the nRF CDM and got a Connection timed out error.

Here is the LogCat of nRF CDM:

2024-11-18 14:06:20.294 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:20.296 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527
2024-11-18 14:06:20.936 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  ViewPostIme pointer 0
2024-11-18 14:06:20.941 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:20.942 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527
2024-11-18 14:06:20.943 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  ViewPostIme pointer 1
2024-11-18 14:06:21.072 20527-20527 Dialog                  no....droid.nrfconnectdevicemanager  D  mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
2024-11-18 14:06:21.086 20527-20527 MultiWindowDecorSupport no....droid.nrfconnectdevicemanager  I  [INFO] isPopOver = false
2024-11-18 14:06:21.086 20527-20527 MultiWindowDecorSupport no....droid.nrfconnectdevicemanager  I  updateCaptionType >> DecorView@9409e7[], isFloating: true, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: false
2024-11-18 14:06:21.086 20527-20527 MultiWindowDecorSupport no....droid.nrfconnectdevicemanager  D  setCaptionType = 0, DecorView = DecorView@9409e7[]
2024-11-18 14:06:21.136 20527-20527 ScrollView              no....droid.nrfconnectdevicemanager  D  initGoToTop
2024-11-18 14:06:21.185 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  setView = com.android.internal.policy.DecorView@9409e7 TM=true MM=false
2024-11-18 14:06:21.280 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  Relayout returned: old=(0,72,1080,2076) new=(27,529,1053,1619) req=(1026,1090)0 dur=14 res=0x7 s={true 519380463616} ch=true
2024-11-18 14:06:21.282 20527-20574 mali_winsys             no....droid.nrfconnectdevicemanager  I  new_window_surface() [1098x1162] return: 0x3000
2024-11-18 14:06:21.327 20527-20527 ScrollView              no....droid.nrfconnectdevicemanager  D   onsize change changed 
2024-11-18 14:06:21.330 20527-20527 DecorView               no....droid.nrfconnectdevicemanager  E  mWindow.mActivityCurrentConfig is null
2024-11-18 14:06:21.359 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  MSG_WINDOW_FOCUS_CHANGED 1 1
2024-11-18 14:06:21.457 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  MSG_WINDOW_FOCUS_CHANGED 0 1
2024-11-18 14:06:21.458 20527-20527 InputMethodManager      no....droid.nrfconnectdevicemanager  D  prepareNavigationBarInfo() DecorView@610c89c[MainActivity]
2024-11-18 14:06:21.458 20527-20527 InputMethodManager      no....droid.nrfconnectdevicemanager  D  getNavigationBarColor() -1773582
2024-11-18 14:06:21.526 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  MSG_RESIZED: frame=(27,529,1053,1619) ci=(0,0,0,0) vi=(0,0,0,0) or=1
2024-11-18 14:06:21.571 20527-20527 DecorView               no....droid.nrfconnectdevicemanager  E  mWindow.mActivityCurrentConfig is null
2024-11-18 14:06:25.469 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1000, calling pid = 20527
2024-11-18 14:06:25.473 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1000, callingPid = 20527
2024-11-18 14:06:25.569 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:25.571 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527
2024-11-18 14:06:26.977 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  ViewPostIme pointer 0
2024-11-18 14:06:26.985 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:26.987 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527
2024-11-18 14:06:29.555 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  ViewPostIme pointer 1
2024-11-18 14:06:29.588 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:29.591 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527
2024-11-18 14:06:29.685 20527-20527 BluetoothAdapter        no....droid.nrfconnectdevicemanager  D  STATE_ON
2024-11-18 14:06:29.719 20527-20527 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  connect() - device: EB:A3:43:8E:4B:5D, auto: false
2024-11-18 14:06:29.719 20527-20527 BluetoothAdapter        no....droid.nrfconnectdevicemanager  D  isSecureModeEnabled
2024-11-18 14:06:29.722 20527-20527 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  registerApp()
2024-11-18 14:06:29.724 20527-20527 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  registerApp() - UUID=6425f747-f34f-41ac-8741-1956c1e827fa
2024-11-18 14:06:29.740 20527-20595 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onClientRegistered() - status=0 clientIf=16
2024-11-18 14:06:29.783 20527-20574 mali_egl                no....droid.nrfconnectdevicemanager  I  eglDestroySurface() in
2024-11-18 14:06:29.788 20527-20574 mali_winsys             no....droid.nrfconnectdevicemanager  I  delete_surface() [1098x1162] return
2024-11-18 14:06:29.788 20527-20574 mali_egl                no....droid.nrfconnectdevicemanager  I  eglDestroySurface() out
2024-11-18 14:06:29.789   512-562   BufferQueueProducer     pid-512                              E  [no.nordicsemi.android.nrfconnectdevicemanager/io.runtime.mcumgr.sample.MainActivity$_20527#1] disconnect: not connected (req=1)
2024-11-18 14:06:29.789 20527-20574 libEGL                  no....droid.nrfconnectdevicemanager  W  EGLNativeWindowType 0x78dc1e5a10 disconnect failed
2024-11-18 14:06:29.789 20527-20574 OpenGLRenderer          no....droid.nrfconnectdevicemanager  D  endAllActiveAnimators on 0x78eda17200 (RippleDrawable) with handle 0x794be91c40
2024-11-18 14:06:29.790 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  dispatchDetachedFromWindow
2024-11-18 14:06:29.795 20527-20527 InputTransport          no....droid.nrfconnectdevicemanager  D  Input channel destroyed: '1747cc3', fd=84
2024-11-18 14:06:29.801   967-3037  InputDispatcher         pid-967                              E  Window handle Window{1747cc3 u0 no.nordicsemi.android.nrfconnectdevicemanager/io.runtime.mcumgr.sample.MainActivity} has no registered input channel
2024-11-18 14:06:29.931 20527-20527 InputMethodManager      no....droid.nrfconnectdevicemanager  D  prepareNavigationBarInfo() DecorView@610c89c[MainActivity]
2024-11-18 14:06:29.931 20527-20527 InputMethodManager      no....droid.nrfconnectdevicemanager  D  getNavigationBarColor() -1773582
2024-11-18 14:06:29.951   967-1047  WindowManager           pid-967                              E  win=Window{1747cc3 u0 no.nordicsemi.android.nrfconnectdevicemanager/io.runtime.mcumgr.sample.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:1249 com.android.server.wm.AppWindowToken.destroySurfaces:1230 com.android.server.wm.WindowState.onExitAnimationDone:5189 com.android.server.wm.WindowStateAnimator.onAnimationFinished:320 com.android.server.wm.WindowState.onAnimationFinished:5630 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0$SurfaceAnimator:100 
2024-11-18 14:06:29.994 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1000, calling pid = 20527
2024-11-18 14:06:29.994 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1000, callingPid = 20527
2024-11-18 14:06:30.001 20527-20527 ViewRootIm...nActivity] no....droid.nrfconnectdevicemanager  I  MSG_WINDOW_FOCUS_CHANGED 1 1
2024-11-18 14:06:30.001 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  E  sendUserActionEvent() mView returned.
2024-11-18 14:06:30.471 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onClientConnectionState() - status=0 clientIf=16 device=EB:A3:43:8E:4B:5D
2024-11-18 14:06:30.794 20527-20721 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  discoverServices() - device: EB:A3:43:8E:4B:5D
2024-11-18 14:06:30.898 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=6 latency=0 timeout=500 status=0
2024-11-18 14:06:30.964 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onPhyUpdate() - status=0 address=EB:A3:43:8E:4B:5D txPhy=2 rxPhy=2
2024-11-18 14:06:31.371 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onSearchComplete() = Device=EB:A3:43:8E:4B:5D Status=0
2024-11-18 14:06:31.411 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=39 latency=0 timeout=500 status=0
2024-11-18 14:06:31.489 20527-20600 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  configureMTU() - device: EB:A3:43:8E:4B:5D mtu: 498
2024-11-18 14:06:31.557 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onConfigureMTU() - Device=EB:A3:43:8E:4B:5D mtu=498 status=0
2024-11-18 14:06:31.559 20527-20600 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  setCharacteristicNotification() - uuid: da2e7828-fbce-4e01-ae9e-261174997c48 enable: true
2024-11-18 14:06:31.862 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onPhyRead() - status=0 address=EB:A3:43:8E:4B:5D txPhy=2 rxPhy=2
2024-11-18 14:06:31.873 20527-20600 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  requestConnectionPriority() - params: 1
2024-11-18 14:06:32.197 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=12 latency=0 timeout=500 status=0
2024-11-18 14:06:35.440 20527-20549 BluetoothGatt           no....droid.nrfconnectdevicemanager  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=39 latency=0 timeout=42 status=0
2024-11-18 14:06:49.043 20527-20527 ViewRootImpl            no....droid.nrfconnectdevicemanager  I  updatePointerIcon pointerType = 1002, calling pid = 20527
2024-11-18 14:06:49.046 20527-20527 InputManager            no....droid.nrfconnectdevicemanager  D  setPointerIconType iconId = 1002, callingPid = 20527

Hope that helps …

lsh-silpion commented 1 day ago

In BASIC-Mode inside the nRF CDM I get this:

14:11:39.798  V  Starting DFU, mode: CONFIRM_ONLY
14:11:40.050  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 4, Command: 8) CBOR {}
14:11:40.054  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:11:40.140  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=12 latency=0 timeout=500 status=0
14:11:40.143  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-04-08-BF-62-72-63-08-FF
14:11:40.145  I  Connection parameters updated (interval: 15.0ms, latency: 0, timeout: 5000ms)
14:11:40.166  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 4, Command: 8) CBOR {"rc":8}
14:11:40.274  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 1, Seq: 5, Command: 0) CBOR {}
14:11:40.278  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:11:40.313  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-F4-00-01-05-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
14:11:40.329  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 244, Group: 1, Seq: 5, Command: 0) CBOR {"images":[{"slot":0,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":false,"active":false,"permanent":false}],"splitStatus":0}
14:11:40.449  V  Validation response: {"images":[{"slot":0,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":false,"active":false,"permanent":false}],"splitStatus":0}
14:11:40.453  V  Moving from state VALIDATE to state CONFIRM
14:11:40.482  I  Sending (57 bytes) Header (Version: 1, Op: 2, Flags: 0, Len: 49, Group: 1, Seq: 6, Command: 0) CBOR {"confirm":true,"hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA="}
14:11:40.494  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:11:40.526  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0B-00-00-F4-00-01-06-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F5-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F5-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
14:11:40.536  I  Received Header (Version: 1, Op: 3, Flags: 0, Len: 244, Group: 1, Seq: 6, Command: 0) CBOR {"images":[{"slot":0,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}
14:11:40.675  V  Confirm response: {"images":[{"slot":0,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}
14:11:40.676  V  Moving from state CONFIRM to state RESET
14:11:40.695  I  Sending (9 bytes) Header (Version: 1, Op: 2, Flags: 0, Len: 1, Group: 0, Seq: 7, Command: 5) CBOR {}
14:11:40.700  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:11:40.725  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0B-00-00-02-00-00-07-05-BF-FF
14:11:40.730  I  Received Header (Version: 1, Op: 3, Flags: 0, Len: 2, Group: 0, Seq: 7, Command: 5) CBOR {}
14:11:40.793  V  Reset request success. Waiting for disconnect...
14:11:45.969  D  onClientConnectionState() - status=8 clientIf=16 device=EB:A3:43:8E:4B:5D
14:11:45.997  W  Error: (0x8): GATT CONN TIMEOUT
14:11:46.000  I  Disconnected
14:11:46.016  D  close()
14:11:46.028  D  unregisterApp() - mClientIf=16
14:11:46.046  I  Device disconnected
14:11:46.047  V  Waiting remaining 4746 ms for the swap operation to complete
14:11:50.801  I  Upgrade complete
philips77 commented 1 day ago

Here is the LogCat from my app with

   val transport = McuMgrBleTransport(context, bluetoothDevice)
   transport.setLoggingEnabled(true)

I think you need to add dependency to slf4j-simple in your project, instead of slf4j-noop. The McuMgrBleTransport is logging using LSF4J and seems like the logs are discarded.

philips77 commented 1 day ago

In BASIC mode you're getting:

{
   "images": [ 
    {
      "slot":0,
      "version":"0.3.2",
      "hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=",
      "bootable":true,
      "pending":false,
      "confirmed":true,
      "active":true,
      "permanent":false
    }, 
    {
      "slot":1,
      "version":"0.3.4",
      "hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=",
      "bootable":true,
      "pending":true,
      "confirmed":false,
      "active":false,
      "permanent":true
    }
  ],
  "splitStatus":0
}

Which would indicate, that the 0.3.4 will be set as active after the reset. This is a good response.

As you see, the 2nd image was marked as "pending" (will be swapped) and "permanent" con't be reverted after second reset. After the device reboots and starts advertising you should read 0.3.4 in slot 0 with "active" flag on.

lsh-silpion commented 1 day ago

The firmware downgrade works in nRF CDM:

14:24:19.382  V  Starting DFU, mode: CONFIRM_ONLY
14:24:22.888  I  Connected to EB:A3:43:8E:4B:5D
14:24:23.285  I  Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
14:24:23.362  I  PHY updated (TX: LE 2M, RX: LE 2M)
14:24:23.752  I  Services discovered
14:24:23.867  I  Connection parameters updated (interval: 48.75ms, latency: 0, timeout: 5000ms)
14:24:23.957  I  MTU changed to: 498
14:24:24.154  I  Data written to descr. 00002902-0000-1000-8000-00805f9b34fb
14:24:24.155  I  Notifications enabled
14:24:24.167  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:24.250  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-06-00-00-FF-06-BF-62-72-63-08-FF
14:24:24.260  I  Wait for value changed complete
14:24:24.348  I  Received Header (Version: 0, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 255, Command: 6) CBOR {"rc":8}
14:24:24.350  I  PHY read (TX: LE 2M, RX: LE 2M)
14:24:24.374  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 0, Command: 8) CBOR {}
14:24:24.564  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:24.590  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 1, Command: 6) CBOR {}
14:24:24.598  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:24.642  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-00-08-BF-62-72-63-08-FF
14:24:24.654  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 0, Command: 8) CBOR {"rc":8}
14:24:24.692  D  onConnectionUpdated() - Device=EB:A3:43:8E:4B:5D interval=12 latency=0 timeout=500 status=0
14:24:24.832  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-01-06-BF-62-72-63-08-FF
14:24:24.833  I  Connection parameters updated (interval: 15.0ms, latency: 0, timeout: 5000ms)
14:24:24.841  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 1, Command: 6) CBOR {"rc":8}
14:24:24.853  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 1, Seq: 2, Command: 0) CBOR {}
14:24:24.934  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:24.944  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-F4-00-01-02-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
14:24:24.967 I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 244, Group: 1, Seq: 2, Command: 0) CBOR {"images":[{"slot":0,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":false,"active":false,"permanent":false}],"splitStatus":0}
14:24:24.974  I  Sending (19 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 11, Group: 0, Seq: 3, Command: 7) CBOR {"format":"sv"}
14:24:25.099  V  Validation response: {"images":[{"slot":0,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":false,"active":false,"permanent":false}],"splitStatus":0}
14:24:25.102  V  Moving from state VALIDATE to state CONFIRM
14:24:25.116  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:25.118  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-03-07-BF-62-72-63-08-FF
14:24:25.125  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 3, Command: 7) CBOR {"rc":8}
14:24:25.134  I  Sending (57 bytes) Header (Version: 1, Op: 2, Flags: 0, Len: 49, Group: 1, Seq: 4, Command: 0) CBOR {"confirm":true,"hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk="}
14:24:25.202  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:25.209  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0B-00-00-F4-00-01-04-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F5-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F5-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
14:24:25.224  I  Received Header (Version: 1, Op: 3, Flags: 0, Len: 244, Group: 1, Seq: 4, Command: 0) CBOR {"images":[{"slot":0,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}
14:24:25.230  I  Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 5, Command: 8) CBOR {}
14:24:25.338  V  Confirm response: {"images":[{"slot":0,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":true,"confirmed":false,"active":false,"permanent":true}],"splitStatus":0}
14:24:25.339  V  Moving from state CONFIRM to state RESET
14:24:25.346  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:25.348  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-05-08-BF-62-72-63-08-FF
14:24:25.355  I  Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 5, Command: 8) CBOR {"rc":8}
14:24:25.361  I  Sending (9 bytes) Header (Version: 1, Op: 2, Flags: 0, Len: 1, Group: 0, Seq: 6, Command: 5) CBOR {}
14:24:25.443  I  Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:24:25.446  I  Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 0B-00-00-02-00-00-06-05-BF-FF
14:24:25.451  I  Received Header (Version: 1, Op: 3, Flags: 0, Len: 2, Group: 0, Seq: 6, Command: 5) CBOR {}
14:24:25.509  V  Reset request success. Waiting for disconnect...
14:24:30.635  D  onClientConnectionState() - status=8 clientIf=16 device=EB:A3:43:8E:4B:5D
14:24:30.654  W  Error: (0x8): GATT CONN TIMEOUT
14:24:30.656  I  Disconnected
14:24:30.662  D  close()
14:24:30.688  I  Device disconnected
14:24:30.689  V  Waiting remaining 4821 ms for the swap operation to complete
14:24:35.518  I  Upgrade complete
lsh-silpion commented 1 day ago

Here is the LogCat from my app with

   val transport = McuMgrBleTransport(context, bluetoothDevice)
   transport.setLoggingEnabled(true)

I think you need to add dependency to slf4j-simple in your project, instead of slf4j-noop. The McuMgrBleTransport is logging using LSF4J and seems like the logs are discarded.

Did that and now got the following:

14:28:44.489  W  [main] Connected to EB:A3:43:8E:4B:5D
14:28:44.826  W  [main] Services discovered
14:28:44.998  W  [main] MTU changed to: 498
14:28:45.195  W  [main] Data written to descr. 00002902-0000-1000-8000-00805f9b34fb
14:28:45.198  W  [main] Notifications enabled
14:28:45.221  W  [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:28:45.297  W  [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 01-00-00-06-00-00-FF-06-BF-62-72-63-08-FF
14:28:45.329  W  [main] Wait for value changed complete
14:28:45.451  W  [main] Received Header (Version: 0, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 255, Command: 6) CBOR {"rc":8}
14:28:45.503  D  latestFirmwareVersionString: 0.3.4+1
14:28:45.504  D  CUBOx.firmwareVersionString: 0.3.1+0
14:28:45.519  W  [main] Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 0, Command: 8) CBOR {}
14:28:45.525  W  [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:28:45.582  W  [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-06-00-00-00-08-BF-62-72-63-08-FF
14:28:45.600  W  [main] Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 0, Command: 8) CBOR {"rc":8}
14:28:45.786  W  [main] Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 1, Seq: 1, Command: 0) CBOR {}
14:28:45.815  W  [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
14:28:45.881  W  [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value: (0x) 09-00-00-F4-00-01-01-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
14:28:45.906  W  [main] Received Header (Version: 1, Op: 1, Flags: 0, Len: 244, Group: 1, Seq: 1, Command: 0) CBOR {"images":[{"slot":0,"version":"0.3.2","hash":"pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=","bootable":true,"pending":false,"confirmed":true,"active":true,"permanent":false},{"slot":1,"version":"0.3.4","hash":"IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=","bootable":true,"pending":false,"confirmed":false,"active":false,"permanent":false}],"splitStatus":0}
14:28:46.030  D  onUpgradeCompleted()
philips77 commented 1 day ago

Here's what you have before downgrade:

{
    "images": [
        {
            "version": "0.3.4",
            "hash": "IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=",
            "bootable": true,
            "pending": false,
            "confirmed": true,
            "active": true,
            "slot": 0,
            "permanent": false
        },
        {
            "slot": 1,
            "version": "0.3.2",
            "hash": "pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=",
            "bootable": true,
            "active": false,
            "confirmed": false,
            "pending": false,
            "permanent": false
        }
    ],
    "splitStatus": 0
}

and after sending confirm request:

{
    "images": [
        {
            "slot": 0,
            "version": "0.3.4",
            "hash": "IZYuIGgd8aYTdXn5EhPHoCbJjDK2AN79W7MKBMgTGZA=",
            "bootable": true,
            "pending": false,
            "confirmed": true,
            "active": true,
            "permanent": false
        },
        {
            "slot": 1,
            "version": "0.3.2",
            "hash": "pj/ztdWi0EPIIi1E1k8xsjCafXSaz9Ey5KW1qZoI7bk=",
            "bootable": true,
            "pending": true,
            "confirmed": false,
            "active": false,
            "permanent": true
        }
    ],
    "splitStatus": 0
}

This is the same as https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/issues/202#issuecomment-2482965503, where you upgrade (only version and hash are swapped). IMO both up and downgrade should work.

philips77 commented 1 day ago

Based on you latest comment I deduct, that from your app you're trying to send 0.3.2, not 0.3.4. It checks that the hash of the "active" slot 0 is the same as in the binary and reports success, no action needed.

lsh-silpion commented 1 day ago

Based on you latest comment I deduct, that from your app you're trying to send 0.3.2, not 0.3.4. It checks that the hash of the "active" slot 0 is the same as in the binary and reports success, no action needed.

Now I am baffled. I am pretty sure I am uploading 0.3.4 Is there any way to confirm this?

philips77 commented 1 day ago

You may open the file that you're sending from your app in nRF CDM and compare hashes. On BASIC view it will show the hash after the file is selected. Then, open ADVANCED, and tap READ to list the firmware which is already on the device. Check out hashes for each version and compare with the selected file. Just make supre you're using exactly the file that your app is trying to send.

In your app you may also print the hash of the binaries from the ZIP file or teh BIN, depending on what you are sending. If you create ImageTarget object, it has hash property.

~Also, I believe you're not using the latest version of this library, which is 2.2.2.~

lsh-silpion commented 1 day ago

Our Firmware developer tells me right now that it is required for our appliance to work to write to slot0, not slot1, to make the firmware work. How do I force a write to slot0?

Thanks again,

Lars

philips77 commented 1 day ago

Hmm.. the standard way of upgrading is by sending the image to slot 1 (secondary), then confirming them (sending confirm command with the right hash) and reseting the board (sending reset command). This will cause McuBoot to swap images, so the new one lands in slot 0 and is set as active. And I believe this is exactly the same as the iOS app is doing.

lsh-silpion commented 1 day ago

Here is the LogCat with the hash of the image I am going to upload (produced by the following code):

val imageSet = ZipPackage(firmwareFile.readBytes()).binaries

Timber.d("imageSet.images[0].image.hash: ${imageSet.images[0].image.hash.toHex()}")

dfuManager.setMode(FirmwareUpgradeManager.Mode.CONFIRM_ONLY)

try {
   dfuManager.start(imageSet, dfuManagerSettings)
} catch (e: Exception) {
   Timber.e(e)
}
D imageSet.images[0].image.hash: 0x4B19673BD336D0FAD78BBD2CD589B3F542DB6EDB953650B05AF8891FFBD0F715
W [main] Services discovered
W [main] MTU changed to: 498
W [main] Data written to descr.00002902-0000-1000-8000-00805f9b34fb
W [main] Notifications enabled
W [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
W [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value:(0x)01-00-00-06-00-00-FF-06-BF-62-72-63-08-FF
W [main] Wait for value changed complete
W [main] Received Header (Version: 0, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 255, Command: 6) CBOR {"rc":8}
W [main] Sending (9 bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 0, Seq: 0, Command: 8) CBOR {}
W [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
W [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value:(0x)09-00-00-06-00-00-00-08-BF-62-72-63-08-FF
W [main] Received Header (Version: 1, Op: 1, Flags: 0, Len: 6, Group: 0, Seq: 0, Command: 8) CBOR {"rc":8}
W [main] Sending (9bytes) Header (Version: 1, Op: 0, Flags: 0, Len: 1, Group: 1, Seq: 1, Command: 0) CBOR {}
W [main] Data written to da2e7828-fbce-4e01-ae9e-261174997c48
W [main] Notification received from da2e7828-fbce-4e01-ae9e-261174997c48, value:(0x)09-00-00-F4-00-01-01-00-BF-66-69-6D-61-67-65-73-9F-BF-64-73-6C-6F-74-00-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-32-64-68-61-73-68-58-20-A6-3F-F3-B5-D5-A2-D0-43-C8-22-2D-44-D6-4F-31-B2-30-9A-7D-74-9A-CF-D1-32-E4-A5-B5-A9-9A-08-ED-B9-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F5-66-61-63-74-69-76-65-F5-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-BF-64-73-6C-6F-74-01-67-76-65-72-73-69-6F-6E-65-30-2E-33-2E-34-64-68-61-73-68-58-20-21-96-2E-20-68-1D-F1-A6-13-75-79-F9-12-13-C7-A0-26-C9-8C-32-B6-00-DE-FD-5B-B3-0A-04-C8-13-19-90-68-62-6F-6F-74-61-62-6C-65-F5-67-70-65-6E-64-69-6E-67-F4-69-63-6F-6E-66-69-72-6D-65-64-F4-66-61-63-74-69-76-65-F4-69-70-65-72-6D-61-6E-65-6E-74-F4-FF-FF-6B-73-70-6C-69-74-53-74-61-74-75-73-00-FF
W [main] Received:
    Header (Version:1, Op:1, Flags:0, Len: 244, Group:1, Seq:1, Command:0)
    CBOR:
      {
          "images": [
              {
                  "active": true,
                  "bootable": true,
                  "confirmed": true,
                  "hash": "A63FF3B5D5A2D043C8222D44D64F31B2309A7D749ACFD132E4A5B5A99A08EDB9",
                  "pending": false,
                  "permanent": false,
                  "slot": 0,
                  "version": "0.3.2"
              },
              {
                  "active": false,
                  "bootable": true,
                  "confirmed": false,
                  "hash": "21962E20681DF1A6137579F91213C7A026C98C32B600DEFD5BB30A04C8131990",
                  "pending": false,
                  "permanent": false,
                  "slot": 1,
                  "version": "0.3.4"
              }
          ],
          "splitStatus": 0
      }
D onUpgradeCompleted()
lsh-silpion commented 1 day ago

Btw. ZipPackage is derived from https://github.com/NordicSemiconductor/Android-nRF-Connect-Device-Manager/blob/main/sample/src/main/java/io/runtime/mcumgr/sample/utils/ZipPackage.java and has been adapted a bit (to provide getManifestFileVersion() which we need to compare the downloaded version of our firmware to the one on the device):

ZipPackage.java ```java package io.runtime.mcumgr.sample.utils; import androidx.annotation.Keep; import androidx.annotation.NonNull; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import io.runtime.mcumgr.dfu.mcuboot.model.ImageSet; import io.runtime.mcumgr.dfu.mcuboot.model.TargetImage; import io.runtime.mcumgr.dfu.suit.model.CacheImageSet; import io.runtime.mcumgr.exception.McuMgrException; import timber.log.Timber; public final class ZipPackage { private static final String MANIFEST = "manifest.json"; @SuppressWarnings({"unused", "MismatchedReadAndWriteOfArray"}) @Keep private static class Manifest { private int formatVersion; private File[] files; @Keep private static class File { /** * The file type. Expected vales are: "application", "bin", "suit-envelope". */ private String type; /** * The name of the image file. */ private String file; /** * The version of the image file. */ private String version_MCUBOOT; /** * The size of the image file in bytes. This is declared size and does not have to * be equal to the actual file size. */ private int size; /** * Image index is used for multi-core devices. Index 0 is the main core (app core), * index 1 is secondary core (net core), etc. *

* For single-core devices this is not present in the manifest file and defaults to 0. */ private int imageIndex = 0; /** * The slot number where the image is to be sent. By default images are sent to the * secondary slot and then swapped to the primary slot after the image is confirmed * and the device is reset. *

* However, if the device supports Direct XIP feature it is possible to run an app * from a secondary slot. The image has to be compiled for this slot. A ZIP package * can contain images for both slots. Only the one targeting the available one will * be sent. * @since NCS v 2.5, nRF Connect Device Manager 1.8. */ private int slot = 0; // FIXME MARC: 0 works!, was TargetImage.SLOT_SECONDARY; /** * The target partition ID. This parameter is valid for files with type `cache`. */ private int partition = 0; } } private Manifest manifest; private final Map entries = new HashMap<>(); public ArrayList getManifestFileVersion() { ArrayList versions = new ArrayList<>(manifest.files.length); for (Manifest.File file : manifest.files) { versions.add(file.version_MCUBOOT); } return versions; } public ZipPackage(@NonNull final byte[] data) throws IOException { ZipEntry ze; // Unzip the file and look for the manifest.json. final ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(data)); while ((ze = zis.getNextEntry()) != null) { if (ze.isDirectory()) throw new IOException("Invalid ZIP"); final String name = validateFilename(ze.getName(), "."); if (name.equals(MANIFEST)) { final Gson gson = new GsonBuilder().create(); manifest = gson.fromJson(new InputStreamReader(zis), Manifest.class); } else if (name.endsWith(".bin") || name.endsWith(".suit")) { final byte[] content = getData(zis); entries.put(name, content); } else { Timber.w("Unsupported file found: %s", name); } } } public ImageSet getBinaries() throws IOException, McuMgrException { final ImageSet binaries = new ImageSet(); // Search for images. for (final Manifest.File file: manifest.files) { final String name = file.file; final byte[] content = entries.get(name); if (content == null) throw new IOException("File not found: " + name); binaries.add(new TargetImage(file.imageIndex, file.slot, content)); } return binaries; } /** * Returns the SUIT envelope. *

* This is valid only for SUIT updates using SUIT manager. * @return The SUIT envelope, or null if not present in the ZIP. */ public byte[] getSuitEnvelope() { // First, search for an entry of type "suit-envelope". for (final Manifest.File file: manifest.files) { if (file.type.equals("suit-envelope")) { return entries.get(file.file); } } // If not found, search for a file with the ".suit" extension. for (final Manifest.File file: manifest.files) { if (file.file.endsWith(".suit")) { return entries.get(file.file); } } // Not found. return null; } /** * Raw cache images are sent to the device together with the SUIT envelope before starting the * update process. The cache images are stored in the cache partitions. * * @return The cache images, or null if not present in the ZIP. * @throws IOException if at least one of the cache images is missing. */ public CacheImageSet getCacheBinaries() throws IOException { final CacheImageSet cache = new CacheImageSet(); // Search for images. for (final Manifest.File file: manifest.files) { if (file.type.equals("cache")) { final String name = file.file; final byte[] content = entries.get(name); if (content == null) throw new IOException("File not found: " + name); cache.add(file.partition, content); } } if (cache.getImages().isEmpty()) return null; return cache; } public byte[] getResource(@NonNull final String name) { return entries.get(name); } private byte[] getData(@NonNull ZipInputStream zis) throws IOException { final byte[] buffer = new byte[1024]; // Read file content to byte array final ByteArrayOutputStream os = new ByteArrayOutputStream(); int count; while ((count = zis.read(buffer)) != -1) { os.write(buffer, 0, count); } return os.toByteArray(); } /** * Validates the path (not the content) of the zip file to prevent path traversal issues. * *

When unzipping an archive, always validate the compressed files' paths and reject any path * that has a path traversal (such as ../..). Simply looking for .. characters in the compressed * file's path may not be enough to prevent path traversal issues. The code validates the name of * the entry before extracting the entry. If the name is invalid, the entire extraction is aborted. *

* * @param filename The path to the file. * @param intendedDir The intended directory where the zip should be. * @return The validated path to the file. * @throws java.io.IOException Thrown in case of path traversal issues. */ @SuppressWarnings("SameParameterValue") private String validateFilename(@NonNull final String filename, @NonNull final String intendedDir) throws IOException { File f = new File(filename); String canonicalPath = f.getCanonicalPath(); File iD = new File(intendedDir); String canonicalID = iD.getCanonicalPath(); if (canonicalPath.startsWith(canonicalID)) { return canonicalPath.substring(1); // remove leading "/" } else { throw new IllegalStateException("File is outside extraction target directory."); } } } ```

philips77 commented 14 hours ago

Good morning, I filtered (and clarified) the last logs you posted, and it got me baffled. Seems like the validation assumes that the hashes are equal, while they are not. Let me check the code and come back to you.

philips77 commented 13 hours ago

I went through the code and cannot find the reason. Could you go to the Validate class and add logs all over the place and check why nothing gets uploaded? The only reason I see is that the hash has been found, so something is clearly not right. Either you print a different hash, then is later use in the library, or I have no idea what. Try debugging what happens after the lib gets "image list" response and how it enqueues tasks.

lsh-silpion commented 10 hours ago

I went through the code and cannot find the reason. Could you go to the Validate class and add logs all over the place and check why nothing gets uploaded? The only reason I see is that the hash has been found, so something is clearly not right. Either you print a different hash, then is later use in the library, or I have no idea what. Try debugging what happens after the lib gets "image list" response and how it enqueues tasks.

Which Validate class are you talking about? If you meant the io.runtime.mcumgr.dfu.mcuboot.task.Validate class I sadly can't change it since it comes right out of the Gradle dependency no.nordicsemi.android:mcumgr-core:2.2.2@aar which our app is using.

philips77 commented 9 hours ago

You could clone the repo to StudioProjects and add the library as a module just like here: https://github.com/NordicSemiconductor/Android-DFU-Library/blob/0c559244b34ebd27a4f51f045c067b965f918b73/settings.gradle.kts#L36-L38 You'll be able to modify the source of the library and debug it.