Skip to main content

I'm trying to get ssh working into a Windows 2022 system with UniVerse via openssh. It works much better than the last time I tried it, but for one problem: the escape key. The problem is that the escape key is not passed to UniVerse. I'm wondering if anyone has any suggestions or has managed to get this going?

Let me illustrate this a little. If I ssh into the Windows server, CD to a UniVerse account, and run the uv (or uvsh) command, and then run the following program:

     GETKEY
0001 PRINT 'This will list the ASCII code of the key pressed until you hit "Q"'
0002 loop
0003    c = keyin()
0004    print seq(c)
0005 until c = 'Q' ! c = 'q' do repeat

It returns the ASCII code for any key I press - except for the ESC key, when it simply doesn't respond.

Curiously, the same problem occurs if I run the program after opening a UniVerse command line session using Start > Rocket U2 > UniVerse Shell (so the problem isn't exclusively related to ssh, it would seem).

Furthermore, if from the same session I go into Python and run the following, it does register when I press the ESC key (I've included what happens when I press some keys, including ESCape):

>PYTHON
python> import msvcrt
python> for i in range(5):
...     print( msvcrt.getch() )
...
b'\\x1b'
b'\\x1b'
b'j'
b'd'
b'i'

Anyway, I have no idea what is going on - perhaps some PTERM setting, or something else?

I'm hoping someone has a good idea to fix this!

Thanks!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

I'm trying to get ssh working into a Windows 2022 system with UniVerse via openssh. It works much better than the last time I tried it, but for one problem: the escape key. The problem is that the escape key is not passed to UniVerse. I'm wondering if anyone has any suggestions or has managed to get this going?

Let me illustrate this a little. If I ssh into the Windows server, CD to a UniVerse account, and run the uv (or uvsh) command, and then run the following program:

     GETKEY
0001 PRINT 'This will list the ASCII code of the key pressed until you hit "Q"'
0002 loop
0003    c = keyin()
0004    print seq(c)
0005 until c = 'Q' ! c = 'q' do repeat

It returns the ASCII code for any key I press - except for the ESC key, when it simply doesn't respond.

Curiously, the same problem occurs if I run the program after opening a UniVerse command line session using Start > Rocket U2 > UniVerse Shell (so the problem isn't exclusively related to ssh, it would seem).

Furthermore, if from the same session I go into Python and run the following, it does register when I press the ESC key (I've included what happens when I press some keys, including ESCape):

>PYTHON
python> import msvcrt
python> for i in range(5):
...     print( msvcrt.getch() )
...
b'\\x1b'
b'\\x1b'
b'j'
b'd'
b'i'

Anyway, I have no idea what is going on - perhaps some PTERM setting, or something else?

I'm hoping someone has a good idea to fix this!

Thanks!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Martin,

I don't have access to verify just now, but try:

PTERM INPUTCTL ON

and

PTERM MODE RAW

both separately and together, let us know how it goes.

I would caution however that as you are not using the UniVerse Telnet service and that OpenSSH is probably using the DOS command line interpreter. AFAIK all versions of COMMAND.COM's command line editor will interpret pressing the ESCAPE key as command to cancel the input line, so the ESCAPE code will not be accessible as user input. Any use of ESCAPE will need to bypass interpretation by the line editor. 

I've used tools in the past to remap keys, though not the escape key - and the effect required a reboot and was global affecting everything. You may find 'keymapper' useful to try here https://www.microsoft.com/en-us/windows/learning-center/how-to-remap-your-keyboard

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------


I'm trying to get ssh working into a Windows 2022 system with UniVerse via openssh. It works much better than the last time I tried it, but for one problem: the escape key. The problem is that the escape key is not passed to UniVerse. I'm wondering if anyone has any suggestions or has managed to get this going?

Let me illustrate this a little. If I ssh into the Windows server, CD to a UniVerse account, and run the uv (or uvsh) command, and then run the following program:

     GETKEY
0001 PRINT 'This will list the ASCII code of the key pressed until you hit "Q"'
0002 loop
0003    c = keyin()
0004    print seq(c)
0005 until c = 'Q' ! c = 'q' do repeat

It returns the ASCII code for any key I press - except for the ESC key, when it simply doesn't respond.

Curiously, the same problem occurs if I run the program after opening a UniVerse command line session using Start > Rocket U2 > UniVerse Shell (so the problem isn't exclusively related to ssh, it would seem).

Furthermore, if from the same session I go into Python and run the following, it does register when I press the ESC key (I've included what happens when I press some keys, including ESCape):

>PYTHON
python> import msvcrt
python> for i in range(5):
...     print( msvcrt.getch() )
...
b'\\x1b'
b'\\x1b'
b'j'
b'd'
b'i'

Anyway, I have no idea what is going on - perhaps some PTERM setting, or something else?

I'm hoping someone has a good idea to fix this!

Thanks!



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Martin,

I have to ask - is there any reason why you cannot use SSL? This is natively supported by both the UniVerse telnet service and the UniRPC service. Rocket have wIntegrate (or indeed SBClient) as SSL-capable client software, though there ar other producrs out there  well.

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

Martin,

I don't have access to verify just now, but try:

PTERM INPUTCTL ON

and

PTERM MODE RAW

both separately and together, let us know how it goes.

I would caution however that as you are not using the UniVerse Telnet service and that OpenSSH is probably using the DOS command line interpreter. AFAIK all versions of COMMAND.COM's command line editor will interpret pressing the ESCAPE key as command to cancel the input line, so the ESCAPE code will not be accessible as user input. Any use of ESCAPE will need to bypass interpretation by the line editor. 

I've used tools in the past to remap keys, though not the escape key - and the effect required a reboot and was global affecting everything. You may find 'keymapper' useful to try here https://www.microsoft.com/en-us/windows/learning-center/how-to-remap-your-keyboard

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

Thanks John, I've given your suggestions a try, but with no luck:

  1. PTERM INPUTCTL ON made no difference to recognition of the ESC;
  2. PTERM MODE RAW results in "Warning: option "MODE RAW" is not supported for this device."

As noted above, running Python from within the UV shell shows that ESC can be received and decoded. I'm sure it's something wonky with my config somewhere!

I've also tried alternate login shells for OpenSSH (this can be set through the registry HKEY_LOCAL_MACHINE \\ SOFTWARE \\ OpenSSH \\ DefaultShell value, none of which seem to work. I've tried using a Linux terminal, SBClient, wIntegrate, and PuTTY to connect - all without success! Perhaps it is something to do with my server config: Windows 2022 + UV 11.4.1 + OpenSSH_for_Windows_9.5p1, LibreSSL 3.8.2.



------------------------------
Martin Shields
Senior Technical Consultant
Meier Business Systems PTY LTD
Carnegie VIC AU
------------------------------

Martin,

I have to ask - is there any reason why you cannot use SSL? This is natively supported by both the UniVerse telnet service and the UniRPC service. Rocket have wIntegrate (or indeed SBClient) as SSL-capable client software, though there ar other producrs out there  well.

Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------

A suggestion:

  1. Make sure the Windows telnet client is installed
  2. From a DOS shell on the Windows console run telnet localhost to connect to UniVerse.
  3. Test the ESCAPE key here
  4. Connect using OpenSSH to a  DOS shell
  5. From here, repeat the telnet localhost as above
  6. Test again
  7. From a DOS shell on the system consolem, cd to a UniVerse directory and run a UniVerse shell
  8. Test again
  9. Finally - change the OpenSSH shell executed to the UniVerse executable itself - making sure that this launches in a UniVerse account location 
  10. Test again

I suspect I know what you will find but don't want to shape expectations....
(I'd try this myself but don't have access at the moment).


Regards

JJ



------------------------------
John Jenkins
Thame, Oxfordshire
------------------------------