Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-intel-libsensors: Commit

hardware/intel/libsensors


Commit MetaInfo

Revision21c5c782fa3cb1efddb2dc3a0ecfb789bad9c2c4 (tree)
Zeit2019-01-15 03:48:16
Autorlambdadroid <lambdadroid@gmai...>
Commiterlambdadroid

Log Message

Add support for sensor specific available sampling frequencies

Change-Id: Iad0e5aed487a35d32ee7333599316f72915bd858

Ändern Zusammenfassung

Diff

--- a/common.h
+++ b/common.h
@@ -40,6 +40,7 @@
4040 #define SENSOR_OFFSET_PATH BASE_PATH "in_%s_offset"
4141 #define SENSOR_SCALE_PATH BASE_PATH "in_%s_scale"
4242 #define SENSOR_SAMPLING_PATH BASE_PATH "in_%s_sampling_frequency"
43+#define SENSOR_AVAIL_FREQ_PATH BASE_PATH "in_%s_sampling_frequency_available"
4344 #define DEVICE_SAMPLING_PATH BASE_PATH "sampling_frequency"
4445 #define DEVICE_AVAIL_FREQ_PATH BASE_PATH "sampling_frequency_available"
4546 #define ILLUMINATION_CALIBPATH BASE_PATH "in_illuminance_calibscale"
--- a/description.c
+++ b/description.c
@@ -482,6 +482,7 @@ int sensor_get_order (int s, unsigned char map[MAX_CHANNELS])
482482 int sensor_get_available_frequencies (int s)
483483 {
484484 int dev_num = sensor[s].dev_num, err, i;
485+ const char *prefix = sensor_catalog[sensor[s].catalog_index].tag;
485486 char avail_sysfs_path[PATH_MAX], freqs_buf[100];
486487 char *p, *end;
487488 float f;
@@ -492,8 +493,12 @@ int sensor_get_available_frequencies (int s)
492493 sprintf(avail_sysfs_path, DEVICE_AVAIL_FREQ_PATH, dev_num);
493494
494495 err = sysfs_read_str(avail_sysfs_path, freqs_buf, sizeof(freqs_buf));
495- if (err < 0)
496- return 0;
496+ if (err < 0) {
497+ sprintf(avail_sysfs_path, SENSOR_AVAIL_FREQ_PATH, dev_num, prefix);
498+ err = sysfs_read_str(avail_sysfs_path, freqs_buf, sizeof(freqs_buf));
499+ if (err < 0)
500+ return 0;
501+ }
497502
498503 for (p = freqs_buf, f = strtof(p, &end); p != end; p = end, f = strtof(p, &end))
499504 sensor[s].avail_freqs_count++;
Show on old repository browser