tree: 7e1ef58cb75d9b7ebd635f46e1a492e8b78fbc58 [path history] [tgz]
  1. bind/
  2. driver_test_realm/
  3. metadata/
  4. simple/
  5. skeleton/
  6. template/
  7. transport/
  8. BUILD.gn
  9. METADATA.textproto
  10. OWNERS
  11. README.md
examples/drivers/README.md

Driver Example Index

This is an index of the examples intended to demonstrate driver concepts.

Basic examples

Examples that showcase common driver concepts.

Skeleton driver

The skeleton driver example is a minimal driver written in DFv2.

Template driver

Template driver is a minimal driver written in DFv2, and built with SDK rules, which can be used either in-tree or out-of-tree.

Simple driver

The simple driver examples showcases how to write a DFv1 driver and a DFv2 driver with common patterns:

  • Adding logs
  • Adding a child node
  • Implementing stop functions
  • Setting up a compat device server

Metadata

The metadata example demonstrates how to define metadata types and pass metadata from a driver to its children.

Transport examples

Examples that showcase communication between drivers.

Banjo

DFv1 and DFv2 driver examples that demonstrate a parent driver serving a Banjo transport and a child driver that connects and queries data from it.

Zircon transport

DFv1 and DFv2 driver examples that demonstrate a parent driver serving a FIDL protocol over zircon transport and a child driver that connects and queries data from it.

Driver transport

DFv1 and DFv2 driver examples that demonstrate a parent driver serving a FIDL protocol over zircon transport and a child driver that connects and queries data from it.

Bind examples

Bind library

This example demonstrates how to write a bind library.

Bind library codegen

This example demonstrates how to use the C++ and Rust constants generated from a bind library.

FIDL bind library codegen

This example demonstrates how to write a bind library.

Test examples

Unit tests

Here are various unit tests in the examples

  • Simple driver - barebones unit test for the simple driver example
  • Banjo transport - unit test that verifies that the child driver can query from a fake banjo server
  • Zircon transport - unit test that verifies that the child driver can query from a fake FIDL zircon server
  • Driver transport - unit test that verifies that the child driver can query from a fake FIDL driver server

Integration tests

The Driver Test Realm examples demonstrate how to write hermetic and non-hermetic integration tests for a driver.