[lug] talking directly to a printer
D. Stimits
stimits at attbi.com
Thu Jan 9 01:12:17 MST 2003
Hugh Brown 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?
>
USB produces, via the HID kernel "stuff" (that's a technical term, it
inherits from "module" and "coffee" and "fuzzy brain" and "jeez, it is
after 1 AM, why the *#$% am I awake?"), /dev/input/, and within
/dev/input/, are various USB devices. If it were a mouse, you'd know it
is /dev/input/mouse0 or similar, ditto for keyboard and joystick. I have
to wonder what the device would be named for a USB printer? Maybe
/dev/lp0 is a sym link pointing to the right USB device (digging around
in /usr/src/linux-2.4/Documentation/ could give more clues). In any
case, it is likely accessed just like any other device special file,
with a few "standard" ioctl's, plus some custom to the kernel module
that supports it. Or at least that is a place to start.
D. Stimits, stimits AT attbi DOT com
PS: Looks like I'll miss another meeting...sleep sounds awefully good
right now. Was that Robert Frost that had the poem about miles to go and
things to do before resting his weary feet? :(
> Hugh
>
>
>
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>
More information about the LUG
mailing list