mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-24 17:15:07 +03:00
pipeline: uvcvideo: Fail match() if the camera has no supported format
A UVC device could expose only formats that are not supported by libcamera. The pipeline handler doesn't currently consider this as an error, and happily creates a camera. The camera won't be usable, and worse, generateConfiguration() and validate() will crash as those functions assume that at least one format is supported. Fix this by failing match() if none of the formats exposed by the camera are supported. Log an error message in that case to notify the user. Bug: https://bugs.libcamera.org/show_bug.cgi?id=145 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Tested-by: Christian Rauch <Rauch.Christian@gmx.de>
This commit is contained in:
parent
f98919307e
commit
6225d647b4
1 changed files with 7 additions and 0 deletions
|
@ -457,6 +457,13 @@ int UVCCameraData::init(MediaDevice *media)
|
|||
}
|
||||
}
|
||||
|
||||
if (formats_.empty()) {
|
||||
LOG(UVC, Error)
|
||||
<< "Camera " << id_ << " (" << media->model()
|
||||
<< ") doesn't expose any supported format";
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Populate the camera properties. */
|
||||
properties_.set(properties::Model, utils::toAscii(media->model()));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue