[libcamera-devel,0/3] libcamera: Fix crash with UVC cameras that expose no supported format
mbox series

Message ID 20220903181037.1406-1-laurent.pinchart@ideasonboard.com
Headers show
Series
  • libcamera: Fix crash with UVC cameras that expose no supported format
Related show

Message

Laurent Pinchart Sept. 3, 2022, 6:10 p.m. UTC
Hello,

This patch series fixes a crash in the uvcvideo pipeline handler with
cameras that exposes only formats that are not supported by libcamera.
Patches 1/3 and 2/3 perform small refactoring, to prepare for patch 3/3
that fixes the crash by rejecting those cameras.

Laurent Pinchart (3):
  pipeline: uvcvideo: Move camera ID generation to UVCCameraData class
  pipeline: uvcvideo: Cache supported formats in UVCCameraData
  pipeline: uvcvideo: Fail match() if the camera has no supported format

 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 200 ++++++++++---------
 1 file changed, 107 insertions(+), 93 deletions(-)


base-commit: 251f0534b74bcb46c777aa0df34b1b4142b664f5

Comments

Umang Jain Sept. 5, 2022, 10:56 a.m. UTC | #1
Hi Laurent,

Thank you for the series,

On 9/3/22 11:40 PM, Laurent Pinchart via libcamera-devel wrote:
> Hello,
>
> This patch series fixes a crash in the uvcvideo pipeline handler with
> cameras that exposes only formats that are not supported by libcamera.
> Patches 1/3 and 2/3 perform small refactoring, to prepare for patch 3/3
> that fixes the crash by rejecting those cameras.
>
> Laurent Pinchart (3):
>    pipeline: uvcvideo: Move camera ID generation to UVCCameraData class
>    pipeline: uvcvideo: Cache supported formats in UVCCameraData
>    pipeline: uvcvideo: Fail match() if the camera has no supported format

For all the above patches,

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

>
>   src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 200 ++++++++++---------
>   1 file changed, 107 insertions(+), 93 deletions(-)
>
>
> base-commit: 251f0534b74bcb46c777aa0df34b1b4142b664f5
Laurent Pinchart Sept. 5, 2022, 10:31 p.m. UTC | #2
Christian,

Would you be able to test that this series fixes the issue you're
experiencing ? If so, can I add your Tested-by ?

On Sat, Sep 03, 2022 at 09:10:34PM +0300, Laurent Pinchart via libcamera-devel wrote:
> Hello,
> 
> This patch series fixes a crash in the uvcvideo pipeline handler with
> cameras that exposes only formats that are not supported by libcamera.
> Patches 1/3 and 2/3 perform small refactoring, to prepare for patch 3/3
> that fixes the crash by rejecting those cameras.
> 
> Laurent Pinchart (3):
>   pipeline: uvcvideo: Move camera ID generation to UVCCameraData class
>   pipeline: uvcvideo: Cache supported formats in UVCCameraData
>   pipeline: uvcvideo: Fail match() if the camera has no supported format
> 
>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 200 ++++++++++---------
>  1 file changed, 107 insertions(+), 93 deletions(-)
> 
> 
> base-commit: 251f0534b74bcb46c777aa0df34b1b4142b664f5
Christian Rauch Sept. 6, 2022, 6:10 p.m. UTC | #3
Hi Laurent,


Am 06.09.22 um 00:31 schrieb Laurent Pinchart:
> Christian,
>
> Would you be able to test that this series fixes the issue you're
> experiencing ? If so, can I add your Tested-by ?

Your patch series works. For "cam" I get:

ERROR UVC uvcvideo.cpp:461 Camera [...] doesn't expose any supported format
Camera 1 not found
Failed to create camera session

However, I found the message "Camera 1 not found" somehow misleading,
since the camera was found, but it just did not expose any supported format.

Can I insert the "Tested-by" just here in the email?

Tested-by: Christian Rauch <Rauch.Christian@gmx.de>

Best,
Christian


> On Sat, Sep 03, 2022 at 09:10:34PM +0300, Laurent Pinchart via libcamera-devel wrote:
>> Hello,
>>
>> This patch series fixes a crash in the uvcvideo pipeline handler with
>> cameras that exposes only formats that are not supported by libcamera.
>> Patches 1/3 and 2/3 perform small refactoring, to prepare for patch 3/3
>> that fixes the crash by rejecting those cameras.
>>
>> Laurent Pinchart (3):
>>   pipeline: uvcvideo: Move camera ID generation to UVCCameraData class
>>   pipeline: uvcvideo: Cache supported formats in UVCCameraData
>>   pipeline: uvcvideo: Fail match() if the camera has no supported format
>>
>>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 200 ++++++++++---------
>>  1 file changed, 107 insertions(+), 93 deletions(-)
>>
>>
>> base-commit: 251f0534b74bcb46c777aa0df34b1b4142b664f5
>
Laurent Pinchart Sept. 6, 2022, 9:31 p.m. UTC | #4
Hi Christian,

On Tue, Sep 06, 2022 at 08:10:06PM +0200, Christian Rauch via libcamera-devel wrote:
> Am 06.09.22 um 00:31 schrieb Laurent Pinchart:
> > Christian,
> >
> > Would you be able to test that this series fixes the issue you're
> > experiencing ? If so, can I add your Tested-by ?
> 
> Your patch series works. For "cam" I get:
> 
> ERROR UVC uvcvideo.cpp:461 Camera [...] doesn't expose any supported format
> Camera 1 not found
> Failed to create camera session
> 
> However, I found the message "Camera 1 not found" somehow misleading,
> since the camera was found, but it just did not expose any supported format.

It's two different layers. For libcamera, it has indeed found a UVC
camera, and figured out that it doesn't know how to use it, so libcamera
hasn't created a Camera instance for it. From the point of view of the
application, there is thus no camera. I don't think exposing unusable
cameras to applications would be a good idea.

> Can I insert the "Tested-by" just here in the email?
> 
> Tested-by: Christian Rauch <Rauch.Christian@gmx.de>

Yes, that's perfect. I'll add it to the commit messages and then push.
Thank you for testing.

> > On Sat, Sep 03, 2022 at 09:10:34PM +0300, Laurent Pinchart via libcamera-devel wrote:
> >> Hello,
> >>
> >> This patch series fixes a crash in the uvcvideo pipeline handler with
> >> cameras that exposes only formats that are not supported by libcamera.
> >> Patches 1/3 and 2/3 perform small refactoring, to prepare for patch 3/3
> >> that fixes the crash by rejecting those cameras.
> >>
> >> Laurent Pinchart (3):
> >>   pipeline: uvcvideo: Move camera ID generation to UVCCameraData class
> >>   pipeline: uvcvideo: Cache supported formats in UVCCameraData
> >>   pipeline: uvcvideo: Fail match() if the camera has no supported format
> >>
> >>  src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 200 ++++++++++---------
> >>  1 file changed, 107 insertions(+), 93 deletions(-)
> >>
> >>
> >> base-commit: 251f0534b74bcb46c777aa0df34b1b4142b664f5