Skip to content

Commit

Permalink
chore: switch to bash
Browse files Browse the repository at this point in the history
Signed-off-by: Stephan Wendel <[email protected]>
  • Loading branch information
KwadFan committed Mar 19, 2024
1 parent 09b19c9 commit b901181
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions libs/hwhandler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,17 @@ list_picam_resolution() {
}

get_libcamera_controls() {
python - <<EOL
from picamera2 import Picamera2
picam = Picamera2()
ctrls = picam.camera_controls
for key, value in ctrls.items():
min, max, default = value
if type(min) is int:
ctrl_type = "int"
elif type(min) is float:
ctrl_type = "float"
elif type(min) is bool:
ctrl_type = "bool"
elif type(min) is tuple:
ctrl_type = "tuple"
else:
ctrl_type=type(min)
print(f"{key} ({ctrl_type}) :\t\tmin={min} max={max} default={default}")
EOL
local ust_bin flags
flags=( --camera-type=libcamera --camera-list_options )
ust_bin="${BASE_CN_PATH}/bin/camera-streamer/camera-streamer"
if [[ -x "${ust_bin}" ]]; then
"${ust_bin}" "${flags[@]}" 2> /dev/null | \
sed 's/device//g;^SNAPSHOT/q' | sed '/^SNAPSHOT/d' | \
sed '/^CAMERA/d;/- property/d' | sed '/\.\/camera/d'
else
log_msg "WARN: 'libcamera' device option can not be displayed, because"
log_msg "WARN: camera-streamer is not installed"
fi
}

list_picam_controls() {
Expand Down

0 comments on commit b901181

Please sign in to comment.