aravis
aravis copied to clipboard
gentl: always call IFUpdateDeviceList before IFOpenDevice
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.
@xiaoqiangwang, just pinging you since you first implemented the support for GenTL and might not be watching the repository. ;)
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.
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.
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!