grayver / mi-vigem

ViGEm adapter for Xiaomi Gamepad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shared vs exclusive HID access

dancol90 opened this issue · comments

Hi! mi-360 developer here. Nice project!

I saw that you don't enforce exclusive access to the HID devices when you open them, hence reverting to the standard shared mode. This leaves the Xiaomi Gamepad visible and accessible to the applications and games along with the virtual XBox controller.

Have you ever noticed some incompatibilities with some game leaving two game devices simultaneously available? Have you ever had problems with exclusive access too?

Hi Daniele! Nice to meet you! Thanks for your project!

Actually, I didn't test my project in many games, just in couple platformers I played recently. I'm aware of the issue you describing and I see 2 devices in Steam client or in Gamepad Tester (https://html5gamepad.com/). But it doesn't bring any problems in games I've played.

I've read about different solutions described on the README page of HidGuardian (https://github.com/ViGEm/HidGuardian) and I suspect that this problem has no easy solution. I also suspect that exclusive capture of HID device is possible only in kernel mode (but I'm not sure, though). However, this is subject for research.

Here is interesting reading on the subject:
signal11/hidapi#302

No, there's no easy solution. I found this MSDN page that also confirms that exclusive access is not viable for HID devices.

Since last version of mi-360, it will fallback to shared access if exclusive is not available, but it doesn't feel like the right thing to do