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
e4569ef9
Commit
e4569ef9
authored
Aug 19, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update lines from debugfs but use flags from saved config
parent
81d29baf
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
213 additions
and
88 deletions
+213
-88
debugfs.js
src/debugfs-webgui/debugfs.js
+187
-83
debugfs.php
src/debugfs-webgui/debugfs.php
+26
-5
No files found.
src/debugfs-webgui/debugfs.js
View file @
e4569ef9
This diff is collapsed.
Click to expand it.
src/debugfs-webgui/debugfs.php
View file @
e4569ef9
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
$config
=
"debugfs.json"
;
$config
=
"debugfs.json"
;
$tmp_config
=
"/tmp/
$config
"
;
$tmp_config
=
"/tmp/
$config
"
;
$DEBUGFSFILE
=
"/sys/kernel/debug/dynamic_debug/control"
;
if
(
isset
(
$_GET
[
'cmd'
]))
if
(
isset
(
$_GET
[
'cmd'
]))
$cmd
=
$_GET
[
'cmd'
];
$cmd
=
$_GET
[
'cmd'
];
else
else
...
@@ -97,7 +99,7 @@ function update_config($data){
...
@@ -97,7 +99,7 @@ function update_config($data){
}
}
function
apply_config_to_control
(){
function
apply_config_to_control
(){
global
$tmp_config
;
global
$tmp_config
,
$DEBUGFSFILE
;
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
$arr_config
=
json_decode
(
file_get_contents
(
$tmp_config
),
true
);
foreach
(
$arr_config
as
$k0
=>
$v0
){
foreach
(
$arr_config
as
$k0
=>
$v0
){
if
(
$v0
[
'state'
]
==
1
){
if
(
$v0
[
'state'
]
==
1
){
...
@@ -109,7 +111,7 @@ function apply_config_to_control(){
...
@@ -109,7 +111,7 @@ function apply_config_to_control(){
$flag
=
$v2
[
'flags'
];
$flag
=
$v2
[
'flags'
];
if
(
$flag
==
"p"
)
$sign
=
"+"
;
if
(
$flag
==
"p"
)
$sign
=
"+"
;
else
$sign
=
"-"
;
else
$sign
=
"-"
;
exec
(
"echo -n 'file
$file
line
$lineno
${sign}p' >
/sys/kernel/debug/dynamic_debug/control
"
);
exec
(
"echo -n 'file
$file
line
$lineno
${sign}p' >
$DEBUGFSFILE
"
);
//echo "echo -n 'file $file line $lineno ${sign}p'\n";
//echo "echo -n 'file $file line $lineno ${sign}p'\n";
}
}
}
}
...
@@ -153,9 +155,20 @@ function sync_to_config($file,$line,$flag){
...
@@ -153,9 +155,20 @@ function sync_to_config($file,$line,$flag){
update_config
(
json_encode
(
$arr_config
));
update_config
(
json_encode
(
$arr_config
));
}
}
function
filter_record_by_file
(
$a
,
$f
){
$res
=
Array
();
foreach
(
$a
as
$k
=>
$v
){
if
(
$v
[
'file'
]
==
$f
){
$res
=
$v
;
break
;
}
}
return
$res
;
}
if
(
$cmd
==
"do_nothing"
){
if
(
$cmd
==
"do_nothing"
){
if
(
isset
(
$_GET
[
'file'
]))
$file
=
$_GET
[
'file'
];
if
(
isset
(
$_GET
[
'file'
]))
$file
=
$_GET
[
'file'
];
else
$file
=
"/sys/kernel/debug/dynamic_debug/control"
;
else
$file
=
$DEBUGFSFILE
;
//echo json_encode(get_control($file));
//echo json_encode(get_control($file));
//echo "<pre>";
//echo "<pre>";
...
@@ -191,7 +204,7 @@ if ($cmd=="echo") {
...
@@ -191,7 +204,7 @@ if ($cmd=="echo") {
$flag
=
"-"
;
$flag
=
"-"
;
}
}
exec
(
"echo -n 'file
$file
line
$line
${flag}p' >
/sys/kernel/debug/dynamic_debug/control
"
);
exec
(
"echo -n 'file
$file
line
$line
${flag}p' >
$DEBUGFSFILE
"
);
sync_to_config
(
$file
,
$line
,
$flag
);
sync_to_config
(
$file
,
$line
,
$flag
);
}
}
...
@@ -201,7 +214,7 @@ $debugfs_configs = "debugfs_configs";
...
@@ -201,7 +214,7 @@ $debugfs_configs = "debugfs_configs";
if
(
$cmd
==
"save"
){
if
(
$cmd
==
"save"
){
$file
=
$_GET
[
'file'
];
$file
=
$_GET
[
'file'
];
if
(
!
is_dir
(
$debugfs_configs
))
mkdir
(
$debugfs_configs
);
if
(
!
is_dir
(
$debugfs_configs
))
mkdir
(
$debugfs_configs
);
file_put_contents
(
"
$debugfs_configs
/
$file
"
,
file_get_contents
(
"/sys/kernel/debug/dynamic_debug/control"
));
file_put_contents
(
"
$debugfs_configs
/
$file
"
,
file_get_contents
(
$DEBUGFSFILE
));
}
}
if
(
$cmd
==
"sync"
){
if
(
$cmd
==
"sync"
){
...
@@ -218,6 +231,14 @@ if ($cmd=="restore"){
...
@@ -218,6 +231,14 @@ if ($cmd=="restore"){
apply_config_to_control
();
apply_config_to_control
();
}
}
if
(
$cmd
==
"reread"
){
$file
=
$_GET
[
'file'
];
$arr
=
get_control
(
$DEBUGFSFILE
);
$filtered
=
filter_record_by_file
(
$arr
,
$file
);
echo
json_encode
(
$filtered
);
//echo "<pre>";print_r($filtered);
}
//single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control
//single line: echo -n 'file gamma_tables.c +p' > /sys/kernel/debug/dynamic_debug/control
?>
?>
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