[libcamera-devel] Support for hotplugging UVC devices
Umang Jain
email at uajain.com
Fri Apr 17 14:28:04 CEST 2020
Hi all,
I have doing some researching regarding hot-plugging UVC devices. The
goal
is to have CameraManager emit a "camera-added" hotplug signal so that
applications
like QCam, can detect the newly hotplugged camera and be able to start
streaming.
I have discussed this with Kieran briefly and we both agree this is
something worth
pursuing.
As far as I read the implementation, DeviceEnumeratorUdev::udevNotify()
can
detect new UVC devices being plugged in and add the the list of media
devices in the
DeviceEnumerator.
But right now, there is nothing done when a new device is being
plugged-in, so that
it can be brought into use. Below is what I think is a very crude
version of the code flow is:
1) Emit a signal for DeviceEnumerator::addDevice() that CameraManager
can connect to.
2) Upon receiving the signal, the CameraManager queries the
PipelineHandler to see if
it has a supported pipeline. Initially, this is being done via
PipelineHandler::match()
but match() takes a entire DeviceEnumerator as argument and is
meant to run in a loop(in ::init()).
We need something similar to match() which can validate the
pipeline-handling-support
but for a specific MediaDevice instance(s?).
3) After the Pipeline Handler can validate the support for a
MediaDevice, it can go ahead
and create/register the Camera via
PipelineHandler::registerCamera() with the CameraManager.
4) The signal-handler in 2), proceeds to emit a
CameraManager::camera-added signal
for applications to connect to.
This is what I have researched till now. Of course, this is right now
being targeted towards
UVC devices but I am sure folks here, will have some generalistic point
of view to support
hotplugs for various other media-device domains that I might not be
aware of. Your
thoughts/comments will be helpful.
Let me know what you think!
--
Umang Jain
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.libcamera.org/pipermail/libcamera-devel/attachments/20200417/72e7c03e/attachment.htm>
More information about the libcamera-devel
mailing list