Drivers can use component framework's structured configuration to read values provided at product assembly time (see providing configuration). See the example C++ and Rust drivers.
In your driver CML, use the config capability with the name of your configuration:
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/cpp/meta/config_driver.cml" region_tag="use_config" adjust_indentation="auto" %}
In the build file, you need to declare the manifest target manually, so that you can use the build target to generate the library to access the configuration:
{C++}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/cpp/BUILD.gn" region_tag="manifest_declaration" adjust_indentation="auto" %}
{Rust}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/rust/BUILD.gn" region_tag="manifest_declaration" adjust_indentation="auto" %}
You can now access the configuration values in the code by using the generated library.
Include the library dependency:
{C++}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/cpp/config_driver.cc" region_tag="include" adjust_indentation="auto" %}
{Rust}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/rust/src/lib.rs" region_tag="include" adjust_indentation="auto" %}
Use the library to access the configuration from the start arguments of the driver:
{C++}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/cpp/config_driver.cc" region_tag="use" adjust_indentation="auto" %}
{Rust}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="examples/drivers/config/rust/src/lib.rs" region_tag="use" adjust_indentation="auto" %}