blob: d3861e2a5c339097ccff5d3c797c5627543aed86 [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.liu9f91db32025-02-13 11:24:18 +08003
b.liuf678f992024-05-08 15:23:10 +08004#include "mbtk_device.h"
b.liu9e8584b2024-11-06 19:21:28 +08005#include "mbtk_utils.h"
6#if 0
b.liuf678f992024-05-08 15:23:10 +08007static char* band_2_str(mbtk_modem_band_area_enum band_area)
8{
9 switch(band_area)
10 {
11 case MBTK_MODEM_BAND_AREA_CN:
12 return "CN";
13 case MBTK_MODEM_BAND_AREA_EU:
14 return "EU";
15 default:
16 return "ALL";
17 }
18}
b.liu9e8584b2024-11-06 19:21:28 +080019#endif
b.liuf678f992024-05-08 15:23:10 +080020
21static void help()
22{
23 printf("mbtk_reboot [download]\n");
24}
25
26int main(int argc, char *argv[])
27{
28 if(argc == 1) {
b.liu9e8584b2024-11-06 19:21:28 +080029 mbtk_system("reboot -f");
b.liuf678f992024-05-08 15:23:10 +080030 } else if(argc == 2) {
31 if(strcmp(argv[1], "download")) {
32 help();
33 return 0;
34 }
35 } else {
36 help();
37 return 0;
38 }
39
40 mbtk_device_info_basic_t info_basic;
41 memset(&info_basic, 0, sizeof(mbtk_device_info_basic_t));
42 int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
43 if(result) {
44 printf("mbtk_dev_info_read(BASIC) fail.\n");
45 return -1;
46 }
47
b.liub7530d22025-06-16 19:49:05 +080048 if(info_basic.version == DEV_INFO_VERSION_V1) {
49 info_basic.basic.v1.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD;
50 } else {
51 info_basic.basic.v2.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD;
52 }
b.liuf678f992024-05-08 15:23:10 +080053 result = mbtk_dev_info_write(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
54 if(result) {
55 printf("mbtk_dev_info_write(BASIC) fail.\n");
56 return -1;
57 }
58
b.liu9e8584b2024-11-06 19:21:28 +080059 mbtk_system("sync");
60 mbtk_system("reboot -f");
b.liuf678f992024-05-08 15:23:10 +080061
62 return 0;
63}
64
65