OSDN Git Service

STPK-1429 Rename misleading macro definition
authorPatrick Porlan <patrick.porlan@intel.com>
Mon, 14 Apr 2014 11:50:46 +0000 (13:50 +0200)
committersuyyala <sridhar.uyyala@intel.com>
Sat, 10 May 2014 15:31:14 +0000 (08:31 -0700)
The "common" attributes are per sensor, but we may also have
per device attributes, so rename a few macros for the sake of
clarity.

The Intel Sensor Hub driver uses a per-sensor sampling rate,
whereas the Invensense MPU-6500 has a per-device sampling rate
which following commits will address.

Issue: STPK-1429

Change-Id: I6c455f04fdeec1638e1f81661e108c6201dbe581
Signed-off-by: Patrick Porlan <patrick.porlan@intel.com>
common.h
control.c
enumeration.c

index 34de105..029f1ae 100644 (file)
--- a/common.h
+++ b/common.h
@@ -17,9 +17,9 @@
 #define ENABLE_PATH            BASE_PATH "buffer/enable"
 #define NAME_PATH              BASE_PATH "name"
 #define TRIGGER_PATH           BASE_PATH "trigger/current_trigger"
-#define COMMON_OFFSET_PATH     BASE_PATH "in_%s_offset"
-#define COMMON_SCALE_PATH      BASE_PATH "in_%s_scale"
-#define COMMON_SAMPLING_PATH   BASE_PATH "in_%s_sampling_frequency"
+#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 PROP_BASE      "ro.iio.%s.%s" /* Note: PROPERTY_KEY_MAX is small */
 
index fc1f27c..71aefca 100644 (file)
--- a/control.c
+++ b/control.c
@@ -672,7 +672,7 @@ int sensor_set_delay(int s, int64_t ns)
                new_sampling_rate = 1;
        }
 
-       sprintf(sysfs_path, COMMON_SAMPLING_PATH, dev_num, prefix);
+       sprintf(sysfs_path, SENSOR_SAMPLING_PATH, dev_num, prefix);
 
        if (sysfs_read_int(sysfs_path, &cur_sampling_rate) != -1)
                if (new_sampling_rate != cur_sampling_rate) {
index 9e430e8..a21eb82 100644 (file)
@@ -77,10 +77,10 @@ static void add_sensor (int dev_num, int catalog_index, int use_polling)
 
        /* See if we have general offsets and scale values for this sensor */
 
-       sprintf(sysfs_path, COMMON_OFFSET_PATH, dev_num, prefix);
+       sprintf(sysfs_path, SENSOR_OFFSET_PATH, dev_num, prefix);
        sysfs_read_float(sysfs_path, &sensor_info[s].offset);
 
-       sprintf(sysfs_path, COMMON_SCALE_PATH, dev_num, prefix);
+       sprintf(sysfs_path, SENSOR_SCALE_PATH, dev_num, prefix);
        if (!sysfs_read_float(sysfs_path, &scale))
                 sensor_info[s].scale = scale;
         else