Commit 352611b5 authored by Didier Raboud's avatar Didier Raboud

Imported Upstream version 3.12.11

parent fa97f0c2

Too many changes to show.

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

......@@ -170,7 +170,7 @@ dist_base_DATA = base/maint.py base/codes.py base/g.py base/pml.py base/status.p
base/__init__.py base/mfpdtf.py base/utils.py base/wifi.py base/LedmWifi.py \
base/device.py base/logger.py base/slp.py base/exif.py base/strings.py base/magic.py \
base/imagesize.py base/pexpect.py base/models.py base/mdns.py base/tui.py base/dime.py \
base/ldif.py base/vcard.py base/module.py base/pkit.py
base/ldif.py base/vcard.py base/module.py base/pkit.py base/queues.py
# installer
installdir = $(hplipdir)/installer
......@@ -395,16 +395,16 @@ hplipjsdir = $(cupsfilterdir)
hplipjs_PROGRAMS = hplipjs
hplipjs_SOURCES = prnt/filters/hplipjs.c
# hpps (CUPS filter)
hppsdir = $(cupsfilterdir)
hpps_PROGRAMS = hpps
hpps_SOURCES = prnt/hpps/hppsfilter.c
hpps_LDADD = -lcups
# hpcac (CUPS filter, Color Access Control, ie: CLJ 4700)
cacdir = $(cupsfilterdir)
dist_cac_SCRIPTS = prnt/filters/hpcac
# hpps (Finishing PS filter)
findir = $(cupsfilterdir)
dist_fin_SCRIPTS = prnt/filters/hpps
endif # FULL_BUILD
endif # HPLIP_BUILD
......@@ -553,24 +553,24 @@ install-dist_hplip_LogDATA:
if FULL_BUILD
test -z "$(DESTDIR)$(hplip_Logdir)" || mkdir -p $(DESTDIR)$(hplip_Logdir)
chgrp "lp" -R $(DESTDIR)$(hplip_Logdir)
chmod 774 $(DESTDIR)$(hplip_Logdir)
chmod 777 $(DESTDIR)$(hplip_Logdir)
endif #FULL_BUILD
if HPLIP_BUILD
test -z "$(DESTDIR)$(hplip_Logdir)" || mkdir -p $(DESTDIR)$(hplip_Logdir)
chgrp "lp" -R $(DESTDIR)$(hplip_Logdir)
chmod 774 $(DESTDIR)$(hplip_Logdir)
chmod 777 $(DESTDIR)$(hplip_Logdir)
endif #FULL_BUILD
install-dist_hplip_tmpDATA:
if FULL_BUILD
test -z "$(DESTDIR)$(hplip_tmpdir)" || mkdir -p $(DESTDIR)$(hplip_tmpdir)
chgrp "lp" -R $(DESTDIR)$(hplip_tmpdir)
chmod 1774 $(DESTDIR)$(hplip_tmpdir)
chmod 1777 $(DESTDIR)$(hplip_tmpdir)
endif #FULL_BUILD
if HPLIP_BUILD
test -z "$(DESTDIR)$(hplip_tmpdir)" || mkdir -p $(DESTDIR)$(hplip_tmpdir)
chgrp "lp" -R $(DESTDIR)$(hplip_tmpdir)
chmod 1774 $(DESTDIR)$(hplip_tmpdir)
chmod 1777 $(DESTDIR)$(hplip_tmpdir)
endif #FULL_BUILD
install-dist_cronDATA:$(dist_cron_DATA)
......
This diff is collapsed.
......@@ -2530,7 +2530,7 @@ class Device(object):
if data:
data = data.split('\r\n\r\n', 1)[1]
if data:
data = status.clean(data)
data = status.ExtractXMLData(data)
return data
#-------------------------For LEDM SOAP PROTOCOL(FAX) Devices----------------------------------------------------------------------#
......@@ -2544,7 +2544,7 @@ class Device(object):
if data:
data = data.split('\r\n\r\n', 1)[1]
if data:
data = status.clean(data)
data = status.ExtractXMLData(data)
return data
def readAttributeFromXml_EWS(self, uri, attribute):
......@@ -2670,12 +2670,43 @@ class LocalOpenerEWS_LEDM(urllib.URLopener):
reply = xStringIO()
while dev.readEWS_LEDM(512, reply, timeout=3):
pass
#while dev.readEWS_LEDM(512, reply, timeout=3):
#pass
reply.seek(0)
END_OF_DATA="0\r\n\r\n"
bytes_requested = 1024
bytes_remaining = 0
chunkedFlag = True
bytes_read = dev.readEWS_LEDM(bytes_requested, reply, timeout=3)
for line in reply.getvalue().splitlines():
if line.lower().find("content-length") != -1:
bytes_remaining = int(line.split(":")[1])
chunkedFlag = False
break
xml_data_start = reply.getvalue().find("<?xml")
if (xml_data_start != -1):
bytes_remaining = bytes_remaining - (len(reply.getvalue()) - xml_data_start)
while bytes_read > 0:
temp_buf = xStringIO()
bytes_read = dev.readEWS_LEDM(bytes_requested, temp_buf, timeout=3)
reply.write(temp_buf.getvalue())
if not chunkedFlag: # Unchunked data
bytes_remaining = bytes_remaining - bytes_read
if bytes_remaining <= 0:
break
elif END_OF_DATA == temp_buf.getvalue(): # Chunked data end
break
reply.seek(0)
return reply.getvalue()
# URLs: hp:/usb/HP_OfficeJet_7500?serial=00XXXXXXXXXX&loc=/hp/device/info_device_status.xml
class LocalOpener_LEDM(urllib.URLopener):
def open_hp(self, url, dev, foot=""):
......@@ -2696,24 +2727,37 @@ class LocalOpener_LEDM(urllib.URLopener):
reply = xStringIO()
while dev.readLEDM(512, reply, timeout=3):
pass
#TODO:Need to add following code in order to improve the delay.
#exp_end_of_data="0\r\n\r\n"
#num_of_bytes_read = dev.readEWS_LEDM(512, reply, timeout=5)
#while num_of_bytes_read:
#temp_buf = xStringIO()
#num_of_bytes_read = dev.readEWS_LEDM(512, temp_buf, timeout=5)
#reply.write(temp_buf.getvalue())
#if num_of_bytes_read == 5 and exp_end_of_data == temp_buf.getvalue():
# break
#while dev.readLEDM(512, reply, timeout=3):
#pass
reply.seek(0)
return reply.getvalue()
END_OF_DATA="0\r\n\r\n"
bytes_requested = 1024
bytes_remaining = 0
chunkedFlag = True
bytes_read = dev.readLEDM(bytes_requested, reply, timeout=3)
for line in reply.getvalue().splitlines():
if line.lower().find("content-length") != -1:
bytes_remaining = int(line.split(":")[1])
chunkedFlag = False
break
xml_data_start = reply.getvalue().find("<?xml")
if (xml_data_start != -1):
bytes_remaining = bytes_remaining - (len(reply.getvalue()) - xml_data_start)
while bytes_read > 0:
temp_buf = xStringIO()
bytes_read = dev.readLEDM(bytes_requested, temp_buf, timeout=3)
reply.write(temp_buf.getvalue())
if not chunkedFlag: # Unchunked data
bytes_remaining = bytes_remaining - bytes_read
if bytes_remaining <= 0:
break
elif END_OF_DATA == temp_buf.getvalue(): # Chunked data end
break
reply.seek(0)
return reply.getvalue()
......@@ -109,6 +109,7 @@ TECH_CLASSES = [
"Saipan",
"PyramidPlus",
"Hbpl1",
"Kapan",
]
TECH_CLASSES.sort()
......@@ -165,7 +166,8 @@ TECH_CLASS_PDLS = {
"Copperhead" : 'pcl3',
"Copperhead12" : 'pcl3',
"Ampere" : 'pcl3',
"Hbpl1" : 'hbpl1'
"Hbpl1" : 'hbpl1',
"Kapan" : 'pcl3'
}
PDL_TYPE_PCL = 0 # less preferred
......
This diff is collapsed.
......@@ -1500,7 +1500,10 @@ pen_health10_xlate = { 'ok' : AGENT_HEALTH_OK,
'missing' : AGENT_HEALTH_MISINSTALLED,
}
def clean(data):
#ExtractXMLData will extract actual data from http response (Transfer-encoding: chunked).
#For unchunked response it will not do anything.
def ExtractXMLData(data):
if data[0] is not '<':
size = -1
temp = ""
......@@ -1515,15 +1518,13 @@ def clean(data):
def StatusType10FetchUrl(func, url, footer=""):
data_fp = cStringIO.StringIO()
if footer:
#data = dev.getEWSUrl_LEDM(url, data_fp, footer)
data = func(url, data_fp, footer)
else:
#data = dev.getEWSUrl_LEDM(url, data_fp)
data = func(url, data_fp)
if data:
data = data.split('\r\n\r\n', 1)[1]
if data:
data = clean(data)
data = ExtractXMLData(data)
return data
def StatusType10(func): # Low End Data Model
......
......@@ -1896,12 +1896,11 @@ def Is_Process_Running(process_name):
# None --> on error.
# "terminal name"-->success
def get_terminal():
terminal_list=['gnome-terminal', 'konsole','x-terminal-emulator', 'xterm', 'gtkterm']
cnt = 0
terminal_list={'gnome-terminal':'--profile hold', 'konsole':'-hold','x-terminal-emulator':'-hold', 'xterm':'-hold', 'gtkterm':''}
terminal_cmd = None
while cnt < len(terminal_list):
if which(terminal_list[cnt]):
terminal_cmd = terminal_list[cnt]+" -e "
for cmd in terminal_list:
if which(cmd):
terminal_cmd = cmd +" "+ terminal_list[cmd]+" -e "
log.debug("Available Terminal = %s " %terminal_cmd)
break