modules/batt_health/sys.c
int BHD_SYS_sys_param_string_get(const char *path, char *s, int size)
{
        int r;
        int fd = open(path, O_RDONLY);
        s[0] = 0;
        if (fd < 0) {
		ALOGE("Failed to open %s for reading, errno = %d (%s)",
			path, errno, strerror(errno));
                return -1;
	}
        r = read(fd, s, size - 1);
        close(fd);
        if (r >= 0) {
                s[r] = '\0';
		ALOGV("Get %s = %s", path, s);
	} else {
		ALOGE("Failed to read file %s, errno = %d (%s)",
			path, errno, strerror(errno));
	}

	return r;
}
/* Gets a string value to a sysfs file */
Gets a string value to a sysfs file
Gets a string value to a sysfs file
int BHD_SYS_sys_param_string_get(const char *path, char *s, int size)
{
        int r;
        int fd = open(path, O_RDONLY);
        s[0] = 0;
        if (fd < 0) {
		ALOGE("Failed to open %s for reading, errno = %d (%s)",
			path, errno, strerror(errno));
                return -1;
	}
        r = read(fd, s, size - 1);
        close(fd);
        if (r >= 0) {
                s[r] = '\0';
		ALOGV("Get %s = %s", path, s);
	} else {
		ALOGE("Failed to read file %s, errno = %d (%s)",
			path, errno, strerror(errno));
	}
	return r;
}
int BHD_SYS_sys_param_string_get ( const char * path , char * s , int size ) { int r ; int fd = open ( path , O_RDONLY ) ; s [ 0 ] = 0 ; if ( fd < 0 ) { ALOGE ( " " , path , errno , strerror ( errno ) ) ; return -1 ; } r = read ( fd , s , size - 1 ) ; close ( fd ) ; if ( r >= 0 ) { s [ r ] = ' \0 ' ; ALOGV ( " " , path , s ) ; } else { ALOGE ( " " , path , errno , strerror ( errno ) ) ; } return r ; }
Gets a string value to a sysfs file
Gets a string value to a sysfs file