summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-03-21 09:25:46 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-03-21 09:25:46 -0300
commita6bb4e06551224137312b60dfc7db5c06581d35f (patch)
tree6c0ed4947f0c7ffd9a9b6e30f1ac5ae5d94668a4
parent6dc2a349c6f745f424ebf35ffe66e6bf98b781d9 (diff)
downloadpfsense-a6bb4e06551224137312b60dfc7db5c06581d35f.zip
pfsense-a6bb4e06551224137312b60dfc7db5c06581d35f.tar.gz
Detect Zones and Cores for thermal sensors using regex, it fixes #3337
-rw-r--r--usr/local/www/widgets/javascript/thermal_sensors.js33
1 files changed, 8 insertions, 25 deletions
diff --git a/usr/local/www/widgets/javascript/thermal_sensors.js b/usr/local/www/widgets/javascript/thermal_sensors.js
index 17f07d0..edc9990 100644
--- a/usr/local/www/widgets/javascript/thermal_sensors.js
+++ b/usr/local/www/widgets/javascript/thermal_sensors.js
@@ -278,33 +278,16 @@ function pulsateThermalSensorsItems(itemsToPulsate) {
}
function getSensorFriendlyName(sensorFullName){
+ var rzone = /^hw\.acpi\.thermal\.tz([0-9]+)\.temperature$/;
+ var rcore = /^dev\.cpu\.([0-9]+)\.temperature$/;
- var friendlyName = "";
-
- switch (sensorFullName) {
- case "hw.acpi.thermal.tz0.temperature":
- friendlyName = "Zone 0";
- break;
- case "hw.acpi.thermal.tz1.temperature":
- friendlyName = "Zone 1";
- break;
- case "dev.cpu.0.temperature":
- friendlyName = "Core 0";
- break;
- case "dev.cpu.1.temperature":
- friendlyName = "Core 1";
- break;
- case "dev.cpu.2.temperature":
- friendlyName = "Core 2";
- break;
- case "dev.cpu.3.temperature":
- friendlyName = "Core 3";
- break;
- default:
- friendlyName = sensorFullName;
- }
+ if (rzone.test(sensorFullName))
+ return "Zone " + rzone.exec(sensorFullName)[1];
+
+ if (rcore.test(sensorFullName))
+ return "Core " + rcore.exec(sensorFullName)[1];
- return friendlyName;
+ return sensorFullName;
}
function getThermalSensorValue(stringValue){
OpenPOWER on IntegriCloud