OSDN Git Service

6f827d3f906ea94a7234dfdda4fb56c6e227a943
[android-x86/hardware-intel-libsensors.git] / utils.h
1 /*
2  * Copyright (C) 2014 Intel Corporation.
3  */
4
5 #ifndef __UTILS_H__
6 #define __UTILS_H__
7
8 #include "common.h"
9
10 int     sysfs_read_int  (const char path[PATH_MAX], int *value);
11 int     sysfs_write_int (const char path[PATH_MAX], int value);
12
13 int     sysfs_read_str  (const char path[PATH_MAX], char *buf, int buf_len);
14 int     sysfs_write_str (const char path[PATH_MAX], const char *buf);
15
16 int     sysfs_read_float(const char path[PATH_MAX], float *value);
17
18 int     decode_type_spec(const char type_buf[MAX_TYPE_SPEC_LEN],
19                          struct datum_info_t *type_info);
20
21 int64_t sample_as_int64 (unsigned char* sample, struct datum_info_t* type);
22
23 float   transform_sample(int sensor_type, int channel, float val);
24
25 int64_t get_timestamp   (void);
26
27 #endif
28
29
30