Putty Serial Escape Sequence

Posted on

Is there any other escape sequence. 162461 Views Tags: escape. SecureCRT and Putty will not work with this method. Stopping Traceroute & Ping using escape seq. Ansi Escape Sequences in Shell Scripts. Introduction; List of ANSI Codes; How to Use ANSI Codes in Shell Scripts. Common terminal emulaters such as xterm, rxvt, PuTTY, and the Default Terminal emulators of the UNIX/Linux desktop environments all support text colour and shape manipulation based on escape sequences.

Active8 years, 7 months ago
  1. Apr 27, 2010  Chapter 4: Configuring PuTTY. PuTTY makes no response whatsoever to the relevant escape sequence. This may upset server-side software that is expecting some sort of response. The Serial panel allows you to configure options that only apply when PuTTY is connecting to a local serial line. 4.28.1 Selecting a serial line to connect to.
  2. Terminal Function Key Escape Codes. Tue, 13 Dec 2005. Terminal Function Key Escape Codes. Since the original VT220 didn't have F1 through F5, the XFree86 xterm uses the escape sequences from the VT100's PF1 through PF4 for F1 through F4 while retaining the VT220-based escape sequences from the X Consortium xterm for F5 through F12.
  3. Hyperterminal newbie question: What to type for abort sequence? By nash 9 replies Jul 28, 2005. +++ is an escape sequence used to drop the modem out of DATA mode and into Command mode, used.
$begingroup$

I think it is possible due to how I can run vi straight from my serial port looking via TeraTerm. There, I can edit some text, go to the next line, then come back and edit the first line! How do they do this?

What character over UART could I send through to go 'up a line'?

EDIT: Apparently line feed works. 'f' to clear the screen. However, this only works for Hyperterminal on my machine and not Teraterm. Anyone know why?

Toby Jaffey
24.9k18 gold badges87 silver badges146 bronze badges
cksa361cksa361
2,0234 gold badges26 silver badges44 bronze badges
$endgroup$

3 Answers

$begingroup$Toby JaffeyToby Jaffey
24.9k18 gold badges87 silver badges146 bronze badges
$endgroup$$begingroup$

What you see on a console window is the result of an automatic echo (which can often be turned off or on), where the console program draws the characters you send on the screen, or the result of receiving characters. This means there are two ways of changing it:

  1. Have a local program, on the PC, redraw the screen.
  2. Have the connected device redraw the screen.

There are many ways to do this, but this is how I'd approach a simplistic hobby implementation:

  • Set a default line width, like 80, and number of rows, like 24. Turn off automatic echo.
  • An 80x24 screen means 1920 characters per 'frame', which means, if the connected device is doing the work, a maximum refresh rate of around 1920/BAUDRATE/11 or about 5Hz at 115200 baud (using 1 start bit, 1 stop, 1 parity, 8 data).
  • Map the arrow keys to specific characters or strings. This may already be done behind the scenes. (For OSX Terminal, left:033[5D; right:033[5C; up & down undefined by default.)
  • Program the connected device to recognize these characters and/or strings, and move the cursor reference accordingly.
  • Output over the serial line not by character or character array, but by frame. Specifically, keep a two 1921 (1920+terminator) character-long arrays: one to write to while the other is being transmitted (assuming the use of hardware UART and interrupts).
  • Writing to the frame buffer can be accomplished by using a function like this:
    uint8_t framewrite(const char *s, uint8_t row, uint8_t col)
    .. Where *s is your [terminated] char array, and row and col are where you want the first character to appear. (Return uint8_t is for error catching.)
  • You'll probably want functions like uint8_t frame_clear(void), uint8_t frame_shiftrowsdown(void), etc.
  • To indicate cursor position you can alternate the current character and a black box or the character of your choice (pblinkchar), using framewrite(pblinkchar,cursor_row,cursor_col).
  • The same method can be used to echo characters back to the cursor position.

I'm sure there are much simpler (I think software guys call it 'elegant') ways to do this by programming a PC window, and you can probably figure out how by digging through this tutorial, but the above is similar to what I've done in the past and works for simple user interfaces with micros with plenty of spare memory.

tyblutyblu
7,1134 gold badges33 silver badges68 bronze badges
$endgroup$$begingroup$

This is an indirect answer to your question. If you are in VI, then all you need to do to move the cursor up is to send 'k'.

Looking at this VT100 command page, it looks like the up arrow key is represented by sending the following sequence: ESC [ A or 0x1B, 0x5B, 0x41. I don't know if this will work, but I am interested to know if it does.

Mosby's medical, nursing, & allied health dictionary. Anderson, Douglas M. / chief lexicographer, Douglas M. Anderson; lexicographers, Jeff Keith. Nursing and allied health database. Mosby's Medical, Nursing & Allied Health Dictionary [Mosby] on Amazon.com. *FREE* shipping on qualifying offers. Book by Mosby. From The Community. Try Prime Books Go Search EN Hello. Sign in Account & Lists Sign in Account.

W5VOW5VO
15.5k5 gold badges50 silver badges87 bronze badges
$endgroup$

Not the answer you're looking for? Browse other questions tagged serialuart or ask your own question.

Active3 years, 9 months ago

I SSH with PuTTY from my Win7 x64 laptop to a Unix environment for my office. The problem I'm facing is very similar to this post where I cannot send an Esc character to the terminal. I first noticed it when trying to exit insert mode in vi, but based on the troubleshooting within that post that I've done it seems that hitting the Esc key just isn't doing anything at all.

So first off, let me restate the problem. Logged into PuTTY, vi a file, go into insert mode, can't come out without hitting F1 and then :q (to quit the help), then I can save and quit the document.

The first troubleshooting step in the other question states to try this:

Then the result should be 27. Running this, I'm told I have an empty string (similar to one of the comments, but this user never comes back).

Then I tried the next thing in the comment..but to be honest I had no clue what I was looking for. Command and my results are given:

Using the Ctrl+V then hitting Esc does nothing until I hit Enter, which then displays ^M (I believe this is the carriage return (CR) character that I get from quoting the Enter key). Typing Ctrl+[ will let me exit vi, so I'm assuming that's the correct character I'm looking for, I just don't know why my terminal seems to think Esc is not bound or is bound to some random character.

My current settings for the keyboard/terminal function keys and keyboard are set to 'Esc[n~'. I've tried changing them to 'Linux' and 'Xterm R6', but this doesn't seem to change anything.

I've recently had to add a tunnel for another application to work, and changed the setting under Terminal > Features > Disable application keypad mode set to true. I've since reverted to this being false, but that does seem to resolve my problem either.

My assumption is in saving my profile after these changes I accidentally changed something else that is now saved, but reverting to the default settings and logging into my server does not resolve the issue either.

I have no ~/.vimrc and no changes were made to the server according to management so I'm guess I did something.

My question at this point is: What else can I check in PuTTY or try changing that will alter the behavior of how a key is being passed to the prompt? Is it possible to just create a .vimrc to force this to work? What else can I do to make this work?

I'm a new user to these forums so if I made a mistake in laying this out please let me know, but any help in troubleshooting my issue or helping to point me in the right direction would be lovely.

Community
John LillardJohn Lillard

4 Answers

I just started having the same problem, hitting Ctrl+[ also exits insert mode in Vi (it's an alternate key for Esc).

To fix it for me, I went to Terminal > Keyboard, and changed the Function Keys and Keypad to VT100+ emulation.

Jawa
3,2198 gold badges24 silver badges35 bronze badges
Sun KwokSun Kwok

Escape Sequence Cisco

..so again getting frustrated with vi numpad not working, I changed the 'Disable application keypad mode' as mentioned in my original question back to 'True/checked'. This not only allowed me to use my numpad in vi again, but seems to have repaired my Esc issue as well.

The only think I can add is that it seems my machine also had a java error of some kind that seemed to mess up Windows updates that was fixed by one of our IT Techs. Perhaps the two unknowingly correlated?? At any rate, I am closing the question.

Perhaps I didn't save my profile correctly? I'm pretty sure I double-checked this, but I'm also struggling with the idea this 'magically fixed itself'.

John LillardJohn Lillard

Glad that you found an answer, which was mucking with PuTTY settings.As an alternative, if the Esc key doesn't work as expected, you can often try Ctrl-[.][CyberPillar][: ctrl key keyboard sequences mentions this, as does ][CyberPIllar][: Meta key. Keep that in mind, as the tip can occasionally be quite handy, perhaps e specially if you regularly use the Esc key with remote Unix programs (like vi, as you mentioned).

TOOGAMTOOGAM

Serial Escape

11.7k3 gold badges26 silver badges48 bronze badges

Serial Escape From Tarkov

maybe I have a different shell or something but ctrl+alt+[ does it for me

BenBen

Not the answer you're looking for? Browse other questions tagged bashsshvimputty or ask your own question.