blob: d6be21734a9d54d4c99b67ac640686e3e0581ce1 [file]
# Copyright 2019 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/bind/bind.gni")
import("//build/components.gni")
import("//build/drivers.gni")
import("//build/test.gni")
driver_bind_rules("usb_hid_bind") {
rules = "usb_hid.bind"
header_output = "usb_hid-bind.h"
bind_output = "usb-hid.bindbc"
tests = "usb_hid_bind_tests.json"
deps = [ "//src/devices/bind/fuchsia.usb" ]
}
driver_bind_rules("one_endpoint_hid_bind") {
rules = "function/one_endpoint_hid.bind"
header_output = "function/one_endpoint_hid-bind.h"
tests = "function/one_endpoint_hid_bind_tests.json"
deps = [
"//src/devices/bind/fuchsia.usb",
"//src/ui/input/drivers/usb-hid/fuchsia.usb.hid.bind:fuchsia.usb.hid.test",
]
}
driver_bind_rules("two_endpoint_hid_bind") {
rules = "function/two_endpoint_hid.bind"
header_output = "function/two_endpoint_hid-bind.h"
tests = "function/two_endpoint_hid_bind_tests.json"
deps = [
"//src/devices/bind/fuchsia.usb",
"//src/ui/input/drivers/usb-hid/fuchsia.usb.hid.bind:fuchsia.usb.hid.test",
]
}
fuchsia_driver("usb-hid-driver") {
output_name = "usb-hid"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [ "usb-hid.cc" ]
deps = [
":usb_hid_bind",
"//sdk/banjo/fuchsia.hardware.hidbus:fuchsia.hardware.hidbus_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.composite:fuchsia.hardware.usb.composite_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp",
"//src/devices/lib/driver",
"//src/devices/usb/lib/usb",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/pretty",
"//zircon/system/ulib/sync",
]
}
fuchsia_driver_component("usb-hid") {
component_name = "usb-hid"
deps = [ ":usb-hid-driver" ]
info = "usb-hid-info.json"
colocate = true
}
fuchsia_driver("usb-one-endpoint-hid-fake-usb-driver") {
output_name = "usb-one-endpoint-hid-fake-usb"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [ "function/one-endpoint-hid-function.cc" ]
deps = [
":one_endpoint_hid_bind",
"//sdk/banjo/fuchsia.hardware.hidbus:fuchsia.hardware.hidbus_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp",
"//sdk/lib/fit",
"//src/devices/lib/driver",
"//src/devices/usb/lib/usb",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/hid",
"//zircon/system/ulib/sync",
"//zircon/system/ulib/zircon-internal",
]
}
fuchsia_driver_component("usb-one-endpoint-hid-fake-usb") {
component_name = "usb-one-endpoint-hid-fake-usb"
deps = [ ":usb-one-endpoint-hid-fake-usb-driver" ]
info = "usb-one-endpoint-hid-fake-usb-info.json"
colocate = true
}
fuchsia_driver("usb-two-endpoint-hid-fake-usb-driver") {
output_name = "usb-two-endpoint-hid-fake-usb"
configs += [
"//build/config:all_source",
"//build/config/fuchsia:enable_zircon_asserts",
]
sources = [ "function/two-endpoint-hid-function.cc" ]
deps = [
":two_endpoint_hid_bind",
"//sdk/banjo/fuchsia.hardware.hidbus:fuchsia.hardware.hidbus_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb:fuchsia.hardware.usb_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.function:fuchsia.hardware.usb.function_banjo_cpp",
"//sdk/banjo/fuchsia.hardware.usb.request:fuchsia.hardware.usb.request_banjo_cpp",
"//sdk/lib/fit",
"//src/devices/lib/driver",
"//src/devices/usb/lib/usb",
"//src/lib/ddk",
"//src/lib/ddktl",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/hid",
"//zircon/system/ulib/sync",
"//zircon/system/ulib/zircon-internal",
]
}
fuchsia_driver_component("usb-two-endpoint-hid-fake-usb") {
component_name = "usb-two-endpoint-hid-fake-usb"
deps = [ ":usb-two-endpoint-hid-fake-usb-driver" ]
info = "usb-two-endpoint-hid-fake-usb-info.json"
colocate = true
}
group("fake") {
deps = [
":usb-one-endpoint-hid-fake-usb",
":usb-two-endpoint-hid-fake-usb",
]
}
test("usb-hid-test") {
sources = [ "usb-hid-test.cc" ]
deps = [
"//sdk/fidl/fuchsia.device:fuchsia.device_llcpp",
"//sdk/fidl/fuchsia.hardware.input:fuchsia.hardware.input_llcpp",
"//sdk/fidl/fuchsia.hardware.usb.peripheral:fuchsia.hardware.usb.peripheral_llcpp",
"//sdk/fidl/fuchsia.hardware.usb.virtual.bus:fuchsia.hardware.usb.virtual.bus_llcpp",
"//sdk/lib/fdio",
"//src/lib/ddk",
"//zircon/system/ulib/fbl",
"//zircon/system/ulib/hid",
"//zircon/system/ulib/usb-virtual-bus-launcher",
"//zircon/system/ulib/zx",
"//zircon/system/ulib/zxtest",
]
# TODO(fxbug.dev/69585): This target uses raw zx::channel with LLCPP which is deprecated.
# Please migrate to typed channel APIs (fidl::ClientEnd<T>, fidl::ServerEnd<T>).
# See linked bug for details.
configs += [ "//build/cpp:fidl-llcpp-deprecated-raw-channels" ]
}
fuchsia_unittest_package("usb-hid-test-package") {
package_name = "usb-hid-test"
deps = [
":fake",
":usb-hid",
":usb-hid-test",
"//src/devices/board/drivers/integration-test",
"//src/devices/bus/drivers/platform",
"//src/devices/usb/drivers/usb-bus",
"//src/devices/usb/drivers/usb-composite",
"//src/devices/usb/drivers/usb-peripheral",
"//src/devices/usb/drivers/usb-virtual-bus",
"//src/ui/input/drivers/hid",
]
test_specs = {
log_settings = {
max_severity = "ERROR"
}
}
}
group("tests") {
testonly = true
deps = [
":one_endpoint_hid_bind_test",
":two_endpoint_hid_bind_test",
":usb-hid-test-package",
":usb_hid_bind_test",
]
}