ITEM: CS1860L

loading 3151 Function keys: How to set them up.


ENVIRONMENT: 4.1.5
PROBLEM: Customer wants help with a  3151 ascii display for loading
programmable function keys from host.

Customer confirms  that he can send a file to the device and program the
function keys.
i.e.
\#vi junk
enter:
\^[!=! ls\^[=
\^[!=" cat\^[=
\#cat junk > /dev/ttyx
This sets the F1 key of a 3151 to 'ls'.  So when I hit F1 I get a
listing of my current directory.
It also sets F2 to do a cat.
The F keys are assigned with the following characters.
! F1
" F2
\# F3
$ F4
% F5
@ F6
' F7
( F8
) F9
* F10
+ F11
, F12

(The actual operation is choosing the ascii character with the
equivalent value of a high in the 7th bit  (dec 32) at all times and 
then adding the ascending values for each function key 1 for F1, 2
for F2 and so on.
F1 = 33 = !     (dec 33)
F2 = 34 = "     (dec 34)
etc.....

Customer says programming them this way is not problem but using the
'pfkey' attribute in the terminfo file does not work at all.  It is
like he never did it.
Customer has a program he wrote which used the pfkey attribute to assign the
F keys.  It works fine on wyse60 and some others but not a 3151.

Here is the solution to do hard function key coding from the terminfo file:

I spoke with customer and indicated I was successful in programming the
first four function keys of my 3151 by inserting the following line
into my ibm.ti file.
pfkey=\\E!=! du\\E=\\E!=" df\\E=\\E!=\# ls\\E=\\E!=$ netstat -rn\\E=
A partial entry for my ibm3151 now looks like this:
ibm3151|ibm3152|IBM 3151 and IBM 3152 display,
        is2=\\E\\040S, rs2=\\E\\040S,
        pfkey=\\E!=! du\\E=\\E!=" df\\E=\\E!=\# ls\\E=\\E!=$ netstat -rn\\E=,
        font0=\\E>B,
        smcup=\\E>B,     rmcup=\\E>A,     smacs=\\E>A,     rmacs=\\E>B,
        sgr=\\E4%'@'%?%p1%t%'A'%!%;
                   %?%p2%t%'B'%!%;
                   %?%p3%t%'A'%!%;
                   %?%p4%t%'D'%!%;
I now do :wq!
I now do: tic ibm.ti

\#tput -tibm3151 pfkey > /dev/tty1
I hit enter on the 3151 and return to the prompt.
now my F1-F4 keys are programmed with du, df, ls, netstat -rn.
When I hit F1, I get a du output, and the rest follow accordingly.

The only thing left is to make the pfkey programmable from the command
line.

To accomplish this I do:

In the ibm.ti file under the 3151 section put this line:
pfkey=\\E!=%p1% 32 %+%c%'\\s'%c%p2%s\\E=,
A partial 3151 entry now looks like this:
ibm3151!ibm3152!IBM 3151 and IBM 3152 display,
        is2=\\E\\040S, rs2=\\E\\040S,
        pfkey=\\E!=%p1% 32 %+%c%'\\s'%c%p2%s\\E=,
        font0=\\E>B,
        smcup=\\E>B,     rmcup=\\E>A,     smacs=\\E>A,     rmacs=\\E>B,
        sgr=\\E4%'@'%?%p1%t%'A'%!%;
                   %?%p2%t%'B'%!%;
                   %?%p3%t%'A'%!%;
What the pfkey=  lines says is this:
1) send to the terminal   Esc!= (\\E!=)
2) push on to stack value of  p1 (%p1)
3) push on to stack 32  (decimal 32) (% 32 )
4) pop from stack top two values, add them, push sum on stack (%+)
5) pop top value from stack and send to terminal as ascii character (%c)
6) push an ascii 'space' on to stack (%'\\s')
7) pop top value from stack and send to terminal as ascii character (%c)
8) push on to stack value of  p2 (%p2)
9) pop all values sent in last push and send to terminal as string (%s)
10) send to the terminal   Esc=  (\\E=)
11) end of terminfo line entry (,)
Now on the 3151 terminal I want to program a F key I run the command:
\#tput -Tibm3151 pfkey 7 'ps -ef'
NOW when I press the F7 key I get the out put of the command \#ps -ef.
NOTE: To reset the terminal function keys do:
\#vi junk
 enter this line
\^[ t
 (that is ESC, space, little t )
:wq!
\#cat junk (on 3151 that you want to clear all functions keys)



Support Line: loading 3151 Function keys: How to set them up. ITEM: CS1860L
Dated: March 1998 Category: N/A
This HTML file was generated 99/06/24~13:30:17
Comments or suggestions? Contact us