Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
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
x393
Commits
510a3dc6
Commit
510a3dc6
authored
May 12, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Elphel/x393
parents
b65dd54c
42e39542
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
+24
-6
imgsrv.py
py393/imgsrv.py
+10
-0
test_mcntrl.py
py393/test_mcntrl.py
+14
-6
No files found.
py393/imgsrv.py
100644 → 100755
View file @
510a3dc6
...
@@ -37,6 +37,7 @@ import time
...
@@ -37,6 +37,7 @@ import time
import
socket
import
socket
import
shutil
import
shutil
import
sys
import
sys
import
subprocess
path
=
"/www/pages/img.jpeg"
path
=
"/www/pages/img.jpeg"
PORT
=
8888
PORT
=
8888
...
@@ -95,6 +96,9 @@ if ((not acquisition_parameters["bayer"] is None) and
...
@@ -95,6 +96,9 @@ if ((not acquisition_parameters["bayer"] is None) and
ibayer
^=
2
ibayer
^=
2
acquisition_parameters
[
"bayer"
]
=
str
(
ibayer
)
acquisition_parameters
[
"bayer"
]
=
str
(
ibayer
)
#restart compressor
communicate
(
PORT
,
"compressor_control all 1 None None None None None"
)
cmd_str
=
"jpeg_acquire_write
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s"
%
(
cmd_str
=
"jpeg_acquire_write
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s
%
s"
%
(
str
(
acquisition_parameters
[
"file_path"
]),
str
(
acquisition_parameters
[
"file_path"
]),
str
(
acquisition_parameters
[
"channel"
]),
str
(
acquisition_parameters
[
"channel"
]),
...
@@ -157,6 +161,12 @@ reply = communicate(PORT,cmd_str)
...
@@ -157,6 +161,12 @@ reply = communicate(PORT,cmd_str)
if
(
acquisition_parameters
[
"cmode"
]
==
"5"
):
if
(
acquisition_parameters
[
"cmode"
]
==
"5"
):
path
=
path
.
replace
(
"jpeg"
,
"jp4"
)
path
=
path
.
replace
(
"jpeg"
,
"jp4"
)
circbufcmd
=
"echo
\"
3 "
+
str
(
acquisition_parameters
[
"y_quality"
])
+
"
\"
> /dev/circbuf0"
subprocess
.
check_output
(
circbufcmd
,
stderr
=
subprocess
.
STDOUT
,
shell
=
True
)
communicate
(
PORT
,
"compressor_control all 0 None None None None None"
)
communicate
(
PORT
,
"compressor_control all 3 None None None None None"
)
timestamp
=
str
(
time
.
time
())
.
replace
(
"."
,
"_"
)
# later use image timestamp
timestamp
=
str
(
time
.
time
())
.
replace
(
"."
,
"_"
)
# later use image timestamp
print
(
"Content-Type: image/jpeg"
)
print
(
"Content-Type: image/jpeg"
)
print
(
"Content-Disposition: inline; filename=
\"
elphelimg_
%
s.jpeg
\"
"
%
(
timestamp
))
print
(
"Content-Disposition: inline; filename=
\"
elphelimg_
%
s.jpeg
\"
"
%
(
timestamp
))
...
...
py393/test_mcntrl.py
View file @
510a3dc6
...
@@ -428,11 +428,18 @@ USAGE
...
@@ -428,11 +428,18 @@ USAGE
if
socket_conn
:
if
socket_conn
:
print
(
prompt
,
end
=
""
)
print
(
prompt
,
end
=
""
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
ready_to_read
,
_
,
_
=
select
.
select
(
#ready_to_write, in_error
if
(
args
.
socket_port
):
[
socket_conn
,
sys
.
stdin
],
# potential_readers,
ready_to_read
,
_
,
_
=
select
.
select
(
#ready_to_write, in_error
[],
# potential_writers,
#[socket_conn, sys.stdin], # potential_readers,
[])
# potential_errs,
[
socket_conn
],
# potential_readers,
if
sys
.
stdin
in
ready_to_read
:
[],
# potential_writers,
[])
# potential_errs,
else
:
ready_to_read
,
_
,
_
=
select
.
select
(
#ready_to_write, in_error
[
socket_conn
,
sys
.
stdin
],
# potential_readers,
[],
# potential_writers,
[])
# potential_errs,
if
(
not
args
.
socket_port
)
and
(
sys
.
stdin
in
ready_to_read
):
line
=
raw_input
()
line
=
raw_input
()
# print ("stdin: ", line)
# print ("stdin: ", line)
elif
socket_conn
in
ready_to_read
:
elif
socket_conn
in
ready_to_read
:
...
@@ -449,7 +456,8 @@ USAGE
...
@@ -449,7 +456,8 @@ USAGE
print
(
"Unexpected result from select: ready_to_read = "
,
ready_to_read
)
print
(
"Unexpected result from select: ready_to_read = "
,
ready_to_read
)
continue
continue
else
:
# No sockets, just command line input
else
:
# No sockets, just command line input
line
=
raw_input
(
prompt
)
if
(
not
args
.
socket_port
):
line
=
raw_input
(
prompt
)
# line=raw_input('x393%s +%3.3fs--> '%(('','(simulated)')[args.simulated],(time.time()-tim))).strip()
# line=raw_input('x393%s +%3.3fs--> '%(('','(simulated)')[args.simulated],(time.time()-tim))).strip()
line
=
line
.
strip
()
# maybe also remove comment?
line
=
line
.
strip
()
# maybe also remove comment?
...
...
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