Properly define relation between hid_exit and hid_deregister_callback #786

Open
opened 2026-03-31 08:36:40 -05:00 by Youw · 2 comments
Youw commented 2026-03-31 08:36:40 -05:00 (Migrated from github.com)

One of the cases are mentioned by @Copilot https://github.com/libusb/hidapi/pull/674#discussion_r2870009025_

But the problem is more general: there is no clear definition how hid_exit and hid_deregister_callback are related to each other: should hid_exit automatically deregister all callbacks or should user be forced to deregister all callbacks before hid_exit?

One of the cases are mentioned by @Copilot https://github.com/libusb/hidapi/pull/674#discussion_r2870009025_ But the problem is more general: there is no clear definition how `hid_exit` and `hid_deregister_callback` are related to each other: should `hid_exit` automatically deregister all callbacks or should user be forced to deregister all callbacks before `hid_exit`?
k1-801 commented 2026-03-31 09:05:54 -05:00 (Migrated from github.com)

should hid_exit automatically deregister all callbacks

I vote for automatic cleanup.

> should `hid_exit` automatically deregister all callbacks I vote for automatic cleanup.
Youw commented 2026-03-31 12:42:14 -05:00 (Migrated from github.com)

We need to consider all options, there are also devices, which needs to be closed before exit - and it is not possible to close those safely automatically. Even though deregistering callback automatically is possible - it makes inconsistent behavior between two similar cases.

We need to consider all options, there are also devices, which needs to be closed before exit - and it is not possible to close those safely automatically. Even though deregistering callback automatically is possible - it makes inconsistent behavior between two similar cases.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-libusb/hidapi#786
No description provided.