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