[i2c-hid] Migrate to new DdkInit/DdkUnbind hooks.

The DdkInit() hook is run after automatically after DdkAdd() is called.
By moving the post-add initialization logic into this hook,
we can guarantee the device will be invisible and not able to
be unbound until InitTxn.Reply() is called.

If InitTxn.Reply() is called with a bad status,
the device manager will begin unbinding the device.

When removing a device, we call DdkAsyncRemove() (rather than
DdkRemoveDeprecated), which will begin unbinding the device.

---------------
DDK lifecycle:
---------------
1) DdkAdd()
2) DdkInit()
3) InitTxn.Reply() // Device becomes visible
4) DdkUnbind()     // started by InitTxn.Reply(!ZX_OK) / DdkAsyncRemove
5) UnbindTxn.Reply()
6) DdkRelease()

TEST= fx test i2c-hid-test

BUG=37831
BUG=43261

Change-Id: If8028536483599da18b21cdd4c46ba7b6d4e1073
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/397715
Reviewed-by: David Gilhooley <dgilhooley@google.com>
Testability-Review: David Gilhooley <dgilhooley@google.com>
Commit-Queue: Jocelyn Dang <jocelyndang@google.com>
3 files changed
tree: e4a6767f170482a53546f7a8a151f97c65f415a6
  1. boards/
  2. build/
  3. bundles/
  4. cts/
  5. docs/
  6. examples/
  7. garnet/
  8. products/
  9. scripts/
  10. sdk/
  11. src/
  12. third_party/
  13. tools/
  14. zircon/
  15. .clang-format
  16. .clang-tidy
  17. .gitattributes
  18. .gitignore
  19. .gn
  20. .style.yapf
  21. AUTHORS
  22. BUILD.gn
  23. CODE_OF_CONDUCT.md
  24. CONTRIBUTING.md
  25. LICENSE
  26. OWNERS
  27. PATENTS
  28. README.md
  29. rustfmt.toml
README.md

Fuchsia

Pink + Purple == Fuchsia (a new operating system)

What is Fuchsia?

Fuchsia is a modular, capability-based operating system. Fuchsia runs on modern 64-bit Intel and ARM processors.

Fuchsia is an open source project with a code of conduct that we expect everyone who interacts with the project to respect.

How can I build and run Fuchsia?

See Getting Started.

Where can I learn more about Fuchsia?

See fuchsia.dev.