OSDN Git Service

Merge branch 'lineage-16.0' of https://github.com/me176c-dev/android_hardware_iio... oreo-x86 pie-x86 q-x86 r-x86 android-x86-8.1-r3 android-x86-8.1-r4 android-x86-8.1-r5 android-x86-8.1-r6 android-x86-9.0-r1 android-x86-9.0-r2
authorChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 26 Jun 2019 03:30:18 +0000 (11:30 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Wed, 26 Jun 2019 03:30:18 +0000 (11:30 +0800)
Android.mk
activity_event_utils.h
common.h
description.c

index 11b5b6e..b4b3a12 100644 (file)
@@ -56,7 +56,7 @@ LOCAL_MODULE := sens
 LOCAL_CFLAGS := -DLOG_TAG=\"Sensors\" -fvisibility=hidden
 LOCAL_SHARED_LIBRARIES := liblog libcutils libdl
 LOCAL_SRC_FILES := sens.c
-LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
 include $(BUILD_EXECUTABLE)
 
@@ -87,6 +87,6 @@ LOCAL_MODULE := activity
 LOCAL_CFLAGS := -DLOG_TAG=\"Activity\" -fvisibility=hidden
 LOCAL_SHARED_LIBRARIES := liblog libcutils libdl
 LOCAL_SRC_FILES := activity.c
-LOCAL_MODULE_TAGS := eng
+LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_EXECUTABLES)
 include $(BUILD_EXECUTABLE)
index b54d958..582ef68 100644 (file)
 #define MAX_ACTIVITIES         6
 #define MAX_EVENTS_PER_ACTIVITY        2
 
-typedef unsigned bool;
-#define true   1
-#define false  0
-
 /* For each activity in activity_recognition.h we can monitor 2 events at most :
  * ENTER and EXIT */
 struct activity_event_info {
index fdd6c4d..8ffa528 100644 (file)
--- a/common.h
+++ b/common.h
@@ -40,6 +40,7 @@
 #define SENSOR_OFFSET_PATH     BASE_PATH "in_%s_offset"
 #define SENSOR_SCALE_PATH      BASE_PATH "in_%s_scale"
 #define SENSOR_SAMPLING_PATH   BASE_PATH "in_%s_sampling_frequency"
+#define SENSOR_AVAIL_FREQ_PATH BASE_PATH "in_%s_sampling_frequency_available"
 #define DEVICE_SAMPLING_PATH   BASE_PATH "sampling_frequency"
 #define DEVICE_AVAIL_FREQ_PATH BASE_PATH "sampling_frequency_available"
 #define ILLUMINATION_CALIBPATH BASE_PATH "in_illuminance_calibscale"
index 685b7eb..60a0b1e 100644 (file)
@@ -482,6 +482,7 @@ int sensor_get_order (int s, unsigned char map[MAX_CHANNELS])
 int sensor_get_available_frequencies (int s)
 {
        int dev_num = sensor[s].dev_num, err, i;
+       const char *prefix = sensor_catalog[sensor[s].catalog_index].tag;
        char avail_sysfs_path[PATH_MAX], freqs_buf[100];
        char *p, *end;
        float f;
@@ -492,8 +493,12 @@ int sensor_get_available_frequencies (int s)
        sprintf(avail_sysfs_path, DEVICE_AVAIL_FREQ_PATH, dev_num);
 
        err = sysfs_read_str(avail_sysfs_path, freqs_buf, sizeof(freqs_buf));
-       if (err < 0)
-               return 0;
+       if (err < 0) {
+               sprintf(avail_sysfs_path, SENSOR_AVAIL_FREQ_PATH, dev_num, prefix);
+               err = sysfs_read_str(avail_sysfs_path, freqs_buf, sizeof(freqs_buf));
+               if (err < 0)
+                       return 0;
+       }
 
        for (p = freqs_buf, f = strtof(p, &end); p != end; p = end, f = strtof(p, &end))
                sensor[s].avail_freqs_count++;