2
# -*- coding: utf-8 -*-
4
# (c) Copyright 2003-2009 Hewlett-Packard Development Company, L.P.
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
__title__ = 'Printer/Fax Setup Utility'
27
__doc__ = "Installs HPLIP printers and faxes in the CUPS spooler. Tries to automatically determine the correct PPD file to use. Allows the printing of a testpage. Performs basic fax parameter setup."
45
from base import device, utils, tui, models, module
50
def plugin_download_callback(c, s, t):
51
pm.update(int(100*c*s/t),
52
utils.format_bytes(c*s))
55
nickname_pat = re.compile(r'''\*NickName:\s*\"(.*)"''', re.MULTILINE)
57
USAGE = [ (__doc__, "", "name", True),
58
("Usage: %s [MODE] [OPTIONS] [SERIAL NO.|USB bus:device|IP|DEVNODE]" % __mod__, "", "summary", True),
61
utils.USAGE_INTERACTIVE_MODE,
64
("Automatic mode:", "-a or --auto (-i mode only)", "option", False),
65
("To specify the port on a multi-port JetDirect:", "--port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
66
("No testpage in automatic mode:", "-x (-i mode only)", "option", False),
67
("To specify a CUPS printer queue name:", "-p<printer> or --printer=<printer> (-i mode only)", "option", False),
68
("To specify a CUPS fax queue name:", "-f<fax> or --fax=<fax> (-i mode only)", "option", False),
69
("Type of queue(s) to install:", "-t<typelist> or --type=<typelist>. <typelist>: print*, fax\* (\*default) (-i mode only)", "option", False),
70
("To specify the device URI to install:", "-d<device> or --device=<device> (--qt4 mode only)", "option", False),
71
("Remove printers or faxes instead of setting-up:", "-r or --rm or --remove (-u only)", "option", False),
73
utils.USAGE_LOGGING1, utils.USAGE_LOGGING2, utils.USAGE_LOGGING3,
75
("[SERIAL NO.|USB ID|IP|DEVNODE]", "", "heading", False),
76
("USB bus:device (usb only):", """"xxx:yyy" where 'xxx' is the USB bus and 'yyy' is the USB device. (Note: The ':' and all leading zeros must be present.)""", 'option', False),
77
("", "Use the 'lsusb' command to obtain this information.", "option", False),
78
("IPs (network only):", 'IPv4 address "a.b.c.d" or "hostname"', "option", False),
79
("DEVNODE (parallel only):", '"/dev/parportX", X=0,1,2,...', "option", False),
80
("SERIAL NO. (usb and parallel only):", '"serial no."', "option", True),
82
("Setup using GUI mode:", "$ hp-setup", "example", False),
83
("Setup using GUI mode, specifying usb:", "$ hp-setup -b usb", "example", False),
84
("Setup using GUI mode, specifying an IP:", "$ hp-setup 192.168.0.101", "example", False),
85
("One USB printer attached, automatic:", "$ hp-setup -i -a", "example", False),
86
("USB, IDs specified:", "$ hp-setup -i 001:002", "example", False),
87
("Network:", "$ hp-setup -i 66.35.250.209", "example", False),
88
("Network, Jetdirect port 2:", "$ hp-setup -i --port=2 66.35.250.209", "example", False),
89
("Parallel:", "$ hp-setup -i /dev/parport0", "example", False),
90
("USB or parallel, using serial number:", "$ hp-setup -i US12345678A", "example", False),
91
("USB, automatic:", "$ hp-setup -i --auto 001:002", "example", False),
92
("Parallel, automatic, no testpage:", "$ hp-setup -i -a -x /dev/parport0", "example", False),
93
("Parallel, choose device:", "$ hp-setup -i -b par", "example", False),
96
("1. If no serial number, USB ID, IP, or device node is specified, the USB and parallel busses will be probed for devices.", "", 'note', False),
97
("2. Using 'lsusb' to obtain USB IDs: (example)", "", 'note', False),
98
(" $ lsusb", "", 'note', False),
99
(" Bus 003 Device 011: ID 03f0:c202 Hewlett-Packard", "", 'note', False),
100
(" $ hp-setup --auto 003:011", "", 'note', False),
101
(" (Note: You may have to run 'lsusb' from /sbin or another location. Use '$ locate lsusb' to determine this.)", "", 'note', True),
102
("3. Parameters -a, -f, -p, or -t are not valid in GUI (-u) mode.", "", 'note', True),
105
("hp-makeuri", "", "seealso", False),
106
("hp-probe", "", "seealso", False),
110
def showPasswordUI(prompt):
113
print log.bold(prompt)
114
username = raw_input("Username: ")
115
password = getpass.getpass("Password: ")
117
return (username, password)
121
if os.path.exists('/etc/init.d/cups'):
122
return '/etc/init.d/cups restart'
124
elif os.path.exists('/etc/init.d/cupsys'):
125
return '/etc/init.d/cupsys restart'
128
return 'killall -HUP cupsd'
131
mod = module.Module(__mod__, __title__, __version__, __doc__, USAGE,
132
(INTERACTIVE_MODE, GUI_MODE),
133
(UI_TOOLKIT_QT3, UI_TOOLKIT_QT4),
136
opts, device_uri, printer_name, mode, ui_toolkit, loc = \
137
mod.parseStdOpts('axp:P:f:t:b:d:rq',
138
['ttl=', 'filter=', 'search=', 'find=',
139
'method=', 'time-out=', 'timeout=',
140
'printer=', 'fax=', 'type=', 'port=',
141
'auto', 'device=', 'rm', 'remove'],
142
handle_device_printer=False)
144
selected_device_name = None
152
testpage_in_auto_mode = True
155
ignore_plugin_check = False
159
testpage_in_auto_mode = False
161
elif o in ('-P', '-p', '--printer'):
164
elif o in ('-f', '--fax'):
167
elif o in ('-d', '--device'):
170
elif o in ('-b', '--bus'):
171
bus = [x.lower().strip() for x in a.split(',')]
172
if not device.validateBusList(bus, False):
173
mod.usage(error_msg=['Invalid bus name'])
175
elif o in ('-t', '--type'):
176
setup_fax, setup_print = False, False
177
a = a.strip().lower()
178
for aa in a.split(','):
179
if aa.strip() not in ('print', 'fax'):
180
mod.usage(error_msg=['Invalid type.'])
182
if aa.strip() == 'print':
185
elif aa.strip() == 'fax':
186
if not prop.fax_build:
187
log.error("Cannot enable fax setup - HPLIP not built with fax enabled.")
195
#log.error("Invalid port number. Must be between 1 and 3 inclusive.")
196
mod.usage(error_msg=['Invalid port number. Must be between 1 and 3 inclusive.'])
198
elif o in ('-a', '--auto'):
201
elif o in ('-r', '--rm', '--remove'):
204
ignore_plugin_check = True
212
log.debug("param=%s" % param)
213
if printer_name is not None:
214
selected_device_name = printer_name
216
if fax_name is not None:
217
selected_device_name = fax_name
218
log.debug("selected_device_name=%s" % selected_device_name)
221
if selected_device_name is not None:
222
log.warning("-p or -f option is not supported")
223
if ui_toolkit == 'qt3':
224
if not utils.canEnterGUIMode():
225
log.error("%s requires GUI support (try running with --qt4). Also, try using interactive (-i) mode." % __mod__)
228
if not utils.canEnterGUIMode4():
229
log.error("%s requires GUI support (try running with --qt3). Also, try using interactive (-i) mode." % __mod__)
233
if ui_toolkit == 'qt3':
236
from ui import setupform
238
log.error("Unable to load Qt3 support. Is it installed?")
242
log.warn("-r/--rm/--remove not supported in qt3 mode.")
244
app = QApplication(sys.argv)
245
QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
248
loc = user_conf.get('ui', 'loc', 'system')
249
if loc.lower() == 'system':
250
loc = str(QTextCodec.locale())
251
log.debug("Using system locale: %s" % loc)
253
if loc.lower() != 'c':
256
l, x = loc.split('.')
257
loc = '.'.join([l, e])
260
loc = '.'.join([loc, e])
262
log.debug("Trying to load .qm file for %s locale." % loc)
263
trans = QTranslator(None)
265
qm_file = 'hplip_%s.qm' % l
266
log.debug("Name of .qm file: %s" % qm_file)
267
loaded = trans.load(qm_file, prop.localization_dir)
270
app.installTranslator(trans)
275
log.debug("Using default 'C' locale")
277
log.debug("Using locale: %s" % loc)
278
QLocale.setDefault(QLocale(loc))
281
locale.setlocale(locale.LC_ALL, locale.normalize(loc))
286
w = setupform.SetupForm(bus, param, jd_port)
288
log.error("Unable to connect to HPLIP I/O. Please (re)start HPLIP and try again.")
298
from PyQt4.QtGui import QApplication, QMessageBox
299
from ui4.setupdialog import SetupDialog
301
log.error("Unable to load Qt4 support. Is it installed?")
304
app = QApplication(sys.argv)
305
log.debug("Sys.argv=%s printer_name=%s param=%s jd_port=%s device_uri=%s remove=%s" % (sys.argv, printer_name, param, jd_port, device_uri, remove))
306
dlg = SetupDialog(None, param, jd_port, device_uri, remove)
309
log.debug("Starting GUI loop...")
311
except KeyboardInterrupt:
315
else: # INTERACTIVE_MODE
318
cups.setPasswordCallback(showPasswordUI)
321
log.error("-r/--rm/--remove not supported in -i mode.")
325
log.info("(Note: Defaults for each question are maked with a '*'. Press <enter> to accept the default.)")
328
# ******************************* MAKEURI
330
device_uri, sane_uri, fax_uri = device.makeURI(param, jd_port)
332
# ******************************* CONNECTION TYPE CHOOSER
333
if not device_uri and bus is None:
334
bus = tui.connection_table()
339
log.info("\nUsing connection type: %s" % bus[0])
343
# ******************************* DEVICE CHOOSER
346
log.debug("\nDEVICE CHOOSER setup_fax=%s, setup_print=%s" % (setup_fax, setup_print))
347
device_uri = mod.getDeviceUri(device_uri, selected_device_name, devices = device.probeDevices(bus))
350
# ******************************* QUERY MODEL AND COLLECT PPDS
351
log.info(log.bold("\nSetting up device: %s\n" % device_uri))
354
print_uri = device_uri.replace("hpfax:", "hp:")
355
fax_uri = device_uri.replace("hp:", "hpfax:")
357
back_end, is_hp, bus, model, \
358
serial, dev_file, host, zc, port = \
359
device.parseDeviceURI(device_uri)
361
log.debug("Model=%s" % model)
362
mq = device.queryModelByURI(device_uri)
364
if not mq or mq.get('support-type', SUPPORT_TYPE_NONE) == SUPPORT_TYPE_NONE:
365
log.error("Unsupported printer model.")
368
if mq.get('fax-type', FAX_TYPE_NONE) in (FAX_TYPE_NONE, FAX_TYPE_NOT_SUPPORTED) and setup_fax:
369
#log.warning("Cannot setup fax - device does not have fax feature.")
372
# ******************************* PLUGIN
374
norm_model = models.normalizeModelName(model).lower()
375
plugin = mq.get('plugin', PLUGIN_NONE)
377
plugin_installed = utils.to_bool(sys_state.get('plugin', 'installed', '0'))
378
if ignore_plugin_check is False and plugin > PLUGIN_NONE and not plugin_installed:
379
tui.header("PLUG-IN INSTALLATION")
381
hp_plugin = utils.which('hp-plugin')
385
os.system("hp-plugin -i")
387
os.system("hp-plugin")
389
ppds = cups.getSystemPPDs()
391
default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
393
installed_print_devices = device.getSupportedCUPSDevices(['hp'])
394
for d in installed_print_devices.keys():
395
for p in installed_print_devices[d]:
396
log.debug("found print queue '%s'" % p)
398
installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
399
for d in installed_fax_devices.keys():
400
for f in installed_fax_devices[d]:
401
log.debug("found fax queue '%s'" % f)
403
# ******************************* PRINT QUEUE SETUP
406
tui.header("PRINT QUEUE SETUP")
408
if not auto and print_uri in installed_print_devices:
409
log.warning("One or more print queues already exist for this device: %s." %
410
', '.join(installed_print_devices[print_uri]))
412
ok, setup_print = tui.enter_yes_no("\nWould you like to install another print queue for this device", 'n')
413
if not ok: sys.exit(0)
417
printer_name = default_model
419
printer_default_model = default_model
421
installed_printer_names = device.getSupportedCUPSPrinterNames(['hp'])
422
# Check for duplicate names
423
if (device_uri in installed_print_devices and printer_default_model in installed_print_devices[device_uri]) \
424
or (printer_default_model in installed_printer_names):
427
t = printer_default_model + "_%d" % i
428
if (t not in installed_printer_names) and(device_uri not in installed_print_devices or t not in installed_print_devices[device_uri]):
429
printer_default_model += "_%d" % i
434
if printer_name is None:
436
printer_name = raw_input(log.bold("\nPlease enter a name for this print queue (m=use model name:'%s'*, q=quit) ?" % printer_default_model))
438
if printer_name.lower().strip() == 'q':
439
log.info("OK, done.")
442
if not printer_name or printer_name.lower().strip() == 'm':
443
printer_name = printer_default_model
447
for d in installed_print_devices.keys():
448
for p in installed_print_devices[d]:
449
if printer_name == p:
450
log.error("A print queue with that name already exists. Please enter a different name.")
454
for d in installed_fax_devices.keys():
455
for f in installed_fax_devices[d]:
456
if printer_name == f:
457
log.error("A fax queue with that name already exists. Please enter a different name.")
461
for c in printer_name:
462
if c in cups.INVALID_PRINTER_NAME_CHARS:
463
log.error("Invalid character '%s' in printer name. Please enter a name that does not contain this character." % c)
469
printer_name = printer_default_model
471
log.info("Using queue name: %s" % printer_name)
473
default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
476
log.info("Locating PPD file... Please wait.")
477
print_ppd = cups.getPPDFile2(mq, default_model, ppds)
480
if print_ppd is None:
482
log.error("Unable to find an appropriate PPD file.")
485
print_ppd, desc = print_ppd
486
log.info("\nFound PPD file: %s" % print_ppd)
489
log.info("Description: %s" % desc)
492
log.info("\nNote: The model number may vary slightly from the actual model number on the device.")
493
ok, ans = tui.enter_yes_no("\nDoes this PPD file appear to be the correct one")
494
if not ok: sys.exit(0)
495
if not ans: enter_ppd = True
501
ok, enter_ppd = tui.enter_yes_no("\nWould you like to specify the path to the correct PPD file to use", 'n')
502
if not ok: sys.exit(0)
508
user_input = raw_input(log.bold("\nPlease enter the full filesystem path to the PPD file to use (q=quit) :"))
510
if user_input.lower().strip() == 'q':
511
log.info("OK, done.")
514
file_path = user_input
516
if os.path.exists(file_path) and os.path.isfile(file_path):
518
if file_path.endswith('.gz'):
519
nickname = gzip.GzipFile(file_path, 'r').read(4096)
521
nickname = file(file_path, 'r').read(4096)
524
desc = nickname_pat.search(nickname).group(1)
525
except AttributeError:
529
log.info("Description for the file: %s" % desc)
531
log.error("No PPD 'NickName' found. This file may not be a valid PPD file.")
533
ok, ans = tui.enter_yes_no("\nUse this file")
534
if not ok: sys.exit(0)
535
if ans: print_ppd = file_path
538
log.error("File not found or not an appropriate (PPD) file.")
543
log.error("PPD file required. Setup cannot continue. Exiting.")
547
location, info = '', 'Automatically setup by HPLIP'
550
location = raw_input(log.bold("Enter a location description for this printer (q=quit) ?"))
552
if location.strip().lower() == 'q':
553
log.info("OK, done.")
556
# TODO: Validate chars
560
info = raw_input(log.bold("Enter additonal information or notes for this printer (q=quit) ?"))
562
if info.strip().lower() == 'q':
563
log.info("OK, done.")
566
# TODO: Validate chars
569
log.info(log.bold("\nAdding print queue to CUPS:"))
570
log.info("Device URI: %s" % print_uri)
571
log.info("Queue name: %s" % printer_name)
572
log.info("PPD file: %s" % print_ppd)
573
log.info("Location: %s" % location)
574
log.info("Information: %s" % info)
576
log.debug("Restarting CUPS...")
577
status, output = utils.run(restart_cups())
578
log.debug("Restart CUPS returned: exit=%d output=%s" % (status, output))
581
cups.setPasswordPrompt("You do not have permission to add a printer.")
582
if not os.path.exists(print_ppd): # assume foomatic: or some such
583
status, status_str = cups.addPrinter(printer_name.encode('utf8'), print_uri,
584
location, '', print_ppd, info)
586
status, status_str = cups.addPrinter(printer_name.encode('utf8'), print_uri,
587
location, print_ppd, '', info)
589
log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
591
installed_print_devices = device.getSupportedCUPSDevices(['hp'])
593
if print_uri not in installed_print_devices or \
594
printer_name not in installed_print_devices[print_uri]:
596
log.error("Printer queue setup failed. Please restart CUPS and try again.")
599
# sending Event to add this device in hp-systray
600
utils.sendEvent(EVENT_CUPS_QUEUES_CHANGED,print_uri, printer_name)
603
# ******************************* FAX QUEUE SETUP
604
if setup_fax and not prop.fax_build:
605
log.error("Cannot setup fax - HPLIP not built with fax enabled.")
613
# This can fail on Python < 2.3 due to the datetime module
615
log.warning("Fax setup disabled - Python 2.3+ required.")
621
tui.header("FAX QUEUE SETUP")
623
if not auto and fax_uri in installed_fax_devices:
624
log.warning("One or more fax queues already exist for this device: %s." % ', '.join(installed_fax_devices[fax_uri]))
625
ok, setup_fax = tui.enter_yes_no("\nWould you like to install another fax queue for this device", 'n')
626
if not ok: sys.exit(0)
629
if auto: # or fax_name is None:
630
fax_name = default_model + '_fax'
632
fax_default_model = default_model + '_fax'
634
installed_fax_names = device.getSupportedCUPSPrinterNames(['hpfax'])
635
# Check for duplicate names
636
if (fax_uri in installed_fax_devices and fax_default_model in installed_fax_devices[fax_uri]) \
637
or (fax_default_model in installed_fax_names):
640
t = fax_default_model + "_%d" % i
641
if (t in installed_fax_names) and (fax_uri not in installed_fax_devices or t not in installed_fax_devices[fax_uri]):
642
fax_default_model += "_%d" % i
649
fax_name = raw_input(log.bold("\nPlease enter a name for this fax queue (m=use model name:'%s'*, q=quit) ?" % fax_default_model))
651
if fax_name.lower().strip() == 'q':
652
log.info("OK, done.")
655
if not fax_name or fax_name.lower().strip() == 'm':
656
fax_name = fax_default_model
660
for d in installed_print_devices.keys():
661
for p in installed_print_devices[d]:
663
log.error("A print queue with that name already exists. Please enter a different name.")
667
for d in installed_fax_devices.keys():
668
for f in installed_fax_devices[d]:
670
log.error("A fax queue with that name already exists. Please enter a different name.")
675
if c in (' ', '#', '/', '%'):
676
log.error("Invalid character '%s' in fax name. Please enter a name that does not contain this character." % c)
683
fax_name = fax_default_model
685
log.info("Using queue name: %s" % fax_name)
686
fax_ppd,fax_ppd_type,nick = cups.getFaxPPDFile(mq, fax_name)
689
log.error("Unable to find HP fax PPD file! Please check you HPLIP installation and try again.")
693
location, info = '', 'Automatically setup by HPLIP'
696
location = raw_input(log.bold("Enter a location description for this printer (q=quit) ?"))
698
if location.strip().lower() == 'q':
699
log.info("OK, done.")
702
# TODO: Validate chars
706
info = raw_input(log.bold("Enter additonal information or notes for this printer (q=quit) ?"))
708
if info.strip().lower() == 'q':
709
log.info("OK, done.")
712
# TODO: Validate chars
715
log.info(log.bold("\nAdding fax queue to CUPS:"))
716
log.info("Device URI: %s" % fax_uri)
717
log.info("Queue name: %s" % fax_name)
718
log.info("PPD file: %s" % fax_ppd)
719
log.info("Location: %s" % location)
720
log.info("Information: %s" % info)
722
cups.setPasswordPrompt("You do not have permission to add a fax device.")
723
if not os.path.exists(fax_ppd): # assume foomatic: or some such
724
status, status_str = cups.addPrinter(fax_name.encode('utf8'), fax_uri,
725
location, '', fax_ppd, info)
727
status, status_str = cups.addPrinter(fax_name.encode('utf8'), fax_uri,
728
location, fax_ppd, '', info)
730
log.debug("addPrinter() returned (%d, %s)" % (status, status_str))
732
installed_fax_devices = device.getSupportedCUPSDevices(['hpfax'])
734
log.debug(installed_fax_devices)
736
if fax_uri not in installed_fax_devices or \
737
fax_name not in installed_fax_devices[fax_uri]:
739
log.error("Fax queue setup failed. Please restart CUPS and try again.")
742
# sending Event to add this device in hp-systray
743
utils.sendEvent(EVENT_CUPS_QUEUES_CHANGED,fax_uri, fax_name)
747
# ******************************* FAX HEADER SETUP
748
tui.header("FAX HEADER SETUP")
754
user_input = raw_input(log.bold("\nWould you like to perform fax header setup (y=yes*, n=no, q=quit) ?")).strip().lower()
756
if user_input == 'q':
757
log.info("OK, done.")
763
setup_fax = (user_input == 'y')
765
if user_input in ('y', 'n', 'q'):
768
log.error("Please enter 'y' or 'n'")
771
d = fax.getFaxDevice(fax_uri, disable_dbus=True)
776
log.error("Unable to communicate with the device. Please check the device and try again.")
786
current_phone_num = str(d.getPhoneNum())
787
current_station_name = str(d.getStationName())
789
log.error("Could not communicate with device. Device may be busy. Please wait for retry...")
802
if current_phone_num:
803
phone_num = raw_input(log.bold("\nEnter the fax phone number for this device (c=use current:'%s'*, q=quit) ?" % current_phone_num))
805
phone_num = raw_input(log.bold("\nEnter the fax phone number for this device (q=quit) ?"))
806
if phone_num.strip().lower() == 'q':
807
log.info("OK, done.")
810
if current_phone_num and (not phone_num or phone_num.strip().lower() == 'c'):
811
phone_num = current_phone_num
813
if len(phone_num) > 50:
814
log.error("Phone number length is too long (>50 characters). Please enter a shorter number.")
819
if x not in '0123456789-(+) ':
820
log.error("Invalid characters in phone number. Please only use 0-9, -, (, +, and )")
830
if current_station_name:
831
station_name = raw_input(log.bold("\nEnter the name and/or company for this device (c=use current:'%s'*, q=quit) ?" % current_station_name))
833
station_name = raw_input(log.bold("\nEnter the name and/or company for this device (q=quit) ?"))
834
if station_name.strip().lower() == 'q':
835
log.info("OK, done.")
838
if current_station_name and (not station_name or station_name.strip().lower() == 'c'):
839
station_name = current_station_name
842
if len(station_name) > 50:
843
log.error("Name/company length is too long (>50 characters). Please enter a shorter name/company.")
848
d.setStationName(station_name)
849
d.setPhoneNum(phone_num)
851
log.error("Could not communicate with device. Device may be busy.")
853
log.info("\nParameters sent to device.")
858
# ******************************* TEST PAGE
860
print_test_page = False
862
tui.header("PRINTER TEST PAGE")
865
if testpage_in_auto_mode:
866
print_test_page = True
868
ok, print_test_page = tui.enter_yes_no("\nWould you like to print a test page")
869
if not ok: sys.exit(0)
872
path = utils.which('hp-testpage')
875
param = "-p%s" % printer_name
877
param = "-d%s" % print_uri
880
cmd = 'hp-testpage %s' % param
882
cmd = 'python ./testpage.py %s' % param
888
except KeyboardInterrupt:
889
log.error("User exit")