2011-08-15 02:21:12 -07:00
|
|
|
/* Setup if we need cpufreq? */
|
2012-11-30 06:38:34 -08:00
|
|
|
#include "e_wizard.h"
|
2018-05-27 06:51:15 -07:00
|
|
|
#include "e_wizard_api.h"
|
2011-08-15 02:21:12 -07:00
|
|
|
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/sysctl.h>
|
|
|
|
#endif
|
|
|
|
|
2012-11-24 15:45:55 -08:00
|
|
|
#ifndef __FreeBSD__
|
2011-08-15 02:21:12 -07:00
|
|
|
static char *
|
|
|
|
read_file(const char *file)
|
|
|
|
{
|
|
|
|
FILE *f = fopen(file, "r");
|
|
|
|
size_t len;
|
|
|
|
char buf[4096], *p;
|
|
|
|
if (!f) return NULL;
|
|
|
|
len = fread(buf, 1, sizeof(buf) - 1, f);
|
|
|
|
if (len == 0)
|
|
|
|
{
|
|
|
|
fclose(f);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
buf[len] = 0;
|
|
|
|
for (p = buf; *p; p++)
|
|
|
|
{
|
|
|
|
if (p[0] == '\n') p[0] = 0;
|
|
|
|
}
|
|
|
|
fclose(f);
|
|
|
|
return strdup(buf);
|
|
|
|
}
|
2012-11-24 15:45:55 -08:00
|
|
|
#endif
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_init(E_Wizard_Page *pg EINA_UNUSED, Eina_Bool *need_xdg_desktops EINA_UNUSED, Eina_Bool *need_xdg_icons EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_shutdown(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_show(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
int hav_cpufreq = 0;
|
|
|
|
#ifdef __FreeBSD__
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
size_t len = 0;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
len = sizeof(buf);
|
|
|
|
if (sysctlbyname("dev.cpu.0.freq_levels", buf, &len, NULL, 0) == 0)
|
2012-06-28 06:12:13 -07:00
|
|
|
hav_cpufreq = 1;
|
2011-08-15 02:21:12 -07:00
|
|
|
#else
|
|
|
|
char *str, *p;
|
|
|
|
|
|
|
|
str = read_file("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies");
|
|
|
|
if (str)
|
|
|
|
{
|
|
|
|
for (p = str; *p; p++)
|
|
|
|
{
|
|
|
|
if (isspace(*p))
|
|
|
|
{
|
|
|
|
hav_cpufreq = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(str);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (!hav_cpufreq)
|
|
|
|
{
|
|
|
|
E_Config_Module *em;
|
|
|
|
Eina_List *l;
|
2012-06-28 06:12:13 -07:00
|
|
|
|
2011-08-15 02:21:12 -07:00
|
|
|
EINA_LIST_FOREACH(e_config->modules, l, em)
|
|
|
|
{
|
|
|
|
if (!em->name) continue;
|
|
|
|
if (!strcmp(em->name, "cpufreq"))
|
|
|
|
{
|
|
|
|
e_config->modules = eina_list_remove_list
|
2012-06-28 06:12:13 -07:00
|
|
|
(e_config->modules, l);
|
2011-08-15 02:21:12 -07:00
|
|
|
if (em->name) eina_stringshare_del(em->name);
|
|
|
|
free(em);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
e_config_save_queue();
|
|
|
|
}
|
|
|
|
return 0; /* 1 == show ui, and wait for user, 0 == just continue */
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
/*
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_hide(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2015-05-07 12:13:10 -07:00
|
|
|
E_API int
|
2015-03-18 15:09:09 -07:00
|
|
|
wizard_page_apply(E_Wizard_Page *pg EINA_UNUSED)
|
2011-08-15 02:21:12 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2012-11-30 02:46:48 -08:00
|
|
|
*/
|