- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Printing through a terminal?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 02:22 PM
07-03-2002 02:22 PM
I think I have just been asked to do the impossible. We have an old application written in C. Currently reports are printed to serial printers connected to a modem for each printer. There is one phone connection for each terminal and a second phone connection for each user's printer. The manager has just realized that he could cut the monthly phone expenses in half if they could somehow print through the AUX/PRINTER port on the Wyse 60 terminal. My boss has told them that we can do this. Please help! Is this even remotely possible. I don't even know where to begin.
Thanks in advance, Ryan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 02:33 PM
07-03-2002 02:33 PM
SolutionPlan A) How about a dedicated connection and a pair of stat MUX'es? One MUX on your end and the other on theirs. Maybe 8 ports on each end. That might be cheaper and would require no code changes.
Plan B) Ryan gets to do some work. I just untic'ed wyse60 and you are in luck (more or less). The 'mc4' terminfo sequence turns the printer port off and the 'mc5' sequence turns the printer port on.
You can do a bit of a test by doing something like this:
PTRON=$(tputs mc5)
PTROFF=$(tputs mc4)
echo "${PTRON}\c"
echo "This should go to the printer."
echo "${PTROFF}\c"
echo "This should go to the screen."
Hopefully you are using curses in your application. In that case, you will be using the tputs() fuinction. Man curses for details.
I can't remember if the wyse60 does a transparent print or not; some terminals echoed everything to both the screen and the printer port. If you are lucky, the wyse60 does not garbage the screen while it's printing.
Happy coding, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 03:38 PM
07-03-2002 03:38 PM
Re: Printing through a terminal?
Wy-60 sure does have transparent print, and it's just a simple escape sequence.
Transparent on => ESC d # (OR) CTRL-X
Transparent off => CTRL-T
OR you can use
AUX print mode on => CTRL-R
AUX print mode off => CTRL-X
Can't begin to count how many of these I installed over a 7 year period in the '80s/90s, but I'm pretty sure it was 4 figures....
Just alter the program to send one of these ON codes just prior to the print stream & follow it w/CTRL-X after the print stream & you should be good to go.
Notes:
1) IF you use either you will NOT be able to use the term for anything else 'til the print's done
2) These are the codes for the native Wy-60 mode...IF you are emulating anything else, all bets are off. I STRONGLY suggest you use the native mode.
3) Of course you'll have to insure the serial settings are correct on the port & ptr...particularly handshake. Make sure you send a LONG (longer than ptr buffer) doc thru to the ptr before you release it.
4) DON'T get fancy with the print jobs....it's easy to hit a ptr ctrl sequence that the terminal will act on if it's in it's control set. Bold, italic, u-line that's about all...graphics RARELY work.
HTH,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 03:41 PM
07-03-2002 03:41 PM
Re: Printing through a terminal?
AUX print mode off => CTRL-T
Either way CTRL-T turns print off.
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2002 11:04 PM
07-03-2002 11:04 PM
Re: Printing through a terminal?
you can print in a printer attached to your terminal through TSM software.
I have HP 700/70 terminals and print to the laserjet connected to the parallel port.
You need in /home/user/.profile:
myterminal=`tty`
myprinter=`echo $myterminal | cut -d / -f 4`
TSMLP=i_$myprinter ; export TSMLP
tsm nonstop 2
You need in /home/user/.tsm:
window_title=SHELL 1
#respawn 1 $SHELL
# 1 /home/integral/setisc ; /usr/tsm/bin/tsm.command qy
1 /path/to/your/aplication
window_title=PRINTER CONTROL
2 /usr/tsm/bin/tsm.lpcat
tsm 2
To define the printer:
/usr/tsm/bin/tsm.lpadmin -p i_eb111 -m localp
Where eb111 is the port name in the DDFA file.
Hope this help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 07:25 AM
07-08-2002 07:25 AM
Re: Printing through a terminal?
I did a small test. I put some printf's with the external port on/off sequences supplied by Jeff and it works. It doesn't mess up the screen either. The curses screen remains intact.
Thanks for your help,
Ryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 07:36 AM
07-08-2002 07:36 AM
Re: Printing through a terminal?
While your approach will work, it's how shall I politely phrase this? It's Mickey Mouse. Since you are using curses, use it to your advantage. What happens if the customer suddenly buys a new, 'better', 'improved' (maybe not even Wyse) terminal. Your hard-coded sequences suddenly don't work anymore. Another point is suppose your customers finds a 'better' printer. If it were me I would do the terminfo lookup for the printer on and off AND I would not assume that the screen is not 'messed up'.
The really smart play would:
1) Save the current curses window/screen.
2) Use the printer on sequences found in the terminfo database to enable printing.
3) Print your stuff.
4) Use the printer off sequences found in the terminfo database to disable printing.
5) Refresh the curses window/screen.
An even more robust approach would use an ENV variable (e.g. EXTPRINTER) to define another
terminfo entry to describe the external printer. That way, double-width, underline, bold, etc. could be looked up as well.
If you follow this approach, no matter what is thrown at you, a few terminfo changes and you are done AND you can support various terminal/printer combinations.
P.S. I like Mickey Mouse cartoons; I detest Mickey Mouse code.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 08:08 AM
07-08-2002 08:08 AM
Re: Printing through a terminal?
Ryan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 08:12 AM
07-08-2002 08:12 AM
Re: Printing through a terminal?
This is a device which combines a number of serial ports on one end and sends them over a single (usually leased) line to be demultiplexed into another set of ports on the other end. You might look at MultiTech; I know they made these things at one time. Stat MUX'es have largely been replaced by ATS units these days.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 08:35 AM
07-08-2002 08:35 AM
Re: Printing through a terminal?
Here is a small script that does the magic :
echo "\033[5i"
cat $*
echo "\033[4i"
jsut save this a lprint in bin of the machine , what this does is that when you run it with a file name it will print the file on the serial port of the termial attached to the printer , during this time ofcourse you can type anyhting on the terminal .
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2002 10:10 AM
07-08-2002 10:10 AM
Re: Printing through a terminal?
Thanks again,
Ryan