Linux / hidraw flock support? #660

Open
opened 2024-02-22 07:59:52 -06:00 by ghost · 1 comment
ghost commented 2024-02-22 07:59:52 -06:00 (Migrated from github.com)

I have seen other applications using flock on their open hidraw file descriptors to open them exclusively. This is not the default for hidapi but I am not asking for this to change. I was thinking it might be a good idea to use flock to acquire a shared lock so hidapi applications won't conflict with other applications using flock with an exclusive lock while still allowing hidraw devices to be opened concurrently with other applications that are also using a shared lock.

Would this be useful at all to implement? It's not particularly hard to do.

I have seen other applications using `flock` on their open `hidraw` file descriptors to open them exclusively. This is not the default for `hidapi` but I am not asking for this to change. I was thinking it might be a good idea to use `flock` to acquire a shared lock so `hidapi` applications won't conflict with other applications using `flock` with an exclusive lock while still allowing `hidraw` devices to be opened concurrently with other applications that are also using a shared lock. Would this be useful at all to implement? It's not particularly hard to do.
Youw commented 2024-02-22 17:05:58 -06:00 (Migrated from github.com)

Maybe it is.
In any cases this sounds like something that might be implemented as platform-specific extension, in similar way as it is done for macOS.

Maybe it is. In any cases this sounds like something that might be implemented as platform-specific extension, in similar way as it is done for [macOS](https://github.com/libusb/hidapi/blob/master/mac/hidapi_darwin.h).
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#660
No description provided.