Reading page count from USB printer

Olivier Nicole on at cs.ait.ac.th
Mon Sep 24 20:30:16 PDT 2007


Hi,

I posted this to freebsd-question list, but then I relized this list
may be more appropriate.

I have an HP2200 printer connected to a 6.2 box via USB.

I would like to read the page count. I know the PCL sequence to do
that, but I am unsure about the way to access the printer.

The pinter shows up at /dev/ulpt0, I can redirect text to it for
printing, using cat file.ps >/dev/ulpt0

But I do not manage to read the PCL response.

How should I do? In Perl preferably.

Best regards,

Olivier

How to do on a network printer:

$ telnet 192.168.1.1 9100
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
^[%-12345X at PJL JOB NAME="PID=58584 USER=on HOST=host"
@PJL USTATUS JOB=ON
    @PJL USTATUS JOB
    START
    NAME="PID=58584 USER=on HOST=host"

coucou
^[%-12345X at PJL EOJ NAME="PID=58584 USER=on HOST=host"
^[%-12345X
    @PJL USTATUS JOB
    END
    NAME="PID=58584 USER=on HOST=host"
    PAGES=2

^]
telnet> q
Connection closed.

Lines starting with spaces are replies sent by the printer.

How I would like to do on USB printer:

$ cat > /dev/ulpt0
^[%-12345X at PJL JOB NAME="PID=58584 USER=on HOST=host"
@PJL USTATUS JOB=ON
coucou
^[%-12345X at PJL EOJ NAME="PID=58584 USER=on HOST=host"
^[%-12345X

and here I need to interrupt (ctrl-C) after waiting for LONG time.
The text "coucou" get printed OK, but I do not see the reply sent by
the printer.


More information about the freebsd-usb mailing list