bayangan1991 / PYXInput

Python Library for Creating and Analysing XInput devices
https://pypi.python.org/pypi/PYXInput
MIT License
87 stars 22 forks source link

Program exiting will leave controllers connected #15

Open PickleTicklewithnospace opened 4 years ago

PickleTicklewithnospace commented 4 years ago

If the program crashes/exits unexpectedly, controllers can be left connected. Is there any way to disconnect these controllers? I noticed I can't restart my computer either so I have to force shutdown every time, but this does disconnect the controllers on restart.

niluan304 commented 2 years ago

It bothers me, too. I try to solve it by import atexit Like this:

import atexit

vc = pyxinput.vController(False)

@atexit.register
def unPlug():
    print("Virtual Controller UnPlug")
    vc.UnPlug(True)