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

Added check if instance mode is serial when trying to find if mavlin… #12642

Merged
merged 2 commits into from
Aug 6, 2019

Conversation

garfieldG
Copy link
Contributor

…k instance exists

Describe problem solved by the proposed pull request
If using mavlink with other communication other then serial (eth) and trying to open another mavlink instance with serial communication connected to /dev/ttyS1 mavlink will not allow it because device_name default is /dev/ttyS1 and from mavlink concern the instance already exists even though there is no real use in that port.

Describe your preferred solution
at the same point where we check if the port is being used we check if it's a serial connection.

@julianoes julianoes requested a review from mcsauder August 6, 2019 11:18
@@ -426,7 +426,7 @@ Mavlink::instance_exists(const char *device_name, Mavlink *self)
while (inst != nullptr) {

/* don't compare with itself */
if (inst != self && !strcmp(device_name, inst->_device_name)) {
if ((inst != self) && (inst->get_protocol() == SERIAL) && !strcmp(device_name, inst->_device_name)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the fix is correct but I would suggest that the method instance_exists is renamed to serial_instance_exists and that the comment above is adapted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julianoes
I agree with you, it's a far better name.

@dagar dagar merged commit d3ba9c5 into PX4:master Aug 6, 2019
@garfieldG garfieldG deleted the mavlink_fix branch August 6, 2019 15:46
bozkurthan pushed a commit to bozkurthan/Firmware that referenced this pull request Sep 4, 2019
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