Commit 4577b4c8 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

initial

parent c591b899
# Runs 'make', 'make install', and 'make clean' in specified subdirectories
#SUBDIRS := src/php_top src/python_tests src/debugfs-webgui # src1
SUBDIRS := src
INSTALLDIRS = $(SUBDIRS:%=install-%)
CLEANDIRS = $(SUBDIRS:%=clean-%)
#TARGETDIR=$(DESTDIR)/www/pages
all: $(SUBDIRS)
@echo "make all top"
$(SUBDIRS):
$(MAKE) -C $@
install: $(INSTALLDIRS)
echo "make install top"
$(INSTALLDIRS):
$(MAKE) -C $(@:install-%=%) install
clean: $(CLEANDIRS)
@echo "make clean top"
$(CLEANDIRS):
$(MAKE) -C $(@:clean-%=%) clean
.PHONY: all install clean $(SUBDIRS) $(INSTALLDIRS) $(CLEANDIRS)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
<storageModule moduleId="org.eclipse.cdt.core.settings">
<cconfiguration id="0.1221820363">
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="0.1221820363" moduleId="org.eclipse.cdt.core.settings" name="Default">
<externalSettings/>
<extensions>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.VCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildProperties="" description="" id="0.1221820363" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1221820363." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1043274217" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.1043274217.1071800033" name=""/>
<builder arguments="web-hwmon" command="${workspace_loc:/elphel-web-hwmon/run_bitbake.sh}" enableCleanBuild="false" enabledIncrementalBuild="true" id="org.eclipse.cdt.build.core.settings.default.builder.365026764" incrementalBuildTarget="-c install -f" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.785882741" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.982996495" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.8554647" languageId="org.eclipse.cdt.core.assembly" languageName="Assembly" sourceContentType="org.eclipse.cdt.core.asmSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.480226500" name="GNU C++" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1347472659" languageId="org.eclipse.cdt.core.g++" languageName="GNU C++" sourceContentType="org.eclipse.cdt.core.cxxSource,org.eclipse.cdt.core.cxxHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1686385332" name="GNU C" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.716913472" languageId="org.eclipse.cdt.core.gcc" languageName="GNU C" sourceContentType="org.eclipse.cdt.core.cSource,org.eclipse.cdt.core.cHeader" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.559915258" name="LLVM bytecode assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1886099197" languageId="org.eclipse.cdt.managedbuilder.llvm.ui.llvmAssembly" languageName="LLVM bytecode assembly" sourceContentType="org.eclipse.cdt.managedbuilder.llvm.ui.llvmAssemblySource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
<tool id="org.eclipse.cdt.build.core.settings.holder.1960214219" name="UPC" superClass="org.eclipse.cdt.build.core.settings.holder">
<inputType id="org.eclipse.cdt.build.core.settings.holder.inType.1593701683" languageId="org.eclipse.cdt.core.parser.upc.upc" languageName="UPC" sourceContentType="org.eclipse.cdt.core.parser.upc.upcSource" superClass="org.eclipse.cdt.build.core.settings.holder.inType"/>
</tool>
</toolChain>
</folderInfo>
<sourceEntries>
<entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/>
</sourceEntries>
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
</cconfiguration>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<project id="elphel-web-hwmon.null.1071524317" name="elphel-web-hwmon"/>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="0.1221820363">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
<storageModule moduleId="refreshScope" versionNumber="2">
<configuration configurationName="Default">
<resource resourceType="PROJECT" workspacePath="/elphel-web-hwmon"/>
</configuration>
</storageModule>
</cproject>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="true"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/elphel-web-hwmon/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="web-hwmon -c target_scp -f"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>elphel-web-hwmon</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/SCP web-hwmon to target.launch</value>
</dictionary>
<dictionary>
<key>incclean</key>
<value>true</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand>
<name>org.python.pydev.PyDevBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
<nature>org.python.pydev.pythonNature</nature>
</natures>
</projectDescription>
#!/bin/bash
args="$@"
while (( "$#" )); do
shift
done
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Launching bitbake $args"
cd $DIR/../../poky
. ./oe-init-build-env
bitbake $args | sed -u 's@| @@'
exit 0
DOCUMENTROOT=$(DESTDIR)/www/pages
OWN = -o root -g root
INSTDOCS = 0644
INSTALL = install
DOCS = hwmon.html \
hwmon.js
PHP_SCRIPTS = hwmon.php
all:
@echo "make all in src"
install:
@echo "make install in src"
# below depends on Yocto and the corresponding recipe (meta-core/init/init.bb)
$(INSTALL) $(OWN) -d $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(DOCS) $(DOCUMENTROOT)
$(INSTALL) $(OWN) -m $(INSTDOCS) $(PHP_SCRIPTS) $(DOCUMENTROOT)
clean:
@echo "make clean in src"
<html>
<head>
<script src="js/jquery-2.2.3.min.js"></script>
<script src="js/flot/jquery.flot.min.js"></script>
<script src="hwmon.js"></script>
<style>
input{
width:50px;
text-align:right;
}
</style>
</head>
<body onload='init()'>
<table>
<tr>
<td valign='top'>
<table>
<tr>
<td>T<sub>shutdown</sub> </td>
<td><input type='text' id='t_shutdown' value='0' class='pars'/></td>
<td> &deg;C</td>
</tr>
<tr>
<td>T<sub>fan</sub> </td>
<td><input type='text' id='t_fan_on' value='0' class='pars'/></td>
<td> &deg;C</td>
</tr>
<tr>
<td>&Delta;T<sub>fan hyst</sub> </td>
<td><input type='text' id='t_fan_hyst' value='0' class='pars'/></td>
<td> &deg;C</td>
</tr>
<tr>
<td>t<sub>scan period</sub> </td>
<td><input type='text' id='scan_period' value='1' class='pars'/></td>
<td> s</td>
</tr>
</table>
</td>
<td><div id="t_chart"></div></td>
</tr>
</table>
</body>
</html>
\ No newline at end of file
$(function(){
//init();
});
var interval_read_temperature;
var d0 = Array(600);
var d1 = Array(600);
var d2 = Array(600);
var ds = [Array(600),Array(600),Array(600),Array(600)];
var labels = ["CPU","389","/dev/sda","/dev/sdb"];
var t = Array();
var level_shutdown;
var level_fan_on;
var level_fan_hyst;
var options = {
lines: { show: true },
points: { show: false },
xaxis: {
tickDecimals: 0,
tickSize: 1
},
yaxis: {
min: 0,
max: 100
},
colors: [
'rgba(255,100,100,0.5)',
'rgba(255,150, 20,0.5)',
'rgba(100,255,100,0.5)',
'rgba(0,0,0,1)',
'rgba(100,100,200,1)',
'rgba( 50,150, 50,1)',
'rgba( 50,150,150,1)'
],
legend:{
position: "nw"
},
};
function init(){
console.log("hwmon init()");
var tc = $("#t_chart");
tc.css({
width: "800px",
height: "600px",
background:"rgba(100,100,100,0.0)"
});
read_params(init_fields);
}
function init_fields(){
$("#t_shutdown").val(level_shutdown);
$("#t_fan_on").val(level_fan_on);
$("#t_fan_hyst").val(level_fan_hyst);
$("#scan_period").val(scan_period);
$(".pars").change(function(){
update_params();
});
interval_read_temperature = setInterval(read_core_temp,scan_period*1000);
}
function update_params(){
level_shutdown = parseFloat($("#t_shutdown").val());
level_fan_on = parseFloat($("#t_fan_on").val());
level_fan_hyst = parseFloat($("#t_fan_hyst").val());
scan_period = parseFloat($("#scan_period").val());
$.ajax({
url: "hwmon.php?cmd=write&temp_sampling_time="+scan_period+"&temp_major="+level_shutdown+"&temp_minor="+level_fan_on+"&temp_hyst="+level_fan_hyst,
complete: function(){
console.log("parameters updated");
clearInterval(interval_read_temperature);
interval_read_temperature = setInterval(read_core_temp,scan_period*1000);
}
});
}
function read_params(callback){
$.ajax({
url: "hwmon.php?cmd=read",
complete: function(data){
var tmp_str = data.responseText;
tmp_str = tmp_str.trim();
var tmp_arr = tmp_str.split(/\n|: /);
for (var i=0;i<tmp_arr.length;i++){
switch(tmp_arr[i]){
case "temp_sampling_time":
scan_period = parseFloat(tmp_arr[i+1]);
break;
case "temp_major":
level_shutdown = parseFloat(tmp_arr[i+1]);
break;
case "temp_minor":
level_fan_on = parseFloat(tmp_arr[i+1]);
break;
case "temp_hyst":
level_fan_hyst = parseFloat(tmp_arr[i+1]);
break;
default:
break;
}
}
callback();
}
});
}
function read_core_temp(){
$.ajax({
url: "hwmon.php?cmd=t",
complete: function(data){
console.log(data.responseText);
temps = data.responseText.trim().split(" ");
//t.push(d1.length);
d0.splice(0,1);
d0.push(level_shutdown);
d1.splice(0,1);
d1.push(level_fan_on);
d2.splice(0,1);
d2.push(level_fan_on-level_fan_hyst);
options.xaxis.tickSize = Math.max(1,Math.round(d1.length)/10);
points = [
{label: "CPU shutdown level", data: get_data(t,d0)},
{label: "CPU Fan-On level", data: get_data(t,d1)},
{label: "CPU Fan-Off level", data: get_data(t,d2)},
];
for(var i=0;i<temps.length;i++){
if (temps[i]!="-"){
ds[i].splice(0,1);
ds[i].push(temps[i]);
points.push({label: labels[i], data: get_data(t,ds[i])});
}
}
$.plot($("#t_chart"), points, options);
}
});
}
function get_data(x,y){
var d = Array();
for (var i=0;i<y.length; i++){
d.push([i, y[i]]);
}
return d;
}
\ No newline at end of file
<?php
if (isset($_GET['cmd']))
$cmd = $_GET['cmd'];
else
$cmd = "t";
if ($cmd=="t"){
$t_cpu = file_get_contents("/tmp/core_temp");
$t_10389 = "";
$t_sda = "";
$t_sdb = "";
$temp1_input = "/sys/devices/soc0/amba@0/e0004000.ps7-i2c/i2c-0/0-001a/hwmon/hwmon0/temp1_input";
if (is_file($temp1_input)){
$t_10389 = trim(file_get_contents($temp1_input));
$t_10389 = intval($t_10389)/1000;
}
$t_sda = exec("smartctl -A /dev/sda | egrep ^194 | awk '{print $10}'");
if ($t_sda=="") $t_sda = "-";
else $t_sda = intval($t_sda);
$t_sdb = exec("smartctl -A /dev/sdb | egrep ^194 | awk '{print $10}'");
if ($t_sdb=="") $t_sdb = "-";
else $t_sdb = intval($t_sdb);
echo "$t_cpu $t_10389 $t_sda $t_sdb";
}
if ($cmd=="read"){
echo file_get_contents("/tmp/core_temp_params");
}
if ($cmd=="write"){
$cstr = "";
foreach($_GET as $key => $val){
if(strpos($key,"temp")===0){
$cstr .= "$key:$val\n";
}
}
file_put_contents("/tmp/core_temp_params",$cstr);
echo "$cstr";
}
?>
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