Printing in UniVerse involves multiple pieces but it is quite simple once you break it down. The core idea of printing from UniVerse is that UniVerse sends print jobs to a forms queue. The forms queue is in turn a linux shell script that will then send the print job to the printer. This is what gives the UniVerse print architecture flexibility, instead of dealing with the printer directly, it interacts with linux and leaves the job of handling the printing to Linux.
02AUG2023 - I wrote some notes on how to manage users and printers now.
Unfortunately this means that you can't manage printing solely from UniVerse, you need to also be aware of the Linux level as well. The commands you need to know are:
SP-ASSIGN
usa
usm
The first command is a UniVerse command and the other 2 are linux commands.
Let's add a new printer to UniVerse
The first step to setting up a printer for UniVerse is to create an entry in the sp.config file. The default is that it is located at: /usr/spool/uv/sp.config.
The sp.config file is a text file that contains a printer on each line. There is a specific format to it. This file can also be updated through an entry screen in the uv account.
Let's add a new printer, PRINTER7, to sp.config.
PRINTER7 /dev/null BAUD 9600 DRIVER /usr/spool/uv/driver7 FORMS 7 XOFF STARTANY OFF PARITY None TABS ON FFDELAY 1 LFDELAY 0 DATABITS 8
The key parts are that we are naming this PRINTER7, we are saying where the driver we want to use is located and we setting the FORMS queue to 7. None of these have to match, it is good practice however that they do. It will make life so much easier when you inevitably need to debug things.
Now that we have our printer set up, let's create the driver, we will create the path from above: /usr/spool/uv/driver7:
date=$(date +%s)
cat - > /tmp/$date.txt
This shell script will get executed whenever we print something from UniVerse. It will create a new file in the tmp directory that will contain everything we sent to the printer. The contents are piped to this script so we could continue this chain by adding a lp command as well. This is how we would send things to a printer.
cat - | lp -d 192.168.7.12
This would send the contents of our print job to a printer that exists on our network.
The next thing to do is to restart the UniVerse spooler. This is where our usa command comes in. We have now updated our sp.config but the changes don't take effect until we restart the spooler.
usa -r
This will refresh the spooler but it won't remove anything.
usa -R
This command will hard reset the spooler and force it synchronize with what we have in the sp.config file.
Now we can view the spooler:
usa
We should see the following:
Printer: PRINTER7 Q: on P: on Form: 7
no entries.
Now let's pause this printer so that we can catch the print job:
usa -p PRINTER7 -o
If we run usa again we should see:
Printer: PRINTER7 Q: on P: off Form: 7
no entries.
This printer is now turned off.
Now we can turn our attention to UniVerse. We have our printer set up and we have our driver written. We have restarted the spooler so that our new printer is getting picked up.
Now we can do an SP-ASSIGN and see our job go through:
SP-ASSIGN F7
We set out forms queue to 7.
Then we can send a print job:
BLOCK-PRINT HELLO WORLD
This should give us a spooler number. We can then run usa again and see our print job.
Job # Job description User name Pri Forms Size Cps Status Delay
000132 UniVerse nivethan:2 30 7 1920 1 wait
Now before we restart this job, we can kill this job by using the usm command. The usm command is for jobs in process while the usa command is used to manage the printers themselves.
usm -k 132
usm -k all
We can kill a specific job or we can kill all outstanding jobs. This is handy when there jobs that get stuck.
Now you can do another BLOCK-PRINT to get another job in the queue.
Let's turn on the printer.
usa -p PRINTER7 +o
Now if we run usa:
Printer: PRINTER7 Q: on P: error Form: 7
***Error: Printer driver does not have execute permissions. Set permissions and re-enable printer (usa +o -p printer) (1)
Job # Job description User name Pri Forms Size Cps Status Delay
000132 UniVerse nivethan:2 30 7 1920 1 wait
Welp. The driver wasn't executable.
chmod +x /usr/spool/uv/driver7
We can then turn the printer back on again and do usa:
Printer: PRINTER7 Q: on P: on Form: 7
no entries.
Much better! If I did it faster enough, I would be able to see the job hit the queue and then immediately finish.
Now we can look at /tmp/$date.txt to see our contents.
! We have set up a printer and got it fully functional from UniVerse.
This way of setting up the printers is a bit involved as it is all outside of UniVerse but it is simple and once you see the flow of things, it is straightforward.
My biggest issues with usa and usm are that the help options require -H and so I never bothered to learn it properly. They should map -h to the same thing so it is a bit more obvious there is a help.
I would also like the entire management of printing moved into UniVerse directly rather than having to do it all in Linux.
I would also like the sp.config file to be better documented. I'm sure it exists, I just don't have it. This is a problem with most parts of Multivalue, not enough stuff is easily lookupable (googleable).
Still, I'm a big fan of how simple printing is from UniVerse, take the cat dump it to lp and away you go.