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("./../usbmgr.gni") 15 16config("usbsrv_private_config") { 17 include_dirs = [ "${usb_manager_path}/interfaces/innerkits/native/include" ] 18} 19 20config("usbsrv_public_config") { 21 include_dirs = [ 22 "native/include", 23 "${usb_manager_path}/services/zidl/include", 24 "${usb_manager_path}/utils/native/include", 25 ] 26} 27 28ohos_shared_library("usbservice") { 29 sanitize = { 30 integer_overflow = true 31 ubsan = true 32 boundary_sanitize = true 33 cfi = true 34 cfi_cross_dso = true 35 debug = false 36 } 37 branch_protector_ret = "pac_ret" 38 39 install_enable = true 40 sources = [ 41 "${usb_manager_path}/services/zidl/src/usb_srv_stub.cpp", 42 "native/src/usb_descriptor_parser.cpp", 43 "native/src/usb_device_manager.cpp", 44 "native/src/usb_function_switch_window.cpp", 45 "native/src/usb_host_manager.cpp", 46 "native/src/usb_port_manager.cpp", 47 "native/src/usb_report_sys_event.cpp", 48 "native/src/usb_right_database.cpp", 49 "native/src/usb_right_db_helper.cpp", 50 "native/src/usb_right_manager.cpp", 51 "native/src/usb_serial_reader.cpp", 52 "native/src/usb_service.cpp", 53 "native/src/usb_service_subscriber.cpp", 54 "native/src/usbd_bulkcallback_impl.cpp", 55 ] 56 57 if (distributed_notification_enable) { 58 sources += [ "native/src/usb_mass_storage_notification.cpp" ] 59 } 60 61 configs = [ 62 "${utils_path}:utils_config", 63 ":usbsrv_private_config", 64 ] 65 66 public_configs = [ ":usbsrv_public_config" ] 67 68 defines = [] 69 70 external_deps = [ 71 "ability_base:base", 72 "ability_base:want", 73 "ability_base:zuri", 74 "ability_runtime:ability_connect_callback_stub", 75 "ability_runtime:ability_manager", 76 "ability_runtime:wantagent_innerkits", 77 "access_token:libaccesstoken_sdk", 78 "access_token:libtokenid_sdk", 79 "bundle_framework:appexecfwk_base", 80 "bundle_framework:appexecfwk_core", 81 "cJSON:cjson", 82 "c_utils:utils", 83 "common_event_service:cesfwk_innerkits", 84 "drivers_interface_usb:libusb_proxy_1.1", 85 "drivers_peripheral_usb:libusb_interface_service_1.1", 86 "hilog:libhilog", 87 "hisysevent:libhisysevent", 88 "hitrace:hitrace_meter", 89 "init:libbegetutil", 90 "ipc:ipc_single", 91 "memmgr:memmgrclient", 92 "napi:ace_napi", 93 "os_account:os_account_innerkits", 94 "relational_store:native_rdb", 95 "safwk:system_ability_fwk", 96 "samgr:samgr_proxy", 97 ] 98 99 if (distributed_notification_enable) { 100 external_deps += [ 101 "distributed_notification_service:ans_innerkits", 102 "i18n:intl_util", 103 "resource_management:global_resmgr", 104 ] 105 defines += [ "USB_NOTIFICATION_ENABLE" ] 106 } 107 108 if (usb_manager_feature_pop_up_func_switch_model) { 109 defines += [ "USB_FUNC_SWITCH_MODE" ] 110 } 111 shlib_type = "sa" 112 version_script = "usbservice.map" 113 subsystem_name = "usb" 114 part_name = "usb_manager" 115} 116 117ohos_prebuilt_etc("usb_service.init") { 118 source = "usb_service.cfg" 119 relative_install_dir = "init" 120 subsystem_name = "usb" 121 part_name = "usb_manager" 122} 123