1# Copyright (c) 2021 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("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") 16import("//drivers/peripheral/usb/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 "host/include", 30 "//drivers/peripheral/usb/interfaces/ddk/common", 31 "//drivers/peripheral/usb/interfaces/ddk/device", 32 "//drivers/peripheral/usb/interfaces/ddk/host", 33 ] 34 sources = [ 35 "host/src/linux_adapter.c", 36 "host/src/usb_interface_pool.c", 37 "host/src/usb_io_manage.c", 38 "host/src/usb_protocol.c", 39 "host/src/usb_raw_api.c", 40 "host/src/usb_raw_api_library.c", 41 ] 42 43 if (drivers_peripheral_usb_feature_linux_native_model) { 44 if (defined(defines)) { 45 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 46 } else { 47 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 48 } 49 } 50 51 if (is_standard_system) { 52 external_deps = [ 53 "c_utils:utils", 54 "hdf_core:libhdf_host", 55 "hdf_core:libhdf_utils", 56 "hiviewdfx_hilog_native:libhilog", 57 ] 58 } else { 59 external_deps = [ "hilog:libhilog" ] 60 } 61 62 install_images = [ chipset_base_dir ] 63 subsystem_name = "hdf" 64 part_name = "drivers_peripheral_usb" 65} 66 67ohos_shared_library("libusb_pnp_manager") { 68 include_dirs = [ 69 "$hdf_framework_path/model/usb/include", 70 "host/include", 71 "device/include", 72 default_config_path, 73 ] 74 sources = [ 75 "$hdf_framework_path/model/usb/src/usb_ddk_pnp_loader.c", 76 "device/src/usbfn_uevent_handle.c", 77 "host/src/ddk_device_manager.c", 78 "host/src/ddk_pnp_listener_mgr.c", 79 "host/src/ddk_sysfs_device.c", 80 "host/src/ddk_uevent_handle.c", 81 "host/src/usb_pnp_manager.c", 82 ] 83 84 if (drivers_peripheral_usb_feature_linux_native_model) { 85 if (defined(defines)) { 86 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 87 } else { 88 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 89 } 90 } 91 92 if (is_standard_system) { 93 external_deps = [ 94 "c_utils:utils", 95 "hdf_core:libhdf_host", 96 "hdf_core:libhdf_utils", 97 "hiviewdfx_hilog_native:libhilog", 98 ] 99 } else { 100 external_deps = [ "hilog:libhilog" ] 101 } 102 103 install_images = [ chipset_base_dir ] 104 subsystem_name = "hdf" 105 part_name = "drivers_peripheral_usb" 106} 107 108ohos_shared_library("libusb_ddk_device") { 109 include_dirs = [ 110 "device/include", 111 "host/include", 112 "//drivers/peripheral/usb/interfaces/ddk/common", 113 "//drivers/peripheral/usb/interfaces/ddk/device", 114 "//drivers/peripheral/usb/interfaces/ddk/host", 115 ] 116 117 sources = [ 118 "device/src/adapter_if.c", 119 "device/src/usbfn_cfg_mgr.c", 120 "device/src/usbfn_dev_mgr.c", 121 "device/src/usbfn_io_mgr.c", 122 "device/src/usbfn_sdk_if.c", 123 ] 124 125 if (is_standard_system) { 126 external_deps = [ 127 "c_utils:utils", 128 "hdf_core:libhdf_utils", 129 "hiviewdfx_hilog_native:libhilog", 130 ] 131 } else { 132 external_deps = [ "hilog:libhilog" ] 133 } 134 135 if (drivers_peripheral_usb_feature_linux_native_model) { 136 if (defined(defines)) { 137 defines += [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 138 } else { 139 defines = [ "USB_EVENT_NOTIFY_LINUX_NATIVE_MODE" ] 140 } 141 } 142 143 install_images = [ chipset_base_dir ] 144 subsystem_name = "hdf" 145 part_name = "drivers_peripheral_usb" 146} 147