Skip to content

gentl: always call IFUpdateDeviceList before IFOpenDevice - #1002

Merged
EmmanuelP merged 1 commit into
AravisProject:mainfrom
psoftware:fix-ifopendevice
Nov 16, 2026
Merged

EmmanuelP merged 1 commit into
AravisProject:mainfrom
psoftware:fix-ifopendevice

Conversation

@psoftware

Copy link
Copy Markdown
Contributor

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.

@henriquesimoes

Copy link
Copy Markdown
Contributor

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

@xiaoqiangwang

Copy link
Copy Markdown

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.

@EmmanuelP

Copy link
Copy Markdown
Contributor

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.

@psoftware

Copy link
Copy Markdown
Contributor Author

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!

@EmmanuelP
EmmanuelP marked this pull request as draft October 23, 2026 08:35
@xiaoqiangwang

Copy link
Copy Markdown

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.

The original idea of closing interfaces when finished is to avoid holding unnecessary resources, thinking all GenTL producers from several vendors. In some cases, it can lock up the interface and prevent other processes to access it, which is the case of a KAYA GenTL on a CLHS frame grabber.

So I think this PR is the least intrusive solution.

@EmmanuelP

Copy link
Copy Markdown
Contributor

Ok. GenTL support is still experimental, let's experiment.

@EmmanuelP
EmmanuelP marked this pull request as ready for review November 16, 2026 19:37
@EmmanuelP
EmmanuelP merged commit c393107 into AravisProject:main Nov 16, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot open Alkeria cameras

4 participants