@@ -505,68 +505,6 @@ static bool img_mgmt_state_encode_slot(struct smp_streamer *ctxt, uint32_t slot,
505505/**
506506 * Command handler: image state read
507507 */
508- #if !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER )
509- int
510- img_mgmt_state_read (struct smp_streamer * ctxt )
511- {
512- LOG_ERR ("state read" );
513- return MGMT_ERR_EOK ;
514- zcbor_state_t * zse = ctxt -> writer -> zs ;
515- uint32_t i ;
516- bool ok ;
517-
518-
519- ok = zcbor_tstr_put_lit (zse , "images" ) &&
520- zcbor_list_start_encode (zse , 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER );
521-
522- img_mgmt_take_lock ();
523-
524- for (i = 0 ; ok && i < CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER ; i ++ ) {
525- /* _a is active slot, _o is opposite slot */
526- enum img_mgmt_next_boot_type type = NEXT_BOOT_TYPE_NORMAL ;
527- int next_boot_slot = img_mgmt_get_next_boot_slot (i , & type );
528- int slot_a = img_mgmt_active_slot (i );
529- int slot_o = img_mgmt_get_opposite_slot (slot_a );
530- int flags_a = REPORT_SLOT_ACTIVE ;
531- int flags_o = 0 ;
532-
533- if (type != NEXT_BOOT_TYPE_REVERT ) {
534- flags_a |= REPORT_SLOT_CONFIRMED ;
535- }
536-
537- if (next_boot_slot != slot_a ) {
538- if (type == NEXT_BOOT_TYPE_NORMAL ) {
539- flags_o = REPORT_SLOT_PENDING | REPORT_SLOT_PERMANENT ;
540- } else if (type == NEXT_BOOT_TYPE_REVERT ) {
541- flags_o = REPORT_SLOT_CONFIRMED ;
542- } else if (type == NEXT_BOOT_TYPE_TEST ) {
543- flags_o = REPORT_SLOT_PENDING ;
544- }
545- }
546-
547- /* Need to report slots in proper order */
548- if (slot_a < slot_o ) {
549- ok = img_mgmt_state_encode_slot (ctxt , slot_a , flags_a ) &&
550- img_mgmt_state_encode_slot (ctxt , slot_o , flags_o );
551- } else {
552- ok = img_mgmt_state_encode_slot (ctxt , slot_o , flags_o ) &&
553- img_mgmt_state_encode_slot (ctxt , slot_a , flags_a );
554- }
555- }
556-
557- /* Ending list encoding for two slots per image */
558- ok = ok && zcbor_list_end_encode (zse , 2 * CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER );
559- /* splitStatus is always 0 so in frugal list it is not present at all */
560- if (!IS_ENABLED (CONFIG_MCUMGR_GRP_IMG_FRUGAL_LIST ) && ok ) {
561- ok = zcbor_tstr_put_lit (zse , "splitStatus" ) &&
562- zcbor_int32_put (zse , 0 );
563- }
564-
565- img_mgmt_release_lock ();
566-
567- return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE ;
568- }
569- #else
570508int
571509img_mgmt_state_read (struct smp_streamer * ctxt )
572510{
@@ -580,6 +518,7 @@ img_mgmt_state_read(struct smp_streamer *ctxt)
580518 img_mgmt_take_lock ();
581519
582520 for (i = 0 ; ok && i < CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER ; i ++ ) {
521+ LOG_ERR ("state read %d" , i );
583522 /* _a is active slot, _o is opposite slot */
584523 int slot_a = img_mgmt_active_slot (i );
585524 int slot_o = img_mgmt_get_opposite_slot (slot_a );
@@ -602,7 +541,6 @@ img_mgmt_state_read(struct smp_streamer *ctxt)
602541
603542 return ok ? MGMT_ERR_EOK : MGMT_ERR_EMSGSIZE ;
604543}
605- #endif /* !defined(CONFIG_MCUBOOT_BOOTLOADER_MODE_FIRMWARE_UPDATER) */
606544
607545static int img_mgmt_set_next_boot_slot_common (int slot , int active_slot , bool confirm )
608546{
0 commit comments