From c19a7f264103ab64f164aa4c13a34db1b3de5dde Mon Sep 17 00:00:00 2001 From: peng Date: Thu, 4 Jan 2024 20:31:43 +0800 Subject: [PATCH 1/6] add MULTIMEDIA_MEDIA_AUDIOCODEC syscap Signed-off-by: peng --- include/codec_config/syscap_define.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/codec_config/syscap_define.h b/include/codec_config/syscap_define.h index 65cb79a..7884584 100755 --- a/include/codec_config/syscap_define.h +++ b/include/codec_config/syscap_define.h @@ -115,6 +115,7 @@ typedef enum SystemCapabilityNum { MULTIMEDIA_MEDIA_AUDIORECORDER, MULTIMEDIA_MEDIA_AUDIODECODER, MULTIMEDIA_MEDIA_AUDIOENCODER, + MULTIMEDIA_MEDIA_AUDIOCODEC, MULTIMEDIA_MEDIA_VIDEODECODER, MULTIMEDIA_MEDIA_VIDEOENCODER, MULTIMEDIA_MEDIA_CODECBASE, @@ -412,6 +413,7 @@ const static SyscapWithNum g_arraySyscap[] = { {"SystemCapability.Multimedia.Media.AudioRecorder", MULTIMEDIA_MEDIA_AUDIORECORDER}, {"SystemCapability.Multimedia.Media.AudioDecoder", MULTIMEDIA_MEDIA_AUDIODECODER}, {"SystemCapability.Multimedia.Media.AudioEncoder", MULTIMEDIA_MEDIA_AUDIOENCODER}, + {"SystemCapability.Multimedia.Media.AudioCodec", MULTIMEDIA_MEDIA_AUDIOCODEC}, {"SystemCapability.Multimedia.Media.VideoDecoder", MULTIMEDIA_MEDIA_VIDEODECODER}, {"SystemCapability.Multimedia.Media.VideoEncoder", MULTIMEDIA_MEDIA_VIDEOENCODER}, {"SystemCapability.Multimedia.Media.CodecBase", MULTIMEDIA_MEDIA_CODECBASE}, From d49edbe54ad7aa0113831c7894c78e3c48550748 Mon Sep 17 00:00:00 2001 From: peng Date: Fri, 5 Jan 2024 14:32:19 +0800 Subject: [PATCH 2/6] adjust the enum position Signed-off-by: peng --- include/codec_config/syscap_define.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/codec_config/syscap_define.h b/include/codec_config/syscap_define.h index 7884584..4264c4f 100755 --- a/include/codec_config/syscap_define.h +++ b/include/codec_config/syscap_define.h @@ -115,7 +115,6 @@ typedef enum SystemCapabilityNum { MULTIMEDIA_MEDIA_AUDIORECORDER, MULTIMEDIA_MEDIA_AUDIODECODER, MULTIMEDIA_MEDIA_AUDIOENCODER, - MULTIMEDIA_MEDIA_AUDIOCODEC, MULTIMEDIA_MEDIA_VIDEODECODER, MULTIMEDIA_MEDIA_VIDEOENCODER, MULTIMEDIA_MEDIA_CODECBASE, @@ -320,6 +319,7 @@ typedef enum SystemCapabilityNum { FILEMANAGEMENT_FILE_ENVIRONMENT_FOLDEROBTAIN, FILEMANAGEMENT_USERFILESERVICE_FOLDERSELECTION, FILEMANAGEMENT_APPFILESERVICE_FOLDERAUTHORIZATION, + MULTIMEDIA_MEDIA_AUDIOCODEC, // Add before here SYSCAP_BASIC_END = 500, } SyscapNum; From 2614a3faddf085a68c24684fdacc9736c2a1ca35 Mon Sep 17 00:00:00 2001 From: x30034819 Date: Tue, 9 Jan 2024 19:05:13 +0800 Subject: [PATCH 3/6] add graphics drawing syscap Signed-off-by: x30034819 Signed-off-by: x30034819 Change-Id: I224aa6bb2cf58bdc2aa2b1b7ee6a99ebf314db7f --- include/codec_config/syscap_define.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/codec_config/syscap_define.h b/include/codec_config/syscap_define.h index 4264c4f..083f693 100755 --- a/include/codec_config/syscap_define.h +++ b/include/codec_config/syscap_define.h @@ -320,6 +320,7 @@ typedef enum SystemCapabilityNum { FILEMANAGEMENT_USERFILESERVICE_FOLDERSELECTION, FILEMANAGEMENT_APPFILESERVICE_FOLDERAUTHORIZATION, MULTIMEDIA_MEDIA_AUDIOCODEC, + GRAPHICS_DRAWING, // Add before here SYSCAP_BASIC_END = 500, } SyscapNum; @@ -623,6 +624,7 @@ const static SyscapWithNum g_arraySyscap[] = { {"SystemCapability.FileManagement.UserFileService.FolderSelection", FILEMANAGEMENT_USERFILESERVICE_FOLDERSELECTION}, {"SystemCapability.FileManagement.AppFileService.FolderAuthorization", FILEMANAGEMENT_APPFILESERVICE_FOLDERAUTHORIZATION}, + {"SystemCapability.Graphics.Drawing", GRAPHICS_DRAWING}, }; #ifdef __cplusplus From 0b3a97a8e349540745697733cb7298ac311c0e57 Mon Sep 17 00:00:00 2001 From: lichao Date: Wed, 10 Jan 2024 15:15:37 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=8C=89=E7=85=A7=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- interfaces/inner_api/syscap_interface.c | 13 ++++++------- src/create_pcid.c | 2 +- src/syscap_tool.c | 1 + 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interfaces/inner_api/syscap_interface.c b/interfaces/inner_api/syscap_interface.c index 9fd163b..81ee2e8 100644 --- a/interfaces/inner_api/syscap_interface.c +++ b/interfaces/inner_api/syscap_interface.c @@ -327,7 +327,6 @@ static int32_t TransStringFormatAndSaveSyscap(struct FreeAfterDecodeRpcidInfo fr cJSON *sysCapArray, const char *inputFile) { // trans to string format - freeAfterDecodeRpcidInfo.sysCapDefine = CreateWholeSyscapJsonObj(); sysCapArray = cJSON_GetObjectItem(freeAfterDecodeRpcidInfo.rpcidRoot, "syscap"); if (sysCapArray == NULL || !cJSON_IsArray(sysCapArray)) { PRINT_ERR("Get syscap failed. Input file: %s\n", inputFile); @@ -404,6 +403,7 @@ static void PartSysCapAndOutBuffer(struct FreeAfterDecodeRpcidInfo freeAfterDeco uint16_t indexPri = 0; cJSON *cJsonTemp = NULL; + freeAfterDecodeRpcidInfo.sysCapDefine = CreateWholeSyscapJsonObj(); (void)memset_s(priSyscapArray, freeAfterDecodeRpcidInfo.sysCapArraySize * SINGLE_SYSCAP_LEN, 0, freeAfterDecodeRpcidInfo.sysCapArraySize * SINGLE_SYSCAP_LEN); freeAfterDecodeRpcidInfo.priSyscap = priSyscapArray; @@ -492,7 +492,6 @@ char *DecodeRpcidToStringFormat(const char *inputFile) PRINT_ERR("Prase rpcid to json failed. Input file: %s\n", inputFile); return FreeAfterDecodeRpcidToString(freeAfterDecodeRpcidInfo, FREE_RPCID_ROOT_AFTER_DECODE_RPCID, outBuffer); } - ret = TransStringFormatAndSaveSyscap(freeAfterDecodeRpcidInfo, sysCapArray, inputFile); if (ret == -1) { return FreeAfterDecodeRpcidToString(freeAfterDecodeRpcidInfo, FREE_WHOLE_SYSCAP_AFTER_DECODE_RPCID, outBuffer); @@ -533,7 +532,7 @@ static int32_t CopySyscopToRet(struct PcidPriSyscapInfo pcidPriSyscapInfo, const static int32_t CheckPcidEachBit(struct PcidPriSyscapInfo pcidPriSyscapInfo, CompareError *result, const size_t allSyscapNum, uint32_t i, uint32_t blockBits) { - int32_t flag = 0; + int32_t ret = 0; for (uint8_t k = 0; k < INT_BIT; k++) { if (blockBits & (1U << k)) { char *tempSyscap = (char *)malloc(sizeof(char) * SINGLE_SYSCAP_LEN); @@ -542,8 +541,8 @@ static int32_t CheckPcidEachBit(struct PcidPriSyscapInfo pcidPriSyscapInfo, Comp FreeCompareError(result); return -1; } - flag = CopySyscopToRet(pcidPriSyscapInfo, allSyscapNum, tempSyscap, i, k); - if (flag != EOK) { + ret = CopySyscopToRet(pcidPriSyscapInfo, allSyscapNum, tempSyscap, i, k); + if (ret != EOK) { PRINT_ERR("strcpy_s failed.\n"); FreeCompareError(result); return -1; @@ -551,11 +550,11 @@ static int32_t CheckPcidEachBit(struct PcidPriSyscapInfo pcidPriSyscapInfo, Comp result->syscap[pcidPriSyscapInfo.ossyscapFlag++] = tempSyscap; } } - return 0; + return ret; } static int32_t ComparePcidWithOsSyscap(struct PcidPriSyscapInfo pcidPriSyscapInfo, - uint32_t pcidOsAarry[PCID_OUT_BUFFER], uint32_t rpcidOsAarry[PCID_OUT_BUFFER], CompareError *result, + const uint32_t pcidOsAarry[PCID_OUT_BUFFER], const uint32_t rpcidOsAarry[PCID_OUT_BUFFER], CompareError *result, const size_t allSyscapNum) { uint32_t i; diff --git a/src/create_pcid.c b/src/create_pcid.c index 7ad15aa..cea4e57 100644 --- a/src/create_pcid.c +++ b/src/create_pcid.c @@ -384,7 +384,6 @@ int32_t GetPriSyscap(PCIDMain *pcidMain, cJSON *sysCapObject, size_t contextBufL static int32_t CheckSysCapObj(struct FreeDecodePcidJsonInfo freePcidJsonInfo, PCIDMain *pcidMain, uint32_t contextBufLen, int32_t ret) { - freePcidJsonInfo.flag = 0; if (freePcidJsonInfo.sysCapObj == NULL) { PRINT_ERR("cJSON_CreateObject failed\n"); freePcidJsonInfo.flag = -1; @@ -456,6 +455,7 @@ int32_t DecodePCID(char *inputFile, char *outDirPath) freePcidJsonInfo.contextBuffer = NULL; freePcidJsonInfo.jsonRootObj = NULL; freePcidJsonInfo.sysCapObj = NULL; + freePcidJsonInfo.flag = 0; ret = GetFileContext(inputFile, &freePcidJsonInfo.contextBuffer, (uint32_t *)&contextBufLen); if (ret != 0) { diff --git a/src/syscap_tool.c b/src/syscap_tool.c index cf66e7d..323c6b8 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -450,6 +450,7 @@ int32_t EncodeRpcidscToString(char *inputFile, char *outDirPath) freeAfterEncodeRpcidscInfo.osSysCapIndex = NULL; freeAfterEncodeRpcidscInfo.sysCapDefine = NULL; freeAfterEncodeRpcidscInfo.rpcidRoot = NULL; + freeAfterEncodeRpcidscInfo.outBuffer =NULL; freeAfterEncodeRpcidscInfo.contextBuffer = NULL; freeAfterEncodeRpcidscInfo.type = 0; freeAfterEncodeRpcidscInfo.flag = 0; From b801e8c84cd2910cfe9f133e32b2ce0814db2a9b Mon Sep 17 00:00:00 2001 From: lichao Date: Wed, 10 Jan 2024 15:43:46 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=8C=89=E7=85=A7=E7=BC=96=E7=A0=81?= =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lichao --- src/syscap_tool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscap_tool.c b/src/syscap_tool.c index 323c6b8..ff4e084 100644 --- a/src/syscap_tool.c +++ b/src/syscap_tool.c @@ -450,7 +450,7 @@ int32_t EncodeRpcidscToString(char *inputFile, char *outDirPath) freeAfterEncodeRpcidscInfo.osSysCapIndex = NULL; freeAfterEncodeRpcidscInfo.sysCapDefine = NULL; freeAfterEncodeRpcidscInfo.rpcidRoot = NULL; - freeAfterEncodeRpcidscInfo.outBuffer =NULL; + freeAfterEncodeRpcidscInfo.outBuffer = NULL; freeAfterEncodeRpcidscInfo.contextBuffer = NULL; freeAfterEncodeRpcidscInfo.type = 0; freeAfterEncodeRpcidscInfo.flag = 0; From fa0d82473ffe901acc79dbe5f14e38bbf1e53699 Mon Sep 17 00:00:00 2001 From: cuican Date: Fri, 12 Jan 2024 11:06:49 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=88=9B?= =?UTF-8?q?=E5=BB=BAmkdir=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cuican --- tools/syscap_collector.py | 42 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/tools/syscap_collector.py b/tools/syscap_collector.py index 0902dda..ea00085 100755 --- a/tools/syscap_collector.py +++ b/tools/syscap_collector.py @@ -33,6 +33,12 @@ def get_args(): def dict_to_json(output_path: str, syscaps_dict: dict): + """ + output diff product syscaps json to output path + :param output_path: + :param syscaps_dict: + :return: + """ print("start generate syscap json...") flags = os.O_WRONLY | os.O_CREAT modes = stat.S_IWUSR | stat.S_IRUSR @@ -52,6 +58,12 @@ def check_syscap(syscap_str: str): def bundle_syscap_list_handler(bundle_syscap_list: list, component_syscaps_list: list): + """ + check syscap + :param bundle_syscap_list: + :param component_syscaps_list: + :return: + """ for component_syscap in component_syscaps_list: component_syscap = check_syscap(component_syscap) if component_syscap: @@ -92,6 +104,11 @@ def path_component_to_bundle(path: str) -> str: def handle_bundle_json_file(component_path_dict: dict): + """ + from product required part bundle.json to all products parts list + :param component_path_dict: + :return: all products parts list + """ print("start collect syscap path...") syscap_dict = dict() errors_list = list() @@ -130,6 +147,13 @@ def traversal_path(parts_path_info: dict, project_path: str, product_define_dict def collect_all_product_component_syscap_dict(parts_path_info: dict, project_path: str, product_define_dict): + """ + get all syscap to dict + :param parts_path_info: + :param project_path: + :param product_define_dict: + :return: + """ if parts_path_info: print("start collect component path...") component_path_dict = traversal_path(parts_path_info, project_path, product_define_dict) @@ -140,6 +164,12 @@ def collect_all_product_component_syscap_dict(parts_path_info: dict, project_pat def get_subsystem_info(subsystem_config_file, source_root_dir): + """ + get subsystem name and subsystem path from oh/build/subsystem_config.json + :param subsystem_config_file: subsystem_config_file path + :param source_root_dir: oh project path + :return: subsystem name and subsystem path + """ subsystem_configs = scan(subsystem_config_file, source_root_dir) _all_components_path = [] for _, value in subsystem_configs.get('subsystem').items(): @@ -226,7 +256,7 @@ def scan(subsystem_config_file, source_root_dir): 'source_path': source_root_dir, 'subsystem': _build_configs, } - print('subsytem config scan completed') + print('subsystem config scan completed') return scan_result @@ -376,7 +406,12 @@ class LoadBuildConfig(object): def get_parts_info(source_root_dir, subsystem_info, build_xts=False): - """parts info, get info from build config file. + """ + get parts path info from subsystem info + :param source_root_dir: oh project path + :param subsystem_info: + :param build_xts: + :return: parts path info """ _phony_target = {} _parts_path_info = {} @@ -458,8 +493,9 @@ def get_product_define_dict(source_root_dir): def output_path_handler(project_path): output_path = os.path.join(project_path, 'interface', 'sdk-js', 'api', 'device-define-common') folder = os.path.exists(output_path) + # 多线程创建文件夹问题 if not folder: - os.mkdir(output_path) + os.makedirs(output_path, exist_ok=True) return output_path