[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

329.0. "NEED TERMINAL PRINTER STATUS" by PMRV70::AVDEV (Ed Tribuna ... Aviation Svcs) Mon Oct 06 1986 20:28

    
    	I have a COBOL program that needs to query a terminal with printer
    	port for the printer status.  I haven't been able to find anything
    	about it in the VMS doc.  I looked primarily under SYS$QIO and
    	SYS$GETDVI.
    
    	I'm using GETDVI to determine wether the terminal has a printer
    	port.  Assuming that the device does have a printer port I would
    	then like to be able to use a DSR sequence to get back the printer
    	status.
    
    	I tried simply writing the DSR sequence via QIO then another
    	QIO to read the response.  That didn't do it.
    
    	I've looked thru several of the macro definition library modules
    	including TT, TT2, IO, DVI, TRM and haven't found anything that
    	would even lead me to another method to try.  This has led me
    	to believe that I'm totally on the wrong track.
    
    	Anyone got any ideas?
    
    	Thanks,
    	Ed...
    
T.RTitleUserPersonal
Name
DateLines
329.1It worked (partially)TAV02::NITSANNitsan Duvdevani, Digital IsraelTue Oct 07 1986 06:327
A few years ago I had the same problem (with VT100 + printer port).
I sent the appropriate escape sequence, and did get the correct response,
but when the printer was turned off, the indication of its existance
lasted for about 1 more minute. When I switched it to "off-line" however,
I got an immediate change of the indication.

Nitsan
329.2Write Only PortFROST::HARRIMANDEC 41-BLANK-03, Harriman,Paul J., qty 1Tue Oct 07 1986 12:2728
    re: .-2, .-1
    
    That's very interesting, since the VT100 printer port is a one-way
    port (you can send but you can't really receive over it)...
    
    Most VT10x conversion kits (and the VT102) have this inability.
    I tried at length before I got some concrete explanations about
    this. Unfortunately, they never appeared in a notes file so I can't
    point you to them.
    
    The reason that .-1 worked (partially) is that the printer port
    is not the standard DEC 3-wire connection. It's actually a real
    RS-232 port, meaning that the printer doesn't have to be a DEC printer,
    just any old RS-232 printer will do (it uses either DTR or CTS to
    control (pins 6/20)). Anyway, with the printer off-line and the
    port enabled, the terminal knows the printer isn't ready (closed
    loop).... However, if you send the escape sequence "who are you"
    to the printer, (i.e. and LA50) it will respond, but the VT10x will
    NOT listen for it back.
    
    I know of no way for this to work - perhaps someone else in this
    conference has a workaround? You can, of course, send the "turn
    on the port" and "turn off the port" escape sequences to the
    terminal... however, your program will never really know whether
    or not the printer is there....
    
    /pjh
    
329.3A little more infoPMRV70::AVDEVEd Tribuna ... Aviation SvcsTue Oct 07 1986 14:1919
    
    	re: .2
    
    	I don't expect to be able to get back the printer device info.
    
    	But according to the VT102 user guide (pg 100) the system can
    	request a printer status report from the terminal using '[?15n'.
    	It goes on to list 3 responses to the printer status report
    	request:
    
    			Printer not connected
    			Printer not ready
    			Printer ready
    
    	These are the responses that I'm looking for.
    
    	Ed...
    
    
329.4No terminator?SKYLAB::FISHERBurns Fisher 381-1466, ZKO1-1/D42Tue Oct 07 1986 15:3227
    So, Ed, you are saying that you send the correct escape sequence
    to the terminal, but you get nothing back?  Try connecting a VT220
    as the terminal and setting "display controls" mode to make sure
    that you are actually getting the correct sequence at the terminal.
    If not, you may have some characteristic set which is not passing
    control characters.
    
    If the terminal is getting the escape sequence ok, then you need
    to look at the other end.  One problem might be that the receiving
    QIO is not seeing a terminator, and so it is sitting there waiting
    for more characters.  You can fix this problem by either doing
    something disgusting like setting a timeout or reading one character
    at a time, or you can make sure that the Escape characteristic is
    enabled.  This will cause escape sequences to be parsed, and the
    entire escape sequence will be considered to be a terminator.

    One more hint:  You should clear the typeahead buffer before you
    do the inquire since you don't want to try to read typeahead
    data as part of the escape sequence.  It is also desireable to reduce
    the window between when you clear the buffer and when you read the
    data back.  This can be done using a read QIO with the clear modifier,
    and with a prompt.  The prompt should contain the inquiry escape
    sequence.  Thus all three operations (clear typeahead, write, read)
    are all done in a single QIO.
    
    Burns
    
329.5oh, right...FROST::HARRIMANDEC 41-BLANK-03, Harriman,Paul J., qty 1Tue Oct 07 1986 15:4310
    re: .-1 : couldn't have said it better...
    
    	I was going to say "you probably aren't getting the escape sequence
    to the terminal" but Burns beat me to it.
    
        Check the I/O Users Guide Vol. I for all of the characteristics
    you have to enable/disable.
    
    /pjh
    
329.6Not so tough after allPMRV70::AVDEVEd Tribuna ... Aviation SvcsTue Oct 07 1986 18:257
    	Thanks Burns.  The single QIO works like a champ.
    
    	Sure is easy when you know what you're doing.
    
    	Thanks again,
    	Ed...
    
329.7It works and also usedTAV02::NITSANNitsan Duvdevani, Digital IsraelThu Oct 16 1986 07:366
We have a customer with a large application using this trick. This is what
I meant in .1 (and it works in spite of the "one way" behavior). The terminal
operator gets a message from the application if the printer attacehd to his/her
VT100 is off-line or not present or turned off (more than a minute ago...)

Nitsan