libcamera: media_device: Handle media device fd in acquire() and release()

To gain better control of when a file descriptor is open to the media
device and reduce the work needed in pipeline handler implementations,
handle the file descriptor in acquire() and release().

This changes the current behavior where a file descriptor is only open
when requested by the pipeline handler to that one is always open as
long a media device is acquired. This new behavior is desired to allow
implementing exclusive access to a pipeline handler between processes.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2019-04-14 00:43:29 +02:00
parent ef30be09eb
commit 1a813a5c3a
5 changed files with 33 additions and 86 deletions

View file

@ -57,12 +57,6 @@ class MediaDeviceLinkTest : public Test
return TestSkip;
}
if (dev_->open()) {
cerr << "Failed to open media device at "
<< dev_->deviceNode() << endl;
return TestFail;
}
return 0;
}
@ -238,7 +232,6 @@ class MediaDeviceLinkTest : public Test
void cleanup()
{
dev_->close();
dev_->release();
}