ruabmbua / hidapi-rs

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

public call to `close` missing #137

Closed shufps closed 10 months ago

shufps commented 10 months ago

libusb hidapi has a close function:

https://github.com/libusb/hidapi/blob/master/hidapi/hidapi.h#L481

This crate has a call to it via ffi::hid_close(device)

But the crate itself doesn't expose the close - is there a way how we could do it?

Problem is that we open a device multiple times what leads to errors after a couple of minutes and we would like to close it before opening it again.

liugangnhm commented 9 months ago

i have the same question

ruabmbua commented 9 months ago

If you want to close a device, you need to drop the HidDevice.