Commit 17ed8b45 authored by Didier Raboud's avatar Didier Raboud

Imported Upstream version 3.15.4

parent 73367e47

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

......@@ -248,13 +248,24 @@ pcardext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
prntdir = $(hplipdir)/prnt
dist_prnt_DATA = prnt/cups.py prnt/__init__.py prnt/ldl.py prnt/pcl.py prnt/colorcal.py
# IPP library
lib_LTLIBRARIES += libhpipp.la
#hpipp_LTLIBRARIES = hpipp.la
#hpipp_la_LDFLAGS = -module -avoid-version
libhpipp_la_SOURCES = protocol/hp_ipp.c protocol/hp_ipp.h protocol/hp_ipp_i.h
libhpipp_la_CFLAGS = -DCONFDIR=\"$(hplip_confdir)\"
libhpipp_la_LDFLAGS = -version-info 0:1:0
libhpipp_la_LIBADD = libhpmud.la
# cupsext
cupsextdir = $(pyexecdir)
cupsext_LTLIBRARIES = cupsext.la
cupsext_la_LDFLAGS = -module -avoid-version
cupsext_la_SOURCES = prnt/cupsext/cupsext.c prnt/cupsext/cupsext.h
cupsext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
cupsext_la_LIBADD = -lcups
cupsext_la_CFLAGS = -I$(PYTHONINCLUDEDIR) -Iprotocol
cupsext_la_LIBADD = -lcups libhpipp.la
if SCAN_BUILD
# scan
......@@ -484,6 +495,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
hpcups_LDADD = -ljpeg -ldl -lcups -lcupsimage $(DBUS_LIBS)
#else
#hpcupsdir = $(cupsfilterdir)
#hpcups_PROGRAMS = hpcups
......
This diff is collapsed.
......@@ -144,7 +144,7 @@ try:
if not device_uri:
sys.exit(1)
log.info("Using device : %s\n" % device_uri)
if mode == GUI_MODE:
if not utils.canEnterGUIMode4():
log.error("%s -u/--gui requires Qt4 GUI support. Entering interactive mode." % __mod__)
......
......@@ -172,13 +172,13 @@ def performScan(dev, adapterName, ssid=None):
if params is not None:
if elementCount == 1:
try:
ssid = str(params['io:wifinetworks-io:wifinetwork-wifi:ssid']).decode("hex")
ssid = binascii.unhexlify(str(params['io:wifinetworks-io:wifinetwork-wifi:ssid']).encode('utf-8')).decode("utf-8")
if not ssid:
ret['ssid-0'] = to_unicode('(unknown)')
else:
ret['ssid-0'] = ssid
try:
ret['bssid-0'] = str(params['io:wifinetworks-io:wifinetwork-wifi:bssid']).decode("hex")
ret['bssid-0'] = binascii.unhexlify(str(params['io:wifinetworks-io:wifinetwork-wifi:bssid']).encode('utf-8')).decode("utf-8")
except:
ret['bssid-0'] = params['io:wifinetworks-io:wifinetwork-wifi:bssid']
......@@ -203,7 +203,7 @@ def performScan(dev, adapterName, ssid=None):
else:
ret['ssid-%d' % a] = ssid
try:
ret['bssid-%d' % a] = str(params['io:wifinetworks-io:wifinetwork-wifi:bssid-%d' % a]).decode("hex")
ret['bssid-%d' % a] = binascii.unhexlify(str(params['io:wifinetworks-io:wifinetwork-wifi:bssid-%d' % a]).encode('utf-8')).decode("utf-8")
except:
ret['bssid-%d' % a] = params['io:wifinetworks-io:wifinetwork-wifi:bssid-%d' % a]
ret['channel-%d' % a] = params['io:wifinetworks-io:wifinetwork-wifi:channel-%d' % a]
......@@ -491,7 +491,7 @@ def readXmlTagDataFromURI(dev,URI,xmlRootNode,xmlReqDataNode,timeout=5):
strResp = utils.unchunck_xml_data(strResp)
pos = strResp.find(xmlRootNode,0,len(strResp))
repstr = strResp[pos:].strip()
repstr = repstr.replace('\r','').replace('\t','').replace('\n','') # To remove formating characters from the received xml
repstr = repstr.replace('\r',' ').replace('\t',' ').replace('\n',' ') # To remove formating characters from the received xml
repstr = repstr.rstrip('0') # To remove trailing zero from the received xml
try:
parser_object = utils.extendedExpat()
......@@ -500,7 +500,7 @@ def readXmlTagDataFromURI(dev,URI,xmlRootNode,xmlReqDataNode,timeout=5):
reqDataElementList = root_element.getElementsByTagName(xmlReqDataNode)
for node in reqDataElementList:
repstr = node.toString()
repstr = repstr.replace('\r','').replace('\t','').replace('\n','') # To remove formating characters from the received xml
repstr = repstr.replace('\r',' ').replace('\t',' ').replace('\n',' ') # To remove formating characters from the received xml
params = utils.XMLToDictParser().parseXML(to_bytes_utf8(repstr))
paramsList.append(params)
except xml.parsers.expat.ExpatError as e:
......@@ -551,7 +551,7 @@ def readXmlDataFromURI(dev,URI,xmlRootNode,xmlChildNode,timeout=5):
strResp = utils.unchunck_xml_data(strResp)
pos = strResp.find(xmlRootNode,0,len(strResp))
repstr = strResp[pos:].strip()
repstr = repstr.replace('\r','').replace('\t','').replace('\n','') # To remove formating characters from the received xml
repstr = repstr.replace('\r',' ').replace('\t',' ').replace('\n',' ') # To remove formating characters from the received xml
repstr = repstr.rstrip('0') # To remove trailing zero from the received xml
elementCount = repstr.count(xmlChildNode)
try:
......
......@@ -192,6 +192,9 @@ STATUS_MANUALLY_FEED=1062
STATUS_PRINTER_PRINTHEAD_FAILED = 1063
STATUS_PRINTER_PRINTHEAD_INCOMPATIBLE = 1064
STATUS_UNKNOWN_CODE = 1065
STATUS_PRINTER_STOPPED = 1066
STATUS_PRINTER_PAUSED = 1067
STATUS_INPUT_TRAY_MISSING = 1068
# derived codes
......@@ -225,6 +228,7 @@ STATUS_PRINTER_LOW_TONER = 1804
STATUS_PRINTER_NO_TONER = 1805
STATUS_PRINTER_SERVICE_REQUEST = 1806
STATUS_PRINTER_FUSER_ERROR = 1807
STATUS_PRINTER_EMPTY_TONER = 1808
#end
# other derived codes
......@@ -444,6 +448,7 @@ STATUS_TO_ERROR_STATE_MAP = {
STATUS_PRINTER_CARTRIDGE_MISSING : ERROR_STATE_ERROR,
STATUS_PRINTER_CARTRIDGE_WRONG : ERROR_STATE_ERROR,
STATUS_PRINTER_PRINTHEAD_MISSING : ERROR_STATE_ERROR,
STATUS_PRINTER_EMPTY_TONER : ERROR_STATE_LOW_SUPPLIES,
#Alert messages for Pentane products RQ 8888
STATUS_SCANNER_ADF_MISPICK : ERROR_STATE_ERROR,
......@@ -460,6 +465,9 @@ STATUS_TO_ERROR_STATE_MAP = {
STATUS_PRINTER_RESEAT_DUPLEXER: ERROR_STATE_WARNING,
STATUS_MANUALLY_FEED: ERROR_STATE_WARNING,
STATUS_UNKNOWN_CODE:ERROR_STATE_OK,
STATUS_PRINTER_STOPPED:ERROR_STATE_ERROR,
STATUS_PRINTER_PAUSED:ERROR_STATE_WARNING,
STATUS_INPUT_TRAY_MISSING:ERROR_STATE_ERROR,
# The following block are EVENTs because they are only
......@@ -707,6 +715,7 @@ STATUS_TYPE_PJL = 8
STATUS_TYPE_PML_AND_PJL = 9 # Same as types 3(tbx)+8(hp:)
STATUS_TYPE_LEDM = 10 # Low-end Data Model
STATUS_TYPE_LEDM_FF_CC_0 = 11 #Low-end Data Model over FF/CC/0 USB channel
STATUS_TYPE_IPP = 12
# status-battery-check
STATUS_BATTERY_CHECK_NONE = 0
......
......@@ -1688,6 +1688,10 @@ class Device(object):
log.debug("Type 11: LEDM_FF_CC_0")
status_block = status.StatusType10(self.getUrl_LEDM)
elif status_type == STATUS_TYPE_IPP:
log.debug("Type 12: IPP")
status_block = status.StatusTypeIPP(self.device_uri)
else:
log.error("Unimplemented status type: %d" % status_type)
......
......@@ -546,7 +546,6 @@ class Module(object):
elif len(devices) == 1: # Nothing specified, and only 1 device avail.
device_uri_ret = list(devices.keys())[0]
log.info("Using device: %s\n" % device_uri_ret)
if device_uri_ret is None and len(devices):
if self.mode == INTERACTIVE_MODE:
......@@ -647,7 +646,6 @@ class Module(object):
elif len(printers) == 1: # nothing specified, and only 1 avail. printer
printer_name_ret = printers[0]
log.info("Using printer: %s\n" % printer_name_ret)
if printer_name_ret is None and self.mode in (INTERACTIVE_MODE, NON_INTERACTIVE_MODE) and len(printers):
printer_name_ret = tui.printer_table(printers)
......
......@@ -30,6 +30,7 @@ from .sixext import BytesIO, to_bytes_utf8, to_bytes_latin, to_string_latin, to_
from .g import *
import xml.parsers.expat as expat
import re
import cupsext
try:
from xml.etree import ElementTree
......@@ -1658,8 +1659,6 @@ def StatusType10Media(func): # Low End Data Model
status_block['in-tray2'] = IN_TRAY_PRESENT
elif bin_name == "PhotoTray":
status_block['photo-tray'] = PHOTO_TRAY_ENGAGED
else:
log.error("found invalid bin name '%s'" % bin_name)
try:
elements = tree.findall("Accessories/MediaHandlingDeviceFunctionType")
......@@ -1806,3 +1805,151 @@ def StatusType10Status(func): # Low End Data Model
status_block['status-code'] = STATUS_UNKNOWN_CODE
return status_block
#IPP Status Code
IPP_PRINTER_STATE_IDLE = 0x03
IPP_PRINTER_STATE_PROCESSING = 0x04
IPP_PRINTER_STATE_STOPPED = 0x05
marker_kind_xlate = { 'ink' : AGENT_KIND_SUPPLY,
'inkCartridge' : AGENT_KIND_SUPPLY,
'printhead' : AGENT_KIND_HEAD,
'toner' : AGENT_KIND_TONER_CARTRIDGE,
'tonerCartridge' : AGENT_KIND_TONER_CARTRIDGE,
'toner-cartridge' : AGENT_KIND_TONER_CARTRIDGE,
'maintenanceKit' : AGENT_KIND_MAINT_KIT,
}
marker_type_xlate = {'magenta ink' : AGENT_TYPE_MAGENTA,
'cyan ink' : AGENT_TYPE_CYAN,
'yellow ink' : AGENT_TYPE_YELLOW,
'black ink' : AGENT_TYPE_BLACK,
'Black Cartridge' : AGENT_TYPE_BLACK,
'Maintenance Kit' : AGENT_TYPE_NONE,
}
marker_leveltrigger_xlate = { 'ok' : AGENT_LEVEL_TRIGGER_SUFFICIENT_0,
'low' : AGENT_LEVEL_TRIGGER_MAY_BE_LOW,
'out' : AGENT_LEVEL_TRIGGER_ALMOST_DEFINITELY_OUT,
'empty' : AGENT_LEVEL_TRIGGER_ALMOST_DEFINITELY_OUT,
'missing' : AGENT_LEVEL_TRIGGER_ALMOST_DEFINITELY_OUT,
}
marker_state_xlate = { 'ok' : AGENT_HEALTH_OK,
'misinstalled' : AGENT_HEALTH_MISINSTALLED,
'missing' : AGENT_HEALTH_MISINSTALLED,
}
printer_state_reasons_xlate = { 'none' : STATUS_PRINTER_IDLE,
'media-needed' : STATUS_PRINTER_OUT_OF_PAPER,
'media-jam' : STATUS_PRINTER_MEDIA_JAM,
'shutdown' : STATUS_PRINTER_TURNING_OFF,
'toner-low' : STATUS_PRINTER_LOW_TONER,
'toner-empty' : STATUS_PRINTER_EMPTY_TONER,
'cover-open' : STATUS_PRINTER_DOOR_OPEN,
'door-open' : STATUS_PRINTER_DOOR_OPEN,
'input-tray-missing' : STATUS_PRINTER_TRAY_2_3_DOOR_OPEN,
'media-low' : STATUS_PRINTER_OUT_OF_PAPER,
'media-empty' : STATUS_PRINTER_OUT_OF_PAPER,
'output-tray-missing' : STATUS_PRINTER_TRAY_2_MISSING,
'output-area-almost-full' : STATUS_PRINTER_CLEAR_OUTPUT_AREA,
'output-area-full' : STATUS_PRINTER_CLEAR_OUTPUT_AREA,
'marker-supply-low' : STATUS_PRINTER_VERY_LOW_ON_INK,