Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorota Czaplejewicz
librem5-devkit-tools
Commits
13f7f1e8
Commit
13f7f1e8
authored
Nov 11, 2022
by
Dorota Czaplejewicz
Browse files
cameras: Add test for test pattern
parent
9bebffde
Pipeline
#79364
passed with stages
in 2 minutes and 55 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
pytests/test_cameras_test_patterns.py
View file @
13f7f1e8
import
shlex
import
subprocess
import
tempfile
...
...
@@ -35,3 +36,33 @@ def test_front():
file
=
open
(
"%s"
%
temp
.
name
,
"rb"
)
assert
(
comp_data
in
file
.
read
(
30
))
file
.
close
()
def
test_big
():
def
call
(
cmd
):
return
subprocess
.
check_call
(
shlex
.
split
(
cmd
))
try
:
call
(
'''media-ctl -d "platform:30b80000.csi" --entity "csi" --set-v4l2 "'csi':0 [fmt:SGRBG8/1052x780 colorspace:raw]"'''
)
call
(
'''media-ctl -d "platform:30b80000.csi" --entity "csi" --set-v4l2 "'imx8mq-mipi-csi2 30b60000.csi':0 [fmt:SGRBG8/1052x780 colorspace:raw]"'''
)
call
(
'''media-ctl -d "platform:30b80000.csi" --entity "csi" --set-v4l2 "'s5k3l6xx 3-002d':0 [fmt:SGRBG8/1052x780 colorspace:raw]"'''
)
call
(
'''media-ctl -d "platform:30b80000.csi" -l "'s5k3l6xx 3-002d':0 -> 'imx8mq-mipi-csi2 30b60000.csi':0 [1]"'''
)
except
subprocess
.
CalledProcessError
as
e
:
raise
RuntimeError
(
"media-ctl error: %s "
%
(
e
.
returncode
))
try
:
# gray test pttern
call
(
'''v4l2-ctl --media-bus-info platform:30b80000.csi --device 's5k3l6xx 3-002d' --set-ctrl=test_pattern=5'''
)
except
subprocess
.
CalledProcessError
as
e
:
raise
RuntimeError
(
"v4l2-ctl sensor setting error: %s "
%
(
e
.
returncode
))
try
:
with
tempfile
.
NamedTemporaryFile
(
mode
=
'rb'
)
as
tempf
:
call
(
'''v4l2-ctl --device="/dev/v4l/by-path/platform-30b80000.csi-video-index0" --set-fmt-video=width=1052,height=780,pixelformat=GRBG --stream-mmap --stream-skip=3 --stream-count=1 --stream-to={}'''
.
format
(
tempf
.
name
))
comp_data
=
bytearray
([
0x10
]
*
0xc8550
)
assert
(
comp_data
==
tempf
.
read
())
except
subprocess
.
CalledProcessError
as
e
:
raise
RuntimeError
(
"v4l2-ctl streaming error: %s "
%
(
e
.
returncode
))
finally
:
call
(
'''v4l2-ctl --media-bus-info platform:30b80000.csi --device 's5k3l6xx 3-002d' --set-ctrl=test_pattern=0'''
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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