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

Prevent uninit timeout in pyusb_backend #154

Closed
wants to merge 1 commit into from
Closed

Prevent uninit timeout in pyusb_backend #154

wants to merge 1 commit into from

Conversation

geky
Copy link
Contributor

@geky geky commented Jun 8, 2015

The PyUSB backend in a virtual machine can't seem to keep up with
multiple packets being sent at the same time. Even with no timeout,
the speed_test script hangs as soon as the overlapped test starts.

There may be a more efficient solution than just limiting the backend
to a single packet, but this at least prevents PyUSB from crashing.
Should PyUSB be able to handle multiple packets on slow connections?

Tested on the K64F and nRF51822 in Ubuntu 14.04.

The PyUSB backend in a virtual machine can't seem to keep up with
multiple packets being sent at the same time.
@c1728p9
Copy link
Collaborator

c1728p9 commented Jun 9, 2015

Hi @geky , can you provide any more details on your setup, or the problem you are experiencing? Is your virtual machine passing through USB traffic to your PC's hardware? Could the root cause of this be a virtual machine driver problem? Also, do you know how many overlapped packets get sent before pyOCD gets stuck? PyUSB should be able to handle this even on slow connections.

@geky
Copy link
Contributor Author

geky commented Jun 9, 2015

Ah yes, It's an instance of the Oracle VirtualBox and USB is being passed through their VirtualBox USB driver to the Windows 7 host machine.

It does send roughly 900 packets before timing out. It wouldn't be too surprising if the problem is just a flaw in the virtual machine's driver.

Alternatively, do you think it would be reasonable to add a packet-limiting flag to PyOCD?

@posborne
Copy link
Contributor

posborne commented Jun 9, 2015

I'm pretty sure there is definitely some bugs in the VirtualBox USB drivers. For me, when I run pyOCD in a VM and attempt to perform a flash, my entire VM crashes/freezes. Could be https://www.virtualbox.org/ticket/9786.

@geky
Copy link
Contributor Author

geky commented Jun 9, 2015

Ack, yep, looks like I'm most likely running into this issue: https://www.virtualbox.org/ticket/13579.

I guess it's not really worth working around then, thanks for looking into it.

@geky geky closed this Jun 9, 2015
@geky
Copy link
Contributor Author

geky commented Jun 9, 2015

I put together a quick fork with a packet_limit flag in case anyone else runs into this issue and needs a workaround: /geky/pyOCD/tree/packet_limit

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

Successfully merging this pull request may close these issues.

3 participants