1# Copyright (c) 2021-2023 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("./../../../hdf_core/adapter/uhdf2/uhdf.gni") 16import("./../usb.gni") 17 18group("libusb_core") { 19 deps = [ 20 ":libusb_ddk_device", 21 ":libusb_ddk_host", 22 ":libusb_pnp_manager", 23 ] 24} 25 26ohos_shared_library("libusb_ddk_host") { 27 include_dirs = [ 28 "device/include", 29 "$hdf_framework_path/model/usb/include", 30 "host/include", 31 "./../interfaces/ddk/common", 32 "./../interfaces/ddk/device", 33 "./../interfaces/ddk/host", 34 ] 35 sources = [ 36 "host/src/linux_adapter.c", 37 "host/src/usb_interface_pool.c", 38 "host/src/usb_io_manage.c", 39 "host/src/usb_protocol.c", 40 "host/src/usb_raw_api.c", 41 "host/src/usb_raw_api_library.c", 42 ] 43 44 if (drivers_peripheral_usb_feature_linux_native_model) { 45 if (defined(defines)) { 46 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 47 } else { 48 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 49 } 50 } 51 52 if (is_standard_system) { 53 external_deps = [ 54 "c_utils:utils", 55 "hdf_core:libhdf_host", 56 "hdf_core:libhdf_utils", 57 "hilog:libhilog", 58 ] 59 } else { 60 external_deps = [ "hilog:libhilog" ] 61 } 62 63 install_images = [ chipset_base_dir ] 64 subsystem_name = "hdf" 65 part_name = "drivers_peripheral_usb" 66} 67 68ohos_shared_library("libusb_pnp_manager") { 69 include_dirs = [ 70 "$hdf_framework_path/model/usb/include", 71 "host/include", 72 "device/include", 73 ] 74 sources = [ 75 "$hdf_framework_path/model/usb/src/usb_ddk_pnp_loader.c", 76 "$hdf_framework_path/model/usb/src/usb_wrapper.cpp", 77 "device/src/usbfn_uevent_handle.c", 78 "host/src/ddk_device_manager.c", 79 "host/src/ddk_pnp_listener_mgr.c", 80 "host/src/ddk_sysfs_device.c", 81 "host/src/ddk_uevent_handle.c", 82 "host/src/usb_pnp_manager.c", 83 ] 84 85 if (drivers_peripheral_usb_feature_linux_native_model) { 86 if (defined(defines)) { 87 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 88 } else { 89 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 90 } 91 } 92 93 if (is_standard_system) { 94 external_deps = [ 95 "c_utils:utils", 96 "hdf_core:libhdf_host", 97 "hdf_core:libhdf_utils", 98 "hilog:libhilog", 99 "hisysevent:libhisysevent", 100 ] 101 } else { 102 external_deps = [ "hilog:libhilog" ] 103 } 104 105 install_images = [ chipset_base_dir ] 106 subsystem_name = "hdf" 107 part_name = "drivers_peripheral_usb" 108} 109 110ohos_shared_library("libusb_ddk_device") { 111 include_dirs = [ 112 "device/include", 113 "host/include", 114 "./../interfaces/ddk/common", 115 "./../interfaces/ddk/device", 116 "./../interfaces/ddk/host", 117 ] 118 119 sources = [ 120 "device/src/adapter_if.c", 121 "device/src/usbfn_cfg_mgr.c", 122 "device/src/usbfn_dev_mgr.c", 123 "device/src/usbfn_io_mgr.c", 124 "device/src/usbfn_sdk_if.c", 125 ] 126 127 if (is_standard_system) { 128 external_deps = [ 129 "c_utils:utils", 130 "hdf_core:libhdf_utils", 131 "hilog:libhilog", 132 ] 133 } else { 134 external_deps = [ "hilog:libhilog" ] 135 } 136 137 if (drivers_peripheral_usb_feature_linux_native_model) { 138 if (defined(defines)) { 139 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 140 } else { 141 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 142 } 143 } 144 145 install_images = [ chipset_base_dir ] 146 subsystem_name = "hdf" 147 part_name = "drivers_peripheral_usb" 148} 149