1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "display_dump_disp.h"
17
18 #include <string>
19 #include <securec.h>
20 #include <cstdio>
21 #include <dlfcn.h>
22
23 #include "devhost_dump_reg.h"
24 #include "hdf_base.h"
25 #include "hdf_log.h"
26
27 #define HDF_LOG_TAG uhdf_composer_host
28
29 namespace OHOS {
30 namespace HDI {
31 namespace Display {
32 namespace Composer {
33 namespace V1_0 {
34
35 using namespace OHOS::HDI::Display::Composer::V1_0;
36
37 const char *g_dispComposerDumpHelp =
38 " Get Display Dump Info options:\n"
39 " -cmd: operate display dump, not support\n";
40
ShowDumpMenu(struct HdfSBuf * reply)41 int32_t DisplayDumper::ShowDumpMenu(struct HdfSBuf *reply)
42 {
43 if (reply != nullptr) {
44 (void)HdfSbufWriteString(reply, g_dispComposerDumpHelp);
45 return HDF_SUCCESS;
46 } else {
47 return HDF_FAILURE;
48 }
49 }
50
ComposerHostDumpProcess(struct HdfSBuf * data,struct HdfSBuf * reply,uint32_t argsNum)51 int32_t DisplayDumper::ComposerHostDumpProcess(struct HdfSBuf *data, struct HdfSBuf *reply, uint32_t argsNum)
52 {
53 int32_t ret = ShowDumpMenu(reply);
54 if (ret != HDF_SUCCESS) {
55 HDF_LOGE("%{public}s: get composer display dump failed", __func__);
56 return HDF_FAILURE;
57 }
58
59 return HDF_SUCCESS;
60 }
61 } //namespace V1_0
62 } //namespace Composer
63 } //namespace Display
64 } //namespace HDI
65 } //namespace OHOS