ruabmbua / hidapi-rs

Rust bindings for the hidapi C library
MIT License
167 stars 80 forks source link

Having issues opening game controller with open_path #87

Closed LuggaFiech closed 2 years ago

LuggaFiech commented 2 years ago

I just can't get open_path to work. Below is my code. Please let me know what i'm doing wrong here. Screenshot 2022-07-21 203212 Error: image

ruabmbua commented 2 years ago

I assume you are using windows (the path). Can you try opening it with vid + pid instead? I never tried to open by path on windows.

LuggaFiech commented 2 years ago

My problem is that i need to open only one page of the device. How would i do that only with vid and pid?

ruabmbua commented 2 years ago

Hm, it might not be possible then. You `ll have to check if the hidapi C library allows that on windows, we use it as the backend.

LuggaFiech commented 2 years ago

Ok thanks for the answer.

ruabmbua commented 2 years ago

You can try listing the devices with their usage pages with the library. If the multiple usage pages do not show up, it might be unimplemented for windows.

LuggaFiech commented 2 years ago

If i try it for every device it only prints one usage page each time so it might be unimplemented then.

ruabmbua commented 2 years ago

Only recently this started working on linux hidraw, so it might just be too new. Also, entirely possible that the windows API does not allow it?

LuggaFiech commented 2 years ago

I assume if you open a device with vid and pid it opens the standard usage page?

ruabmbua commented 2 years ago

Probably (it does for my devices), but entirely possible it just opens the one first in the descriptors (is that the default?).

LuggaFiech commented 2 years ago

Because i'm building the device myself i have the ability to manage the order of the usage pages so i will try to manage it like that. Thanks for helping.