emoose / Xb2XInput

XB2X: User-mode Windows driver for Xbox OG controllers, supporting both XInput and DirectInput.
115 stars 12 forks source link

Automate WinUSB driver setup #3

Open emoose opened 5 years ago

emoose commented 5 years ago

Currently WinUSB has to be setup for the controller manually (big thanks to MS for making the controller not provide any useful USB/HID descriptors, even though it can speak HID fine...)

The instructions for installing it could maybe confuse some people, so it'd be nice if we could automate it somehow. I think devcon can be used to install the winusb.inf for the device, but the vendor/product ID need to be known in advance first, and since there's a large range of IDs that could be troublesome...

libusb does seem to be able to enumerate devices without WinUSB (as seen in the listdevs.exe libusb sample app), but can't talk to it without the driver being installed - maybe we could check if the device is in the libusb list, and then if it fails to open the device, create a script that uses devcon and ask the user to run it?

Or maybe we can make a script that just tries to install winusb.inf for every vendor/product combo we know of? I think something like that might be possible...

Edit: doesn't look like devcon can install the winusb.inf since it's not configured for the hardware ID, damn... https://zadig.akeo.ie is maybe an option, gives an easier way for users to set up the controller for WinUSB at least, I wonder if it could be ran as a batch script or something like that? If not, the library it uses for driver installs looks pretty simple to integrate, hmm..

Edit2: Looks like the wdi-simple app for libwdi can be ran in batch, but unfortunately it doesn't seem like compiled builds are released for it :( Will have a look into building it myself soon.

emoose commented 5 years ago

Latest commit now uses wdi-simple to automate WinUSB setup, unfortunately it takes a minute or two since it has to install the driver for every VID/PID we know of...

I'll leave this issue open for now, maybe in future we can find a way to only make it install drivers for devices connected to the system.