bugfix for open subdevices opening wrong device / not opening all devices #479
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.
I have been dealing with this issue for a while now.
It mainly comes up when using multiple Kinects, especially if they are of a different type ( i.e: a mixture of 1473, K4W and 1414 models ).
This PR rewrites the motor and audio opening code in fnusb_open_subdevices so that it now only matches audio and motor devices that have the same libusb parent as the camera. The old code was doing a for loop through all devices in the system and trying to match based on the order listed. My guess is that this approach fails to get the correct audio device and therefore doesn't upload the audio firmware to the correct kinect.
In test, this produces much more stable results and makes it so I can open three different devices ( a 1473, K4w and 1414 ) at the same time with no error and every time. ( the current master works sometimes, when the audio firmware has been uploaded, but on first connection to the computer fails and needs several open / close to get devices working ).
In addition the code in the current master produces the following message when trying to open three devices:
Failed to open motor subddevice or it is not disabled. Failed to open audio subdevice
And not all devices load ( see image )
The code in this PR doesn't get this error and loads and runs all kinects correctly. ( see image )