[cups.general] How to access a printer via its DEVICE_URI?

Michael R Sweet msweet at apple.com
Thu Apr 17 07:58:34 PDT 2008


Justin Huang wrote:
> I am trying to develop an application for monitoring a specific printer. The printer could be USB connected. Currently, I can enumerate the drivers by using IPP APIs or CUPS APIs. I also know how to get the DEVICE URI string for a certain driver. The DEVICE URI may look like this:
>   usb://manufacturer_name/model_name
> 
> I am looking for a method to convert this string into another string which represents the physical device, e.g. "/dev/usb/lp01". With the physical device string, I can "open" it and then do bi-directional communication with the printer directly.

The backend code does this already, but keep in mind that USB support
is highly OS/distro-specific - sometimes it will map to a character
device you can read/write, but often you will need to do a lot more
work.

> Am I doing my job in the correct direction?

You would probably be better off running the backend and communicating
via pipes - file descriptor 0 of the backend should be the incoming
side of a pipe to send data to the device, file descriptors 1, 2, and
4 should go to /dev/null, and file descriptor 3 should be the outgoing
side of a pipe to receive data from the device.

-- 
______________________________________________________________________
Michael R Sweet                        Senior Printing System Engineer





More information about the cups mailing list