Moved init and release.
Moved the init release calls in the vehicle-hal-tool.
I assume the correct sequence for a set is :-
VehicleNetworkService -> VehicleHAL vehicle_device_open
VehicleNetworkService -> VehicleHAL vehicle_device_init
VehicleNetworkService -> VehicleHAL vehicle_device_set
VehicleNetworkService -> VehicleHAL vehicle_device_release
bug: 27816048
Change-Id: I3ac37eaf69027824bc6247f25a99f27527c1a2b9
diff --git a/tests/vehicle/vehicle-hal-tool.c b/tests/vehicle/vehicle-hal-tool.c
index 3c3922f..c93790a 100755
--- a/tests/vehicle/vehicle-hal-tool.c
+++ b/tests/vehicle/vehicle-hal-tool.c
@@ -396,7 +396,6 @@
float sample_rate,
uint32_t wait_in_seconds) {
// Init the device with a callback.
- device->init(device, vehicle_event_callback, vehicle_error_callback);
int ret_code = device->subscribe(device, prop, 0, 0);
if (ret_code != 0) {
printf("Could not subscribe: %d\n", ret_code);
@@ -412,11 +411,6 @@
if (ret_code != 0) {
printf("Error unsubscribing the HAL, still continuining to uninit HAL ...");
}
-
- ret_code = device->release(device);
- if (ret_code != 0) {
- printf("Error uniniting HAL, exiting anyways.");
- }
}
int main(int argc, char* argv[]) {
@@ -438,6 +432,8 @@
vehicle_hw_device_t *vehicle_device = (vehicle_hw_device_t *) (device);
printf("HAL Loaded!\n");
+ vehicle_device->init(vehicle_device, vehicle_event_callback, vehicle_error_callback);
+
// If this is a list properties command - we check for -l command.
int list_properties = 0;
// Type of the property (see #defines in vehicle.h).
@@ -529,5 +525,10 @@
}
subscribe_to_property(vehicle_device, property, sample_rate, wait_time_in_sec);
}
+
+ ret_code = vehicle_device->release(vehicle_device);
+ if (ret_code != 0) {
+ printf("Error uniniting HAL, exiting anyways.");
+ }
return 0;
}