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

Allow driver to recover on USB disconnect / reconnect #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

haljarrett
Copy link

Overcoming intermittent USB connection issues

Background / Problem

We have gotten good use out of this driver, but have had a chronic issue of the kangaroos occasionally dropping out, causing erroneous behavior (i.e. careening across the lab, sparing no shin, wall, or scientist).

Our platform (Jetson TX2) seems to be prone to occasional USB reset events, and when this occurs, the driver is left in a state of continuing to attempt to write to a file descriptor that is no longer valid.

Solution

My solution to this is to close the port, and attempt to reopen. If it is a momentary blip, then when the device reappears on the device list, it will be reopened with a new, valid file descriptor.

Line-by-Line:

Line 322: close() calls the method for closing the port
Line 323: fd = -1; will make is_open() return false.
Line 515: When this reset occurs, the kangaroo sometimes finds itself in a timeout state. Calling send_start_signals(address) if a timeout error is received will clear the error and restart the device.

Hopefully this will help someone else experiencing the same issues!

--Hal Jarrett, Georgia Tech Research Institute

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.

1 participant