<div dir="auto">Forgot to CC the list in reply to Laurent, but I agree his proposed change is better - and still fixes the problem I was having.<div dir="auto"><br></div><div dir="auto">Wasn't sure if you wanted me to resubmit but I wanted to try git send-email, hopefully this time it'll apply cleanly.</div><div dir="auto"><br></div><div dir="auto">Dan</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 28 Aug 2020, 07:27 Dan Scally, <<a href="mailto:djrscally@googlemail.com">djrscally@googlemail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The setupLink function fails (ioctl returns EINVAL) when it passes the<br>
MEDIA_LNK_FL_ENABLE flag to a link that is already flagged with<br>
MEDIA_LNK_FL_ENABLE and MEDIA_LNK_FL_IMMUTABLE. Contrast to media-ctl's<br>
equivalent media_setup_link() which ORs the new flags with the existing<br>
values. This patch modifies the behaviour of setupLink() to behave the<br>
same as media_setup_link() in media-ctl.<br>
<br>
Signed-off-by: Dan Scally <<a href="mailto:djrscally@gmail.com" target="_blank" rel="noreferrer">djrscally@gmail.com</a>><br>
---<br>
<br>
Changelog:<br>
<br>
v3 - Moved the change to MediaLink::setEnabled()<br>
<br>
v2 - Simplified by removing the call to link() to fetch a link that's<br>
already passed as a parameter to the function.<br>
<br>
src/libcamera/media_object.cpp | 3 ++-<br>
1 file changed, 2 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/libcamera/media_object.cpp b/src/libcamera/media_object.cpp<br>
index ce77a72..a2e6a0d 100644<br>
--- a/src/libcamera/media_object.cpp<br>
+++ b/src/libcamera/media_object.cpp<br>
@@ -115,7 +115,8 @@ LOG_DECLARE_CATEGORY(MediaDevice)<br>
*/<br>
int MediaLink::setEnabled(bool enable)<br>
{<br>
- unsigned int flags = enable ? MEDIA_LNK_FL_ENABLED : 0;<br>
+ unsigned int flags = (flags_ & ~MEDIA_LNK_FL_ENABLED)<br>
+ | (enable ? MEDIA_LNK_FL_ENABLED : 0);<br>
<br>
int ret = dev_->setupLink(this, flags);<br>
if (ret)<br>
-- <br>
2.25.1<br>
<br>
</blockquote></div>