Commit d74c2749 authored by Franco Fichtner's avatar Franco Fichtner

system: do the previous for thermal modules plus some naming unification

parent efb83c51
......@@ -375,10 +375,7 @@ function is_fqdn($fqdn) {
return($hostname);
}
/*
* load_crypto() - Load crypto modules if enabled in config.
*/
function load_crypto()
function load_crypto_module()
{
global $config;
......@@ -388,22 +385,13 @@ function load_crypto()
}
}
/*
* load_thermal_hardware() - Load temperature monitor kernel module
*/
function load_thermal_hardware()
function load_thermal_module()
{
global $config;
$thermal_hardware_modules = array('coretemp', 'amdtemp');
if (!isset($config['system']['thermal_hardware']) || !in_array($config['system']['thermal_hardware'], $thermal_hardware_modules)) {
return false;
}
if (!empty($config['system']['thermal_hardware']) && !is_module_loaded($config['system']['thermal_hardware'])) {
log_error("Loading {$config['system']['thermal_hardware']} thermal monitor module.");
mwexec("/sbin/kldload {$config['system']['thermal_hardware']}");
log_error(sprintf(gettext('Loading %s thermal monitor module.'), $config['system']['thermal_hardware']));
mwexecf('/sbin/kldload %s', $config['system']['thermal_hardware']);
}
}
......
......@@ -201,10 +201,10 @@ system_setup_sysctl();
echo "done.\n";
/* enable optional crypto modules */
load_crypto();
load_crypto_module();
/* enable optional thermal sensor modules */
load_thermal_hardware();
load_thermal_module();
/* set up our timezone */
system_timezone_configure();
......
......@@ -40,7 +40,7 @@ require_once("interfaces.inc");
function crypto_modules()
{
$crypto_modules = array(
$modules = array(
'aesni' => gettext('AES-NI CPU-based Acceleration'),
'glxsb' => gettext('AMD Geode LX Security Block'),
'hifn' => gettext('Hifn 7751/7951/7811/7955/7956 Crypto Accelerator'),
......@@ -50,7 +50,7 @@ function crypto_modules()
);
$available = array();
foreach ($crypto_modules as $name => $desc) {
foreach ($modules as $name => $desc) {
if (file_exists("/boot/kernel/{$name}.ko")) {
$available[$name] = $desc;
}
......@@ -59,10 +59,22 @@ function crypto_modules()
return $available;
}
$thermal_hardware_modules = array(
'coretemp' => gettext('Intel Core* CPU on-die thermal sensor'),
'amdtemp' => gettext('AMD K8, K10 and K11 CPU on-die thermal sensor'),
);
function thermal_modules()
{
$modules = array(
'amdtemp' => gettext('AMD K8, K10 and K11 CPU on-die thermal sensor'),
'coretemp' => gettext('Intel Core* CPU on-die thermal sensor'),
);
$available = array();
foreach ($modules as $name => $desc) {
if (file_exists("/boot/kernel/{$name}.ko")) {
$available[$name] = $desc;
}
}
return $available;
}
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
......@@ -95,10 +107,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$input_errors = array();
$pconfig = $_POST;
if (!empty($pconfig['thermal_hardware']) && !array_key_exists($pconfig['thermal_hardware'], $thermal_hardware_modules)) {
$input_errors[] = gettext("Please select a valid Thermal Hardware Sensor.");
}
if (count($input_errors) == 0) {
if (!empty($pconfig['proxyurl'])) {
$config['system']['proxyurl'] = $_POST['proxyurl'];
......@@ -213,8 +221,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
system_resolvconf_generate(true);
filter_configure();
activate_powerd();
load_crypto();
load_thermal_hardware();
load_crypto_module();
load_thermal_module();
if ($need_relayd_restart) {
relayd_configure();
}
......@@ -459,7 +467,7 @@ include("head.inc");
<select name="thermal_hardware" class="selectpicker" data-style="btn-default">
<option value=""><?=gettext("None/ACPI"); ?></option>
<?php
foreach ($thermal_hardware_modules as $themalmod_name => $themalmod_descr) :?>
foreach (thermal_modules() as $themalmod_name => $themalmod_descr) :?>
<option value="<?=$themalmod_name; ?>" <?=$pconfig['thermal_hardware'] == $themalmod_name ? " selected=\"selected\"" :"";?>>
<?="{$themalmod_descr} ({$themalmod_name})"; ?>
</option>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment