[lug] talking directly to a printer

Peter Hutnick peter-lists at hutnick.com
Wed Jan 8 17:34:05 MST 2003


Hugh Brown said:
> I have a printer that whose manual claims that if you send it a hex
> number it will respond with a status byte.  Is there a way to do this
> under linux and get the output (I can use cat to write to the device
> file, or I can use cat to read from the device file but not both at the
> same time) without hacking on the kernel?

You certainly won't have to hack the kernel.  You might have to cut some
code.  Check out http://www.elitecoders.de/mags/cscene/CS4/CS4-02.html . 
It leads in with a bunch of DOS stuff, but then brings in the UNIXy
goodness.

I'm not a systems programmer, but I would assume that there is some
buffered I/O system function to allow you to just write to the port then
read whatever comes back.

Now that I am thinking about it, is there some list of system calls,
perhaps with a synopsis for each?  I know they all have man pages, but
that doesn't help if you don't know what you need in the first place!

-Peter





More information about the LUG mailing list