Joystick Problems with Windows 10 (sleep related)

There are a couple of problems I've run into with Windows and joysticks.

One problem is Windows not sleeping.  (Where the joystick precludes Windows from sleeping.  Windows won't sleep with joystick attached.)

The only thing that works for me is disabling the joystick.  I use a batch file and devcon.exe to do that (see below).  But you could go into Device Manager and disable he HID device that is the joystick, or unplug the joystick.

Another problem is my joystick not working after Windows wakes up from being asleep.

What has worked for me is resetting the USB hub that the joystick is plugged into, or resetting the USB Input Device that is associated with the joystick.  Again, I use a batch file and devcon.exe (see below).  But you could unplug and replug the hub, or go into Device Manager, find the USB hub associated with the joystick, and reset that hub.  (Go to "Start menu->Windows administrative tools->Computer Management->Device Manager->universal serial bus controllers->generic USB hub".  Or it could be a root hub depending on where you have joystick plugged in.  Right click on a hub to get properties.  Go into "Power" tab, and look for hub that shows a "HID-compliant game controller" that is your joystick.  For that hub, go into the  "Advanced" tab and click "Reset hub.")

I'm using my joystick for flying in Aces High.  The following is a way to use a batch file to enable the joystick, reset my USB hub, run Aces High, then after Aces High is closed, disable the joystick.  You can use the following as a starting point for what you want to do.

Get devcon.exe here, or get it from Microsoft.

Make a folder "c:\pf\restartUsbHub" (or whatever you choose -- just edit the following as appropriate).

Put devcon.exe into that folder.  Put the following lines into a text file named "startAH.bat", or whatever you choose, as long as it has a ".bat" suffix to the name.  Edit this batch file to do the operations you desire.

cd c:\pf\restartUsbHub
set "myusbports=USB\VID_068E^&PID_^*"
set "myjoysticks=HID\VID_068E^&PID_^*"
devcon enable %myjoysticks%
devcon restart %myusbports%
cd "C:\Hitech Creations\Aces High III"
aceshigh11.exe
cd c:\pf\restartUsbHub
devcon disable %myjoysticks%

Note that you will use a different number after "VID_" in your batch file, depending on your hub and joystick.  More details below.

Once you have that batch file, create a shortcut on your desktop that runs that batch file.  Make sure you right click on the shortcut, select "properties", click the "advanced" button, and have "Run as administrator" enabled.  devcon.exe needs administrator privileges to work.

Make sure you also have usb selective suspend enabled (settings->system->power and sleep->additional power settings->change plan settings->change advanced power settings->usb settings->usb selective suspend setting->enabled).

In Device Manager, for the "USB Input Device" that corresponds to the joystick, set properties->power management->"Allow the computer to turn off this device to save power" to enabled.

To find your VID number

Go into the Device Manager.  (Start menu->Windows administrative tools->Computer Management->Device Manager.  Or type into your Windows search box "device", and you will see "Device Manager" show up.)

Look in "Human Interface Devices" at an entry called "HID-compliant game controller", right click on that, and select "Properties."  Go into Details, and select the property "Hardware ID's".  You'll see an entry like "HID\VID_068E&PID_00F6&REV_0000".  VID gives you the Vendor ID, in this case 068E.

Note that in the batch file above that myusbports=USB\VID_068E^&PID_^*.  That's a string that represents the USB ports that I want to reset on my machine.  In the batch file I have to use "^" in front of "&" and "*" characters so that they don't get interpreted as anything other than a character.  The "*" is there so that I can just match the front part of the string and not have to worry whether devcon is finding the rest of the string (or in my case, if I have rudder pedals plugged in that are from the same vendor, so one command works for both the joystick and pedals).