Commit 86780323 authored by Didier Raboud's avatar Didier Raboud

Imported Upstream version 3.13.4

parent 247847da

Too many changes to show.

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

......@@ -729,6 +729,7 @@ am__dist_ppd_DATA_DIST = prnt/ps/hp-laserjet_4v-ps.ppd.gz \
prnt/ps/hp-laserjet_1220-ps.ppd.gz \
prnt/ps/hp-designjet_t1100ps_24in-ps.ppd.gz \
prnt/ps/hp-designjet_t7100ps_monochrome-ps.ppd.gz \
prnt/ps/hp-officejet_pro_276dw_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cm1312_mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_m9050_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cp5225n-ps.ppd.gz \
......@@ -775,6 +776,7 @@ am__dist_ppd_DATA_DIST = prnt/ps/hp-laserjet_4v-ps.ppd.gz \
prnt/ps/hp-laserjet_4300-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cm1312nfi_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_3000-ps.ppd.gz \
prnt/ps/hp-designjet_z5200_postscript-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cp4020_series-ps.ppd.gz \
prnt/ps/hp-business_inkjet_2300-ps.ppd.gz \
prnt/ps/hp-laserjet_3052-ps.ppd.gz \
......@@ -839,6 +841,7 @@ am__dist_ppd_DATA_DIST = prnt/ps/hp-laserjet_4v-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cp5520_series-ps.ppd.gz \
prnt/ps/hp-laserjet_200_color_m251-ps.ppd.gz \
prnt/ps/hp-laserjet_p4010_series-ps.ppd.gz \
prnt/ps/hp-laserjet_mfp_m521-ps.ppd.gz \
prnt/ps/hp-laserjet_1200-ps.ppd.gz \
prnt/ps/hp-laserjet_p3005-ps.ppd.gz \
prnt/ps/hp-laserjet_9040-ps.ppd.gz \
......@@ -859,6 +862,7 @@ am__dist_ppd_DATA_DIST = prnt/ps/hp-laserjet_4v-ps.ppd.gz \
prnt/ps/hp-laserjet_2100-ps.ppd.gz \
prnt/ps/hp-color_laserjet_3700-ps.ppd.gz \
prnt/ps/hp-color_laserjet_2500-ps.ppd.gz \
prnt/ps/hp-officejet_pro_251dw_printer-ps.ppd.gz \
prnt/ps/hp-laserjet_m5035_mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_9065mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_m2727_mfp_series-ps.ppd.gz \
......@@ -3380,6 +3384,7 @@ foomatic_ps_printers = \
prnt/ps/hp-laserjet_1220-ps.ppd.gz \
prnt/ps/hp-designjet_t1100ps_24in-ps.ppd.gz \
prnt/ps/hp-designjet_t7100ps_monochrome-ps.ppd.gz \
prnt/ps/hp-officejet_pro_276dw_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cm1312_mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_m9050_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cp5225n-ps.ppd.gz \
......@@ -3426,6 +3431,7 @@ foomatic_ps_printers = \
prnt/ps/hp-laserjet_4300-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cm1312nfi_mfp-ps.ppd.gz \
prnt/ps/hp-color_laserjet_3000-ps.ppd.gz \
prnt/ps/hp-designjet_z5200_postscript-ps.ppd.gz \
prnt/ps/hp-color_laserjet_cp4020_series-ps.ppd.gz \
prnt/ps/hp-business_inkjet_2300-ps.ppd.gz \
prnt/ps/hp-laserjet_3052-ps.ppd.gz \
......@@ -3490,6 +3496,7 @@ foomatic_ps_printers = \
prnt/ps/hp-color_laserjet_cp5520_series-ps.ppd.gz \
prnt/ps/hp-laserjet_200_color_m251-ps.ppd.gz \
prnt/ps/hp-laserjet_p4010_series-ps.ppd.gz \
prnt/ps/hp-laserjet_mfp_m521-ps.ppd.gz \
prnt/ps/hp-laserjet_1200-ps.ppd.gz \
prnt/ps/hp-laserjet_p3005-ps.ppd.gz \
prnt/ps/hp-laserjet_9040-ps.ppd.gz \
......@@ -3510,6 +3517,7 @@ foomatic_ps_printers = \
prnt/ps/hp-laserjet_2100-ps.ppd.gz \
prnt/ps/hp-color_laserjet_3700-ps.ppd.gz \
prnt/ps/hp-color_laserjet_2500-ps.ppd.gz \
prnt/ps/hp-officejet_pro_251dw_printer-ps.ppd.gz \
prnt/ps/hp-laserjet_m5035_mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_9065mfp-ps.ppd.gz \
prnt/ps/hp-laserjet_m2727_mfp_series-ps.ppd.gz \
......
......@@ -149,7 +149,7 @@ def setAdaptorPower(dev, adapterList, power_state='on'):
ret['errorreturn'] = writeXmlDataToURI(dev,URI,powerXml,10)
if not(ret['errorreturn'] == HTTP_OK or ret['errorreturn'] == HTTP_NOCONTENT):
log.warn("Wifi Adapter turn ON request Failed. ResponseCode=%s AdaptorId=%s AdaptorName=%s. Trying another interface" %(ret['errorreturn'],adaptor_id,adaptorName))
log.debug("Wifi Adapter turn ON request Failed. ResponseCode=%s AdaptorId=%s AdaptorName=%s. Trying another interface" %(ret['errorreturn'],adaptor_id,adaptorName))
powerXml = adapterPowerXml_payload2 %(power_state)
ret['errorreturn'] = writeXmlDataToURI(dev,URI,powerXml,10)
......@@ -291,16 +291,30 @@ def getIPConfiguration(dev, adapterName):
ip = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:ipaddress']
except:
ip = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:ipaddress-0']
#subnetmask = params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:subnetmask']
#subnetmask = params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:subnetmask']
try:
subnetmask = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:subnetmask']
#gateway = params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:defaultgateway']
except:
subnetmask = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:subnetmask-0']
#gateway = params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:defaultgateway']
try:
gateway = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:defaultgateway']
#if 'DHCP' in params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:configmethod']:
if 'DHCP' in params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:ipconfigmethod-0']:
addressmode = 'dhcp'
else:
addressmode = 'autoip'
except:
gateway = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:defaultgateway-0']
#if 'DHCP' in params['io:protocols-io:protocol-io:addresses-io:ipv4addresses-io:ipv4address-dd:configmethod']:
try:
addressmode = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:ipconfigmethod']
except:
addressmode = params['iocfgdyn2:ioconfigdyn-dd3:ioadaptorconfig-dd3:networkadaptorconfig-dd3:ipversionconfig-dd3:ipconfig-dd:ipconfigmethod-0']
if 'dhcp' in addressmode.lower():
addressmode = 'dhcp'
else:
addressmode = 'autoip'
#if elementCount ==1:
# pridns = params['io:protocols-io:protocol-dd:dnsserveripaddress']
# sec_dns = params['io:protocols-io:protocol-dd:secondarydnsserveripaddress']
......@@ -312,6 +326,7 @@ def getIPConfiguration(dev, adapterName):
except KeyError, e:
log.error("Missing response key: %s" % str(e))
log.debug("ip=%s, hostname=%s, addressmode=%s, subnetmask=%s, gateway=%s, pridns=%s, sec_dns=%s"%(ip, hostname, addressmode, subnetmask, gateway, pridns, sec_dns))
return ip, hostname, addressmode, subnetmask, gateway, pridns, sec_dns
......@@ -491,22 +506,24 @@ def readXmlTagDataFromURI(dev,URI,xmlRootNode,xmlReqDataNode,timeout=5):
if code == HTTP_OK:
strResp = utils.unchunck_xml_data(strResp)
pos = strResp.find(xmlRootNode,0,len(strResp))
repstr = strResp[pos:].strip()
repstr = filter(lambda c: c not in "\r\t\n", repstr) # 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()
root_element = parser_object.Parse(repstr)
xmlReqDataNode = filter(lambda c: c not in "<>", xmlReqDataNode) # To remove '<' and '>' characters
reqDataElementList = root_element.getElementsByTagName(xmlReqDataNode)
for node in reqDataElementList:
repstr = node.toString()
repstr = filter(lambda c: c not in "\r\t\n", repstr) # To remove formating characters from the received xml
params = utils.XMLToDictParser().parseXML(repstr)
paramsList.append(params)
except xml.parsers.expat.ExpatError, e:
log.debug("XML parser failed: %s" % e) #changed from error to debug
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.rstrip('0') # To remove trailing zero from the received xml
try:
parser_object = utils.extendedExpat()
root_element = parser_object.Parse(repstr)
xmlReqDataNode = filter(lambda c: c not in "<>", xmlReqDataNode) # To remove '<' and '>' characters
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
params = utils.XMLToDictParser().parseXML(repstr)
paramsList.append(params)
except xml.parsers.expat.ExpatError, e:
log.debug("XML parser failed: %s" % e) #changed from error to debug
else:
log.debug("HTTP Responce failed with %s code"%code)
return paramsList,code
......@@ -551,17 +568,19 @@ def readXmlDataFromURI(dev,URI,xmlRootNode,xmlChildNode,timeout=5):
if strResp is not None:
code = get_error_code(strResp)
if code == HTTP_OK:
strResp = utils.unchunck_xml_data(strResp)
pos = strResp.find(xmlRootNode,0,len(strResp))
repstr = strResp[pos:].strip()
repstr = filter(lambda c: c not in "\r\t\n", repstr) # 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:
params = utils.XMLToDictParser().parseXML(repstr)
except xml.parsers.expat.ExpatError, e:
log.debug("XML parser failed: %s" % e) #changed from error to debug
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.rstrip('0') # To remove trailing zero from the received xml
elementCount = repstr.count(xmlChildNode)
try:
params = utils.XMLToDictParser().parseXML(repstr)
except xml.parsers.expat.ExpatError, e:
log.debug("XML parser failed: %s" % e) #changed from error to debug
else:
log.debug(" HTTP Responce failed with %s code"%code)
return params,code,elementCount
......
......@@ -159,10 +159,10 @@ STATUS_PRINTER_CARTRIDGE_MISSING = 1048
STATUS_PRINTER_PRINTHEAD_MISSING = 1049
#Alert messages for Pentane products RQ 8888
STATUS_SCANNER_ADF_MISPICK = 1050
STATUS_SCANNER_ADF_MISPICK = 1050
STATUS_PRINTER_PAPER_TOO_SHORT_TO_AUTODUPLEX = 1051
STATUS_PRINTER_TRAY_2_3_DOOR_OPEN = 1052
STATUS_PRINTER_INK_TOO_LOW_TO_PRIME = 1053
STATUS_PRINTER_INK_TOO_LOW_TO_PRIME = 1053
STATUS_PRINTER_VERY_LOW_ON_INK = 1054
STATUS_PRINTER_SERVICE_INK_CONTAINER_ALMOST_FULL =1055
STATUS_PRINTER_SERVICE_INK_CONTAINER_FULL=1056
......@@ -592,6 +592,8 @@ AGENT_TYPE_LG_PK = 16 # light grey and photo black
AGENT_TYPE_LG = 17 # light grey
AGENT_TYPE_G = 18 # medium grey
AGENT_TYPE_PG = 19 # photo grey
AGENT_TYPE_PHOTO_BLACK = 20 # photo black
AGENT_TYPE_MATTE_BLACK = 21 # matte black
AGENT_TYPE_BLACK_B8800 = 39 # For PS B8800
AGENT_TYPE_WHITE = 0x20 # For ISO 10180 compatibility
AGENT_TYPE_RED = 0x21 # For ISO 10180 compatibility
......@@ -657,6 +659,7 @@ CLEAN_TYPE_NONE = 0
CLEAN_TYPE_PCL = 1
CLEAN_TYPE_LIDIL = 2
CLEAN_TYPE_PCL_WITH_PRINTOUT = 3
CLEAN_TYPE_LEDM = 4
# color-cal-types
COLOR_CAL_TYPE_UNSUPPORTED = -1
......
......@@ -46,6 +46,10 @@ from prnt import pcl, ldl, cups
import models, mdns, slp
from strings import StringTable
http_result_pat = re.compile("""HTTP/\d.\d\s(\d+)""", re.I)
HTTP_OK = 200
HTTP_ERROR = 500
try:
import hpmudext
......@@ -976,6 +980,8 @@ AGENT_types = { AGENT_TYPE_NONE : 'invalid',
AGENT_TYPE_PG : 'photo_gray',
AGENT_TYPE_C_M : 'cyan_and_magenta',
AGENT_TYPE_K_Y : 'black_and_yellow',
AGENT_TYPE_PHOTO_BLACK : 'photo_black',
AGENT_TYPE_MATTE_BLACK : 'matte_black',
AGENT_TYPE_UNSPECIFIED : 'unspecified', # Kind=5,6
}
......@@ -1082,6 +1088,11 @@ class Device(object):
log.debug("Model/UI model: %s/%s" % (self.model, self.model_ui))
if self.bus == 'net':
self.http_host = self.host
else:
self.http_host = 'localhost'