libusb / hidapi

A Simple cross-platform library for communicating with HID devices
https://libusb.info/hidapi/
Other
1.68k stars 398 forks source link

Linux / hidraw flock support? #660

Open ghost opened 9 months ago

ghost commented 9 months ago

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 9 months ago

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.