gainput icon indicating copy to clipboard operation
gainput copied to clipboard

Does the API support a way to enumerate connected devices?

Open ciaran2 opened this issue 8 years ago • 7 comments

Multiple devices can be registered with the InputManager by means of repeated calls to CreateDevice(). I don't see any clear way to verify that a device is in fact a real connected device, though. It seems like no matter how many devices I register of any type (significantly more than are actually present), the variant of the registered device is always DV_STANDARD, never DV_NULL.

Am I thinking about this completely the wrong way, or is there something to check device validity that I'm not seeing, or is this genuinely a missing feature?

ciaran2 avatar Apr 30 '17 19:04 ciaran2

You should do it this way: Create all the devices you want to possibly support. Then, if you need to know this, you can call InputDevice::IsAvailable() or InputDevice::GetState() to determine what state the device is in.

Does that help?

jkuhlmann avatar May 01 '17 05:05 jkuhlmann

It does, sort of. Now I'm getting the same DeviceState for all devices of the same type. Does one device object of a given type govern all devices of that type?

ciaran2 avatar May 01 '17 09:05 ciaran2

No, it doesn't. Though you may run into limitations as, for example, multiple keyboards are mice are not supported. It should work for gamepads though. What device type are we talking about?

jkuhlmann avatar May 01 '17 15:05 jkuhlmann

What I'm seeing, after creating five pads, three keyboards, and three mice, with one of each device actually connected, is that all of the keyboards and mice are DS_OK and all of the pads are DS_UNAVAILABLE.

I could have sworn that the pad I was using to test was XInput compatible, but assuming I'm wrong and it's not, is that that the output you would expect to see?

ciaran2 avatar May 01 '17 22:05 ciaran2

Yes, assuming the pad doesn't work with Xinput that's exactly what I'd expect. What gamepad is it? Do you have any other way to test if it's supported?

jkuhlmann avatar May 05 '17 07:05 jkuhlmann

I have yet to find an easy, conclusive test for Xinput compatibility. The pad is a Logitech DualAction.

On May 5, 2017 03:00, "Johannes Kuhlmann" [email protected] wrote:

Yes, assuming the pad doesn't work with Xinput that's exactly what I'd expect. What gamepad is it? Do you have any other way to test if it's supported?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jkuhlmann/gainput/issues/33#issuecomment-299396221, or mute the thread https://github.com/notifications/unsubscribe-auth/AKt1hJpi9dsliaSSF29ij9BH7WAZkTPrks5r2sj9gaJpZM4NMqiI .

ciaran2 avatar May 05 '17 08:05 ciaran2

Googling around a little, it seems like the Logitech Dual Action is not directly supported by Xinput, but there are 3rd party drivers/emulators to make it compatible.

jkuhlmann avatar Jul 06 '17 20:07 jkuhlmann