aravis icon indicating copy to clipboard operation
aravis copied to clipboard

Return error when control is not acquired

Open hgaiser opened this issue 6 months ago • 8 comments

It appears to me that when Aravis fails to acquire control of the camera, it will ignore this error and continue as if control was acquired. This is is visible in this line, where the success return value from arv_gv_device_take_control is ignored.

I ran into permission denied errors when setting the TriggerMode in my application, which appeared to be caused by never having acquired control over the camera (there was another application that had taken control). Instead of producing an error about acquiring control, it was producing permission denied errors about changing TriggerMode.

Is there a valid use case for ignoring errors when acquiring control? Or should it produce an error in that case?

hgaiser avatar May 21 '25 14:05 hgaiser

Aravis should not necessarily return an error if it fails to acquire control, as we may want to be able to get read acccess if another client has already taken control.

But I agree the implementation is not as clean as it should.

EmmanuelP avatar May 21 '25 14:05 EmmanuelP

Thanks for the quick reply. So the suggested approach is to check if control was acquired after setting up a camera and deal with it accordingly (assuming the application requires control)?

hgaiser avatar May 21 '25 14:05 hgaiser

Yes. You can use arv_gv_device_is_controller().

I should check how it is handled in GenAPI and try to be consistent with it.

EmmanuelP avatar May 21 '25 16:05 EmmanuelP

Thanks! That will at-least let us detect the problem!

Maybe it would be nice to have explicit functions to take and give up controller access?

Then we could re-try to acquire controller access without closing and re-creating the camera (or device).

de-vri-es avatar May 22 '25 08:05 de-vri-es

arv_gv_device_[take|leave]_control() ?

EmmanuelP avatar May 22 '25 12:05 EmmanuelP

Yes, that will do 😅

I was looking at the documentation from the auto-generated Rust bindings, not sure why these are not exposed, but I will look into that myself :)

de-vri-es avatar May 22 '25 13:05 de-vri-es

@EmmanuelP Hi Emmanuel, does executing arv_gv_device_take_control in the application make the application acquire the control of the camera even if there is another application that had taken control? I am looking for a way to make the current application gain the control of the device even if there is another application that had taken control, is there any suggestion? Thank you in advance.

kamieater1240 avatar Aug 21 '25 01:08 kamieater1240

It is not possible currently, without the other application leaving its control access. Some devices seem to propose a switchover function, but it is not implemented in aravis (it shoud be possible to use it by setting the appropriate features though). Even with the switchover feature, a cooperation is required between the 2 applications (shared key).

https://support.thinklucid.com/knowledgebase/using-application-switchover-with-lucid-cameras/

EmmanuelP avatar Aug 21 '25 13:08 EmmanuelP