Skip to content

Commit e63a7c5

Browse files
committed
fix: libcamera detection on bullseye and bookworm
1 parent 8006dae commit e63a7c5

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

scripts/list-libcamera-devices

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
3+
tool=/usr/bin/rpicam-hello # bookworm
4+
[ -e "$tool" ] || tool=/usr/bin/libcamera-hello # bullseye
5+
6+
$tool --list-cameras | grep -o '/base/soc/[^)]*' || exit -1

systemd/camera-streamer-libcamera.service

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ StartLimitBurst=10
66

77
[Service]
88
EnvironmentFile=/etc/camera-streamer.conf.d/libcamera.conf
9-
ExecCondition=/bin/sh -c "/usr/bin/libcamera-hello --list-cameras | grep -o '/base/soc/[^)]*'"
9+
ExecCondition=/usr/bin/list-libcamera-devices
1010
ExecCondition=/bin/sh -c "! ss -ltn src :$PORT | grep -q LISTEN"
1111
ExecStart=/bin/sh -c "exec /usr/bin/camera-streamer \
1212
--http-port=${PORT} \
1313
--camera-type=libcamera \
14-
--camera-path=$(/usr/bin/libcamera-hello --list-cameras | grep -o '/base/soc/[^)]*' | head -n1) \
14+
--camera-path=$(/usr/bin/list-libcamera-devices | head -n1) \
1515
--camera-format=YUYV \
1616
--camera-width=${WIDTH} --camera-height=${HEIGHT} \
1717
--camera-video.height=${VIDEO_HEIGHT} \

0 commit comments

Comments
 (0)