Printing to an hp jetdirect via a device file - Questions

This is a discussion on Printing to an hp jetdirect via a device file - Questions ; Hi, is there a way to create a device file in /dev that whenever I send something to it, it does a netcat to a jetdirect print server? Can this be done with pseudo ttys and a special type of ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: Printing to an hp jetdirect via a device file

  1. Printing to an hp jetdirect via a device file

    Hi, is there a way to create a device file in /dev that whenever I
    send something to it, it does a netcat to a jetdirect print server?
    Can this be done with pseudo ttys and a special type of getty or
    something?

    Thanks
    PW

  2. Re: Printing to an hp jetdirect via a device file

    On 6 Sep 2003 00:36:12 -0700, PW Herman wrote:
    > Hi, is there a way to create a device file in /dev that whenever I
    > send something to it, it does a netcat to a jetdirect print server?
    > Can this be done with pseudo ttys and a special type of getty or
    > something?
    >
    > Thanks
    > PW


    Perhaps what you are looking for is a "named pipe" aka fifo.

    something on the order of

    mkfifo /dev/pipe2netcat
    netcat ...whateverUneed4jetdirect... < /dev/pipe2netcat &


    Then when some other process writes to /dev/pipe2netcat the
    data will be read by the backgrounded netcat process.

    But that doesn't address the issues of queuing or of respawning
    netcat, because I expect it'll close when it sees the first end
    of file.

    Wouldn't you be happier running a lpd server on the jetdirect
    machine, and using standard unix style network printing?

  3. Re: Printing to an hp jetdirect via a device file

    Creideiki wrote in message news:...
    > On 6 Sep 2003 00:36:12 -0700, PW Herman wrote:
    > > Hi, is there a way to create a device file in /dev that whenever I
    > > send something to it, it does a netcat to a jetdirect print server?
    > > Can this be done with pseudo ttys and a special type of getty or
    > > something?
    > >
    > > Thanks
    > > PW

    >
    > Perhaps what you are looking for is a "named pipe" aka fifo.
    >
    > something on the order of
    >
    > mkfifo /dev/pipe2netcat
    > netcat ...whateverUneed4jetdirect... < /dev/pipe2netcat &
    >
    >
    > Then when some other process writes to /dev/pipe2netcat the
    > data will be read by the backgrounded netcat process.
    >
    > But that doesn't address the issues of queuing or of respawning
    > netcat, because I expect it'll close when it sees the first end
    > of file.
    >
    > Wouldn't you be happier running a lpd server on the jetdirect
    > machine, and using standard unix style network printing?



    Sw333t, that's exactly what I was looking for! I've got an old
    application that runs on a SCO box that handles printing by just
    sending data over raw devices. I was just wondering if there was a
    way to do this in linux...

    Thanks again,
    PW

  4. Re: Printing to an hp jetdirect via a device file

    On 9 Sep 2003 06:43:15 -0700, PW Herman wrote:
    > Creideiki wrote in message news:...
    >> On 6 Sep 2003 00:36:12 -0700, PW Herman wrote:
    >> > Hi, is there a way to create a device file in /dev that whenever I
    >> > send something to it, it does a netcat to a jetdirect print server?
    >> > Can this be done with pseudo ttys and a special type of getty or
    >> > something?
    >> >
    >> > Thanks
    >> > PW

    >>
    >> Perhaps what you are looking for is a "named pipe" aka fifo.
    >>
    >> something on the order of
    >>
    >> mkfifo /dev/pipe2netcat
    >> netcat ...whateverUneed4jetdirect... < /dev/pipe2netcat &
    >>
    >>
    >> Then when some other process writes to /dev/pipe2netcat the
    >> data will be read by the backgrounded netcat process.
    >>
    >> But that doesn't address the issues of queuing or of respawning
    >> netcat, because I expect it'll close when it sees the first end
    >> of file.
    >>
    >> Wouldn't you be happier running a lpd server on the jetdirect
    >> machine, and using standard unix style network printing?

    >
    >
    > Sw333t, that's exactly what I was looking for! I've got an old
    > application that runs on a SCO box that handles printing by just
    > sending data over raw devices. I was just wondering if there was a
    > way to do this in linux...
    >
    > Thanks again,
    > PW


    I'm still not sure if a named pipe is the way to go.

    Consider using a standard lpd package on the linux system with the
    printing device set to /dev/null. then define a filter in the
    /etc/printcap entry that does your netcat thing for you. This would
    give you a more standard printer interface than a named pipe
    kludge

    an entry in /etc/printcap something like

    jetdirect:
    :lp=/dev/null:\
    :sd=/var/spool/lpd/jetdirect:\
    :af=/var/log/jetdirect-acct:\
    :lf=/var/log/jetdirect-errs:\
    :sh:\
    :if=/usr/local/bin/netcat_kludge.sh


    then make a script /usr/local/bin/netcat_kludge.sh that does
    your raw socket thing. I've never used netcat for that.
    typically I use the socket command (see man 1 socket)
    The kludge script could be something like:

    exec socket -qw 192.168.1.123 567

    using 192.168.1.123 as the IP of your jetdirect system
    and port 567 as the post its listening on.

    btw, is this jetdirect server a standalone jetdirect?
    If so, there is a standard way to use it already via
    lpd

    see http://www.hp.com/cposupport/network.../bpj06515.html


  5. Re: Printing to an hp jetdirect via a device file

    Creideiki wrote in message news:...
    > On 9 Sep 2003 06:43:15 -0700, PW Herman wrote:
    > > Creideiki wrote in message news:...
    > >> On 6 Sep 2003 00:36:12 -0700, PW Herman wrote:
    > >> > Hi, is there a way to create a device file in /dev that whenever I
    > >> > send something to it, it does a netcat to a jetdirect print server?
    > >> > Can this be done with pseudo ttys and a special type of getty or
    > >> > something?
    > >> >
    > >> > Thanks
    > >> > PW
    > >>
    > >> Perhaps what you are looking for is a "named pipe" aka fifo.
    > >>
    > >> something on the order of
    > >>
    > >> mkfifo /dev/pipe2netcat
    > >> netcat ...whateverUneed4jetdirect... < /dev/pipe2netcat &
    > >>
    > >>
    > >> Then when some other process writes to /dev/pipe2netcat the
    > >> data will be read by the backgrounded netcat process.
    > >>
    > >> But that doesn't address the issues of queuing or of respawning
    > >> netcat, because I expect it'll close when it sees the first end
    > >> of file.
    > >>
    > >> Wouldn't you be happier running a lpd server on the jetdirect
    > >> machine, and using standard unix style network printing?

    > >
    > >
    > > Sw333t, that's exactly what I was looking for! I've got an old
    > > application that runs on a SCO box that handles printing by just
    > > sending data over raw devices. I was just wondering if there was a
    > > way to do this in linux...
    > >
    > > Thanks again,
    > > PW

    >
    > I'm still not sure if a named pipe is the way to go.
    >
    > Consider using a standard lpd package on the linux system with the
    > printing device set to /dev/null. then define a filter in the
    > /etc/printcap entry that does your netcat thing for you. This would
    > give you a more standard printer interface than a named pipe
    > kludge
    >
    > an entry in /etc/printcap something like
    >
    > jetdirect:
    > :lp=/dev/null:\
    > :sd=/var/spool/lpd/jetdirect:\
    > :af=/var/log/jetdirect-acct:\
    > :lf=/var/log/jetdirect-errs:\
    > :sh:\
    > :if=/usr/local/bin/netcat_kludge.sh
    >
    >
    > then make a script /usr/local/bin/netcat_kludge.sh that does
    > your raw socket thing. I've never used netcat for that.
    > typically I use the socket command (see man 1 socket)
    > The kludge script could be something like:
    >
    > exec socket -qw 192.168.1.123 567
    >
    > using 192.168.1.123 as the IP of your jetdirect system
    > and port 567 as the post its listening on.
    >
    > btw, is this jetdirect server a standalone jetdirect?
    > If so, there is a standard way to use it already via
    > lpd
    >
    > see http://www.hp.com/cposupport/network.../bpj06515.html


    I've got normal printing to the jetdirect via lp working fine, I just
    needed a way to print to it by 'cat'ing to a /dev file. The problem
    was this proprietary dental office program doesn't know anything about
    the lp command. The thing was written in basic or some silly thing so
    it always assumes the printer is on a parallel or serial port.
    I found a cool script for the workaround that will spool anything
    dumped to a /dev file into lp:
    http://www.interex.org/pubcontent/en...01/13qaux.html
    Thanks for all the other suggestions though,
    Rock on
    PW

+ Reply to Thread