Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
7902736b
Commit
7902736b
authored
May 14, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small utililty script to get info via GET requests
parent
2a58817a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
1 deletion
+65
-1
Makefile
src/php_top/Makefile
+2
-1
elphel_functions_include.php
src/php_top/elphel_functions_include.php
+14
-0
utils.php
src/php_top/utils.php
+49
-0
No files found.
src/php_top/Makefile
View file @
7902736b
...
@@ -18,7 +18,8 @@ PHP_SCRIPTS=i2c.php \
...
@@ -18,7 +18,8 @@ PHP_SCRIPTS=i2c.php \
phpinfo.php
\
phpinfo.php
\
raw.php
\
raw.php
\
snapfull.php
\
snapfull.php
\
tuneseq.php
tuneseq.php
\
utils.php
PHPINCLUDES
=
i2c_include.php
\
PHPINCLUDES
=
i2c_include.php
\
show_source_include.php
\
show_source_include.php
\
...
...
src/php_top/elphel_functions_include.php
View file @
7902736b
...
@@ -317,4 +317,18 @@ function get_raw_dev()
...
@@ -317,4 +317,18 @@ function get_raw_dev()
return
$raw_devices
;
return
$raw_devices
;
}
}
/** Get a list of detected sensors (no mux). Readimg from sysfs. */
function
get_sensors
(){
$sensors
=
array
(
'none'
,
'none'
,
'none'
,
'none'
);
$path
=
"/sys/devices/soc0/elphel393-detect_sensors@0"
;
for
(
$i
=
0
;
$i
<
count
(
$sensors
);
$i
++
){
$s
=
"
$path
/sensor
{
$i
}
0"
;
if
(
is_file
(
$s
)){
$c
=
trim
(
file_get_contents
(
$s
));
$sensors
[
$i
]
=
$c
;
}
}
return
$sensors
;
}
?>
?>
src/php_top/utils.php
0 → 100644
View file @
7902736b
<?php
/**
* @copyright Copyright (C) 2020 Elphel, Inc.
* SPDX-License-Identifier: GPL-3.0-or-later
*
* @author Oleg Dzhimiev <oleg@elphel.com>
* @brief Access info or perform actions using GET requests
*/
include
"include/elphel_functions_include.php"
;
$cmd
=
"donothing"
;
if
(
isset
(
$_GET
[
'cmd'
]))
$cmd
=
$_GET
[
'cmd'
];
else
if
(
isset
(
$argv
[
1
]))
$cmd
=
$argv
[
1
];
// allow CORS
header
(
'Access-Control-Allow-Origin: *'
);
switch
(
$cmd
){
case
"sensors"
:
print
(
cmd_sensors
());
break
;
default
:
print
(
"OK"
);
}
function
cmd_sensors
(){
$p0
=
2323
;
$sensors
=
get_sensors
();
$res
=
"
\t
<camera ip='"
.
$_SERVER
[
'SERVER_ADDR'
]
.
"'>
\n
"
;
foreach
(
$sensors
as
$i
=>
$sensor
){
$p
=
$p0
+
$i
;
$res
.=
"
\t\t
<port index='
$i
' port='
$p
'>
$sensor
</port>
\n
"
;
}
$res
.=
"
\t
</camera>
\n
"
;
$xml
=
"<?xml version='1.0' standalone='yes'?>
\n
"
;
$xml
.=
"<Document>
\n
"
;
$xml
.=
$res
;
$xml
.=
"</Document>
\n
"
;
return
$xml
;
}
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment