I am trying to find out how to simulate key press events on remote server (wich has no X.org aboard) using Python 2.7 Paramiko module. I need to send F2 and Enter consequentially.
According to this discussion I have implemented this code:
client = paramiko.SSHClient()
channel = client.get_transport().open_session()
Firstly, I recommend the PDF version of the xterm control sequences document; it was originally designed for paper and the automatic conversion to HTML is not perfect.
The history of terminal emulators is long and complicated, but one point is that the VT100 only had four function keys (PF1 through PF4), and when its successor the VT220 added another 16 function keys, the original coding scheme ran out of room, so they switched to a different one... but they used the old encodings of F1 through F4 for compatibility's sake. Therefore, although F5 is
CSI 15 ~, it's not true that F2 is
CSI 12 ~. Instead, especially if you're telling Paramiko that you're impersonating a VT100, you should use the VT100 encoding of F2, which is
SSE Q or
'\eOQ as a Python string.
I don't know if that's exactly what's causing your problem, but it's probably part of it.