Skip to contentSkip to conversation

libcamera: Update to latest

PATCH New Khem Raj 1 participant 1 message Mar 3, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 libcamera: Update to latest

Add a fix for build with gcc11

Cc Andreas Müller <[email protected]>
---
 .../recipes-multimedia/libcamera/libcamera.bb |  7 ++--
 ...o-variable-to-avoid-range-loop-warni.patch | 38 +++++++++++++++++++
 2 files changed, 42 insertions(+), 3 deletions(-)
 create mode 100644 meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch
meta-multimedia/recipes-multimedia/libcamera/libcamera.bb +4 -3
index 5505626d3e..b05df32102 100644
@@ -10,15 +10,16 @@ LIC_FILES_CHKSUM = "\
 
 SRC_URI = " \
         git://linuxtv.org/libcamera.git;protocol=git \
+        file://0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch \
 "
 
-SRCREV = "1e8c91b65695449c5246d17ba7dc439c8058b781"
+SRCREV = "f490a87fd339fc7443f5d8467ba56a35c750a5f7"
 
-PV = "202008+git${SRCPV}"
+PV = "202102+git${SRCPV}"
 
 S = "${WORKDIR}/git"
 
-DEPENDS = "python3-pyyaml-native udev gnutls boost chrpath-native"
+DEPENDS = "python3-pyyaml-native python3-jinja2-native python3-ply-native python3-jinja2-native udev gnutls boost chrpath-native"
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'qt', 'qtbase qtbase-native', '', d)}"
 
 PACKAGES =+ "${PN}-gst"
meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-uvcvideo-Use-auto-variable-to-avoid-range-loop-warni.patch new file +38 -0
new file mode 100644
index 0000000000..4ca412c695
@@ -0,0 +1,38 @@
+From 767267ef69c001870d41caf9c60dd7fec89b0a13 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Wed, 3 Mar 2021 15:11:46 -0800
+Subject: [PATCH] uvcvideo: Use auto variable to avoid range loop warnings
+
+With c++17 loop range bases are defined where copy is obvious since
+iterator returns a copy and not reference, gcc11 will emit a warning
+about this
+
+uvcvideo.cpp:432:33: error: loop variable 'name' of type 'const string&' {aka 'const std::__cxx11::basic_string<cha
+r>&'} binds to a temporary constructed from type 'const char* const' [-Werror=range-loop-construct]
+|   432 |         for (const std::string &name : { "idVendor", "idProduct" }) {
+|       |                                 ^~~~
+
+Therefore making it explicit is better
+
+Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2021-March/017966.html]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+index 031f96e2..ef23ece7 100644
+--- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
++++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp
+@@ -429,7 +429,7 @@ std::string PipelineHandlerUVC::generateId(const UVCCameraData *data)
+ 
+ 	/* Creata a device ID from the USB devices vendor and product ID. */
+ 	std::string deviceId;
+-	for (const std::string &name : { "idVendor", "idProduct" }) {
++	for (const auto name : { "idVendor", "idProduct" }) {
+ 		std::ifstream file(path + "/../" + name);
+ 
+ 		if (!file.is_open())
+-- 
+2.30.1
+
Signature · 1 line
2.30.1