add clarification on parameter passing in get call
- with errata fix
- also removed build warnings from vehicle.c
bug: 25183740
Change-Id: I6e0ed9e300e4bc5ff8821cca87ff8509ffc0968a
diff --git a/include/hardware/vehicle.h b/include/hardware/vehicle.h
index 267a910..fae035a 100644
--- a/include/hardware/vehicle.h
+++ b/include/hardware/vehicle.h
@@ -353,7 +353,7 @@
* per stream characteristics and global characteristics.
*
* Focus request (get of this property) will take the following form in int32_vec4:
- * int32_array[0]: vehicle_audio_focus_request_type
+ * int32_array[0]: vehicle_audio_focus_request type
* int32_array[1]: bit flags of streams requested by this focus request. There can be up to
* 32 streams.
* int32_array[2]: External focus state flags. For request, only flag like
@@ -366,7 +366,7 @@
* android before this focus request should not be affected by focus request.
*
* Focus response (set and subscription callback for this property) will take the following form:
- * int32_array[0]: vehicle_audio_focus_state_type
+ * int32_array[0]: vehicle_audio_focus_state type
* int32_array[1]: bit flags of streams allowed.
* int32_array[2]: External focus state: bit flags of currently active audio focus in car
* side (outside Android). Active audio focus does not necessarily mean currently
@@ -1452,7 +1452,8 @@
* Get a vehicle property value immediately. data should be allocated
* properly.
* The caller of the API OWNS the data field.
- * Caller will only set data->prop and HAL implementation needs to fill all entries properly.
+ * Caller will set data->prop, data->value_type, and optionally zone value for zoned property.
+ * But HAL implementation needs to fill all entries properly when returning.
* For pointer type, HAL implementation should allocate necessary memory and caller is
* responsible for freeing memory for the pointer.
* For VEHICLE_PROP_CHANGE_MODE_STATIC type of property, get should return the same value
diff --git a/modules/vehicle/vehicle.c b/modules/vehicle/vehicle.c
index 69bfad3..7e92ddd 100644
--- a/modules/vehicle/vehicle.c
+++ b/modules/vehicle/vehicle.c
@@ -18,7 +18,10 @@
#define LOG_NDEBUG 1
#define RADIO_PRESET_NUM 6
+#define UNUSED __attribute__((__unused__))
+
#include <errno.h>
+#include <inttypes.h>
#include <malloc.h>
#include <pthread.h>
#include <stdint.h>
@@ -120,7 +123,7 @@
};
vehicle_prop_config_t* find_config(int prop) {
- int i;
+ unsigned int i;
for (i = 0; i < sizeof(CONFIGS) / sizeof(vehicle_prop_config_t); i++) {
if (CONFIGS[i].prop == prop) {
return &CONFIGS[i];
@@ -140,7 +143,7 @@
return 0;
}
-static vehicle_prop_config_t const * vdev_list_properties(vehicle_hw_device_t* device,
+static vehicle_prop_config_t const * vdev_list_properties(vehicle_hw_device_t* device UNUSED,
int* num_properties) {
ALOGD("vdev_list_properties.");
@@ -180,7 +183,7 @@
return 0;
}
-static int vdev_get(vehicle_hw_device_t* device, vehicle_prop_value_t* data) {
+static int vdev_get(vehicle_hw_device_t* device UNUSED, vehicle_prop_value_t* data) {
ALOGD("vdev_get.");
//TODO all data supporting read should support get
if (!data) {
@@ -237,12 +240,12 @@
memset(&(data->value), 0, sizeof(data->value));
break;
}
- ALOGI("vdev_get, type 0x%x, time %ld, value_type %d", data->prop, data->timestamp,
+ ALOGI("vdev_get, type 0x%x, time %" PRId64 ", value_type %d", data->prop, data->timestamp,
data->value_type);
return 0;
}
-static int vdev_set(vehicle_hw_device_t* device, const vehicle_prop_value_t* data) {
+static int vdev_set(vehicle_hw_device_t* device UNUSED, const vehicle_prop_value_t* data) {
ALOGD("vdev_set.");
// Just print what data will be setting here.
ALOGD("Setting property %d with value type %d\n", data->prop, data->value_type);
@@ -289,8 +292,8 @@
return 0;
}
-void print_subscribe_info(vehicle_device_impl_t* impl) {
- int i;
+void print_subscribe_info(vehicle_device_impl_t* impl UNUSED) {
+ unsigned int i;
for (i = 0; i < sizeof(CONFIGS) / sizeof(vehicle_prop_config_t); i++) {
subscription_t* sub = (subscription_t*)CONFIGS[i].hal_data;
if (sub != NULL) {
@@ -457,7 +460,7 @@
return 0;
}
int ret_code = pthread_create(
- &sub->thread, NULL, fake_event_thread, sub);
+ &sub->thread, NULL, (void *(*)(void*))fake_event_thread, sub);
print_subscribe_info(impl);
pthread_mutex_unlock(&lock_);
return 0;
@@ -509,7 +512,7 @@
* informations in hw_device_t structure. After calling open() the client should
* use the hw_device_t to execute any Vehicle HAL device specific functions.
*/
-static int vdev_open(const hw_module_t* module, const char* __unused name,
+static int vdev_open(const hw_module_t* module, const char* name UNUSED,
hw_device_t** device) {
ALOGD("vdev_open");