Skip to content

jlink.sh: wait for rtt server to start#10849

Closed
cladmi wants to merge 2 commits intoRIOT-OS:masterfrom
cladmi:pr/jlink/wait_rtt_server
Closed

jlink.sh: wait for rtt server to start#10849
cladmi wants to merge 2 commits intoRIOT-OS:masterfrom
cladmi:pr/jlink/wait_rtt_server

Conversation

@cladmi
Copy link
Copy Markdown
Contributor

@cladmi cladmi commented Jan 23, 2019

Contribution description

On my machine I needed some delay between the server start and
connecting to prevent the port not being ready.

I based my code on [1]. I changed using a for loop to limit the number
of iterations.

1: https://stackoverflow.com/questions/27599839/how-to-wait-for-an-open-port-with-netcat

I also added a timeout around nc as when not doing return and calling
nc -z when it was already launched, it could get stuck.
I tried preventing that.

Issues found

When testing without the return after nc and connecting when the server was started, I could not talk to it. So cases that were working before should also be re-tested.

Testing procedure

Using #9013, if you had the issue before, you should now be able to do

BOARD=hamilton make -C examples/default/ flash term

and interact with the board.

I did not tested ruuvitag or thingy52 as I do not have any.

I checked there are no newly introduced shellcheck errors.

Issues/PRs references

I found the issue while testing #9013
I needed to add a delay before starting the terminal #9013 (comment)

This will allow re-using it later.
On my machine I needed some delay between the server start and
connecting to prevent the port not being ready.

I based my code on [1]. I changed using a for loop to limit the number
of iterations.

1: https://stackoverflow.com/questions/27599839/how-to-wait-for-an-open-port-with-netcat

I also added a `timeout` around `nc` as when not doing `return` and calling
`nc -z` when it was already launched, it could get stuck.
I tried preventing that.
@cladmi cladmi added Area: tools Area: Supplementary tools Area: boards Area: Board ports labels Jan 23, 2019
@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Feb 26, 2019

By looking at this in more details with @jcarrano using Pyterm inside this script is forcing to have a non clean terminal.
We will be proposing using socat to have a raw terminal there in the near future and socat, as a tool dedicated to do this, has a retry and delay option for retrying the tcp connection. So would replace the need for a stupid active wait.

@jcarrano
Copy link
Copy Markdown
Contributor

@cladmi do you want to merge this, or go straight for the "right thing", that is socat? I ask because:

  1. This is hacky (though necessary, and really no more hacky than the rest of jlink.sh)
  2. It's going to get undone anyways afterwards.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Feb 27, 2019

Go for a proper fix instead of this hack.

@Hyungsin
Copy link
Copy Markdown

@cladmi, any update regarding this issue?

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 15, 2019

@Hyungsin If you do not have the issue, we can ignore it for the moment I guess or at least not put it as a dependency for the #9013
I would have a nicer solution using socat but this would then require 'socat' installed. So need to update the default packages required on a machine.

@cladmi
Copy link
Copy Markdown
Contributor Author

cladmi commented Mar 28, 2019

@Hyungsin I am thinking that I can put this optional, so I would be sure it does not change any existing boards for the moment and still allow you to do term-rtt --wait-for-tcp-connection for your case.
This would simplify the addition as it is specific to your board for the moment.

@cladmi cladmi added this to the Release 2019.10 milestone Jun 14, 2019
@kb2ma kb2ma modified the milestones: Release 2019.10, Release 2020.01 Oct 9, 2019
@leandrolanzieri leandrolanzieri removed this from the Release 2020.04 milestone Mar 17, 2020
@stale
Copy link
Copy Markdown

stale bot commented Sep 18, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions.

@stale stale bot added the State: stale State: The issue / PR has no activity for >185 days label Sep 18, 2020
@stale stale bot closed this Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: boards Area: Board ports Area: tools Area: Supplementary tools State: stale State: The issue / PR has no activity for >185 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants