|
From: Tim W. <tw...@re...> - 2005-06-09 12:54:58
|
Hi, I would like to programmatically obtain the IEEE 1284 Device ID of a device that HPLIP can drive. With HPOJ, I could use the ptal-devid command to do this. I don't mind doing the work on it, but which approach would you prefer?: 1. Separate executable 'hp-devid' that just takes -p/-d options 2. Additional option for 'hp-info' Thanks, Tim. */ |
|
From: Till K. <til...@gm...> - 2005-06-09 13:10:23
|
AS HPLIP does not grab the devices permanently, you can also use the independent programs http://www.linuxprinting.org/download/printing/getusbprinterid.pl or http://www.linuxprinting.org/download/printing/usb_id_test.c The code of the Perl version I use in printerdrake of Mandriva Linux. The programs work with all USB printers, also non-HP printers. Till Tim Waugh wrote: > Hi, > > I would like to programmatically obtain the IEEE 1284 Device ID of a > device that HPLIP can drive. With HPOJ, I could use the ptal-devid > command to do this. > > I don't mind doing the work on it, but which approach would you > prefer?: > > 1. Separate executable 'hp-devid' that just takes -p/-d options > 2. Additional option for 'hp-info' > > Thanks, > Tim. > */ |
|
From: Tim W. <tw...@re...> - 2005-06-09 13:14:07
Attachments:
hp-devid
|
On Thu, Jun 09, 2005 at 03:10:06PM +0200, Till Kamppeter wrote: > AS HPLIP does not grab the devices permanently, you can also use the > independent programs > > http://www.linuxprinting.org/download/printing/getusbprinterid.pl > > or > > http://www.linuxprinting.org/download/printing/usb_id_test.c > > The code of the Perl version I use in printerdrake of Mandriva Linux. > > The programs work with all USB printers, also non-HP printers. Yes, indeed, but that doesn't really help. I would still have to parse an ID like 'hp:/usb/DESKJET_990C?serial=US05N1J00XLG' to work out which device to use. Much easier would be a program like hp-devid (attached). Tim. */ |
|
From: Till K. <til...@gm...> - 2005-06-09 13:31:24
|
I use "lpinfo -v" to get available "hp://..." URIs. To associate
/dev/usb/... devices to them, I do "getusbprinterid.pl <device>" and
find the "hp://..." URI which contains the "MODEL" or "MDL" field of the
detected ID string right after "hp://usb/" and, if available, matches
the serial number.
To determine whether a printer is supported by HPLIP already before
installing/starting HPLIP I match the '<model name="...">' in
/usr/share/hplip/data/xml/models.xml against the "MODEL" or "MDL" field
of the detected ID string. The HPLIP RPM I have made in a way that
/usr/share/hplip/data/xml/models.xml is in a separate RPM and this
separate RPM is always installed. printerdrake installes the rest of
HPLIP when it detects a supported printer.
Till
Tim Waugh wrote:
> On Thu, Jun 09, 2005 at 03:10:06PM +0200, Till Kamppeter wrote:
>
>
>>AS HPLIP does not grab the devices permanently, you can also use the
>>independent programs
>>
>>http://www.linuxprinting.org/download/printing/getusbprinterid.pl
>>
>>or
>>
>>http://www.linuxprinting.org/download/printing/usb_id_test.c
>>
>>The code of the Perl version I use in printerdrake of Mandriva Linux.
>>
>>The programs work with all USB printers, also non-HP printers.
>
>
> Yes, indeed, but that doesn't really help. I would still have to
> parse an ID like 'hp:/usb/DESKJET_990C?serial=US05N1J00XLG' to work
> out which device to use.
>
> Much easier would be a program like hp-devid (attached).
>
> Tim.
> */
>
>
> ------------------------------------------------------------------------
>
> #!/usr/bin/env python
> #
> # Based on HPLIP info.py:
>
> # (c) Copyright 2003-2004 Hewlett-Packard Development Company, L.P.
> #
> # This program is free software; you can redistribute it and/or modify
> # it under the terms of the GNU General Public License as published by
> # the Free Software Foundation; either version 2 of the License, or
> # (at your option) any later version.
> #
> # This program is distributed in the hope that it will be useful,
> # but WITHOUT ANY WARRANTY; without even the implied warranty of
> # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> # GNU General Public License for more details.
> #
> # You should have received a copy of the GNU General Public License
> # along with this program; if not, write to the Free Software
> # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> #
> # Author: Don Welch
> #
>
>
> # Std Lib
> import sys
> import os
> import getopt
> import re
>
> sys.path.append ("/usr/share/hplip")
>
> # Local
> from base.g import *
> from base import device, service, status, utils
>
> log.set_level ('none')
>
> try:
> device_uri = sys.argv[1]
> except:
> device_uri = utils.getInteractiveDeviceURI( "usb" )
>
> try:
> d = device.Device( None, device_uri, None )
> except Error:
> log.error( "Error opening device. Exiting." )
> sys.exit(0)
>
> try:
> s = None
> try:
> s = service.Service()
> except Error:
> log.error( "Unable to contact services daemon. Exiting." )
> sys.exit(0)
>
> try:
> data = s.queryDevice( d.device_uri, 0, STATUS_PRINTER_IDLE, False )
> except Error:
> log.error( "Device query failed." )
> else:
> print data["deviceid"]
>
> finally:
> log.debug( "Closing services..." )
> if s is not None:
> s.close()
> if d is not None and d.io_state == IO_STATE_HP_OPEN:
> d.close()
>
|
|
From: Tim W. <tw...@re...> - 2005-06-09 15:02:48
|
On Thu, Jun 09, 2005 at 03:31:12PM +0200, Till Kamppeter wrote: > I use "lpinfo -v" to get available "hp://..." URIs. To associate=20 > /dev/usb/... devices to them, I do "getusbprinterid.pl <device>" and=20 > find the "hp://..." URI which contains the "MODEL" or "MDL" field of the= =20 > detected ID string right after "hp://usb/" and, if available, matches=20 > the serial number. Okay. Well, I think I'll just ship hp-devid along with the Fedora Core printer configuration tool for the time being, since that fits into the existing code more easily. > To determine whether a printer is supported by HPLIP already before > installing/starting HPLIP I match the '<model name=3D"...">' in > /usr/share/hplip/data/xml/models.xml against the "MODEL" or "MDL" > field of the detected ID string. The HPLIP RPM I have made in a way > that /usr/share/hplip/data/xml/models.xml is in a separate RPM and > this separate RPM is always installed. printerdrake installes the > rest of HPLIP when it detects a supported printer. That's clever, but isn't that information already in foomatic? Tim. */ |
|
From: Till K. <til...@gm...> - 2005-06-09 17:17:38
|
Tim Waugh wrote:
>>To determine whether a printer is supported by HPLIP already before
>>installing/starting HPLIP I match the '<model name="...">' in
>>/usr/share/hplip/data/xml/models.xml against the "MODEL" or "MDL"
>>field of the detected ID string. The HPLIP RPM I have made in a way
>>that /usr/share/hplip/data/xml/models.xml is in a separate RPM and
>>this separate RPM is always installed. printerdrake installes the
>>rest of HPLIP when it detects a supported printer.
>
>
> That's clever, but isn't that information already in foomatic?
>
Foomatic only contains the info which PostScript->Printers-Own-Language
filter is needed. For HP printers it is usually HPIJS for inkjets or
PCL-5 devices, "pxlmono" for PCL-6 devices, "pnm2ppa" for the old PPA
devices, and "Postscript" (with manufacturer-supplied PPD) for
PostScript devices. HPLIP is independent of this. It works with most not
to old HP printers, also PostScript or PCL-6 models which do not need
HPIJS. HPLIP is a low-level driver framework which serves for accessing
bi-di functions, as 4-edge full bleed, ink level and status check,
nozzle cleaning, scanning, memory card reading. And this is completely
independent of the conversion of incoming PostScript to the printer's
language.
Till
|