This document provides a comprehensive reference for the Driver Manifest Language (DML) in Fuchsia's Driver Framework v2 (DFv2).
In Driver Framework v2 (DFv2), drivers are components executed by the driver runner. Historically, authoring a DFv2 driver required maintaining multiple disconnected configuration files:
.cml): Declaring capabilities, used services, runner configuration, and binary locations..bind): Declaring driver matching rules, hardware identifiers, and composite parent specifications..fidl): Board drivers required board topology manifests, capability route mappings, and static metadata payloads.Maintaining these files separately introduced duplication: service names, parent node names, and hardware protocol requirements were repeated across both .cml and .bind files, creating a risk of drift and configuration bugs.
DML (Driver Manifest Language) solves this by providing a single, unified declarative JSON5 manifest (.dml). The DML compiler (dmlc) processes .dml files and automatically produces:
.cml): Cleaned and validated component manifests ready for compilation with cmc..bind): Bind program source code compiled with bindc into driver bytecode (.bindbc).BoardConfig) for platform bus drivers.The official schema for DML manifests is checked in at //src/devices/tools/dmlc/dml.schema.json.
DML supports two categories of manifests:
| Feature | Driver Manifest (compile-driver) | Board Manifest (compile-board) |
|---|---|---|
| Target | Standalone or composite leaf/intermediate device drivers | System board drivers (e.g. Vim3, QEMU, Astro) |
| Outputs | .cml, .bind, optional C++/Rust metadata parsers | .cml, .bind, .fidl board configuration |
| Top-Level Sections | name, include_inspect, constants, program, use, capabilities, expose, include, config | name, constants, program, children, offer, metadata_mappings, use, include, capabilities, expose |
| Binding Style | Non-composite (program.bind) or composite (use[].bind) | Platform bus device binding (program.bind) |
| Hardware Nodes | Consumes parent nodes | Declares child nodes and capability routes (offer) |
{ // Name of the driver or board component (required). name: "sample_driver", // Optional composite name override. Defaults to 'name' with '-' replaced by '_'. composite_name: "custom_composite_name", // Shards and manifests to include. include: [ "//sdk/lib/driver/compat/compat.shard.cml", "subsystem.shard.dml" ], // Driver manifest only: include 'inspect/client.shard.cml' in the generated // CML (default: true). 'syslog/client.shard.cml' is always included. include_inspect: true, // Optional named compile-time constants (flat or nested namespaces). constants: { ... }, // Execution parameters and standalone bind rules. program: { ... }, // Capabilities consumed, and parent node definitions for composite drivers. use: [ ... ], // Capabilities provided by this driver, including metadata schemas. capabilities: [ ... ], // Capabilities exposed to the framework or parent component. expose: [ ... ], // Optional structured component configuration schema. config: { ... }, // Board manifest only: child device node definitions. children: [ ... ], // Board manifest only: capability offers and constraint routing. offer: [ ... ], // Board manifest only: rules for aggregating metadata across children. metadata_mappings: [ ... ] }
The program section defines driver execution parameters and bind rules for standalone (non-composite) drivers.
| Property | Type | Description |
|---|---|---|
runner | string | Component runner name. Defaults to "driver". |
binary | string | Path to driver shared library (e.g. "driver/sample.so"). Defaults to "driver/<name>.so". |
compat | string | Path to DFv1 compatibility driver shared library (e.g. "driver/sample_compat.so"). Automatically includes //sdk/lib/driver/compat/compat.shard.cml in the generated CML unless already listed in include. |
colocate | string or boolean | Whether to colocate the driver in its parent driver host ("true" or true). |
default_dispatcher_opts | array of string | Options for the driver's default dispatcher (e.g. ["allow_sync_calls"]). |
bind / requirements | object or false | Structured bind block for standalone drivers (see Hardware bus blocks), or false (driver manifests only) for a driver without bind rules. Note: string bind paths are not allowed in DML. |
driver_name | string | Driver name override (primarily used in board manifests). |
program: { binary: "driver/usb_mass_storage.so", colocate: "true", default_dispatcher_opts: [ "allow_sync_calls" ], bind: { protocol: "fuchsia.usb.BIND_PROTOCOL.INTERFACE", usb: { class: "fuchsia.usb.CLASS.MASS_STORAGE", subclass: "fuchsia.usb.massstorage.SUBCLASS.SCSI", protocol: "fuchsia.usb.massstorage.PROTOCOL.BULK_ONLY" } } }
program.bind: false)For drivers that do not ship bind rules (for example, drivers bound only manually or test drivers), set bind: false (or requirements: false). dmlc omits program.bind from the generated CML and refuses to write a .bind output; pair it with disable_autobind = true on the GN fuchsia_driver_dml target. bind: false cannot be combined with composite parent bind rules.
program: { binary: "driver/manual_driver.so", bind: false, }
The use section serves a dual purpose:
service, protocol, directory).| Property | Type | Description |
|---|---|---|
service | string | FIDL service name (e.g. "fuchsia.hardware.gpio.Service"). Emits fuchsia.Service == "<service>"; in parent bind rules. |
protocol | string | FIDL protocol name. |
banjo | string | Banjo protocol identifier (e.g. "fuchsia.acpi.BIND_PROTOCOL.DEVICE"). Emits fuchsia.BIND_PROTOCOL == <banjo>; in bind rules and is excluded from CML. |
name / instance_name | string | Name of the parent node in the composite device specification. |
primary | boolean | Set to true on exactly one use entry to designate it as the primary parent node. |
availability | string | "required" (default) or "optional". Generates optional parent "<name>" in bind rules. |
transport | string | Service transport: "Zircon", "Driver", or "Banjo". |
generate_bind_rule | boolean | Defaults to true. If set to false, the capability is consumed via CML without generating a composite parent bind node. |
bind / requirements | object | Inline bind rules for this parent node (see Hardware bus blocks). |
Services representing platform init steps (such as fuchsia.gpio.Init and fuchsia.pwm.Init) are automatically detected:
fuchsia.Service == "fuchsia.gpio.Init";).use entries because init steps are transient bind milestones rather than connectable runtime FIDL services.Declares capabilities provided by the driver. In addition to standard CML capability types, DML supports schema-driven metadata definitions:
capabilities: [ { service: "fuchsia.hardware.buttons.Service" }, { metadata: { id: "fuchsia.hardware.buttons.Metadata", schema: { title: "ButtonsMetadata", type: "object", definitions: { ButtonItem: { type: "object", properties: { type: { type: "integer", fuchsia_type: "uint8" }, gpio: { type: "integer", fuchsia_type: "uint32" } }, required: [ "type", "gpio" ] } }, properties: { buttons: { type: "array", items: { "$ref": "#/definitions/ButtonItem" } } }, required: [ "buttons" ] } } } ]
When dmlc compile-driver is executed with --h-output, --cc-output, or --rs-output, it generates complete C++ and Rust parser code that parses and validates incoming metadata against the schema.
Standard DFv2 capability exposure:
expose: [ { service: "fuchsia.hardware.buttons.Service", from: "self" } ]
Board manifests (compiled with dmlc compile-board) configure the platform bus and topology:
Declares devices published to the platform bus:
children: [ { name: "adc-buttons", url: "fuchsia-pkg://fuchsia.com/adc-buttons#meta/adc-buttons.cm", compatible: "fuchsia,adc-buttons", metadata: [ { id: "fuchsia.hardware.adc.Metadata", data: [ 1, 0, 0, 0 ] } ] } ]
Routes capabilities between parent controllers and child drivers with hardware constraints:
offer: [ { service: "fuchsia.hardware.gpio.Service", name: "power", from: "#gpio-controller-ff634400", to: "#gpio-buttons", constraints: { pin: 92, name: "power" } } ]
When a platform device consumes an interrupt managed by a userspace interrupt controller driver (rather than the kernel interrupt controller directly), two offer entries are required:
fuchsia.hardware.interrupt.ControllerRegistryService from "parent" to the interrupt controller node (name: "pdev"). dmlc automatically allocates a unique platform bus interrupt_controller_id for that controller node.fuchsia.hardware.platform.device.Service interrupts constraint via controller: "#<controller-node>".offer: [ { name: "pdev", service: "fuchsia.hardware.interrupt.ControllerRegistryService", from: "parent", to: "#gpio-controller-ff634400", }, { name: "pdev", service: "fuchsia.hardware.platform.device.Service", from: "parent", to: "#touchscreen", constraints: { interrupts: [ { name: "touch-irq", number: 14, mode: "EdgeLow", controller: "#gpio-controller-ff634400", }, ], }, }, ]
Aggregates child device constraints into unified FIDL metadata:
metadata_mappings: [ { metadata_id: "fuchsia.hardware.pinimpl.Metadata", aggregations: [ { service: "fuchsia.hardware.gpio.Service", field: "pins" }, { service: "fuchsia.hardware.pin.PinStatesService", field: "device_pin_states", use_node_name: true } ] } ]
DML supports compile-time named constants so hardware IDs, clock IDs, pin numbers, and shared bind values can be named once instead of repeated as raw literals.
Define constants in a top-level constants object containing integer (including JSON5 hex literals such as 0x1000b), string, or boolean values. Constants may be grouped into arbitrarily nested namespace objects, which are flattened with . separators:
{ name: "sample_pci_driver", constants: { LOCAL_DID: 0x1234, pci: { VID: { INTEL: 0x8086, }, }, }, program: { bind: { pci: { vid: "pci.VID.INTEL", did: "LOCAL_DID", }, }, }, }
"name" / "ns.name"): Reference constants directly by their flattened name (such as "g12b_clk.AUDIO", "pci.VID.INTEL", or "AX88179_PID"). Matching string values are replaced in place with the constant's typed value (integer, string, or boolean) before the manifest is parsed.program.bind / program.requirements, use[].bind / use[].requirements / use[].constraints, and in board manifests offer[] / offers[] constraints, properties, metadata payloads, and driver-config payload fields, children[] non-structural fields such as compatible/driver_host/id/metadata[].data, and iommus[] non-name fields). Structural identifiers (including top-level name, composite_name, include, constants, program.binary, use[].name, use[].service, children[].name/url/metadata[].id, offer[].name/from/to/service/driver_config/metadata.id, primary.node, and JSON schema blocks) are never rewritten."pci.VID") or falls inside a known constant namespace (such as "pci.VID.GOOGEL" or "pci.TYPO.GOOGLE"), dmlc fails with a compile error. Plain non-constant strings (including bare strings matching a top-level namespace name like "pci", or standard fuchsia.* protocol and service identifiers) pass through untouched.When compiling a board manifest (dmlc compile-board), dmlc collects constants blocks from the root manifest and all transitively included .dml shards in a first pass before resolving any references. As a result, a shard may reference constants defined in another shard regardless of include order.
include)To share constants across multiple manifests, place them in a standalone .constants.dml file containing only constants (and optionally nested .dml include entries) and reference it explicitly in the manifest's include array:
// sdk/lib/driver/dml/pci.constants.dml { constants: { pci: { VID: { INTEL: 0x8086, }, }, }, }
// meta/my_pci_driver.dml { name: "my_pci_driver", include: [ "driver/dml/pci.constants.dml", "driver_component/driver.shard.cml", ], program: { bind: { pci: { vid: "pci.VID.INTEL", }, }, }, }
dmlc resolves include paths using the same conventions as cmc (--includeroot and repeatable --includepath, defaulting in GN and Bazel to // and //sdk/lib):
// (such as "//sdk/lib/driver/dml/pci.constants.dml") resolve relative to --includeroot."g12b-clk.constants.dml"), then search each --includepath directory (e.g., "driver/dml/pci.constants.dml").compile-driver), .dml entries in include are loaded as constant shards and stripped from the generated .cml, while .cml shards are forwarded to the generated .cml unchanged.fuchsia_driver_dml and fuchsia_board_dml), dmlc emits a Ninja depfile via --depfile, so included .dml files are tracked automatically with no build-file boilerplate.dml_outputs and board_dml_outputs), list included .dml files alongside .cml shards in includes = [...] so Bazel makes them available in the action sandbox (for dml_cc_library, pass them in dml_includes = [...]).Standalone .constants.dml files can also be compiled into C++ headers and Rust crates so driver and board source code shares the exact same definitions as DML manifests without duplicating constants.
In GN (//build/drivers/dml.gni), declare a dml_constants_library:
import("//build/drivers/dml.gni") dml_constants_library("pci") { source = "pci.constants.dml" }
In Bazel (//build/bazel/rules/drivers:dml_constants_library.bzl), declare the equivalent macro (passing any transitively included .dml files or dml_constants_library targets via includes):
load("//build/bazel/rules/drivers:dml_constants_library.bzl", "dml_constants_library") dml_constants_library( name = "pci", src = "pci.constants.dml", includes = [], )
Both GN and Bazel expand to:
:pci: Primary target exposing the .constants.dml source (in Bazel, also provides transitive .dml inputs so downstream dml_outputs, board_dml_outputs, and dml_constants_library targets can list :pci in includes).:pci_cpp: C++ library (source_set in GN, fx_cc_library in Bazel) providing #include <dml/pci.h> (overridable with header_path) with inline constexpr declarations inside namespace dml (overridable with namespace, or "" for no outer wrapper) and nested namespaces mirroring the DML constant hierarchy.:pci_rust: Rust rustc_library crate (omitted in GN Zircon toolchains) named dml_pci (overridable with crate_name) with pub const declarations inside nested pub mod modules.Generated leaf constants map DML scalar values to C++ and Rust types as follows:
| DML value range / type | C++ type | Rust type |
|---|---|---|
Non-negative integer 0 ..= u32::MAX | uint32_t | u32 |
Non-negative integer > u32::MAX (<= u64::MAX) | uint64_t | u64 |
Negative integer i32::MIN ..= -1 | int32_t | i32 |
Negative integer i64::MIN ..< i32::MIN | int64_t | i64 |
| Boolean | bool | bool |
| String | ::std::string_view | &str |
Under the hood, dml_constants_library invokes dmlc generate-constants (at least one of --h-output or --rs-output is required):
dmlc generate-constants <input.constants.dml> \ [--h-output <out.h> [--header-path <dml/foo.h>] [--namespace <dml>] [--include-guard <GUARD>]] \ [--rs-output <out.rs>] \ [--includeroot <root>] [--includepath <dir>] [--depfile <out.d>]
Transitively included .dml constant shards are merged into the generated outputs and recorded in --depfile.
_ and contain only ASCII alphanumeric characters or _ (dots, hyphens, spaces, and leading digits are rejected).generate-constants), key segments (and C++ --namespace segments) must not be "_" or reserved keywords in the target language (C++20/23 keywords and alternative operator tokens for --h-output; Rust edition 2024 strict and reserved keywords for --rs-output).{} is an error).null, and arrays are rejected."pci.VID") or an undefined constant inside a known constant namespace (e.g., "pci.VID.MISSING") is a compile error..dml) accept only constants and .dml include entries and reject unknown top-level fields, non-.dml includes, and circular includes.DML provides structured blocks for major hardware interconnects and discovery protocols.
Platform devices match on Devicetree/platform compatible strings (compat) or Instance ID (instance_id):
bind: { compat: "fuchsia,gpio-buttons", instance_id: 0 }
Generated bind rules:
fuchsia.BIND_PLATFORM_DEV_INSTANCE_ID == 0; fuchsia.COMPATIBLE == "fuchsia,gpio-buttons";
PCI devices match on PCI vendor, device, class, subclass, interface, or topology:
Note: Legacy flat PCI fields (pci_class, pci_subclass, pci_interface) are rejected by dmlc. Always use the structured pci: { ... } block.
bind: { service: "fuchsia.hardware.pci.Service", pci: { vid: "fuchsia.pci.BIND_PCI_VID.INTEL", did: "0x1234", class: "fuchsia.pci.BIND_PCI_CLASS.GENERIC_SYSTEM_PERIPHERAL", subclass: "0x05", interface: "0x01", topo: "0x05" } }
Generated bind rules:
fuchsia.Service == "fuchsia.hardware.pci.Service"; fuchsia.BIND_PCI_VID == fuchsia.pci.BIND_PCI_VID.INTEL; fuchsia.BIND_PCI_DID == 0x1234; fuchsia.BIND_PCI_CLASS == fuchsia.pci.BIND_PCI_CLASS.GENERIC_SYSTEM_PERIPHERAL; fuchsia.BIND_PCI_SUBCLASS == 0x05; fuchsia.BIND_PCI_INTERFACE == 0x01; fuchsia.BIND_PCI_TOPO == 0x05;
USB interfaces and devices match on USB vendor, product, class, subclass, and protocol:
bind: { usb: { vid: "fuchsia.usb.VID.GOOGLE", pid: "0x1234", class: "fuchsia.usb.CLASS.MASS_STORAGE", subclass: "0x02", protocol: 0, bind_protocol: "fuchsia.usb.BIND_PROTOCOL.INTERFACE" } }
Generated bind rules:
fuchsia.BIND_PROTOCOL == fuchsia.usb.BIND_PROTOCOL.INTERFACE; fuchsia.usb.VID == fuchsia.usb.VID.GOOGLE; fuchsia.usb.PID == 0x1234; fuchsia.usb.CLASS == fuchsia.usb.CLASS.MASS_STORAGE; fuchsia.usb.SUBCLASS == 0x02; fuchsia.usb.PROTOCOL == 0;
ACPI devices match on Hardware ID (hid), Compatible ID (first_cid), or ACPI Bus Type:
bind: { acpi: { hid: "PNP0C0A", first_cid: "PNP0C0B", bus_type: "fuchsia.acpi.BUS_TYPE.PCI" } }
Generated bind rules:
fuchsia.acpi.HID == "PNP0C0A"; fuchsia.acpi.FIRST_CID == "PNP0C0B"; fuchsia.acpi.BUS_TYPE == fuchsia.acpi.BUS_TYPE.PCI;
SDIO devices match on Vendor ID (vid), Product/Device ID (pid), and Function (function):
bind: { sdio: { vid: "fuchsia.broadcom.platform.sdio.BIND_SDIO_VID.BROADCOM", pid: "fuchsia.broadcom.platform.sdio.BIND_SDIO_PID.BCM43458", function: 1 } }
Generated bind rules:
fuchsia.BIND_SDIO_VID == fuchsia.broadcom.platform.sdio.BIND_SDIO_VID.BROADCOM; fuchsia.BIND_SDIO_PID == fuchsia.broadcom.platform.sdio.BIND_SDIO_PID.BCM43458; fuchsia.BIND_SDIO_FUNCTION == 1;
Additional high-frequency bind properties have first-class shorthands:
id: Emits fuchsia.ID (e.g. id: 1).nand: Emits fuchsia.nand.CLASS (e.g. nand: "fuchsia.nand.CLASS.PARTMAP").bind: { id: 1, nand: "fuchsia.nand.CLASS.PARTMAP" }
Generated bind rules:
fuchsia.ID == 1; fuchsia.nand.CLASS == fuchsia.nand.CLASS.PARTMAP;
Composite drivers require binding to multiple parent devices (e.g. a platform device, plus GPIO pins, plus I2C buses).
Designate the primary parent with primary: true in its use entry:
use: [ { service: "fuchsia.hardware.platform.device.Service", name: "pdev", primary: true, bind: { compat: "sample,buttons" } }, { service: "fuchsia.hardware.gpio.Service", name: "mic-mute", availability: "optional" } ]
Generated bind rules:
composite sample_composite; using fuchsia; primary parent "pdev" { fuchsia.COMPATIBLE == "sample,buttons"; } optional parent "mic-mute" { fuchsia.Service == "fuchsia.hardware.gpio.Service"; }
Note: If a driver is a composite driver, specifying bind rules under program.bind is forbidden. Place all bind rules in the corresponding use entries instead.
When a driver connects to multiple parents of the same service type (e.g. multiple GPIO pins or ADCs), specify match_name: true inside the parent‘s bind block. dmlc will automatically emit a rule matching the parent’s topological node name (fuchsia.NAME):
use: [ { service: "fuchsia.hardware.gpio.Service", name: "volume-up", bind: { match_name: true } } ]
Generated bind rules:
parent "volume-up" { fuchsia.Service == "fuchsia.hardware.gpio.Service"; fuchsia.NAME == "volume-up"; }
If multiple use entries reference the same parent name (for example, one for a Banjo interface and another for a FIDL service or init step), dmlc automatically groups them into a single parent specification:
use: [ { service: "fuchsia.gpio.Init", name: "gpio-init" }, { service: "fuchsia.hardware.gpio.Service", name: "gpio-init", availability: "optional" } ]
Generated bind rules:
parent "gpio-init" { fuchsia.Service == "fuchsia.gpio.Init"; fuchsia.Service == "fuchsia.hardware.gpio.Service"; }
To match against any one of multiple acceptable values, pass an array instead of a single scalar. dmlc will generate an accept <property> { ... } block in bind rules.
bind: { pci: { vid: "fuchsia.pci.BIND_PCI_VID.INTEL", did: [ "0x1234", "0x5678" ] } }
Generated bind rules:
fuchsia.BIND_PCI_VID == fuchsia.pci.BIND_PCI_VID.INTEL; accept fuchsia.BIND_PCI_DID { 0x1234, 0x5678, }
Works for protocol, compat, instance_id, node_name, id, nand, PCI properties, USB properties, ACPI properties, SDIO properties, and custom rules.
When matching logic requires branching across different buses or device generations, use one_of. dmlc inspects each branch's trigger conditions and compiles them into if ... else if ... else ... statements.
bind: { one_of: [ { pci: { vid: "fuchsia.pci.BIND_PCI_VID.INTEL", did: "0x1234" } }, { pci: { class: "0x02", subclass: "0x00" } } ] }
Generated bind rules:
if fuchsia.BIND_PCI_VID == fuchsia.pci.BIND_PCI_VID.INTEL { fuchsia.BIND_PCI_DID == 0x1234; } else if fuchsia.BIND_PCI_CLASS == 0x02 { fuchsia.BIND_PCI_SUBCLASS == 0x00; } else { false; }
Supported trigger properties in one_of include:
node_name (fuchsia.NAME)acpi.hid and acpi.bus_typecompat (fuchsia.COMPATIBLE)protocol / banjo (fuchsia.BIND_PROTOCOL)service (fuchsia.Service)instance_id (fuchsia.BIND_PLATFORM_DEV_INSTANCE_ID)pci.vid, pci.did, pci.classusb.vid, usb.pid, usb.classsdio.vid, sdio.pid, sdio.functionid (fuchsia.ID) and nand (fuchsia.nand.CLASS)rules keys without a first-class shorthand (e.g. fuchsia.BIND_AUTOBIND)An alternative inside one_of may itself contain a nested one_of to emit a nested conditional inside that branch:
bind: { one_of: [ { service: "fuchsia.hardware.pci.Service", one_of: [ { pci: { vid: "0x10de", did: "0x01" } }, { pci: { vid: "0x8086", did: "0x02" } } ] }, { compat: "fuchsia,fallback" } ] }
Generated bind rules:
if fuchsia.Service == "fuchsia.hardware.pci.Service" { if fuchsia.BIND_PCI_VID == 0x10de { fuchsia.BIND_PCI_DID == 0x01; } else if fuchsia.BIND_PCI_VID == 0x8086 { fuchsia.BIND_PCI_DID == 0x02; } else { false; } } else if fuchsia.COMPATIBLE == "fuchsia,fallback" { true; } else { false; }
To require that a property does not equal one or more values, specify { neq: <value> } or { neq: [ <value1>, <value2>, ... ] } on any first-class bind field (protocol, instance_id, compat, node_name, pci.*, usb.*, acpi.*, sdio.*, id, nand) or in rules. A non-empty list emits one != constraint per value.
Note: rules is strictly for bind properties that do not have a first-class shorthand. dmlc rejects any key in rules that has a dedicated shorthand field (for example, fuchsia.BIND_PCI_VID must use pci: { vid: ... } and fuchsia.NAME must use node_name or match_name).
bind: { protocol: { neq: "fuchsia.usb.BIND_PROTOCOL.INTERFACE" }, compat: { neq: [ "acme,legacy-a", "acme,legacy-b" ] }, rules: { "fuchsia.BIND_COMPOSITE": { neq: 1 } } }
Generated bind rules:
fuchsia.BIND_PROTOCOL != fuchsia.usb.BIND_PROTOCOL.INTERFACE; fuchsia.COMPATIBLE != "acme,legacy-a"; fuchsia.COMPATIBLE != "acme,legacy-b"; fuchsia.BIND_COMPOSITE != 1;
meta/usb_mass_storage.cml:
{ include: [ "inspect/client.shard.cml", "syslog/client.shard.cml", ], program: { runner: "driver", binary: "driver/usb_mass_storage.so", bind: "meta/bind/usb_mass_storage.bindbc", colocate: "true", default_dispatcher_opts: [ "allow_sync_calls" ], }, capabilities: [ { service: "fuchsia.hardware.block.volume.Service" } ], expose: [ { service: "fuchsia.hardware.block.volume.Service", from: "self" } ] }
meta/usb_mass_storage.bind:
using fuchsia.usb; using fuchsia.usb.massstorage; fuchsia.BIND_PROTOCOL == fuchsia.usb.BIND_PROTOCOL.INTERFACE; fuchsia.usb.CLASS == fuchsia.usb.CLASS.MASS_STORAGE; fuchsia.usb.SUBCLASS == fuchsia.usb.massstorage.SUBCLASS.SCSI; fuchsia.usb.PROTOCOL == fuchsia.usb.massstorage.PROTOCOL.BULK_ONLY;
{ name: "usb-mass-storage", program: { colocate: "true", default_dispatcher_opts: [ "allow_sync_calls" ], bind: { protocol: "fuchsia.usb.BIND_PROTOCOL.INTERFACE", usb: { class: "fuchsia.usb.CLASS.MASS_STORAGE", subclass: "fuchsia.usb.massstorage.SUBCLASS.SCSI", protocol: "fuchsia.usb.massstorage.PROTOCOL.BULK_ONLY" } } }, capabilities: [ { service: "fuchsia.hardware.block.volume.Service" } ], expose: [ { service: "fuchsia.hardware.block.volume.Service", from: "self" } ] }
meta/buttons.cml:
{ include: [ "inspect/client.shard.cml", "syslog/client.shard.cml", ], program: { runner: "driver", binary: "driver/buttons.so", bind: "meta/bind/buttons.bindbc", }, use: [ { service: "fuchsia.hardware.platform.device.Service" }, { service: "fuchsia.hardware.gpio.Service" }, ], capabilities: [ { service: "fuchsia.input.report.Service" } ], expose: [ { service: "fuchsia.input.report.Service", from: "self" } ] }
meta/buttons.bind:
composite buttons; using fuchsia; primary parent "pdev" { fuchsia.COMPATIBLE == "fuchsia,gpio-buttons"; } optional parent "gpio-init" { fuchsia.Service == "fuchsia.gpio.Init"; } optional parent "volume-up" { fuchsia.Service == "fuchsia.hardware.gpio.Service"; fuchsia.NAME == "volume-up"; }
{ name: "buttons", use: [ { service: "fuchsia.hardware.platform.device.Service", name: "pdev", primary: true, bind: { compat: "fuchsia,gpio-buttons" } }, { service: "fuchsia.gpio.Init", name: "gpio-init", availability: "optional" }, { service: "fuchsia.hardware.gpio.Service", name: "volume-up", availability: "optional", bind: { match_name: true } } ], capabilities: [ { service: "fuchsia.input.report.Service" } ], expose: [ { service: "fuchsia.input.report.Service", from: "self" } ] }
Notice that:
pdev is explicitly the primary parent.fuchsia.gpio.Init generates a fuchsia.Service == "fuchsia.gpio.Init"; bind rule and is automatically filtered out of the generated CML.volume-up with match_name: true automatically matches fuchsia.NAME == "volume-up".