[libcamera-devel] [PATCH V2] libcamera: MediaDevice: Make MediaDevice::setupLink account for existing link flags
Dan Scally
djrscally at protonmail.com
Wed Aug 26 18:05:50 CEST 2020
The setupLink function fails (ioctl returns EINVAL) when it passes the MEDIA_LNK_FL_ENABLE flag
to a link that is already flagged with MEDIA_LNK_FL_ENABLE and MEDIA_LNK_FL_IMMUTABLE. Contrast
to media-ctl's equivalent media_setup_link() which ORs the new flags with the existing values.
This patch modifies the behaviour of setupLink() to behave the same as media_setup_link() in
media-ctl.
ref https://git.linuxtv.org/v4l-utils.git/tree/utils/media-ctl/libmediactl.c#n210
Changelog:
v2 - Simplified by removing the call to link() to fetch a link that's already passed as a parameter to the function.
---
src/libcamera/media_device.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libcamera/media_device.cpp b/src/libcamera/media_device.cpp
index de18d57..007a45b 100644
--- a/src/libcamera/media_device.cpp
+++ b/src/libcamera/media_device.cpp
@@ -794,7 +794,7 @@ int MediaDevice::setupLink(const MediaLink *link, unsigned int flags)
linkDesc.sink.index = sink->index();
linkDesc.sink.flags = MEDIA_PAD_FL_SINK;
- linkDesc.flags = flags;
+ linkDesc.flags = flags | (link->flags() & MEDIA_LNK_FL_IMMUTABLE);
int ret = ioctl(fd_, MEDIA_IOC_SETUP_LINK, &linkDesc);
if (ret) {
--
2.17.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 509 bytes
Desc: OpenPGP digital signature
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200826/80265ab4/attachment.sig>
More information about the libcamera-devel
mailing list