summaryrefslogtreecommitdiff
path: root/prnt
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2016-01-04 16:45:25 +0100
committerDidier Raboud <odyx@debian.org>2016-01-04 16:45:25 +0100
commitbfdf57b19d6d77d62d062df9872a06064c4fc468 (patch)
treeec226a7327dee095f7ddc77c8812d7fa9997df11 /prnt
parent9e61c3c0f74d2e88ddacf5a802227bdd0eafd522 (diff)
Imported Upstream version 2.8.4
Diffstat (limited to 'prnt')
-rw-r--r--prnt/backend/hp.c147
-rw-r--r--prnt/cups.py137
-rw-r--r--prnt/cupsext/cupsext.c34
-rw-r--r--prnt/drv/hpijs.drv.in31
-rw-r--r--prnt/hpijs/dj3600.cpp2
-rw-r--r--prnt/hpijs/dj4100.h2
-rw-r--r--prnt/hpijs/dj9xxvip.cpp4
-rw-r--r--prnt/hpijs/djgenericvip.cpp10
-rw-r--r--prnt/hpijs/djgenericvip.h2
-rw-r--r--prnt/hpijs/hpijsfax.cpp2
-rw-r--r--prnt/hpijs/ljjetready.cpp22
-rw-r--r--prnt/hpijs/ljjetready.h2
-rw-r--r--prnt/hpijs/ljm1005.h5
-rw-r--r--prnt/hpijs/services.cpp6
-rw-r--r--prnt/printable_areas.py4
15 files changed, 291 insertions, 119 deletions
diff --git a/prnt/backend/hp.c b/prnt/backend/hp.c
index d86be15b3..d0d44d137 100644
--- a/prnt/backend/hp.c
+++ b/prnt/backend/hp.c
@@ -2,7 +2,7 @@
hp.c - hp cups backend
- (c) 2004-2007 Copyright Hewlett-Packard Development Company, LP
+ (c) 2004-2008 Copyright Hewlett-Packard Development Company, LP
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -29,7 +29,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <stdio.h>
@@ -41,6 +40,9 @@
#include <syslog.h>
#include <ctype.h>
#include <pthread.h>
+#ifdef HAVE_FAX
+#include <dbus/dbus.h>
+#endif
#include "hpmud.h"
//#define HP_DEBUG
@@ -129,6 +131,13 @@ static const char pjl_ustatus_cmd[] = "\e%-12345X@PJL USTATUS DEVICE = ON \r\n@P
static const char pjl_job_end_cmd[] = "\e%-12345X@PJL EOJ \r\n\e%-12345X";
static const char pjl_ustatus_off_cmd[] = "\e%-12345X@PJL USTATUSOFF \r\n\e%-12345X";
+#ifdef HAVE_FAX
+#define DBUS_INTERFACE "com.hplip.Service"
+#define DBUS_PATH "/"
+static DBusError dbus_err;
+static DBusConnection *dbus_conn;
+#endif
+
static int bug(const char *fmt, ...)
{
char buf[256];
@@ -473,51 +482,75 @@ bugout:
return r;
}
-static int device_event(const char *dev, const char *jobid, int code, char *type, int timeout)
+#ifdef HAVE_FAX
+static int device_event(const char *dev, const char *printer, int code,
+ const char *username, const char *jobid, const char *title)
+{
+ DBusMessage * msg = NULL;
+ int id = atoi(jobid);
+
+ msg = dbus_message_new_signal(DBUS_PATH, DBUS_INTERFACE, "Event");
+
+ if (NULL == msg)
+ {
+ BUG("dbus message is NULL!\n");
+ return 0;
+ }
+
+ dbus_message_append_args(msg,
+ DBUS_TYPE_STRING, &dev,
+ DBUS_TYPE_STRING, &printer,
+ DBUS_TYPE_UINT32, &code,
+ DBUS_TYPE_STRING, &username,
+ DBUS_TYPE_UINT32, &id,
+ DBUS_TYPE_STRING, &title,
+ DBUS_TYPE_INVALID);
+
+ if (!dbus_connection_send(dbus_conn, msg, NULL))
+ {
+ BUG("dbus message send failed!\n");
+ return 0;
+ }
+
+ dbus_connection_flush(dbus_conn);
+ dbus_message_unref(msg);
+
+ return 1;
+}
+
+int init_dbus(void)
{
- struct sockaddr_in pin;
- char message[512];
- int len=0;
- int hpssd_socket=-1, hpssd_port_num=2207;
-
- bzero(&pin, sizeof(pin));
- pin.sin_family = AF_INET;
- pin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- pin.sin_port = htons(hpssd_port_num);
+ dbus_error_init(&dbus_err);
+ dbus_conn = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_err);
- if ((hpssd_socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
- {
- BUG("unable to create hpssd socket %d: %m\n", hpssd_port_num);
- goto bugout;
- }
-
- if (connect(hpssd_socket, (void *)&pin, sizeof(pin)) == -1)
- {
- BUG("unable to connect hpssd socket %d: %m\n", hpssd_port_num);
- goto bugout;
- }
-
- if (timeout == 0)
- len = sprintf(message, "msg=Event\ndevice-uri=%s\njob-id=%s\nevent-code=%d\nevent-type=%s\n", dev, jobid, code, type);
- else
- len = sprintf(message, "msg=Event\ndevice-uri=%s\njob-id=%s\nevent-code=%d\nevent-type=%s\nretry-timeout=%d\n",
- dev, jobid, code, type, timeout);
-
- /* Send message with no response. */
- if (send(hpssd_socket, message, len, 0) == -1)
- {
- BUG("unable to send Event %s %s %d: %m\n", dev, jobid, code);
- }
+ if (dbus_error_is_set(&dbus_err))
+ {
+ BUG("dBus Connection Error (%s)!\n", dbus_err.message);
+ dbus_error_free(&dbus_err);
+ }
-bugout:
- if (hpssd_socket >= 0)
- close(hpssd_socket);
+ if (dbus_conn == NULL)
+ {
+ return 0;
+ }
- return 0;
+ return 1;
+}
+#else
+static int device_event(const char *dev, const char *printer, int code,
+ const char *username, const char *jobid, const char *title)
+{
+ return 1;
+}
+int init_dbus(void)
+{
+ return 1;
}
+#endif /* HAVE_FAX */
/* Check printer status, if in an error state, loop until error condition is cleared. */
-static int loop_test(HPMUD_DEVICE dd, HPMUD_CHANNEL cd, struct pjl_attributes *pa, const char *uri, const char *job)
+static int loop_test(HPMUD_DEVICE dd, HPMUD_CHANNEL cd, struct pjl_attributes *pa,
+ const char *dev, const char *printer, const char *username, const char *jobid, const char *title)
{
int retry=0, status;
const char *pstate;
@@ -533,7 +566,7 @@ static int loop_test(HPMUD_DEVICE dd, HPMUD_CHANNEL cd, struct pjl_attributes *p
if (retry)
{
/* Clear error. */
- device_event(uri, job, VSTATUS_PRNT, "event", 0);
+ device_event(dev, printer, VSTATUS_PRNT, username, jobid, title);
fputs("INFO: Printing...\n", stderr);
fprintf(stderr, "STATE: -%s\n", error_state);
retry=0;
@@ -545,14 +578,14 @@ static int loop_test(HPMUD_DEVICE dd, HPMUD_CHANNEL cd, struct pjl_attributes *p
{
/* Display error. */
error_state = pstate;
- device_event(uri, job, status, "error", RETRY_TIMEOUT);
+ device_event(dev, printer, status, username, jobid, title);
fprintf(stderr, "STATE: +%s\n", error_state);
}
if (strcmp(pstate, error_state) != 0)
{
/* Clear old error and display new error. */
- device_event(uri, job, status, "error", RETRY_TIMEOUT);
+ device_event(dev, printer, status, username, jobid, title);
fprintf(stderr, "STATE: -%s\n", error_state);
error_state = pstate;
fprintf(stderr, "STATE: +%s\n", error_state);
@@ -578,14 +611,18 @@ int main(int argc, char *argv[])
HPMUD_CHANNEL cd=-1;
int n, total, retry=0, size, pages;
enum HPMUD_RESULT stat;
-
+ char *printer = getenv("PRINTER");
+
+ // 0 1 2 3 4 5
+ // device_uri job-id user title copies options
+
if (argc > 1)
{
const char *arg = argv[1];
if ((arg[0] == '-') && (arg[1] == 'h'))
{
fprintf(stdout, "HP Linux Imaging and Printing System\nCUPS Backend %s\n", VERSION);
- fprintf(stdout, "(c) 2003-2007 Copyright Hewlett-Packard Development Company, LP\n");
+ fprintf(stdout, "(c) 2003-2008 Copyright Hewlett-Packard Development Company, LP\n");
exit(0);
}
}
@@ -614,6 +651,8 @@ int main(int argc, char *argv[])
copies = atoi(argv[4]);
}
+ init_dbus();
+
fputs("STATE: +connecting-to-device\n", stderr);
/* Get any parameters needed for DeviceOpen. */
@@ -625,13 +664,13 @@ int main(int argc, char *argv[])
if (strcasestr(argv[0], ":/net") == NULL && (ma.statustype==HPMUD_STATUSTYPE_PJL || ma.statustype==HPMUD_STATUSTYPE_PJLPML))
pa.pjl_device = 1;
- device_event(argv[0], argv[1], EVENT_START_JOB, "event", 0);
+ device_event(argv[0], printer, EVENT_START_JOB, argv[2], argv[1], argv[3]);
/* Open hp device. */
while ((stat = hpmud_open_device(argv[0], ma.prt_mode, &hd)) != HPMUD_R_OK)
{
/* Display user error. */
- device_event(argv[0], argv[1], 5000+stat, "error", RETRY_TIMEOUT);
+ device_event(argv[0], printer, 5000+stat, argv[2], argv[1], argv[3]);
BUG("INFO: open device failed; will retry in %d seconds...\n", RETRY_TIMEOUT);
sleep(RETRY_TIMEOUT);
@@ -641,7 +680,7 @@ int main(int argc, char *argv[])
if (retry)
{
/* Clear user error. */
- device_event(argv[0], argv[1], VSTATUS_PRNT, "event", 0);
+ device_event(argv[0], printer, VSTATUS_PRNT, argv[2], argv[1], argv[3]);
retry=0;
}
@@ -668,7 +707,7 @@ int main(int argc, char *argv[])
{
while ((stat = hpmud_open_channel(hd, HPMUD_S_PRINT_CHANNEL, &cd)) != HPMUD_R_OK)
{
- device_event(argv[0], argv[1], 5000+stat, "error", RETRY_TIMEOUT);
+ device_event(argv[0], printer, 5000+stat, argv[2], argv[1], argv[3]);
BUG("INFO: open print channel failed; will retry in %d seconds...\n", RETRY_TIMEOUT);
sleep(RETRY_TIMEOUT);
retry = 1;
@@ -677,7 +716,7 @@ int main(int argc, char *argv[])
if (retry)
{
/* Clear user error. */
- device_event(argv[0], argv[1], VSTATUS_PRNT, "event", 0);
+ device_event(argv[0], printer, VSTATUS_PRNT, argv[2], argv[1], argv[3]);
retry=0;
}
@@ -700,7 +739,7 @@ int main(int argc, char *argv[])
if (n != size)
{
/* IO error, get printer status. */
- loop_test(hd, cd, &pa, argv[0], argv[1]);
+ loop_test(hd, cd, &pa, argv[0], printer, argv[2], argv[1], argv[3]);
}
else
{
@@ -708,7 +747,7 @@ int main(int argc, char *argv[])
if (pa.pjl_device)
{
/* Laserjets have a large data buffer, so manually check for operator intervention condition. */
- loop_test(hd, cd, &pa, argv[0], argv[1]);
+ loop_test(hd, cd, &pa, argv[0], printer, argv[2], argv[1], argv[3]);
}
}
total+=n;
@@ -729,7 +768,7 @@ int main(int argc, char *argv[])
/* Look for job end status. */
for (cnt=0; cnt<10; cnt++)
{
- loop_test(hd, cd, &pa, argv[0], argv[1]);
+ loop_test(hd, cd, &pa, argv[0], printer, argv[2], argv[1], argv[3]);
pthread_mutex_lock(&pa.mutex);
pages = pa.eoj_pages;
pthread_mutex_unlock(&pa.mutex);
@@ -775,7 +814,7 @@ int main(int argc, char *argv[])
sleep(8);
}
- device_event(argv[0], argv[1], EVENT_END_JOB, "event", 0);
+ device_event(argv[0], printer, EVENT_END_JOB, argv[2], argv[1], argv[3]);
fputs("INFO: ready to print\n", stderr);
if (cd >= 0)
diff --git a/prnt/cups.py b/prnt/cups.py
index 2f5a6a6f0..d5989fa4e 100644
--- a/prnt/cups.py
+++ b/prnt/cups.py
@@ -39,6 +39,7 @@ except ImportError:
sys.exit(1)
nickname_pat = re.compile(r'''\*NickName:\s*\"(.*)"''', re.MULTILINE)
+pat_cups_error_log = re.compile("""^loglevel\s?(debug|debug2|warn|info|error|none)""", re.I)
IPP_PRINTER_STATE_IDLE = 3
IPP_PRINTER_STATE_PROCESSING = 4
@@ -132,8 +133,8 @@ CUPS_ERROR_BAD_PARAMETERS = 0x0f01
-def restartCUPS(): # must be root. How do you check for this?
- os.system('killall -HUP cupsd')
+##def restartCUPS(): # must be root. How do you check for this?
+## os.system('killall -HUP cupsd')
def getPPDPath(addtional_paths=None):
"""
@@ -178,18 +179,18 @@ def getAllowableMIMETypes():
allowable_mime_types.append("text/cpp")
return allowable_mime_types
-
+
def getPPDDescription(f):
if f.endswith('.gz'):
nickname = gzip.GzipFile(f, 'r').read(4096)
else:
nickname = file(f, 'r').read(4096)
-
+
try:
desc = nickname_pat.search(nickname).group(1)
except AttributeError:
desc = ''
-
+
return desc
@@ -202,11 +203,11 @@ def getSystemPPDs():
for f in utils.walkFiles(sys_cfg.dirs.ppd, pattern="HP*ppd*;hp*ppd*", abs_paths=True):
desc = getPPDDescription(f)
-
+
if not ('foo2' in desc or
'gutenprint' in desc.lower() or
'gutenprint' in f):
-
+
ppds[f] = desc
log.debug("%s: %s" % (f, desc))
@@ -223,34 +224,47 @@ def getSystemPPDs():
log.debug("Foomatic PPD base path = %s" % foomatic_ppd_path)
for ppd in ppd_dict:
+ if not ppd:
+ continue
+
if 'hp-' in ppd.lower() or 'hp_' in ppd.lower() and \
ppd_dict[ppd]['ppd-make'] == 'HP':
-
+
desc = ppd_dict[ppd]['ppd-make-and-model']
#print ppd, desc
-
+
if not ('foo2' in desc.lower() or
'gutenprint' in desc.lower() or
'gutenprint' in ppd):
-
+
# PPD files returned by CUPS_GET_PPDS (and by lpinfo -m)
# can be relative to /usr/share/ppd/ or to
# /usr/share/cups/model/. Not sure why this is.
# Here we will try both and see which one it is...
- path = os.path.join(foomatic_ppd_path, ppd)
- if not os.path.exists(path):
- path = os.path.join(cups_ppd_path, ppd)
-
- if not os.path.exists(path):
- path = ppd # foomatic: or some other driver
-
+ if os.path.exists(ppd):
+ path = ppd
+ else:
+ try:
+ path = os.path.join(foomatic_ppd_path, ppd)
+ except AttributeError: # happens on some boxes with provider: style ppds (foomatic: etc)
+ path = ppd
+ else:
+ if not os.path.exists(path):
+ try:
+ path = os.path.join(cups_ppd_path, ppd)
+ except AttributeError:
+ path = ppd
+ else:
+ if not os.path.exists(path):
+ path = ppd # foomatic: or some other driver
+
ppds[path] = desc
log.debug("%s: %s" % (path, desc))
return ppds
-
+
# TODO: Move this to CUPSEXT for better performance
def levenshtein_distance(a,b):
"""
@@ -265,17 +279,35 @@ def levenshtein_distance(a,b):
current = range(n+1)
for i in range(1,m+1):
previous, current = current, [i]+[0]*m
+
for j in range(1,n+1):
add, delete = previous[j]+1, current[j-1]+1
change = previous[j-1]
+
if a[j-1] != b[i-1]:
change = change + 1
+
current[j] = min(add, delete, change)
return current[n]
+
number_pat = re.compile(r""".*?(\d+)""", re.IGNORECASE)
+STRIP_STRINGS = ['-ps', '-pcl', 'foomatic:', '-hpijs', 'hp-', 'hp_',
+ '_series', '-hpijs', '.gz', '.ppd', '-series',
+ '-zjs', '-lidil']
+
+def stripModel(model):
+ model = model.lower()
+
+ for x in STRIP_STRINGS:
+ model = model.replace(x, '')
+
+ return model
+
+
+
def getPPDFile(stripped_model, ppds):
"""
Match up a model name to a PPD from a list of system PPD files.
@@ -286,10 +318,7 @@ def getPPDFile(stripped_model, ppds):
min_edit_distance = sys.maxint
for f in ppds:
- t = os.path.basename(f).lower().replace('hp-', '').replace('-hpijs', '').\
- replace('.gz', '').replace('.ppd', '').replace('hp_', '').replace('_series', '').\
- replace('foomatic:', '').lower()
-
+ t = stripModel(os.path.basename(f))
eds[f] = levenshtein_distance(stripped_model, t)
log.debug("dist('%s', '%s') = %d" % (stripped_model, t, eds[f]))
min_edit_distance = min(min_edit_distance, eds[f])
@@ -354,6 +383,68 @@ def getPPDFile(stripped_model, ppds):
return mins
+def getErrorLogLevel():
+ cups_conf = '/etc/cups/cupsd.conf'
+ try:
+ f = file(cups_conf, 'r')
+ except OSError:
+ log.error("%s not found." % cups_conf)
+ else:
+ for l in f:
+ m = pat_cups_error_log.match(l)
+ if m is not None:
+ level = m.group(1).lower()
+ log.debug("CUPS error_log LogLevel: %s" % level)
+ return level
+
+ log.debug("CUPS error_log LogLevel: unknown")
+ return 'unknown'
+
+
+def getPrintJobErrorLog(job_id, max_lines=1000, cont_interval=5):
+ ret = []
+ s = '[Job %d]' % job_id
+ level = getLogLevel()
+ cups_conf = '/var/log/cups/error_log'
+
+
+ if level in ('debug', 'debug2'):
+ try:
+ f = file(cups_conf, 'r')
+
+ except OSError:
+ log.error("Could not open the CUPS error_log file: %s" % cups_conf)
+ return ret
+
+ else:
+ if s in file(cups_conf, 'r').read():
+ queue = utils.Queue()
+ job_found = False
+
+ while True:
+ line = f.readline()
+
+ if s in line:
+ job_found = True
+
+ while len(queue):
+ ret.append(queue.get())
+
+ ret.append(line.strip())
+
+ if len(ret) > max_lines:
+ break
+
+ else:
+ if job_found:
+ queue.put(line.strip())
+
+ if len(queue) > cont_interval:
+ break
+
+ return ret
+
+
#
# cupsext wrappers
#
@@ -504,4 +595,4 @@ def removeOption(option):
def setPasswordCallback(func):
return cupsext.setPasswordCallback(func)
-
+
diff --git a/prnt/cupsext/cupsext.c b/prnt/cupsext/cupsext.c
index 4f76daee7..e52b91f5c 100644
--- a/prnt/cupsext/cupsext.c
+++ b/prnt/cupsext/cupsext.c
@@ -102,27 +102,10 @@ const char * g_ppd_file = NULL;
* 'validate_name()' - Make sure the printer name only contains valid chars.
*/
-static int /* O - 0 if name is no good, 1 if name is good */
+static int /* O - 0 if name is no good, 1 if name is good */
validate_name( const char *name ) /* I - Name to check */
{
- const char * ptr; /* Pointer into name */
-
-
- /*
- * Scan the whole name...
- */
-
- for ( ptr = name; *ptr; ptr ++ )
- if ( *ptr == '@' )
- break;
- else if ( ( *ptr < '!' ) || ( *ptr > '~' ) || ( *ptr == '/' ) )
- return ( 0 );
-
- /*
- * All the characters are good; validate the length, too...
- */
-
- return ( ( ptr - name ) < 128 );
+ return 1; // TODO: Make it work with utf-8 encoding
}
@@ -278,6 +261,8 @@ static PyObject * newPrinter( PyObject * self, PyObject * args, PyObject * kwarg
return _newPrinter( device_uri, printer_uri, name, location, makemodel, info, state, accepting);
}
+
+
PyObject * getPrinters( PyObject * self, PyObject * args )
{
http_t * http = NULL; /* HTTP object */
@@ -660,11 +645,16 @@ PyObject * setDefaultPrinter( PyObject * self, PyObject * args )
{
goto abort;
}
+
+ //char buf[1024];
+ //sprintf( buf, "print '%s'", name);
+ //PyRun_SimpleString( buf );
if ( !validate_name( name ) )
{
goto abort;
}
+
/* Connect to the HTTP server */
if ( ( http = httpConnectEncrypt( cupsServer(), ippPort(), cupsEncryption() ) ) == NULL )
{
@@ -690,10 +680,12 @@ PyObject * setDefaultPrinter( PyObject * self, PyObject * args )
language = cupsLangDefault();
ippAddString( request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
- "attributes-charset", NULL, cupsLangEncoding( language ) );
+ "attributes-charset", NULL, "utf-8" ); //cupsLangEncoding( language ) );
ippAddString( request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE,
- "attributes-natural-language", NULL, language->language );
+ "attributes-natural-language",
+ //NULL, language != NULL ? language->language : "en");
+ NULL, language->language );
ippAddString( request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri );
diff --git a/prnt/drv/hpijs.drv.in b/prnt/drv/hpijs.drv.in
index 15956c898..77796c408 100644
--- a/prnt/drv/hpijs.drv.in
+++ b/prnt/drv/hpijs.drv.in
@@ -2146,6 +2146,11 @@ lity:PenSet=2,Quality:FullBleed=1"
Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart c4200 series;DES:photosmart c4200 series;"
}
{
+ ModelName "HP PhotoSmart C4340 Foomatic/hpijs"
+ PCFileName "hp-photosmart_c4340_series-hpijs.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart c4340 series;DES:photosmart c4340 series;"
+ }
+ {
ModelName "HP PhotoSmart C4380 Foomatic/hpijs"
PCFileName "hp-photosmart_c4380_series-hpijs.ppd"
Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart c4380 series;DES:photosmart c4380 series;"
@@ -2186,6 +2191,11 @@ lity:PenSet=2,Quality:FullBleed=1"
Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart d5100;DES:photosmart d5100;"
}
{
+ ModelName "HP PhotoSmart D5300 Foomatic/hpijs"
+ PCFileName "hp-photosmart_d5300-hpijs.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart d5300;DES:photosmart d5300;"
+ }
+ {
ModelName "HP PhotoSmart D6100 Foomatic/hpijs"
PCFileName "hp-photosmart_d6100-hpijs.ppd"
Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart d6100;DES:photosmart d6100;"
@@ -2270,6 +2280,11 @@ lity:PenSet=2,Quality:FullBleed=1"
PCFileName "hp-officejet_j5700-hpijs.ppd"
Attribute "1284DeviceID" "" "MFG:HP;MDL:officejet j5700;DES:officejet j5700;"
}
+ {
+ ModelName "HP OfficeJet J6400 Foomatic/hpijs"
+ PCFileName "hp-officejet_j6400_-hpijs.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:officejet j6400;DES:officejet j6400;"
+ }
{
// Large format SuperB paper support
CustomMedia "B4JIS/B4 (JIS)" 729.00 1033.00 18.00 36.00 18.00 9.00 "%% FoomaticRIPOptionSetting: PageSize=B4JIS" "%% FoomaticRIPOptionSetting: PageSize=B4JIS"
@@ -2296,6 +2311,11 @@ lity:PenSet=2,Quality:FullBleed=1"
PCFileName "hp-photosmart_pro_b8300_series-hpijs.ppd"
Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart pro b8300 series;DES:photosmart pro b8300 series;"
}
+ {
+ ModelName "HP PhotoSmart Pro B8800 Foomatic/hpijs"
+ PCFileName "hp-photosmart_pro_b8800_series-hpijs.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:photosmart pro b8800 series;DES:photosmart pro b8800 series;"
+ }
}
} // end DJGenericVIP
@@ -2534,6 +2554,11 @@ et=2"
Attribute "1284DeviceID" "" "MFG:HP;MDL:officejet pro l7300;DES:officejet pro l7300;"
}
{
+ ModelName "HP OfficeJet Pro L7400 Foomatic/hpijs"
+ PCFileName "hp-officejet_pro_l7400-hpijs.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:officejet pro l7400;DES:officejet pro l7400;"
+ }
+ {
ModelName "HP OfficeJet Pro L7500 Foomatic/hpijs"
PCFileName "hp-officejet_pro_l7500-hpijs.ppd"
Attribute "1284DeviceID" "" "MFG:HP;MDL:officejet pro l7500;DES:officejet pro l7500;"
@@ -4062,9 +4087,9 @@ t=0"
Attribute "1284DeviceID" "" "MFG:HP;MDL:laserjet m2727 mfp;DES:laserjet m2727 mfp;"
}
{
- ModelName "HP LaserJet P1505 Foomatic/hpijs/pcl"
- PCFileName "hp-laserjet_p1505-hpijs-pcl.ppd"
- Attribute "1284DeviceID" "" "MFG:HP;MDL:laserjet p1505;DES:laserjet p1505;"
+ ModelName "HP LaserJet P1505n Foomatic/hpijs/pcl"
+ PCFileName "hp-laserjet_p1505n-hpijs-pcl.ppd"
+ Attribute "1284DeviceID" "" "MFG:HP;MDL:laserjet p1505n;DES:laserjet p1505n;"
}
{
ModelName "LaserJet M1522 MFP"
diff --git a/prnt/hpijs/dj3600.cpp b/prnt/hpijs/dj3600.cpp
index 062e19457..366771468 100644
--- a/prnt/hpijs/dj3600.cpp
+++ b/prnt/hpijs/dj3600.cpp
@@ -59,7 +59,7 @@ BOOL DJ3600::FullBleedCapable (PAPER_SIZE ps, FullbleedType *fbType, float *xOv
{
BYTE sDevIdStr[DevIDBuffSize];
char *pStr;
- if ((pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
+ if (pSS->IOMode.bDevID && (pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
{
if ((pStr = strstr ((char *) sDevIdStr, ";S:")))
{
diff --git a/prnt/hpijs/dj4100.h b/prnt/hpijs/dj4100.h
index 92184b2c1..8dc19fef5 100644
--- a/prnt/hpijs/dj4100.h
+++ b/prnt/hpijs/dj4100.h
@@ -95,7 +95,7 @@ public:
"DJ4100", // family name
"Deskjet D4100\0" // DeskJet 4100
"Deskjet D4160\0"
- "Deskjet d42\0"
+ "Deskjet D42\0"
) {m_iPrinterType = eDJ4100;}
inline Printer* CreatePrinter(SystemServices* pSS) const { return new DJ4100(pSS); }
inline PRINTER_TYPE GetPrinterType() const { return eDJ4100;}
diff --git a/prnt/hpijs/dj9xxvip.cpp b/prnt/hpijs/dj9xxvip.cpp
index fe710a3e3..8b3cbb2b2 100644
--- a/prnt/hpijs/dj9xxvip.cpp
+++ b/prnt/hpijs/dj9xxvip.cpp
@@ -832,6 +832,10 @@ DRIVER_ERROR DJ9xxVIP::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
{
num_pens = 10 + (str[0] - 'A');
}
+ else if ((str[0] >= 'a') && (str[0] <= 'f'))
+ {
+ num_pens = 10 + (str[0] - 'a');
+ }
else
{
return BAD_DEVICE_ID;
diff --git a/prnt/hpijs/djgenericvip.cpp b/prnt/hpijs/djgenericvip.cpp
index 56b1c2d7f..e23e39a89 100644
--- a/prnt/hpijs/djgenericvip.cpp
+++ b/prnt/hpijs/djgenericvip.cpp
@@ -54,7 +54,11 @@ DJGenericVIP::DJGenericVIP (SystemServices* pSS, BOOL proto)
{
bCheckForCancelButton = TRUE;
constructor_error = VerifyPenInfo ();
- CERRCHECK;
+ if (constructor_error != NO_ERROR)
+ {
+ constructor_error = NO_ERROR;
+ ePen = BOTH_PENS;
+ }
}
else
ePen = BOTH_PENS;
@@ -213,7 +217,7 @@ PAPER_SIZE DJGenericVIP::MandatoryPaperSize ()
* 100 - 13 X 19 size
*/
- if ((pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
+ if (pSS->IOMode.bDevID && (pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
{
if ((pStr = strstr ((char *) sDevIdStr, ";S:")) && (pSS->GetVIPVersion ()) >= 3)
{
@@ -251,7 +255,7 @@ BOOL DJGenericVIP::FullBleedCapable (PAPER_SIZE ps, FullbleedType *fbType, floa
char *pStr;
sDevIdStr[0] = 0;
- if ((pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
+ if (pSS->IOMode.bDevID && (pSS->GetDeviceID (sDevIdStr, DevIDBuffSize, FALSE)) == NO_ERROR)
{
if ((pStr = strstr ((char *) sDevIdStr, ";S:")) && (pSS->GetVIPVersion ()) >= 3)
{
diff --git a/prnt/hpijs/djgenericvip.h b/prnt/hpijs/djgenericvip.h
index b94210e6a..f7313d7d1 100644
--- a/prnt/hpijs/djgenericvip.h
+++ b/prnt/hpijs/djgenericvip.h
@@ -166,6 +166,7 @@ public:
"Officejet J36\0"
"Officejet J55\0"
"Officejet J57\0"
+ "Officejet J64\0"
"Officejet K71\0"
"Photosmart 2570\0"
"Photosmart 2600\0"
@@ -178,6 +179,7 @@ public:
"Photosmart A320\0"
"Photosmart A440\0"
"Photosmart Pro B8300\0"
+ "Photosmart Pro B88\0"
"Photosmart C31\0"
"Photosmart C41\0"
"Photosmart C42\0"
diff --git a/prnt/hpijs/hpijsfax.cpp b/prnt/hpijs/hpijsfax.cpp
index 27a6fb8ab..d1a62744b 100644
--- a/prnt/hpijs/hpijsfax.cpp
+++ b/prnt/hpijs/hpijsfax.cpp
@@ -344,7 +344,7 @@ int hpijsFaxServer (int argc, char **argv)
}
width = (((pFaxStruct->ph.width + 7) >> 3)) << 3;
- int widthMMR = width;
+ widthMMR = width;
/*
* Devices in the HPFax2 category require fixed width of 2528 pixels.
diff --git a/prnt/hpijs/ljjetready.cpp b/prnt/hpijs/ljjetready.cpp
index ca4d5dcdf..312dc9328 100644
--- a/prnt/hpijs/ljjetready.cpp
+++ b/prnt/hpijs/ljjetready.cpp
@@ -646,7 +646,7 @@ DRIVER_ERROR LJJetReady::Encapsulate (const RASTERDATA* InputRaster, BOOL bLastP
// For color JPEG, you need to skip the header information of 623 bytes
int iJpegHeaderSize = 623;
-#ifdef HAVB_LIBDL
+#ifdef HAVE_LIBDL
if (HPLJJRCompress && m_eCompressMode == COMPRESS_MODE_LJ)
{
iJpegHeaderSize = 0;
@@ -1105,7 +1105,6 @@ BOOL ModeJPEG::Compress( HPLJBITMAP *pSrcBitmap,
)
{
-
#ifdef HAVE_LIBDL
if (HPLJJRCompress && m_eCompressMode == COMPRESS_MODE_LJ)
{
@@ -1115,6 +1114,19 @@ BOOL ModeJPEG::Compress( HPLJBITMAP *pSrcBitmap,
if (pTrgBitmap->pvBits == NULL)
{
return FALSE;
+ }
+ if (bGrayscaleSet)
+ {
+ BYTE *p = pSrcBitmap->pvBits;
+ for (int j = 0; j < pSrcBitmap->bitmapInfo.bmiHeader.biHeight; j++)
+ {
+ for (int i = 0; i < pSrcBitmap->bitmapInfo.bmiHeader.biWidth; i++)
+ {
+ p[0] = ConvertToGrayMacro (p[0], p[1], p[2]);
+ p[1] = p[2] = 0;
+ p += 3;
+ }
+ }
}
iRet = HPLJJRCompress (pTrgBitmap->pvBits, (uint32_t *) &pTrgBitmap->cjBits, pSrcBitmap->pvBits,
pSrcBitmap->bitmapInfo.bmiHeader.biWidth, pSrcBitmap->bitmapInfo.bmiHeader.biHeight);
@@ -1725,7 +1737,7 @@ BOOL ModeJPEG::Process
// Convert 24bpp Gray to 8bpp Gray.
// JPEG takes K 8bpp gray data. We are using two different buffers for these.
//
- if(bGrayScaleSet)
+ if(bGrayScaleSet && m_eCompressMode == COMPRESS_MODE_JPEG)
{
pbTemp = (BYTE*)m_SourceBitmap.pvBits;
@@ -1750,7 +1762,7 @@ BOOL ModeJPEG::Process
//
// JPEG grayscale specific operations are done here.
//
- if(bGrayScaleSet)
+ if(bGrayScaleSet && m_eCompressMode == COMPRESS_MODE_JPEG)
{
jpegGrayBitmap.cjBits = m_SourceBitmap.cjBits / 3;
jpegGrayBitmap.bitmapInfo.bmiHeader.biSizeImage = m_SourceBitmap.bitmapInfo.bmiHeader.biSizeImage / 3;
@@ -1758,7 +1770,7 @@ BOOL ModeJPEG::Process
jpegGrayBitmap.bitmapInfo.bmiHeader.biWidth = m_SourceBitmap.bitmapInfo.bmiHeader.biWidth;
jpegGrayBitmap.bitmapInfo.bmiHeader.biHeight = m_SourceBitmap.bitmapInfo.bmiHeader.biHeight;
}
- if (bGrayScaleSet)
+ if (bGrayScaleSet && m_eCompressMode == COMPRESS_MODE_JPEG)
{
bRet = Compress (&jpegGrayBitmap, &m_DestBitmap, &qTableInfo,bGrayScaleSet);
}
diff --git a/prnt/hpijs/ljjetready.h b/prnt/hpijs/ljjetready.h
index 3058f2d29..aa0245375 100644
--- a/prnt/hpijs/ljjetready.h
+++ b/prnt/hpijs/ljjetready.h
@@ -232,7 +232,7 @@ public:
"LJJetReady", // family name
"hp color LaserJet 3500\0"
"hp color LaserJet 3550\0"
- "HP Color LaserJet 3600\0"
+ "hp color LaserJet 3600\0"
#ifdef APDK_MLC_PRINTER
#endif
) {m_iPrinterType = eLJJetReady;}
diff --git a/prnt/hpijs/ljm1005.h b/prnt/hpijs/ljm1005.h
index 1686db4fc..85d0678ad 100644
--- a/prnt/hpijs/ljm1005.h
+++ b/prnt/hpijs/ljm1005.h
@@ -93,9 +93,12 @@ public:
LJM1005Proxy() : PrinterProxy(
"LJM1005",
"LaserJet M1005\0"
- "HP LaserJet M1005\0"
+ "HP LaserJet M1005\0"
+ "HP LaserJet M1120\0"
"HP LaserJet P1005\0"
"HP LaserJet P1006\0"
+ "HP LaserJet P1007\0"
+ "HP LaserJet P1008\0"
"HP LaserJet P1505\0"
"HP LaserJet P201\0"
"M1005\0"
diff --git a/prnt/hpijs/services.cpp b/prnt/hpijs/services.cpp
index 087300db3..8b872cfcf 100644
--- a/prnt/hpijs/services.cpp
+++ b/prnt/hpijs/services.cpp
@@ -516,9 +516,6 @@ int UXServices::MapPaperSize (float width, float height)
if (size == CUSTOM_SIZE)
pPC->SetCustomSize (width, height);
- PaperWidth = pPC->PhysicalPageSizeX ();
- PaperHeight = pPC->PhysicalPageSizeY ();
-
if ((r = pPC->SetPaperSize ((PAPER_SIZE)size, FullBleed)) != NO_ERROR)
{
if (r > 0)
@@ -536,6 +533,9 @@ int UXServices::MapPaperSize (float width, float height)
return -1;
}
+ PaperWidth = pPC->PhysicalPageSizeX ();
+ PaperHeight = pPC->PhysicalPageSizeY ();
+
return 0;
}
diff --git a/prnt/printable_areas.py b/prnt/printable_areas.py
index 9c2b0f705..759dc4b0c 100644
--- a/prnt/printable_areas.py
+++ b/prnt/printable_areas.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# (c) Copyright 2003-2007 Hewlett-Packard Development Company, L.P.
+# (c) Copyright 2003-2008 Hewlett-Packard Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# NOTE: This file is automatically generated. All changes will be lost.
-# Created: Fri, 08 Feb 2008 18:07:27
+# Created: Wed, 02 Apr 2008 15:20:43
#
# page_width, page_height, left, top, width, height (all in inches)