From owner-freebsd-usb@FreeBSD.ORG Tue Sep 25 03:30:16 2007 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01AFB16A418 for ; Tue, 25 Sep 2007 03:30:16 +0000 (UTC) (envelope-from on@cs.ait.ac.th) Received: from mail.cs.ait.ac.th (mail.cs.ait.ac.th [192.41.170.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4544613C4A5 for ; Tue, 25 Sep 2007 03:30:14 +0000 (UTC) (envelope-from on@cs.ait.ac.th) Received: from banyan.cs.ait.ac.th (banyan.cs.ait.ac.th [192.41.170.5]) by mail.cs.ait.ac.th (8.13.1/8.12.11) with ESMTP id l8P2xHKq050105 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 25 Sep 2007 09:59:17 +0700 (ICT) Received: (from on@localhost) by banyan.cs.ait.ac.th (8.13.3/8.12.11) id l8P2xHOi091307; Tue, 25 Sep 2007 09:59:17 +0700 (ICT) Date: Tue, 25 Sep 2007 09:59:17 +0700 (ICT) Message-Id: <200709250259.l8P2xHOi091307@banyan.cs.ait.ac.th> From: Olivier Nicole To: freebsd-usb@freebsd.org X-Virus-Scanned: on CSIM by amavisd-milter (http://www.amavis.org/) Subject: Reading page count from USB printer X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Sep 2007 03:30:16 -0000 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@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@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@PJL JOB NAME="PID=58584 USER=on HOST=host" @PJL USTATUS JOB=ON coucou ^[%-12345X@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.