Document HIDAPI API usage contract for AI coding agents #834
No reviewers
Labels
No labels
3rdparty
Android
API
Author does not respond
bsd
bug
build system/CI
ci-virtual-device
CMake
Contributions Welcome
Core
dependencies
device-specific
documentation
don't_merge
duplicate
enhancement
Example
Haiku
hidraw
hotplug
info required
invalid
libusb
macOS
Misc
Not an issue
question
Release
Test
Test GUI
Windows
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-libusb/hidapi!834
Loading…
Reference in a new issue
No description provided.
Delete branch "document-api-usage-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds a "HIDAPI API usage contract" section to
AGENTS.mddocumenting the library lifecycle (hid_initfirst,hid_exitlast and only after all devices are closed, neither ever concurrent with anything else) and the multi-threading rules from the Multi‐threading Notes wiki page, which remains the authoritative reference.It also states explicitly that a finding whose trigger requires violating that contract — e.g. calling
hid_exit()while other threads still use the API, or unsynchronized concurrent first-time initialization — is application misuse rather than a library defect, and must not be reported as a bug or "fixed" by adding synchronization. The intent is to stop AI reviewers and agents from repeatedly raising contract-violating scenarios as defects, and to keep generated example/test code within the supported usage.Related to: #788
Assisted-by: claude-code:claude-opus-5