Modify the return value and the output of deviced-tools 39/273539/1
authorSangYoun Kwak <sy.kwak@samsung.com>
Thu, 7 Apr 2022 07:32:35 +0000 (16:32 +0900)
committerSangYoun Kwak <sy.kwak@samsung.com>
Thu, 7 Apr 2022 07:32:35 +0000 (16:32 +0900)
Change-Id: Ic9070e2062f17b109a09791d38948e0aa7c20da9
Signed-off-by: SangYoun Kwak <sy.kwak@samsung.com>
tools/board/clear-boot-mode.c
tools/board/clear-partition-ab-cloned.c
tools/board/get-boot-mode.c
tools/board/get-partition-ab-cloned.c
tools/board/get-upgrade-status.c
tools/board/set-boot-success.c
tools/board/set-partition-ab-cloned.c
tools/board/set-upgrade-status.c
tools/board/switch-partition.c

index 38075f9..7ae0704 100644 (file)
  *
  */
 
+#include <stdio.h>
 #include <hal/device/hal-board.h>
 
 int main(int argc, char *argv[])
 {
-       return hal_device_board_clear_boot_mode();
+       int ret = hal_device_board_clear_boot_mode();
+
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
 }
index 36425fa..6c4437d 100644 (file)
  *
  */
 
+#include <stdio.h>
 #include <hal/device/hal-board.h>
 
 int main(int argc, char *argv[])
 {
-       return hal_device_board_clear_partition_ab_cloned();
+       int ret = hal_device_board_clear_partition_ab_cloned();
+
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
 }
index 29ddde5..f72172c 100644 (file)
@@ -26,8 +26,12 @@ int main(int argc, char *argv[])
        int ret;
 
        ret = hal_device_board_get_boot_mode(buffer, sizeof(buffer));
-       if (ret == 0)
-               printf("%s", buffer);
 
-       return ret;
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("%s\n", buffer);
+       return 0;
 }
index fb55772..d843930 100644 (file)
@@ -26,8 +26,12 @@ int main(int argc, char *argv[])
        int ret;
 
        ret = hal_device_board_get_partition_ab_cloned(&cloned);
-       if (ret == 0)
-               printf("%d", cloned);
 
-       return ret;
+       if (ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("%d\n", cloned);
+       return 0;
 }
index bf3da64..f66ad36 100644 (file)
@@ -26,8 +26,12 @@ int main(int argc, char *argv[])
        int ret;
 
        ret = hal_device_board_get_upgrade_status(&status);
-       if (ret == 0)
-               printf("%d", status);
 
-       return ret;
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("%d\n", status);
+       return 0;
 }
index 16ec3a5..5146149 100644 (file)
  *
  */
 
+#include <stdio.h>
 #include <hal/device/hal-board.h>
 
 int main(int argc, char *argv[])
 {
-       return hal_device_board_set_boot_success();
+       int ret = hal_device_board_set_boot_success();
+
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
 }
index 7bbc906..941fe0d 100644 (file)
  *
  */
 
+#include <stdio.h>
 #include <hal/device/hal-board.h>
 
 int main(int argc, char *argv[])
 {
-       return hal_device_board_set_partition_ab_cloned();
+       int ret = hal_device_board_set_partition_ab_cloned();
+
+       if(ret < 0) {
+               printf("FAILURE\n");
+               return 1;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
 }
index d1a9fe1..5bd1fb1 100644 (file)
@@ -48,17 +48,28 @@ static int parse_integer(const char *str, int *val)
 int main(int argc, char *argv[])
 {
        int status;
-       int parse_ret;
+       int parse_ret, ret;
 
        if(argc < 2) {
-               return -EINVAL;
+               goto err;
        }
 
        parse_ret = parse_integer(argv[1], &status);
 
-       if(parse_ret != 0) {
-               return -EINVAL;
+       if(parse_ret < 0) {
+               goto err;
        }
 
-       return hal_device_board_set_upgrade_status(status);
+       ret = hal_device_board_set_upgrade_status(status);
+
+       if(ret < 0) {
+               goto err;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
+
+err:
+       printf("FAILURE\n");
+       return 1;
 }
index 69bf28a..973e4ac 100644 (file)
  *
  */
 
+#include <stdio.h>
 #include <errno.h>
 #include <hal/device/hal-board.h>
 
 int main(int argc, char *argv[])
 {
        char partition_ab;
+       int ret;
 
        if(argc < 2) {
-               return -EINVAL;
+               goto err;
        }
 
        partition_ab = argv[1][0];
        if(partition_ab != 'a' && partition_ab != 'b') {
-               return -EINVAL;
+               goto err;
        }
 
-       return hal_device_board_switch_partition(partition_ab);
+       ret = hal_device_board_switch_partition(partition_ab);
+
+       if(ret < 0) {
+               goto err;
+       }
+
+       printf("SUCCESS\n");
+       return 0;
+
+err:
+       printf("FAILURE\n");
+       return 1;
 }