| #include <string.h> |
| #include "mbtk_type.h" |
| #include "mbtk_device.h" |
| #include "mbtk_utils.h" |
| #if 0 |
| static char* band_2_str(mbtk_modem_band_area_enum band_area) |
| { |
| switch(band_area) |
| { |
| case MBTK_MODEM_BAND_AREA_CN: |
| return "CN"; |
| case MBTK_MODEM_BAND_AREA_EU: |
| return "EU"; |
| default: |
| return "ALL"; |
| } |
| } |
| #endif |
| |
| static void help() |
| { |
| printf("mbtk_reboot [download]\n"); |
| } |
| |
| int main(int argc, char *argv[]) |
| { |
| if(argc == 1) { |
| mbtk_system("reboot -f"); |
| } else if(argc == 2) { |
| if(strcmp(argv[1], "download")) { |
| help(); |
| return 0; |
| } |
| } else { |
| help(); |
| return 0; |
| } |
| |
| mbtk_device_info_basic_t info_basic; |
| memset(&info_basic, 0, sizeof(mbtk_device_info_basic_t)); |
| int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t)); |
| if(result) { |
| printf("mbtk_dev_info_read(BASIC) fail.\n"); |
| return -1; |
| } |
| |
| info_basic.reboot_flag = MBTK_REBOOT_FLAG_DOWNLOAD; |
| result = mbtk_dev_info_write(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t)); |
| if(result) { |
| printf("mbtk_dev_info_write(BASIC) fail.\n"); |
| return -1; |
| } |
| |
| mbtk_system("sync"); |
| mbtk_system("reboot -f"); |
| |
| return 0; |
| } |
| |
| |