Connecting to a raspberry pi with plink.exe and a usb serial cable: keyboard input doesn't work on apps like vim or htop (ncurses apps presumably) #11900

Closed
opened 2026-01-31 03:00:32 +00:00 by claunia · 4 comments
Owner

Originally created by @jdarias on GitHub (Dec 28, 2020).

Environment

Microsoft Windows [Versión 10.0.19041.685]
Windows Terminal Versión: 1.4.3243.0

Any other software?
putty.exe
plink.exe

Hardware:
raspberry pi
USB Serial cable CP2102

Steps to reproduce

  1. Connect the cable to the raspberry pi as instructed here: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable
  2. Set a windows terminal profile like this:
    {
    // Serial cable to my raspberry pi
    "guid": "{6620a8ea-b9a7-4ed3-974e-03171cf68fbe}",
    "name": "Serial to Raspberry Pi (plink)",
    "commandline": "plink.exe -serial COM4 -sercfg 115200,8,n,1,N",
    "hidden": false,
    "padding": "2,2,2,2",
    "icon": "D:\Dropbox\aaa Webs\Recursos\fugue-icons-3.4.1\icons\network-ethernet.png"
    },
  3. log into your pi using windows terminal with this profile, and the console cable
  4. use a program like htop or vim
  5. esc and the function keys won't work. They do if you use putty.exe, but that's outside windows terminal. the idea here is to be able to use plink.exe inside windows terminal.

Expected behavior

Esc and function keys should work

Actual behavior

Esc and function keys don't work and you're stuck

Originally created by @jdarias on GitHub (Dec 28, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Microsoft Windows [Versión 10.0.19041.685] Windows Terminal Versión: 1.4.3243.0 Any other software? putty.exe plink.exe Hardware: raspberry pi USB Serial cable CP2102 ``` # Steps to reproduce 1. Connect the cable to the raspberry pi as instructed here: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-5-using-a-console-cable 2. Set a windows terminal profile like this: { // Serial cable to my raspberry pi "guid": "{6620a8ea-b9a7-4ed3-974e-03171cf68fbe}", "name": "Serial to Raspberry Pi (plink)", "commandline": "plink.exe -serial COM4 -sercfg 115200,8,n,1,N", "hidden": false, "padding": "2,2,2,2", "icon": "D:\\Dropbox\\aaa Webs\\Recursos\\fugue-icons-3.4.1\\icons\\network-ethernet.png" }, 3. log into your pi using windows terminal with this profile, and the console cable 4. use a program like htop or vim 5. esc and the function keys won't work. They do if you use putty.exe, but that's outside windows terminal. the idea here is to be able to use plink.exe inside windows terminal. <!-- A description of how to trigger this bug. --> # Expected behavior Esc and function keys should work <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> # Actual behavior Esc and function keys don't work and you're stuck <!-- What's actually happening? -->
claunia added the Needs-TriageResolution-ExternalNeeds-Tag-Fix labels 2026-01-31 03:00:32 +00:00
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (Dec 29, 2020):

I wonder if the -no-sanitise-stderr -no-sanitise-stdout options of Plink would help here. I presume Plink cannot distinguish stderr from stdout on a serial connection anyway.

@KalleOlaviNiemitalo commented on GitHub (Dec 29, 2020): I wonder if the [`-no-sanitise-stderr` `-no-sanitise-stdout`](<https://the.earth.li/~sgtatham/putty/0.74/htmldoc/Chapter7.html#plink-option-sanitise> "7.2.3.5 -sanitise-stream: control output sanitisation") options of Plink would help here. I presume Plink cannot distinguish stderr from stdout on a serial connection anyway.
Author
Owner

@jdarias commented on GitHub (Dec 31, 2020):

I tried both options but it made no difference. htop won´t take keyboard
input at all. Plink fails horribly when running from cmd.exe, ncurses apps
look all garbled and they won't take keyboard input. In WT they can at
least be looked at. It may be an issue with plink not windows terminal...

@jdarias commented on GitHub (Dec 31, 2020): I tried both options but it made no difference. htop won´t take keyboard input at all. Plink fails horribly when running from cmd.exe, ncurses apps look all garbled and they won't take keyboard input. In WT they can at least be looked at. It may be an issue with plink not windows terminal...
Author
Owner

@zadjii-msft commented on GitHub (Jan 4, 2021):

Could you share the output of infocmp when connected to the raspberry pi?

Plink fails horribly when running from cmd.exe, ncurses apps look all garbled and they won't take keyboard input. In WT they can at least be looked at. It may be an issue with plink not windows terminal...

This sure sounds like it's probably a plink issue, not a Terminal one. The Terminal is just giving the appearance that it's working, when it really isn't. I'd bet that plink needs to enable both ENABLE_VIRTUAL_TERMINAL_INPUT and ENABLE_VIRTUAL_TERMINAL_PROCESSING. Those will cause the Terminal to send the keystrokes in a linux-friendly format. WSL uses those modes (as an example).

@zadjii-msft commented on GitHub (Jan 4, 2021): ~~Could you share the output of `infocmp` when connected to the raspberry pi?~~ > Plink fails horribly when running from cmd.exe, ncurses apps look all garbled and they won't take keyboard input. In WT they can at least be looked at. It may be an issue with plink not windows terminal... This sure sounds like it's probably a `plink` issue, not a Terminal one. The Terminal is just giving the appearance that it's working, when it really isn't. I'd bet that plink needs to enable both `ENABLE_VIRTUAL_TERMINAL_INPUT` and `ENABLE_VIRTUAL_TERMINAL_PROCESSING`. Those will cause the Terminal to send the keystrokes in a linux-friendly format. WSL uses those modes (as an example).
Author
Owner

@DHowett commented on GitHub (Feb 17, 2021):

Unfortunately, this does look like a plink issue. We're sending it Win32 console events (because it's a win32 console application that predates the 2015-era VT support), and it's not handling them properly. Sorry.

@DHowett commented on GitHub (Feb 17, 2021): Unfortunately, this does look like a plink issue. We're sending it Win32 console events (because it's a win32 console application that predates the 2015-era VT support), and it's not handling them properly. Sorry.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11900