forked from enlightenment/enlightenment
bugfix: unify temp module temperature_get_bus_files() functions
CID 1039874
This commit is contained in:
parent
ed50455cde
commit
ee3370d226
|
@ -363,48 +363,44 @@ temperature_face_update_config(Config_Face *inst)
|
||||||
}
|
}
|
||||||
|
|
||||||
Eina_List *
|
Eina_List *
|
||||||
temperature_get_bus_files(const char* bus)
|
temperature_get_bus_files(const char *bus)
|
||||||
{
|
{
|
||||||
Eina_List *result, *therms;
|
Eina_List *result;
|
||||||
|
Eina_List *therms;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
char busdir[PATH_MAX];
|
char busdir[PATH_MAX];
|
||||||
|
char *name;
|
||||||
|
|
||||||
result = NULL;
|
result = NULL;
|
||||||
if (result)
|
|
||||||
|
snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus);
|
||||||
|
/* Look through all the devices for the given bus. */
|
||||||
|
therms = ecore_file_ls(busdir);
|
||||||
|
|
||||||
|
EINA_LIST_FREE(therms, name)
|
||||||
{
|
{
|
||||||
snprintf(busdir, sizeof(busdir), "/sys/bus/%s/devices", bus);
|
Eina_List *files;
|
||||||
/* Look through all the devices for the given bus. */
|
char *file;
|
||||||
therms = ecore_file_ls(busdir);
|
|
||||||
if (therms)
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(therms, name)
|
/* Search each device for temp*_input, these should be
|
||||||
{
|
* temperature devices. */
|
||||||
Eina_List *files;
|
snprintf(path, sizeof(path), "%s/%s", busdir, name);
|
||||||
char *file;
|
files = ecore_file_ls(path);
|
||||||
|
EINA_LIST_FREE(files, file)
|
||||||
|
{
|
||||||
|
if ((!strncmp("temp", file, 4)) &&
|
||||||
|
(!strcmp("_input", &file[strlen(file) - 6])))
|
||||||
|
{
|
||||||
|
char *f;
|
||||||
|
|
||||||
/* Search each device for temp*_input, these should be
|
snprintf(path, sizeof(path),
|
||||||
* temperature devices. */
|
"%s/%s/%s", busdir, name, file);
|
||||||
snprintf(path, sizeof(path), "%s/%s", busdir, name);
|
f = strdup(path);
|
||||||
files = ecore_file_ls(path);
|
if (f) result = eina_list_append(result, f);
|
||||||
EINA_LIST_FREE(files, file)
|
}
|
||||||
{
|
free(file);
|
||||||
if ((!strncmp("temp", file, 4)) &&
|
}
|
||||||
(!strcmp("_input", &file[strlen(file) - 6])))
|
free(name);
|
||||||
{
|
|
||||||
char *f;
|
|
||||||
|
|
||||||
snprintf(path, sizeof(path),
|
|
||||||
"%s/%s/%s", busdir, name, file);
|
|
||||||
f = strdup(path);
|
|
||||||
if (f) result = eina_list_append(result, f);
|
|
||||||
}
|
|
||||||
free(file);
|
|
||||||
}
|
|
||||||
free(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue