[libcamera-devel] [PATCH 1/3] Early return if no cameras are found on the system.
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Nov 19 16:58:54 CET 2020
Hi Umang,
On 19/11/2020 14:50, Umang Jain wrote:
> Hi Kieran,
>
> On 11/19/20 6:10 PM, Kieran Bingham wrote:
>> Hi Umang,
>>
>> $SUBJECT is missing a "simple-cam:" prefix to match the others.
>>
>> Was this patch already posted somewhere?
>>
>> I don't seem to be able to find it, but I do half-recollect it ;-)
>> I just can't figure out where from.
Ah - found the earlier series now.
> Noted. Let me address this in a new version after 3/3 is reviewed. As
> mentioned in the cover-letter, I submitted this patch earlier a while
> back on the list but it didn't make the merge somehow. Hence, I
Hrm, sorry for letting that slip.
> re-submitted it here. So let's try to get it merged via this series itself.
>>
Yes, lets keep this series moving ;-)
>> On 19/11/2020 12:34, Umang Jain wrote:
>>> Failing to do so, the codepath will segfault while trying to acquire
>>> a non-existent camera.
>>>
>>> Signed-off-by: Umang Jain <email at uajain.com>
>>> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
This still stands with the -ENODEV resolved below, and the $SUBJECT
fixed of course.
>>> ---
>>> simple-cam.cpp | 7 +++++++
>>> 1 file changed, 7 insertions(+)
>>>
>>> diff --git a/simple-cam.cpp b/simple-cam.cpp
>>> index 727bb6d..af9c8b1 100644
>>> --- a/simple-cam.cpp
>>> +++ b/simple-cam.cpp
>>> @@ -307,6 +307,13 @@ int main()
>>> for (std::unique_ptr<Request> &request : requests)
>>> camera->queueRequest(request.get());
>>> + if(!cm->cameras().size()) {
>>> + std::cout << "No cameras were identified on the system."
>>> + << std::endl;
>>> + cm->stop();
>>> + return -1;
>> I think we should we return -ENODEV instead of -1 here. We already use
>> errno values (for example -ENOMEM is used).
> Noted.
>>
>> --
>> Kieran
>>
>>
>>> + }
>>> +
>>> /*
>>> *
>>> --------------------------------------------------------------------
>>> * Run an EventLoop
>>>
>
--
Regards
--
Kieran
More information about the libcamera-devel
mailing list