From 156c4ef8b2bb74b41112fc29a3e6b9da095589ef Mon Sep 17 00:00:00 2001 From: andy <1414772332@qq.com> Date: Fri, 8 Nov 2024 15:30:40 +0800 Subject: [PATCH] =?UTF-8?q?oem=5Ftool=20=E6=B7=BB=E5=8A=A0=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E8=AF=AD=E6=B3=95=E9=94=99=E8=AF=AF=E7=9A=84=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mfgtool/oem_tool/hw3/oem_tool_hw.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/mfgtool/oem_tool/hw3/oem_tool_hw.c b/mfgtool/oem_tool/hw3/oem_tool_hw.c index 57dbb12..7795373 100644 --- a/mfgtool/oem_tool/hw3/oem_tool_hw.c +++ b/mfgtool/oem_tool/hw3/oem_tool_hw.c @@ -925,6 +925,13 @@ uint8_t get_detail_info(char *buf, uint8_t category) str_ptr[1] = strtok(NULL, split_str); str_ptr[2] = strtok(NULL, split_str); + if (!str_ptr[0]) { + die("unresolvable string '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num); + } + if (!str_ptr[1]) { + die("missing second parameter '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num); + } + /* special category */ if (category == CATEGORY_GENERAL) { if (!strcmp(str_ptr[0], "bid")) { @@ -941,6 +948,8 @@ uint8_t get_detail_info(char *buf, uint8_t category) } else if (!strcmp(str_ptr[0], "fver")) { // ? oemcfg.board_cfg_ver = atoi(str_ptr[1]); + } else { + die("unknown keyword with '%s' in %s, line:%d\n", str_ptr[1], g_category_string[category], oem_tool.line_num); } return 0; } else if (category == CATEGORY_RC_HDR) { @@ -975,6 +984,8 @@ uint8_t get_detail_info(char *buf, uint8_t category) (uint8_t *)oem_tool.rc_list[i] + len_hdr, sizeof(iot_board_info_v1_t) - len_hdr); } + } else { + die("unknown keyword with '%s' in %s, line:%d\n", str_ptr[1], g_category_string[category], oem_tool.line_num); } return 0; } @@ -995,7 +1006,11 @@ uint8_t get_detail_info(char *buf, uint8_t category) // 配置gpio uint8_t number = atoi(str_ptr[0]); uint8_t core = atoi(str_ptr[1]); - uint8_t purpose = atoi(str_ptr[2]); + uint8_t purpose = 255; + if (!str_ptr[2]) { + die("missing third parameter '%s' in %s, line:%d\n", buf, g_category_string[category], oem_tool.line_num); + } + purpose = atoi(str_ptr[2]); rc_quantity_boundary_check(category, number); set_peripheral_allot(category, number, core, purpose); oem_tool.rc.device_last = number;