Close serial port fd when piksi disconnects [ESD-1111] #660
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When a piksi is connected to a host via USB cable it will create
3 virtual serial ports which appear on linux systems as /dev/ttyACM*.
When Piksi resets or the USB cable is disconnected the kernel will
remove these device nodes automatically.
When console connects to Piksi via one of these ports is will
detect the disconnect event and raise a message in the log. However
it will not close the file descriptor. The kernel will be unable to
fully remove the device since a FD is still open.
When the Piksi reboots and tries to recreate its virtual ports the
linux kernel will be unable to reuse the same device number as before
so long as the previous console process is still running.
Solution - When console detects the piksi disconnect event it should
close the handle. This allows the kernel to reuse the previous device
node as soon as piksi reboots.
Testing