Skip to content

Solve ports conflicts with same address and different protocol #713

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

Merged
merged 2 commits into from
Jan 31, 2022

Conversation

silvanocerza
Copy link
Contributor

Fix ports not being stored correctly causing ports found by multiple discovery with same address but different protocol conflicting with each other and not being shown correctly in Board Selector dropdown list and Select Board dialog.

Ports separation in Tools > Ports menu is unchanged.

Fixes #711.

Board Selector dropdown
Select Board dialog
Ports menu

@silvanocerza silvanocerza added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Dec 22, 2021
@silvanocerza silvanocerza self-assigned this Dec 22, 2021
@silvanocerza silvanocerza requested a review from 91volt December 22, 2021 16:48
@silvanocerza
Copy link
Contributor Author

@ben-qnimble could you test this please?

You'll find a built artifact for each platform here as soon as the build process has finished.

@ben-qnimble
Copy link
Contributor

Thanks @silvanocerza for the quick change! I can confirm that now ports with shared addresses but different protocols are now listed separately and no not fight each other.

I don't know if this is a separate issue or related to your fix, but if I select, say, COM5 with protocol 'something' then when I upload, the device disconnects and both COM5 ports disappear (as expected) and when the device reconnects, both COM5 ports show up again, but the selected port is now COM5 protocol 'serial' and not 'something'. What is means is that if you click upload, make some change and click upload again the upload will potentially fail is it is connected to a different port than was originally selected.

Thanks,

@silvanocerza
Copy link
Contributor Author

I don't know if this is a separate issue or related to your fix, but if I select, say, COM5 with protocol 'something' then when I upload, the device disconnects and both COM5 ports disappear (as expected) and when the device reconnects, both COM5 ports show up again, but the selected port is now COM5 protocol 'serial' and not 'something'. What is means is that if you click upload, make some change and click upload again the upload will potentially fail is it is connected to a different port than was originally selected.

This is probably caused by the 1200bps touch, probably I should handle reselection of the correct port too.

Thanks.

@per1234
Copy link
Contributor

per1234 commented Dec 23, 2021

the selected port is now COM5 protocol 'serial' and not 'something'.

There are several issues related to the IDE's handling of the port selection after the port is lost (as is normal and expected during an upload to a native USB board). That includes this issue as well as those linked from it: #710

So I don't think this is specific to a port being discovered by multiple discoveries.

@silvanocerza
Copy link
Contributor Author

I confirm what @per1234 is saying, I investigated a bit and it's not an easy fix reselecting the correct board, I risk causing even more conflicts. 😕

@ben-qnimble
Copy link
Contributor

I did a pull request (#765) into this branch to add more filtering on reconnecting ports so on reconnect, the IDE don't connect to a port whose protocol does not match the protocol of the previously selected port.

@ben-qnimble
Copy link
Contributor

Hi @silvanocerza I really appreciate your quick patch for this issue and I wanted to see if there was anything I could do to help move this patch forward into the main branch.

Thanks!

@silvanocerza
Copy link
Contributor Author

Hey @ben-qnimble, am waiting for a code review, as soon as it's approved I'll merge it.
Sorry for the long wait.

Comment on lines 281 to 282
const sortedIDs = Object.keys(ports);
sortedIDs.sort((left: string, right: string): number => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const sortedIDs = Object.keys(ports);
sortedIDs.sort((left: string, right: string): number => {
const sortedIDs = Object.keys(ports).sort((left: string, right: string): number => {

@silvanocerza silvanocerza merged commit ef2be1c into main Jan 31, 2022
@silvanocerza silvanocerza deleted the scerza/fix-discovery-conflicts branch January 31, 2022 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

discoveries not isolated with different protocols
4 participants