[hid][buttons] Add unit tests

Also add DeviceGetMetadataSize to the fake_ddk and refactor/simplify.

ZX-3814 #done

Test: hid-buttons-test unit tests and trace buttons pressing on Astro
via the hid uapp as in:
$ hid read /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 3
hid read /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 3
hid: input thread started for
/dev/sys/platform/00:00:13/hid-buttons/hid-device-000
hid: /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 proto=0
hid: /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 num reports:
1
hid: /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 report ids...
ID 0x01 : TYPE   Input : SIZE 3 bytes
hid: /dev/sys/platform/00:00:13/hid-buttons/hid-device-000 maxreport=3
read returned 3
hid: input from /dev/sys/platform/00:00:13/hid-buttons/hid-device-000
01 00 00
read returned 3
hid: input from /dev/sys/platform/00:00:13/hid-buttons/hid-device-000
01 00 01
read returned 3
hid: input from /dev/sys/platform/00:00:13/hid-buttons/hid-device-000
01 01 01
hid: closing /dev/sys/platform/00:00:13/hid-buttons/hid-device-000
$

Change-Id: I5ca9cc8decd222f2fe872ce291bc6b8e7ba0833e
7 files changed
tree: b07bb185b87f398288b91ad819d22266e892b14f
  1. boards/
  2. build/
  3. buildtools/
  4. bundles/
  5. docs/
  6. examples/
  7. garnet/
  8. infra/
  9. peridot/
  10. products/
  11. scripts/
  12. sdk/
  13. src/
  14. third_party/
  15. tools/
  16. zircon/
  17. .clang-format
  18. .clang-tidy
  19. .dir-locals.el
  20. .gitattributes
  21. .gitignore
  22. .gn
  23. AUTHORS
  24. BUILD.gn
  25. CODE_OF_CONDUCT.md
  26. CONTRIBUTING.md
  27. LICENSE
  28. OWNERS
  29. PATENTS
  30. README.md
  31. 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 the documentation.