blob: 3a85294a7af89d97956a05bf5e7f3a0e398ed975 [file] [log] [blame]
b.liu9e8584b2024-11-06 19:21:28 +08001#include <string.h>
b.liuf678f992024-05-08 15:23:10 +08002#include "mbtk_type.h"
b.liu472cfaf2024-12-19 19:08:19 +08003#ifdef MBTK_DEV_INFO_VERSION_2
4#include "mbtk_device_v2.h"
5#else
b.liuf678f992024-05-08 15:23:10 +08006#include "mbtk_device.h"
b.liu472cfaf2024-12-19 19:08:19 +08007#endif
b.liu9e8584b2024-11-06 19:21:28 +08008#include "mbtk_utils.h"
9#if 0
b.liuf678f992024-05-08 15:23:10 +080010static char* band_2_str(mbtk_modem_band_area_enum band_area)
11{
12 switch(band_area)
13 {
14 case MBTK_MODEM_BAND_AREA_CN:
15 return "CN";
16 case MBTK_MODEM_BAND_AREA_EU:
17 return "EU";
18 default:
19 return "ALL";
20 }
21}
b.liu9e8584b2024-11-06 19:21:28 +080022#endif
b.liuf678f992024-05-08 15:23:10 +080023
24static void help()
25{
26 printf("mbtk_reboot [download]\n");
27}
28
29int main(int argc, char *argv[])
30{
31 if(argc == 1) {
b.liu9e8584b2024-11-06 19:21:28 +080032 mbtk_system("reboot -f");
b.liuf678f992024-05-08 15:23:10 +080033 } else if(argc == 2) {
34 if(strcmp(argv[1], "download")) {
35 help();
36 return 0;
37 }
38 } else {
39 help();
40 return 0;
41 }
42
43 mbtk_device_info_basic_t info_basic;
44 memset(&info_basic, 0, sizeof(mbtk_device_info_basic_t));
45 int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
46 if(result) {
47 printf("mbtk_dev_info_read(BASIC) fail.\n");
48 return -1;
49 }
50
51 info_basic.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD;
52 result = mbtk_dev_info_write(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
53 if(result) {
54 printf("mbtk_dev_info_write(BASIC) fail.\n");
55 return -1;
56 }
57
b.liu9e8584b2024-11-06 19:21:28 +080058 mbtk_system("sync");
59 mbtk_system("reboot -f");
b.liuf678f992024-05-08 15:23:10 +080060
61 return 0;
62}
63
64