const char* om_sysfs_swap(const char* name, const char* val) { const char* path = om_sysfs_path(name); const char* res = NULL; if (path == NULL) return NULL; res = om_sysfs_readfile(path); if (om_sysfs_writefile(path, val) != 0) return NULL; return res; }
static const char* om_gsm_flowcontrol_path() { if (!gsm_flowcontrol_path_found) { const char* root = om_sysfs_path("pm-gsm"); if (root == NULL) return NULL; snprintf(gsm_flowcontrol_path, PATH_MAX, "%s/flowcontrolled", root); if (access(gsm_flowcontrol_path, F_OK) != 0) return NULL; gsm_flowcontrol_path_found = 1; } return gsm_flowcontrol_path; }
int om_sysfs_set(const char* name, const char* val) { const char* path = om_sysfs_path(name); return om_sysfs_writefile(path, val); }
const char* om_sysfs_get(const char* name) { const char* path = om_sysfs_path(name); if (path == NULL) return NULL; return om_sysfs_readfile(path); }