YaST2 Developers Documentation: Printer library.



functions
files
intro

Printer library.

modules/Printerlib.ycp
Some utility functions for printer conf. tools.
Printer library exported functions. What else?!?

Imports

  • Directory
  • Mode
  • Popup
  • Report
  • String

Includes

  • printer/texts.ycp

Global Variables

Global Functions

Local Variables

Local Functions

local paper_size -> symbol

System paper size, taken from system locales. 0 for a4 and 1 for letter. -1 for unknown. Use function Printerlib::getDefaultPaperSize for accessing this function.

local cups_usb_devices_info -> list<list<string> >

Info about USB devices got through CUPS backend Contains lists of [, , ]

global proposal_valid -> boolean

set to true after function Read had been called.

global baseDataDir -> string

Base directory of printconf's data files

local hp_all_in_one -> list<string>

list of HP all-in-one models

local probed_bt_devices -> map<string,string>

List of probed bluetooth devices (in order to keep their names)

global SetCupsUsbDevicesInfo (list<list<string> > di) -> void

Set the USB devices info got through the CUPS backend

Parameters:
di a list of found CUPS devices

global GetCupsUsbDevicesInfo () -> list<list<string> >

Return the currently stored CUPS USB devices info

global GetCupsUsbDeviceInfo (string device) -> list<string>

Get info about device connected to USB port from CUPS backed

Parameters:
device string USB device to examine
Return value:
a list containing CUPS device name, Printer model and UNIX-like device

global GetHPAllInOneModels () -> list<string>

Get the list of all HP all-in-one models

global DisplayUnavailableAIPopup () -> void

Inform user that function isn't available during preparatino of AI via a popup

local wakeUpEpson (string device) -> void

Sends sequence to wake up Epson stylus usb printers.

Parameters:
device Device to send sequence to. Should be /dev/usblp? (or /dev/usb/lp?)
See:
Installing an Epson Stylus Color Printer on USB

global getPtalDevices () -> list<list<string> >

Get list of all PTAL devices

Return value:
a list of PTAL devices

global getHplipDevices () -> list<list<string> >

Get list of all HPLIP devices

Return value:
a list of HPLIP devices

global getPtalUri (string model) -> string

Get URI of ptal device

Parameters:
model string device model identification
Return value:
ptal uri or nil if no ptal device found

global getHplipUri (string model) -> string

Get URI of HPLIP device

Parameters:
model string device model identification
Return value:
ptal uri or nil if no ptal device found

global getEpsonUsbModel (string device) -> string

Calls escputil to find out exact model of Epson stylus printer.

Parameters:
device USB Device to examine.
Return value:
Printer model. If unsuccessful, returns "Stylus".

global testDevice (string dev) -> void

Test device by sending hello world to it. See test_device for details.

Parameters:
dev device to test (/dev/lp0)

global testRemoteUP (string wg, string hname, string rname, string user, string pass, string type) -> void

Test remote queue accessibility if username and password needed

Parameters:
wg string workgroup for samba test
hname string hostname of remote host
rname string name of remote queue
user string username to access remote queue
pass string password to access remote queue
type string "samba" or "novell"

global testRemote (string hname, string rname, string type, integer port) -> void

Test of the connection. See test_remote_lpd for details.

Parameters:
hname host name
rname name of remote queue
type queue type
port TCP port

global getUriType (string uri) -> string

Printer uri = type://device where type is one of parallel, serial, usb, file, lpd, novell, samba, ipp, socket, http and device is depending on the type. For parallel, serial, usb, file it is file name. For lpd it is server/queue. For socket it is server, for ipp, http it is server/path_to_queue, for samba, novell it is user:pass@server/queuename (user, pass is optional).

Parameters:
uri printer uri (file://tmp/pr.tmp, lpd://d11.suse.de)
Return value:
type of printer or ""

global getUriDevice (string uri) -> string

Get printer device from its uri.

Parameters:
uri printer uri
Return value:
device
See:
getUriType

global getUriRemoteQueue (string uri) -> string

Get printer remote queue. Input to this function must be valid because it just takes the part of uri after the last slash. Should be used for: lpd, novell, samba, http/ipp.

Parameters:
uri printer uri
Return value:
remote queue
See:
getUriType

global getUriPort (string uri) -> integer

Get port number from URI.

Parameters:
uri printer uri
Return value:
port

global getUriValue (string uri, string key) -> string

Get any parameter from uri. Suppose uri has form: method://user:pass@address/path?key=value+key=value+key=value

Parameters:
uri printer uri
key key to extract
Return value:
value

global getUriBaudrate (string uri) -> integer

Get printer baud rate from uri. Applies to serial printers only. Does not check if passed uri belongs to serial printer.

Parameters:
uri printer uri
Return value:
baud rate
See:
getUriType

global getUriHost (string uri) -> string

Get host name from uri. Applies to lpd, novell, samba, ipp/http, socket

Parameters:
uri printer uri
Return value:
hostname
See:
getUriType

global getUriUsernamePassWorkgroup (string uri) -> list

Get uri user name and password. Applies to samba, novell.

Parameters:
uri printer uri
Return value:
[ username, password, workgroup ]
See:
getUriType

global getUriNiceName (string uri) -> string

Get nice name for printer uri

Parameters:
uri printer uri
Return value:
nice name of printer uri (device, network printer...)

global getDeviceNiceName (string dev, boolean detected) -> string

Get nice name of some device.

Parameters:
dev device
detected boolean set to true if displaying detected dialog
Return value:
device nice name

global getDefaultPaperSize () -> symbol

get paper size from system and returns `a4 for a4 or `letter for letter

Return value:
`a4 for a4, `letter for letter

YaST2 Developers Documentation