[comp.unix.xenix] Writing serial device drivers

gillisb@mist.CS.ORST.EDU (Brian Gillis) (08/02/89)

Hello Net-Fans,
I am faced with dealing with a serial device, acting as a printer,
that does not have the ability to send Xon/Xoff control to control
data flow.  A possible, and accomplished method, was to write a little
C program to control the speed in which data is sent to the device that
was not dependent on baud rate or device quirks.

The problem:
Various programs bypass the system spooler and write  directly to 
the serial port.  Therefore, I am faced with the problem of getting 
between the serial port and the various application programs. I can
define where to write, such as any /dev/*.

I am not sure if I must write a device driver, but I am not sure on
any other way to get around this problem.

If anyone has any useful ideas or code, please drop me a e-mail note!

Thank you,
Brian Gillis
gillisb@gsd.UUCP
hp-pcd!gsd!gillisb

davidsen@sungod.crd.ge.com (William Davidsen) (08/03/89)

  I can't think of any reason for a program to bypass the queue and
access the printer directly, and would not do it myself. However, why
not just create a FIFO in /dev which the ill-behaved programs can open
and write? Then you can have a daemon which reads the FOFI and write to
the printer, adding delays as needed (perhaps with nap()).

  If the applications do really nasty stuff like play with baud rate and
parity, you can't use this trick. You also might try a pty, which allows
setting the baud rate, but I don't know what it does...
	bill davidsen		(davidsen@crdos1.crd.GE.COM)
  {uunet | philabs}!crdgw1!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

debra@alice.UUCP (Paul De Bra) (08/03/89)

In article <1461@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
>
>  I can't think of any reason for a program to bypass the queue and
>access the printer directly, and would not do it myself.

Well, I have been using an old (second hand) Epson MX 100 for a long time.
It didn't want to print tabs (maybe i could set tabs, but they were not
set to every 8 chars by default anyway).
So I had the spooler execute pr -t -e to expand the tabs.

Then when i wanted to print bitmaps (i.e. Tex output in my case)
i did a cat > /dev/lp to bypass the tab expansion.

Paul.
-- 
------------------------------------------------------
|debra@research.att.com   | uunet!research!debra     |
------------------------------------------------------

bob@wyse.wyse.com (Bob McGowen Wyse Technology Training) (08/04/89)

In article <9731@alice.UUCP> debra@alice.UUCP () writes:
>In article <1461@crdgw1.crd.ge.com> davidsen@crdos1.UUCP (bill davidsen) writes:
>>
>>  I can't think of any reason for a program to bypass the queue and
>>access the printer directly, and would not do it myself.
>
I agree!!!  Except in the special case when you are first setting up
the printer and need to check the physical connection, so you WANT
to bypass the spooler and go directly to the device.
---deleted---
>
>Then when i wanted to print bitmaps (i.e. Tex output in my case)
>i did a cat > /dev/lp to bypass the tab expansion.
>
>Paul.

I am assuming that the spooler in question supports multiple devices
and queues.  You should just set up a second printer pointing at the
same output device.  This gives you another interface file which you
can edit as needed and provides lp spooler control on the output
(it is smart enough to queue alternate requests.  I have one dot
matrix printer set up so I can access it in draft, compressed or
near letter quality as needed using the lp command's -dpr_name
option.)--

	****you will not interfer with anyone elses' output and they
	will not interfere with yours!****
Bob McGowan  (standard disclaimer, these are my own ...)
Customer Education, Wyse Technology, San Jose, CA
..!uunet!wyse!bob
bob@wyse.com