• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

Android.mkD22-Nov-20231.2 KiB4618

READMED22-Nov-20233.1 KiB7458

vehicle-hal-tool.cD22-Nov-202321.9 KiB535465

vehicle_test_fixtures.hD22-Nov-20233.1 KiB9867

vehicle_tests.cppD22-Nov-20235.5 KiB13066

README

1What does this document tell?
2
3This document details how to use the vehicle service if you are implementhing
4HAL. It lists the various places to look for code and how to build and test the
5code on your own dev device.
6
7This code also provides a simple command line utility for the target to test the
8vehicle HAL.
9
10What is the code?
11
12The code is split into folowing logical components:
13a) hardware/libhardware/include/hardware/vehicle.h - this is the main HAL
14interface that will be required to be implemented by the OEMs. It includes all
15documentation necessary to understand what vehicle subsystems are exposed,
16various units, capabilities and any other relevant details about the HAL design
17itself.
18
19b) hardware/libhardware/modules/vehicle/vehicle.c
20This is a reference implementation for the OEMs to have a peek into getting
21started with a barebones structure. There are implementation for each of the
22critical HAL functions such as, get(), set() and subscribe().
23
24c) hardware/libhardware/tests/vehicle/vehicle_test.cpp & vehicle_test_fixtures.h
25These are native tests that can be run on the target to validate basic
26features of HAL implementation. Things such as loading of HAL and
27basic functions are implemented (by check if the returned functions are not NULL
28pointers) can be asserted. It also checks if the subscribe function is doing its
29job by spitting out data at continuous intervals and printed on the stdout.
30
31d) hardware/libhardware/tests/vehicle/vehicle-hal-tool.c
32This tool will provide you with a simple utility which can set commands to the
33HAL such as:
34i) Getting a property (and printing its value).
35ii) Setting a property (and the HAL will take some setting action).
36iii) Subscribe to a property (and the HAL should send you values at some certain
37intevals).
38
39See the usage() function in vehicle-hal-tool.c for details on how to use the
40binary.
41
42How to build and run?
43
44You can build everything by issuing the following from the top of directory. It
45is assumed that you have done a first run of make from the top level so that
46intermediates are generated.
47
48$ croot
49$ mmm hardware/libhardware
50
51This will generate the following binaries that we care about:
52i) out/target/product/XXX/system/lib/hw/vehicle.default.so
53ii) out/target/product/XXX/data/nativetest/vehicle_tests
54iii) out/target/product/XXX/system/bin/vehicle-hal-tool
55
56The location for the first shared library would be:
57$ adb push out/target/product/XXX/system/lib/hw/vehicle.default.so
58/system/lib/hw
59You can also use 'adb sync' if you like, although this is the easiest least
60hassle way of putting it in place.
61
62The second binary is a native test - which is nothing but an executable for the
63target device. You can load it anywhere in your /data directory and run it as:
64$ adb push out/target/product/XXX/data/nativetest/vehicle_tests
65/data/tmp/vehicle_tests
66$ adb shell
67$ ./data/tmp/vehicle_tests
68<...output should be spitted with passing tests for atleast the reference
69implementation ...>
70
71The last binary is the command line tool, to push the binary on your target do:
72$ adb push out/target/product/XXX/system/bin/vehicle-hal-tool
73/data/tmp/vehicle-hal-tool
74