[lug] talking directly to a printer

Timothy C. Klein teece at silverklein.net
Wed Jan 8 19:22:40 MST 2003


* Hugh Brown (hugh at math.byu.edu) wrote:
> On Wed, 2003-01-08 at 19:34, Peter Hutnick wrote:
> > 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.
> > 
> 
> 
> It's a usb printer.  There isn't some sort of fun /proc interface or a
> way to use a fifo or something like that is there?
> 
> Hugh

Don't all Linux devices have to implement read and write system calls?
Well, they have to have them, them may or may not be implemented.  Can't
you just whip up some code, using, write, and them read back?   Just
thinking aloud.

You might poke around linux/Documentation

Tim
--
==============================================
==  Timothy Klein || teece at silverklein.net  ==
==  http://i148.denver.dsl.forethought.net  ==
== ---------------------------------------- ==
== "Hello, World" 17 Errors, 31 Warnings... ==
==============================================



More information about the LUG mailing list