aravis icon indicating copy to clipboard operation
aravis copied to clipboard

gentl: always call IFUpdateDeviceList before IFOpenDevice

Open psoftware opened this issue 8 months ago • 4 comments

Fixes #1001.

I am not sure this is the right way to fix it. In arvgentlsystem.c I see there is a device hashmap which is updated by the _discover function. That function invokes TLOpen -> IFOpen -> IFOpenDevice -> IFClose -> TLClose and keeps the hashmap updated with the current internal list of the gentl producer. Introducing this patch would allow to have a not up-to-date hashmap.

psoftware avatar Mar 28 '25 18:03 psoftware

@xiaoqiangwang, just pinging you since you first implemented the support for GenTL and might not be watching the repository. ;)

henriquesimoes avatar Apr 16 '25 21:04 henriquesimoes

I thought of that but decided it would violate the "do-one-thing" principle. There is a public API, arv_update_device_list for that.

xiaoqiangwang avatar Apr 21 '25 18:04 xiaoqiangwang

I've just had a quick look. This patch is simple, but does not feel right. I think it would be better to make aravis not call IFClose and TLClose automatically on the last use. It would also probably improve the performance on device opening.

EmmanuelP avatar Apr 21 '25 20:04 EmmanuelP

I thought of that but decided it would violate the "do-one-thing" principle. There is a public API, arv_update_device_list for that.

Surely it does not follow that rule, which also bothered me. Maybe this requirement should be moved above the interface.

I've just had a quick look. This patch is simple, but does not feel right. I think it would be better to make aravis not call IFClose and TLClose automatically on the last use. It would also probably improve the performance on device opening.

It was the easiest way to avoid changing things at the caller site. Consider also that the internal implementation does not feel right too. The internal device hashmap cache is updated by the _discover function, which performs the opening of TLSystem, TLInterface, Device, etc. and closing all of them at the end, which makes all entries invalid, unless the caller performs a scan first before opening any of the scanned devices.

I will be able to work on this starting from the next week if you have any ideas (: Thank you for your reviewing!

psoftware avatar Apr 22 '25 21:04 psoftware