Lines Matching refs:fd
33 int count, fd; in inv_read_data() local
35 fd = open(fname, O_RDONLY); in inv_read_data()
36 if(fd < 0) { in inv_read_data()
41 count = read_attribute_sensor(fd, buf, sizeof(buf)); in inv_read_data()
43 close(fd); in inv_read_data()
50 close(fd); in inv_read_data()
56 int read_attribute_sensor(int fd, char* data, unsigned int size) in read_attribute_sensor() argument
61 if (fd > 0) { in read_attribute_sensor()
62 count = pread(fd, data, size, 0); in read_attribute_sensor()
80 int enable_sysfs_sensor(int fd, int en) in enable_sysfs_sensor() argument
88 nb = write(fd, &c, 1); in enable_sysfs_sensor()
95 close(fd); in enable_sysfs_sensor()
102 int write_attribute_sensor(int fd, long data) in write_attribute_sensor() argument
108 if (fd >= 0) { in write_attribute_sensor()
111 num_b = write(fd, buf, strlen(buf) + 1); in write_attribute_sensor()
114 LOGE("HAL:write fd %d returned '%s' (%d)", fd, strerror(err), err); in write_attribute_sensor()
116 LOGV_IF(EXTRA_VERBOSE, "HAL:fd=%d write attribute to %ld", fd, data); in write_attribute_sensor()
118 close(fd); in write_attribute_sensor()
125 int write_attribute_sensor_continuous(int fd, long data) in write_attribute_sensor_continuous() argument
131 if (fd >= 0) { in write_attribute_sensor_continuous()
134 num_b = write(fd, buf, strlen(buf) + 1); in write_attribute_sensor_continuous()
137 LOGE("HAL:write fd %d returned '%s' (%d)", fd, strerror(err), err); in write_attribute_sensor_continuous()
139 LOGV_IF(EXTRA_VERBOSE, "HAL:fd=%d write attribute to %ld", fd, data); in write_attribute_sensor_continuous()
283 int fd; in read_sysfs_dir() local
305 fd = open(full_path, O_RDONLY); in read_sysfs_dir()
306 if (fd > -1) { in read_sysfs_dir()
308 res = read_attribute_sensor(fd, buf, sizeof(buf)); in read_sysfs_dir()
309 close(fd); in read_sysfs_dir()
320 close(fd); in read_sysfs_dir()