blob: 3263d739023c10e8be6b85b706f36162b16d3b65 [file] [log] [blame]
b.liuf678f992024-05-08 15:23:10 +08001#include "mbtk_type.h"
2#include "mbtk_device.h"
3
4static char* band_2_str(mbtk_modem_band_area_enum band_area)
5{
6 switch(band_area)
7 {
8 case MBTK_MODEM_BAND_AREA_CN:
9 return "CN";
10 case MBTK_MODEM_BAND_AREA_EU:
11 return "EU";
12 default:
13 return "ALL";
14 }
15}
16
17static void help()
18{
19 printf("mbtk_reboot [download]\n");
20}
21
22int main(int argc, char *argv[])
23{
24 if(argc == 1) {
25 system("reboot -f");
26 } else if(argc == 2) {
27 if(strcmp(argv[1], "download")) {
28 help();
29 return 0;
30 }
31 } else {
32 help();
33 return 0;
34 }
35
36 mbtk_device_info_basic_t info_basic;
37 memset(&info_basic, 0, sizeof(mbtk_device_info_basic_t));
38 int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
39 if(result) {
40 printf("mbtk_dev_info_read(BASIC) fail.\n");
41 return -1;
42 }
43
44 info_basic.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD;
45 result = mbtk_dev_info_write(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
46 if(result) {
47 printf("mbtk_dev_info_write(BASIC) fail.\n");
48 return -1;
49 }
50
51 system("sync");
52 system("reboot -f");
53
54 return 0;
55}
56
57