[libcamera-devel] Advice on how to wait for camera framework to start

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Jun 23 18:48:06 CEST 2022


Quoting Eric Curtin via libcamera-devel (2022-06-21 16:32:18)
> Hi guys,
> 
> I'm looking for a way on boot to wait until the camera framework has
> started in a machine and at that point start the camera as quickly as
> possible. At present if you start the camera before the camera stack is up
> kernel-side at present you get:
> 
> "No valid sysfs media device directory"
> 
> unless you have compiled with libudev, then you fail in a similar location
> in the udev version.
> 
> Without being an expert in systemd, udev etc. Are there any useful ways to
> detect when the camera is up kernel side and at that point start as quickly
> as possible? Without repeatedly checking for existence of the directory?

I think systemd can do waiting on devices - but that sounds hard to do
generically - because it's platform specific with what to wait on.

I think certainly waiting on the /dev/media0 device is a minimum, but
the camera manager won't handle the cameras until they are all
available. I think udev is already event driven - so it might be able to
probe the cameras when the components are fully available - but this
would be taking the path of building a camera 'server' daemon, or making
even fixed cameras appear as if they were 'hotplugged'. 

I know in the android layer, they don't like that to happen - they wait
for an expected number of cameras to be available or they restart the
server to wait and try again...

Not a solution or an answer I'm afraid, but this is definitely an
interesting discussion point!
--
Kieran


More information about the libcamera-devel mailing list