Well Ashok, I think the original reply has a typo and that is the second '\'. '\' is an escape character so you don't need to escape the '[' character. I think that you'll find that "\033[20~" or "\033[24~" will suit you better. If you care to know, the 033 is the octal representation of the ASCII ESC character... \ sets it into octal or other modes, i.e. \x0A is hex for 0A or 10 decimal. \012 is the octal (base-8) representation of that ASCII character. Here's a code snippet from my server, it uses XTERM or LINUXCON so it's DIFFERENT codes for the function keys.
----
child.send("\033OP") #Sends an F1 key. If I need to do manually, I hit "ESC O P". This does the same.
child.send("\015") #Sends enter key.
Also, sendline sometimes doesn't work sending the enter key so two child.send's is needed.
Good luck ya'll!
P.S. the command od -c -w4 will do you well. Run it, hit a FN key and then enter and it will display the info from the second post!
Last edited by lpd738; 08-30-2013 at 10:19 AM.
|