1 /* 2 * Copyright (c) 2021 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 "hdi_device_interface.h" 17 #include <vector> 18 #include "display_common.h" 19 #include "drm_device.h" 20 21 namespace OHOS { 22 namespace HDI { 23 namespace DISPLAY { DiscoveryDevice()24std::vector<std::shared_ptr<HdiDeviceInterface>> HdiDeviceInterface::DiscoveryDevice() 25 { 26 DISPLAY_DEBUGLOG(); 27 int ret; 28 std::vector<std::shared_ptr<HdiDeviceInterface>> devices; 29 std::shared_ptr<HdiDeviceInterface> drmDevice = DrmDevice::Create(); 30 if (!drmDevice) { 31 DISPLAY_LOGE("can not create drm device"); 32 } 33 ret = drmDevice->Init(); 34 if (ret == DISPLAY_SUCCESS) { 35 DISPLAY_DEBUGLOG("drm device init success"); 36 devices.push_back(std::move(drmDevice)); 37 } else { 38 DISPLAY_LOGE("drm device init failed"); 39 } 40 return devices; 41 } 42 } 43 } 44 }