How can I determine when a serial terminal has (dis)connected?
Clash Royale CLAN TAG#URR8PPP
I have a DEC VT101 serial terminal hooked up to a Raspberry Pi 3 running Debian using a USB RS-232 null modem cable. When I turn the terminal off, I would like for the shell session to end, and when I turn the terminal back on, I'd like that to start a new login session. How can I do this? Right now, when the terminal is turned off then back on, the screen remains blank until I do something e.g. press Return which will make Bash draw a new prompt.
At the very least, if I could figure out how to query whether there was a system receiving the data from the USB null modem cable, I could script the automatic logging in/out myself. One approach I have in mind would be to send answerback queries to the terminal when there has been no recent user input then assume the terminal is off if I don't get a response after a certain amount of time.
shell terminal getty
add a comment |
I have a DEC VT101 serial terminal hooked up to a Raspberry Pi 3 running Debian using a USB RS-232 null modem cable. When I turn the terminal off, I would like for the shell session to end, and when I turn the terminal back on, I'd like that to start a new login session. How can I do this? Right now, when the terminal is turned off then back on, the screen remains blank until I do something e.g. press Return which will make Bash draw a new prompt.
At the very least, if I could figure out how to query whether there was a system receiving the data from the USB null modem cable, I could script the automatic logging in/out myself. One approach I have in mind would be to send answerback queries to the terminal when there has been no recent user input then assume the terminal is off if I don't get a response after a certain amount of time.
shell terminal getty
add a comment |
I have a DEC VT101 serial terminal hooked up to a Raspberry Pi 3 running Debian using a USB RS-232 null modem cable. When I turn the terminal off, I would like for the shell session to end, and when I turn the terminal back on, I'd like that to start a new login session. How can I do this? Right now, when the terminal is turned off then back on, the screen remains blank until I do something e.g. press Return which will make Bash draw a new prompt.
At the very least, if I could figure out how to query whether there was a system receiving the data from the USB null modem cable, I could script the automatic logging in/out myself. One approach I have in mind would be to send answerback queries to the terminal when there has been no recent user input then assume the terminal is off if I don't get a response after a certain amount of time.
shell terminal getty
I have a DEC VT101 serial terminal hooked up to a Raspberry Pi 3 running Debian using a USB RS-232 null modem cable. When I turn the terminal off, I would like for the shell session to end, and when I turn the terminal back on, I'd like that to start a new login session. How can I do this? Right now, when the terminal is turned off then back on, the screen remains blank until I do something e.g. press Return which will make Bash draw a new prompt.
At the very least, if I could figure out how to query whether there was a system receiving the data from the USB null modem cable, I could script the automatic logging in/out myself. One approach I have in mind would be to send answerback queries to the terminal when there has been no recent user input then assume the terminal is off if I don't get a response after a certain amount of time.
shell terminal getty
shell terminal getty
asked Feb 4 at 7:23
Eric PruittEric Pruitt
1012
1012
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The usual way of doing this was by detecting when the DTR ("data terminal ready") signal drops. This does require more than just ground, receive data and transmit data to be wired up.
The stty
settings have to be adjusted to not ignore the DTR signal. Try running stty -clocal
. If your connection is immediately dropped, then your cable does not have the appropriate pins connected. If you still have a shell connection after running the stty command, then try turning the terminal off and on. I would expect the session to be killed then. If not, then it's possible that your serial cable loops the DSR ("data set ready") signal coming out of the RS232 adapter back into its DTR input; you can test this by removing the cable from the adapter and see if that logs you out. If so, then you need to rewire the serial cable.
Runningstty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.
– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498541%2fhow-can-i-determine-when-a-serial-terminal-has-disconnected%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The usual way of doing this was by detecting when the DTR ("data terminal ready") signal drops. This does require more than just ground, receive data and transmit data to be wired up.
The stty
settings have to be adjusted to not ignore the DTR signal. Try running stty -clocal
. If your connection is immediately dropped, then your cable does not have the appropriate pins connected. If you still have a shell connection after running the stty command, then try turning the terminal off and on. I would expect the session to be killed then. If not, then it's possible that your serial cable loops the DSR ("data set ready") signal coming out of the RS232 adapter back into its DTR input; you can test this by removing the cable from the adapter and see if that logs you out. If so, then you need to rewire the serial cable.
Runningstty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.
– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
add a comment |
The usual way of doing this was by detecting when the DTR ("data terminal ready") signal drops. This does require more than just ground, receive data and transmit data to be wired up.
The stty
settings have to be adjusted to not ignore the DTR signal. Try running stty -clocal
. If your connection is immediately dropped, then your cable does not have the appropriate pins connected. If you still have a shell connection after running the stty command, then try turning the terminal off and on. I would expect the session to be killed then. If not, then it's possible that your serial cable loops the DSR ("data set ready") signal coming out of the RS232 adapter back into its DTR input; you can test this by removing the cable from the adapter and see if that logs you out. If so, then you need to rewire the serial cable.
Runningstty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.
– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
add a comment |
The usual way of doing this was by detecting when the DTR ("data terminal ready") signal drops. This does require more than just ground, receive data and transmit data to be wired up.
The stty
settings have to be adjusted to not ignore the DTR signal. Try running stty -clocal
. If your connection is immediately dropped, then your cable does not have the appropriate pins connected. If you still have a shell connection after running the stty command, then try turning the terminal off and on. I would expect the session to be killed then. If not, then it's possible that your serial cable loops the DSR ("data set ready") signal coming out of the RS232 adapter back into its DTR input; you can test this by removing the cable from the adapter and see if that logs you out. If so, then you need to rewire the serial cable.
The usual way of doing this was by detecting when the DTR ("data terminal ready") signal drops. This does require more than just ground, receive data and transmit data to be wired up.
The stty
settings have to be adjusted to not ignore the DTR signal. Try running stty -clocal
. If your connection is immediately dropped, then your cable does not have the appropriate pins connected. If you still have a shell connection after running the stty command, then try turning the terminal off and on. I would expect the session to be killed then. If not, then it's possible that your serial cable loops the DSR ("data set ready") signal coming out of the RS232 adapter back into its DTR input; you can test this by removing the cable from the adapter and see if that logs you out. If so, then you need to rewire the serial cable.
answered Feb 4 at 8:29
wurtelwurtel
10.5k11526
10.5k11526
Runningstty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.
– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
add a comment |
Runningstty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.
– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
Running
stty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.– Eric Pruitt
Feb 9 at 7:11
Running
stty -clocal
didn't kill the connection. Rewiring the cable isn't a practical solution for me right now, so I can't personally test this answer out. I'll request this question be converted to a community wiki if I don't get any other responses.– Eric Pruitt
Feb 9 at 7:11
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
This post helped me refine my Googling, and I came across stackoverflow.com/questions/25232237/… which has additional details. I was able to find the type of cable I need searching for "full handshake." I'll follow-up once I receive cable and have time to test it out.
– Eric Pruitt
Feb 10 at 1:30
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498541%2fhow-can-i-determine-when-a-serial-terminal-has-disconnected%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown