Android-x86
Fork
Faire un don

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libsensors: Commit

hardware/libsensors


Commit MetaInfo

Révision40d6eb0404a1af7647dec78b4bf75d9949920497 (tree)
l'heure2017-11-23 12:59:29
AuteurChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Message de Log

w500_sensor: update HAL version to 1_3

Change Summary

Modification

--- a/Android.mk
+++ b/Android.mk
@@ -48,4 +48,5 @@ LOCAL_MODULE := sensors.w500
4848 LOCAL_MODULE_TAGS := optional
4949 LOCAL_MODULE_RELATIVE_PATH := hw
5050 LOCAL_SRC_FILES := w500_sensor.c
51+LOCAL_CFLAGS := -Wno-unused-parameter
5152 include $(BUILD_SHARED_LIBRARY)
--- a/w500_sensor.c
+++ b/w500_sensor.c
@@ -16,6 +16,7 @@
1616 #include <cutils/native_handle.h>
1717 #include <dirent.h>
1818 #include <math.h>
19+#include <inttypes.h>
1920 #include <hardware/sensors.h>
2021
2122 #define DRIVER_DESC "Acer BMA150 accelerometer"
@@ -37,7 +38,7 @@
3738 #define VALID_ROTATE_MASK (7 << 0)
3839
3940 struct sensor_context {
40- struct sensors_poll_device_t device;
41+ struct sensors_poll_device_1 device;
4142 int accel_fd;
4243
4344 struct timespec delay;
@@ -137,17 +138,6 @@ static int context__activate(struct sensors_poll_device_t *dev,
137138 return -EINVAL;
138139 }
139140
140-static int context__setDelay(struct sensors_poll_device_t *dev,
141- int handle, int64_t ns)
142-{
143- struct sensor_context* ctx = (struct sensor_context *)dev;
144-
145- ctx->delay.tv_sec = 0;
146- ctx->delay.tv_nsec = ns;
147-
148- return 0;
149-}
150-
151141 static int context__close(struct hw_device_t *dev)
152142 {
153143 struct sensor_context* ctx = (struct sensor_context *)dev;
@@ -352,6 +342,24 @@ static int context__poll(struct sensors_poll_device_t *dev, sensors_event_t *dat
352342 return 0;
353343 }
354344
345+static int context__batch(struct sensors_poll_device_1* dev, int sensor_handle,
346+ int flags, int64_t sampling_period_ns, int64_t max_report_latency_ns)
347+{
348+ ALOGD("%s: dev=%p sensor_handle=%d flags=%d sampling_period_ns=%" PRId64 " max_report_latency_ns=%" PRId64,
349+ __FUNCTION__, dev, sensor_handle, flags, sampling_period_ns, max_report_latency_ns);
350+
351+ struct sensor_context* ctx = (struct sensor_context *)dev;
352+ ctx->delay.tv_sec = 0;
353+ ctx->delay.tv_nsec = sampling_period_ns;
354+ return EXIT_SUCCESS;
355+}
356+
357+static int context__flush(struct sensors_poll_device_1* dev, int sensor_handle)
358+{
359+ ALOGD("%s: dev=%p sensor_handle=%d", __FUNCTION__, dev, sensor_handle);
360+ return EXIT_SUCCESS;
361+}
362+
355363 static const struct sensor_t sensor_list[] = {
356364 [0] = {
357365 .name = "W500 Ambient Light sensor",
@@ -418,13 +426,14 @@ static int open_sensors(const struct hw_module_t *module, const char* id,
418426
419427 /* Do common setup */
420428 ctx->device.common.tag = HARDWARE_DEVICE_TAG;
421- ctx->device.common.version = 0;
429+ ctx->device.common.version = SENSORS_DEVICE_API_VERSION_1_3;
422430 ctx->device.common.module = (struct hw_module_t *)module;
423431 ctx->device.common.close = context__close;
424432
425433 ctx->device.activate = context__activate;
426- ctx->device.setDelay = context__setDelay;
427434 ctx->device.poll = context__poll;
435+ ctx->device.batch = context__batch;
436+ ctx->device.flush = context__flush;
428437
429438 *device = &ctx->device.common;
430439
@@ -444,8 +453,8 @@ static struct hw_module_methods_t sensors_module_methods = {
444453 struct sensors_module_t HAL_MODULE_INFO_SYM = {
445454 .common = {
446455 .tag = HARDWARE_MODULE_TAG,
447- .version_major = 1,
448- .version_minor = 0,
456+ .module_api_version = 1,
457+ .hal_api_version = 0,
449458 .id = SENSORS_HARDWARE_MODULE_ID,
450459 .name = "W500 SENSORS Module",
451460 .author = "Marek Vasut",
Afficher sur ancien navigateur de dépôt.