libcamera: media_object: Make MediaLink::setEnabled() account for existing flags
The MediaDevice::setupLink() function fails (ioctl returns EINVAL) when it passes only 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. Fix this by preserving all flags but MEDIA_LNK_FL_ENABLED in MediaLink::setEnabled(). Signed-off-by: Dan Scally <djrscally@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
committed by
Laurent Pinchart
parent
6de4772f1e
commit
e59713c686
@@ -115,7 +115,8 @@ LOG_DECLARE_CATEGORY(MediaDevice)
|
||||
*/
|
||||
int MediaLink::setEnabled(bool enable)
|
||||
{
|
||||
unsigned int flags = enable ? MEDIA_LNK_FL_ENABLED : 0;
|
||||
unsigned int flags = (flags_ & ~MEDIA_LNK_FL_ENABLED)
|
||||
| (enable ? MEDIA_LNK_FL_ENABLED : 0);
|
||||
|
||||
int ret = dev_->setupLink(this, flags);
|
||||
if (ret)
|
||||
|
||||
Reference in New Issue
Block a user