From b35ec7162d6d7ef24c13e3eca93aa87d870ea7c9 Mon Sep 17 00:00:00 2001 From: Jamie Howarth Date: Wed, 16 Mar 2016 18:13:37 -0400 Subject: [PATCH] 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 --- tests/vehicle/vehicle-hal-tool.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) 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 @@ void subscribe_to_property( 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 @@ void subscribe_to_property( 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 @@ int main(int argc, char* argv[]) { 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 @@ int main(int argc, char* argv[]) { } 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; } -- 2.11.0