ruabmbua / hidapi-rs

Rust bindings for the hidapi C library
MIT License
173 stars 82 forks source link

Lazily initialize hidapi. #103

Closed Dirbaio closed 1 year ago

Dirbaio commented 1 year ago

This allows creating multiple HidApi instances at the same time. hidapi is initialized when the first one is created, and never deinitialized.

This issue seems to imply that hidapi is thread safe as long as you don't access the same device from 2 threads at the same time, which the current Rust bindings already enforce: https://github.com/signal11/hidapi/issues/72

ruabmbua commented 1 year ago

LGTM!

ruabmbua commented 1 year ago

Wait, looks like there is a problem (I really should add more CI jobs).

wrap_sys_device() is not compiling when using libusb backend.

Don`t worry I fix it myself