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

  • CUPS
  • Label
  • Mode
  • Popup
  • Report
  • Require
  • Spooler

Includes

  • printer/texts.ycp

Global Variables

Global Functions

Local Variables

Local Functions

global proposal_valid -> boolean

set to true after function Read had been called.

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.

global baseDataDir -> string

Base directory of printconf's data files

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 cups_usb_devices -> list< list<string> >

List of CUPS USB device names Contains lists of [, , ]

global setCupsUsbDevicesInfo () -> void

Set list of CUPS USB devices

global getProblematicCupsUsbDevices () -> list<string>

Get problematic CUPS USB devices names

Return value:
a list of strings with problematic device names

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 getPtalDevices () -> list<list<string> >

Get list of all PTAL devices

Return value:
a list of PTAL 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 getCupsUsbDevices () -> list<string>

Get all CUPS-like USB device names

Return value:
a list of CUPS USB device names

local 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 Detect (boolean cups) -> list<map<string,any> >

Finally detection of hardware

Parameters:
cups true if usb devices should be in form /dev/usb/lp?vendor=04a9&prod_id=1052
Return value:
a list Detected printers. See example.
Example:
 
  Return:
   [
       $[
           "vendor"       : "...",
           "device"       : "...",
           "unique_key"   : "...",
           "uri"          : "...", // usb:/dev/usb/lp0, ...
       ], ...
   ]
 FIXME this function must be merged with Printer::Detect

global amIRoot () -> boolean

Return true if user id is 0 (user is root).

Return value:
true if yast2 was run by root.

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). Get type of printer from uri. (First part of uri before colon)

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 getUriWorkgroup (string uri) -> string

Get workgroup from URI

Parameters:
uri string
Return value:
workgroup

global getUriUsernamePass (string uri) -> list

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

Parameters:
uri printer uri
Return value:
[ username, password ]
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