
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
Global Variables
Global Functions
- Detect (boolean cups)
- DisplayUnavailableAIPopup ()
- amIRoot ()
- getCupsUsbDeviceInfo (string device)
- getCupsUsbDevices ()
- getDefaultPaperSize ()
- getDeviceNiceName (string dev, boolean detected)
- getProblematicCupsUsbDevices ()
- getPtalDevices ()
- getPtalUri (string model)
- getUriBaudrate (string uri)
- getUriDevice (string uri)
- getUriHost (string uri)
- getUriNiceName (string uri)
- getUriPort (string uri)
- getUriRemoteQueue (string uri)
- getUriType (string uri)
- getUriUsernamePass (string uri)
- getUriValue (string uri, string key)
- getUriWorkgroup (string uri)
- setCupsUsbDevicesInfo ()
- testDevice (string dev)
- testRemote (string hname, string rname, string type, integer port)
- testRemoteUP (string wg, string hname, string rname, string user, string pass, string type)
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:
-
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:
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:
global getUriDevice (string uri) -> string
|
|
Get printer device from its uri.
- Parameters:
- Return value:
- See:
-
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:
- Return value:
- See:
-
global getUriPort (string uri) -> integer
|
|
Get port number from URI.
- Parameters:
- Return value:
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:
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:
- Return value:
- See:
-
global getUriHost (string uri) -> string
|
|
Get host name from uri. Applies to lpd, novell, samba, ipp/http,
socket
- Parameters:
- Return value:
- See:
-
global getUriWorkgroup (string uri) -> string
|
|
Get workgroup from URI
- Parameters:
- Return value:
global getUriUsernamePass (string uri) -> list
|
|
Get uri user name and password. Applies to samba, novell.
- Parameters:
- Return value:
- See:
-
global getUriNiceName (string uri) -> string
|
|
Get nice name for printer uri
- Parameters:
- 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:
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 |
|