Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
9165ab6e
Commit
9165ab6e
authored
May 18, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check 10389 presence in tempmon
parent
5c39c2aa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
init_tempmon.py
recipes-core/init-tempmon/files/init_tempmon.py
+20
-10
No files found.
recipes-core/init-tempmon/files/init_tempmon.py
View file @
9165ab6e
...
...
@@ -62,6 +62,7 @@ class temp_monitor():
out_path_prefix
,
out_fnames
):
self
.
is_fan_on
=
False
self
.
is_vp5_enabled
=
False
self
.
is_10389_present
=
True
self
.
ctrl_path_prefix
=
ctrl_path_pref
self
.
ctrl_fnames
=
ctrl_file_names
self
.
hwmon_path_prefix
=
hwmon_path_pref
...
...
@@ -107,13 +108,16 @@ class temp_monitor():
return
False
for
key
,
val
in
self
.
ctrl_fnames
.
items
():
if
not
os
.
access
(
self
.
ctrl_path_prefix
+
val
,
F_OK
):
print
"Failed to open sysfs file: '
%
s
%
s'"
%
(
self
.
ctrl_path_prefix
,
val
)
return
False
if
key
==
"gpio_fn"
:
self
.
is_10389_present
=
False
else
:
print
"Failed to open sysfs file: '
%
s
%
s'"
%
(
self
.
ctrl_path_prefix
,
val
)
return
False
return
True
def
shutdown
(
self
):
"""
Turn system off. This function will be called continuously until the system is turn off.
Turn system off. This function will be called continuously until the system is turn
ed
off.
"""
subprocess
.
call
([
"/sbin/shutdown"
,
"-hP"
,
"now"
])
...
...
@@ -123,20 +127,26 @@ class temp_monitor():
@param ctrl: can be "on" or "off" to turn fan on or off
"""
if
ctrl
is
"on"
:
""" check if +5V is active and turn it on if it is not (it should not happen) """
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"vp5_en_fn"
],
"r+"
)
as
f
:
""" check if +5V is active and turn it on if it is not (it should not happen) """
channels
=
f
.
read
()
if
channels
.
find
(
"vp5"
)
==
-
1
:
f
.
write
(
"vp5"
)
f
.
flush
()
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"gpio_fn"
],
'w'
)
as
f
:
f
.
write
(
self
.
fan_cmd
[
"fan_cmd_on"
])
f
.
flush
()
if
self
.
is_10389_present
:
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"gpio_fn"
],
'w'
)
as
f
:
f
.
write
(
self
.
fan_cmd
[
"fan_cmd_on"
])
f
.
flush
()
self
.
is_fan_on
=
True
elif
ctrl
is
"off"
:
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"gpio_fn"
],
'w'
)
as
f
:
f
.
write
(
self
.
fan_cmd
[
"fan_cmd_off"
])
f
.
flush
()
if
self
.
is_10389_present
:
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"gpio_fn"
],
'w'
)
as
f
:
f
.
write
(
self
.
fan_cmd
[
"fan_cmd_off"
])
f
.
flush
()
else
:
with
open
(
self
.
ctrl_path_prefix
+
self
.
ctrl_fnames
[
"vp5_dis_fn"
],
'w'
)
as
f
:
f
.
write
(
"vp5"
)
f
.
flush
()
self
.
is_fan_on
=
False
else
:
print
"'
%
s': unrecognized command: '
%
s'"
%
(
__name__
,
ctrl
)
...
...
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