Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting (unplugging) vController object causes application hanging #13

Open
ghost opened this issue May 11, 2020 · 0 comments
Open

Deleting (unplugging) vController object causes application hanging #13

ghost opened this issue May 11, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented May 11, 2020

I use Python 3.6 64-bit on 64bit machine.
This project looks really cool, and I was able to use some different inputs to test and it was working. But now I have a problem.
Whenever I run virtual_controller.py the code hangs in this place:
print('Done, disconnecting controllers.')
del cons

def main():
    import time
    cons = []

    print('Testings multiple connections')
    while True:
        print('Connecting Controller:')
        try:
            cons.append(vController())
        except MaxInputsReachedError:
            break
        else:
            print('Available:', vController.available_ids())
            print('This ID:', cons[-1].id)

        # time.sleep(1)

    print('Done, disconnecting controllers.')
    del cons
    print('Available:', vController.available_ids())
    time.sleep(2)

I see the sentence and then I wait a few minutes and nothing happens. When I comment code above and use only this part...

    print('Testing Value setting')
    print('Connecting Controller:')
    try:
        con = vController()
    except MaxInputsReachedError:
        print('Unable to connect controller for testing.')
    else:
        print('This ID:', con.id)
        print('Available:', vController.available_ids())
        print('Setting TriggerR and AxisLx:')
        for x in range(11):
            val = x / 10
            print(val)
            con.set_value('TriggerR', val)
            con.set_value('AxisLx', val)
            time.sleep(0.5)

        print('Done, disconnecting controller.')
        del con
        print('Available:', vController.available_ids())
        time.sleep(2)

... it also hangs after printing: "Done, disconnecting controller."

When I stop process and then run again I have MaxInputsReachedError and I see:
"Unable to connect controller for testing."

So stopping the process is not a good idea because the virtual controller is not plugged off. And it causes that I cannot run the program correctly again. Also uninstalling the controller from device manager doesn't work. It also hangs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants