summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2019-11-05 10:19:50 +0100
committerDidier Raboud <odyx@debian.org>2019-11-05 10:19:50 +0100
commitfad2b7baabd68567d4965d87f2ef033f66b47991 (patch)
tree0ec84e693995000ba9d8ab6f08edf971042c7113
parent816c743cfbe015e06c2eb529b58c3282cb4e8dd1 (diff)
Commit patch queue (exported by git-debrebase)
[git-debrebase make-patches: export and commit patches]
-rw-r--r--debian/patches/0001-Cope-with-prnt-hpcups-ErnieFilter.-cpp-h-removal-by-.patch79
-rw-r--r--debian/patches/0002-Blank-ink-only-patch-by-Richard-Spencer-Smith.patch125
-rw-r--r--debian/patches/0003-Fix-missing-charsign.patch26
-rw-r--r--debian/patches/0004-Corrections-models.dat-entry-for-the-HP-PhotoSmart-P.patch97
-rw-r--r--debian/patches/0005-Fixed-short-edge-duplex-for-non-PS-laser-printers.patch81
-rw-r--r--debian/patches/0006-Make-simple-scan-the-default-scanning-frontend.patch56
-rw-r--r--debian/patches/0007-Try-libhpmud.so.0-directly.patch52
-rw-r--r--debian/patches/0008-For-the-Lidil-printers-enable-two-cartridge-modes-bl.patch71
-rw-r--r--debian/patches/0009-The-hpfax-CUPS-backend-uses-its-function-bug-which-i.patch27
-rw-r--r--debian/patches/0010-Simplified-the-construction-of-the-title-line-of-the.patch51
-rw-r--r--debian/patches/0011-Make-the-menu-of-the-hp-systray-applet-appearing-whe.patch25
-rw-r--r--debian/patches/0012-Fix-duplex-descriptor-uninitialized.patch43
-rw-r--r--debian/patches/0013-Make-sure-that-the-HPLIP-components-which-access-the.patch101
-rw-r--r--debian/patches/0014-Workaround-patch-for-missing-Python3-transition-of-t.patch147
-rw-r--r--debian/patches/0015-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch150
-rw-r--r--debian/patches/0016-Fix-download-and-installation-of-HP-s-proprietary-pl.patch38
-rw-r--r--debian/patches/0017-In-hp-scan-s-manpage-sort-PAGE_SIZES-in-help-for-the.patch22
-rw-r--r--debian/patches/0018-Install-check-plugin.py-as-a-script.patch29
-rw-r--r--debian/patches/0019-LaserJet-PostScript-4000-PPD-bugfix.patch36
-rw-r--r--debian/patches/0020-Patch-UI-files-to-match-upstream-produced-.py-code.patch65
-rw-r--r--debian/patches/0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch49
-rw-r--r--debian/patches/0022-Fix-list-wrapping-in-scan.py-to-fix-generated-manpag.patch23
-rw-r--r--debian/patches/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch28
-rw-r--r--debian/patches/0024-Make-dat2drv-and-locateppd-build-dependent-of-class-.patch44
-rw-r--r--debian/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch112
-rw-r--r--debian/patches/0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch472
-rw-r--r--debian/patches/0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch40
-rw-r--r--debian/patches/0028-hp-check-Fix-core.distro-vs.-core.distro_name-mixups.patch51
-rw-r--r--debian/patches/0029-Make-base.g.xint-more-generous-in-what-it-can-take.patch28
-rw-r--r--debian/patches/0030-Fix-linking-of-libhpipp-and-the-ext-python-extension.patch58
-rw-r--r--debian/patches/0031-Fix-some-typos-in-BUG-and-DBG-messages.patch95
-rw-r--r--debian/patches/0032-Fix-version-pattern-check-to-support-ghostscript-RC-.patch26
-rw-r--r--debian/patches/0033-Fix-the-PIL.Image-version-check-to-work-with-Pillow-.patch22
-rw-r--r--debian/patches/0034-Don-t-gpg-import-but-rely-on-installed-signing_key.a.patch37
-rw-r--r--debian/patches/0035-Shortcut-distros.dat-finding-to-point-to-where-it-is.patch35
-rw-r--r--debian/patches/0036-Accelerate-HTTP-check-by-doing-a-HEAD-not-a-GET.patch56
-rw-r--r--debian/patches/0037-Enforce-Debian-assumptions.patch139
-rw-r--r--debian/patches/0038-Removed-all-page-size-choices-named-Custom-.-they-br.patch96
-rw-r--r--debian/patches/0039-PY3-Fix-dat2drv.py.patch21
-rw-r--r--debian/patches/series39
40 files changed, 2792 insertions, 0 deletions
diff --git a/debian/patches/0001-Cope-with-prnt-hpcups-ErnieFilter.-cpp-h-removal-by-.patch b/debian/patches/0001-Cope-with-prnt-hpcups-ErnieFilter.-cpp-h-removal-by-.patch
new file mode 100644
index 000000000..e1bab9609
--- /dev/null
+++ b/debian/patches/0001-Cope-with-prnt-hpcups-ErnieFilter.-cpp-h-removal-by-.patch
@@ -0,0 +1,79 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Fri, 22 Jul 2016 09:32:50 +0200
+Subject: Cope with prnt/hpcups/ErnieFilter.{cpp,h} removal by disabling the
+ functionality
+
+Origin: vendor
+---
+ Makefile.am | 2 +-
+ prnt/hpcups/Pcl3Gui2.cpp | 17 -----------------
+ prnt/hpcups/Pcl3Gui2.h | 1 -
+ 3 files changed, 1 insertion(+), 19 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 891660d..54a46b5 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -559,7 +559,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
+ prnt/hpcups/Mode2.cpp prnt/hpcups/Mode2.h prnt/hpcups/Mode3.cpp prnt/hpcups/Mode3.h \
+ prnt/hpcups/Mode9.cpp prnt/hpcups/Mode9.h prnt/hpcups/Mode10.cpp prnt/hpcups/Mode10.h \
+ prnt/hpcups/ModeDeltaPlus.cpp prnt/hpcups/ModeDeltaPlus.h prnt/hpcups/ModeJbig.cpp prnt/hpcups/ModeJbig.h \
+- prnt/hpcups/ErnieFilter.cpp prnt/hpcups/ErnieFilter.h prnt/hpcups/EncapsulatorFactory.cpp prnt/hpcups/EncapsulatorFactory.h \
++ prnt/hpcups/EncapsulatorFactory.cpp prnt/hpcups/EncapsulatorFactory.h \
+ prnt/hpcups/Encapsulator.cpp prnt/hpcups/Encapsulator.h prnt/hpcups/Pcl3.cpp prnt/hpcups/Pcl3.h \
+ prnt/hpcups/Pcl3Gui.cpp prnt/hpcups/Pcl3Gui.h prnt/hpcups/Pcl3Gui2.cpp prnt/hpcups/Pcl3Gui2.h \
+ prnt/hpcups/LJMono.cpp prnt/hpcups/LJMono.h prnt/hpcups/LJColor.cpp prnt/hpcups/LJColor.h \
+diff --git a/prnt/hpcups/Pcl3Gui2.cpp b/prnt/hpcups/Pcl3Gui2.cpp
+index 893bcfd..1678c39 100644
+--- a/prnt/hpcups/Pcl3Gui2.cpp
++++ b/prnt/hpcups/Pcl3Gui2.cpp
+@@ -30,7 +30,6 @@
+
+ #include "CommonDefinitions.h"
+ #include "Pcl3Gui2.h"
+-#include "ErnieFilter.h"
+ #include "Mode10.h"
+ #include "Mode9.h"
+ #include "PrinterCommands.h"
+@@ -38,7 +37,6 @@
+ Pcl3Gui2::Pcl3Gui2() : Encapsulator()
+ {
+ speed_mech_enabled = true;
+- m_run_ernie_filter = true;
+ crd_type = eCrd_both;
+ strcpy(m_szLanguage, "PCL3GUI");
+ }
+@@ -59,21 +57,6 @@ DRIVER_ERROR Pcl3Gui2::Configure(Pipeline **pipeline)
+ }
+
+ width = m_pMA->printable_width;;
+- if (m_run_ernie_filter) {
+- ErnieFilter *pErnie;
+-
+- // Normal: threshold = (resolution) * (0.0876) - 2
+- int threshold = ((m_pQA->horizontal_resolution * 876) / 10000) - 2;
+-
+- pErnie = new ErnieFilter (width, eBGRPixelData, threshold);
+- p = new Pipeline (pErnie);
+- if (head) {
+- head->AddPhase (p);
+- }
+- else {
+- head = p;
+- }
+- }
+
+ if (crd_type != eCrd_black_only) {
+ Mode10 *pMode10;
+diff --git a/prnt/hpcups/Pcl3Gui2.h b/prnt/hpcups/Pcl3Gui2.h
+index 8907078..543f8bd 100644
+--- a/prnt/hpcups/Pcl3Gui2.h
++++ b/prnt/hpcups/Pcl3Gui2.h
+@@ -60,7 +60,6 @@ private:
+ DRIVER_ERROR encapsulateRaster(BYTE *input_raster, unsigned int num_bytes, COLORTYPE c_type);
+ bool speed_mech_enabled;
+ int page_number;
+- bool m_run_ernie_filter;
+ eCrdType crd_type;
+ };
+
diff --git a/debian/patches/0002-Blank-ink-only-patch-by-Richard-Spencer-Smith.patch b/debian/patches/0002-Blank-ink-only-patch-by-Richard-Spencer-Smith.patch
new file mode 100644
index 000000000..46285a1c6
--- /dev/null
+++ b/debian/patches/0002-Blank-ink-only-patch-by-Richard-Spencer-Smith.patch
@@ -0,0 +1,125 @@
+From: Torsten Landschoff <torsten@pulsar.galaxy>
+Date: Fri, 22 Jul 2016 09:32:51 +0200
+Subject: Blank-ink-only patch by Richard Spencer-Smith
+
+---
+ prnt/hpijs/breaks_open.cpp | 5 ++++-
+ prnt/hpijs/dj660_maps.cpp | 5 ++++-
+ prnt/hpijs/dj690_maps.cpp | 5 ++++-
+ prnt/hpijs/dj895_maps.cpp | 5 ++++-
+ prnt/hpijs/dj895_maps2.cpp | 5 ++++-
+ prnt/hpijs/dj970_maps.cpp | 6 +++++-
+ prnt/hpijs/dj970_maps3.cpp | 3 ++-
+ 7 files changed, 27 insertions(+), 7 deletions(-)
+
+diff --git a/prnt/hpijs/breaks_open.cpp b/prnt/hpijs/breaks_open.cpp
+index ebfdb95..4d8fdf4 100644
+--- a/prnt/hpijs/breaks_open.cpp
++++ b/prnt/hpijs/breaks_open.cpp
+@@ -1078,7 +1078,10 @@ const unsigned char HT600x6004level970_open[1024]=
+
+ {
+ 0, 0, 255, 0,
+-0, 1, 255, 0,
++// 2001.06.16 mrb: changed the value to 0. With the original "1"
++// the printer sometimes prints empty lines...
++//0, 1, 255, 0,
++0, 0, 255, 0,
+ 0, 3, 255, 0,
+ 0, 5, 255, 0,
+ 0, 7, 255, 0,
+diff --git a/prnt/hpijs/dj660_maps.cpp b/prnt/hpijs/dj660_maps.cpp
+index 7f29cbb..6da224f 100644
+--- a/prnt/hpijs/dj660_maps.cpp
++++ b/prnt/hpijs/dj660_maps.cpp
+@@ -38,7 +38,10 @@ APDK_BEGIN_NAMESPACE
+ //const
+ uint32_t ulMapDJ660_CCM_KCMY[ 9 * 9 * 9 ]=
+ {
+- 422720226UL, 142187374UL, 94354238UL, 62442785UL, 45668877UL, 27648516UL, 8972032UL, 7335680UL, 5895424UL,
++// 2001.06.14 mrb: Replaced the first entry so the printer will
++// use only the black pen when he should print real black.
++// 422720226UL, 142187374UL, 94354238UL, 62442785UL, 45668877UL, 27648516UL, 8972032UL, 7335680UL, 5895424UL,
++ 226UL, 142187374UL, 94354238UL, 62442785UL, 45668877UL, 27648516UL, 8972032UL, 7335680UL, 5895424UL,
+ 2519110233UL, 807846483UL, 391693109UL, 260029471UL, 143570703UL, 42776580UL, 8501760UL, 7782400UL, 6539520UL,
+ 3072173868UL, 1881129514UL, 841465387UL, 524792087UL, 358391818UL, 174364420UL, 40408577UL, 6920704UL, 6530560UL,
+ 3407591425UL, 2551891200UL, 1612695808UL, 824489479UL, 506699268UL, 306153730UL, 105283329UL, 5144320UL, 5737216UL,
+diff --git a/prnt/hpijs/dj690_maps.cpp b/prnt/hpijs/dj690_maps.cpp
+index a8248c6..df0c527 100644
+--- a/prnt/hpijs/dj690_maps.cpp
++++ b/prnt/hpijs/dj690_maps.cpp
+@@ -38,7 +38,10 @@ APDK_BEGIN_NAMESPACE
+ uint32_t ulMapDJ690_CMYK[ 9 * 9 * 9 ]=
+ // DJ690_CMYK
+ {
+- 337848575UL, 37838470UL, 155209268UL, 137905152UL, 36454656UL, 2310144UL,
++// 2001.06.14 mrb: Replaced the first entry so the printer will
++// use only the black pen when he should print real black.
++// 337848575UL, 37838470UL, 155209268UL, 137905152UL, 36454656UL, 2310144UL,
++ 226UL, 37838470UL, 155209268UL, 137905152UL, 36454656UL, 2310144UL,
+ 2179072UL, 2051072UL, 1733120UL, 2013280119UL, 385897321UL, 303379741UL,
+ 270610688UL, 102772224UL, 1844992UL, 1911552UL, 1847296UL, 1784832UL,
+ 2080387626UL, 1157643294UL, 452996881UL, 335555072UL, 202384384UL, 50991872UL,
+diff --git a/prnt/hpijs/dj895_maps.cpp b/prnt/hpijs/dj895_maps.cpp
+index ff23db5..54da57d 100644
+--- a/prnt/hpijs/dj895_maps.cpp
++++ b/prnt/hpijs/dj895_maps.cpp
+@@ -37,7 +37,10 @@ APDK_BEGIN_NAMESPACE
+
+ uint32_t ulMapDJ895_KCMY[ 9*9*9 ]=
+ {
+-1819176703UL, 79494215UL, 112983330UL, 79035667UL, 78183948UL, 60489224UL, 59571718UL, 42007811UL, 7405312UL,
++// 2001.06.14 mrb: Replaced the first entry so the printer will
++// use only the black pen when he should print real black.
++//1819176703UL, 79494215UL, 112983330UL, 79035667UL, 78183948UL, 60489224UL, 59571718UL, 42007811UL, 7405312UL,
++226UL, 79494215UL, 112983330UL, 79035667UL, 78183948UL, 60489224UL, 59571718UL, 42007811UL, 7405312UL,
+ 4230922555UL, 655358293UL, 176553263UL, 128253208UL, 61209869UL, 60751368UL, 26606852UL, 9305345UL, 8650496UL,
+ 4248940299UL, 3776766759UL, 756415798UL, 308083743UL, 142671120UL, 59440646UL, 9239553UL, 9109248UL, 8779520UL,
+ 4248086274UL, 4214276619UL, 2786390812UL, 942206231UL, 491516427UL, 224131588UL, 6616320UL, 7399168UL, 7857664UL,
+diff --git a/prnt/hpijs/dj895_maps2.cpp b/prnt/hpijs/dj895_maps2.cpp
+index 2f6d857..8ab12d8 100644
+--- a/prnt/hpijs/dj895_maps2.cpp
++++ b/prnt/hpijs/dj895_maps2.cpp
+@@ -163,7 +163,10 @@ uint32_t ulMapDJ895_HB_KCMY[ 9*9*9 ]=
+
+ uint32_t ulMapDJ895_Binary_KCMY[ 9*9*9 ]=
+ {
+-1819176648UL, 64158794UL, 80805158UL, 80215318UL, 62389519UL, 61406730UL,
++// 2001.06.14 mrb: Replaced the first entry so the printer will
++// use only the black pen when he should print real black.
++//1819176648UL, 64158794UL, 80805158UL, 80215318UL, 62389519UL, 61406730UL,
++226UL, 64158794UL, 80805158UL, 80215318UL, 62389519UL, 61406730UL,
+ 60292615UL, 42401028UL, 7601920UL, 4230922301UL, 571406681UL, 160889651UL,
+ 113048859UL, 62717200UL, 45415944UL, 27917573UL, 10419457UL, 9238272UL,
+ 4248940557UL, 3743081259UL, 790296119UL, 325515810UL, 127007505UL, 27196678UL,
+diff --git a/prnt/hpijs/dj970_maps.cpp b/prnt/hpijs/dj970_maps.cpp
+index d5d25d5..1f696f0 100644
+--- a/prnt/hpijs/dj970_maps.cpp
++++ b/prnt/hpijs/dj970_maps.cpp
+@@ -127,7 +127,11 @@ uint32_t ulMapGRAY_K_6x6x1[] =
+
+ uint32_t ulMapDJ970_KCMY[ 9*9*9 ]=
+ {
+- 673723135UL, 26007371UL, 9756717UL, 10020638UL, 10022677UL, 10153743UL,
++// 2003.06.05 rss: Replaced the first entry so the printer will
++// (hopefully) use only the black pen when he should print real black.
++// Please report as a bug if it doesn't, or something worse happens.
++// 673723135UL, 26007371UL, 9756717UL, 10020638UL, 10022677UL, 10153743UL,
++ 226UL, 26007371UL, 9756717UL, 10020638UL, 10022677UL, 10153743UL,
+ 10285066UL, 10416133UL, 9169408UL, 3405886809UL, 59743UL, 23980849UL,
+ 9366812UL, 10153744UL, 10285066UL, 10153990UL, 10087424UL, 9169408UL,
+ 3858807091UL, 2197868343UL, 60220UL, 4714015UL, 7270155UL, 8646656UL,
+diff --git a/prnt/hpijs/dj970_maps3.cpp b/prnt/hpijs/dj970_maps3.cpp
+index fcf3877..04c631b 100644
+--- a/prnt/hpijs/dj970_maps3.cpp
++++ b/prnt/hpijs/dj970_maps3.cpp
+@@ -37,7 +37,8 @@ APDK_BEGIN_NAMESPACE
+
+ uint32_t ulMapDJ970_Draft_KCMY[ 9*9*9 ]=
+ {
+-1802205183UL, 22740362UL, 5832524UL, 5635892UL, 5570340UL, 5308188UL,
++//1802205183UL, 22740362UL, 5832524UL, 5635892UL, 5570340UL, 5308188UL,
++ 226UL, 22740362UL, 5832524UL, 5635892UL, 5570340UL, 5308188UL,
+ 5308180UL, 5504778UL, 5504768UL, 4278239136UL, 65446UL, 4194132UL,
+ 5308210UL, 5373728UL, 5308182UL, 5504784UL, 5504776UL, 5504768UL,
+ 4278498896UL, 1862336354UL, 65388UL, 2621242UL, 4128540UL, 4718348UL,
diff --git a/debian/patches/0003-Fix-missing-charsign.patch b/debian/patches/0003-Fix-missing-charsign.patch
new file mode 100644
index 000000000..767f6ccc6
--- /dev/null
+++ b/debian/patches/0003-Fix-missing-charsign.patch
@@ -0,0 +1,26 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:52 +0200
+Subject: Fix missing charsign
+
+---
+ scan/sane/scl.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/scan/sane/scl.c b/scan/sane/scl.c
+index cc640f4..eccd990 100755
+--- a/scan/sane/scl.c
++++ b/scan/sane/scl.c
+@@ -37,10 +37,11 @@
+ #define DEBUG_DECLARE_ONLY
+ #include "sanei_debug.h"
+
+-static int SclBufferIsPartialReply( unsigned char * data, int datalen )
++static int SclBufferIsPartialReply( void * dataptr, int datalen )
+ {
+ int i = 0, value = 0;
+- unsigned char d;
++ unsigned char * const data = dataptr;
++ unsigned int d;
+
+ if( i >= datalen )
+ {
diff --git a/debian/patches/0004-Corrections-models.dat-entry-for-the-HP-PhotoSmart-P.patch b/debian/patches/0004-Corrections-models.dat-entry-for-the-HP-PhotoSmart-P.patch
new file mode 100644
index 000000000..baa178bb4
--- /dev/null
+++ b/debian/patches/0004-Corrections-models.dat-entry-for-the-HP-PhotoSmart-P.patch
@@ -0,0 +1,97 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:53 +0200
+Subject: Corrections: models.dat entry for the HP PhotoSmart Pro B9100
+
+LP: #213984
+---
+ data/models/models.dat | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 77 insertions(+)
+
+diff --git a/data/models/models.dat b/data/models/models.dat
+index 9e0b43a..0510a1b 100644
+--- a/data/models/models.dat
++++ b/data/models/models.dat
+@@ -52244,6 +52244,83 @@ usb-pid=d12
+ usb-vid=3f0
+ wifi-config=0
+
++[photosmart_pro_b9100_series]
++align-type=1
++clean-type=1
++color-cal-type=3
++copy-type=0
++embedded-server-type=1
++fax-type=0
++fw-download=False
++icon=Photosmart_Pro_B9180.png
++io-mfp-mode=4
++io-mode=1
++io-support=6
++job-storage=0
++linefeed-cal-type=0
++model1=HP Photosmart Pro B9180gp Photo Printer
++model2=HP Photosmart Pro B9180 Photo Printer
++monitor-type=0
++panel-check-type=1
++pcard-type=0
++plugin=0
++plugin-reason=0
++power-settings=0
++pq-diag-type=0
++r-type=0
++r0-agent1-kind=1
++r0-agent1-sku=C9407A
++r0-agent1-type=16
++r0-agent10-kind=2
++r0-agent10-sku=C9417A
++r0-agent10-type=6
++r0-agent11-kind=2
++r0-agent11-sku=C9418A
++r0-agent11-type=7
++r0-agent12-kind=2
++r0-agent12-sku=C9419A
++r0-agent12-type=8
++r0-agent2-kind=1
++r0-agent2-sku=C9406A
++r0-agent2-type=14
++r0-agent3-kind=1
++r0-agent3-sku=C9405A
++r0-agent3-type=13
++r0-agent4-kind=1
++r0-agent4-sku=C9404A
++r0-agent4-type=15
++r0-agent5-kind=2
++r0-agent5-sku=C9412A
++r0-agent5-type=1
++r0-agent6-kind=2
++r0-agent6-sku=C9413A
++r0-agent6-type=19
++r0-agent7-kind=2
++r0-agent7-sku=C9414A
++r0-agent7-type=17
++r0-agent8-kind=2
++r0-agent8-sku=C9415A
++r0-agent8-type=4
++r0-agent9-kind=2
++r0-agent9-sku=C9416A
++r0-agent9-type=5
++scan-src=0
++scan-type=0
++status-battery-check=0
++status-dynamic-counters=0
++status-type=2
++support-released=True
++support-subtype=219b2b
++support-type=2
++support-ver=2.8.4
++tech-class=PSB9100
++family-class=Undefined
++tech-subclass=Normal
++tech-type=2
++usb-pid=bd02
++usb-vid=3f0
++wifi-config=0
++
+ [hp_deskjet_9300]
+ align-type=1
+ clean-type=1
diff --git a/debian/patches/0005-Fixed-short-edge-duplex-for-non-PS-laser-printers.patch b/debian/patches/0005-Fixed-short-edge-duplex-for-non-PS-laser-printers.patch
new file mode 100644
index 000000000..98f2d2473
--- /dev/null
+++ b/debian/patches/0005-Fixed-short-edge-duplex-for-non-PS-laser-printers.patch
@@ -0,0 +1,81 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:54 +0200
+Subject: Fixed short-edge duplex for non-PS laser printers
+
+LP: #244295
+---
+ prnt/hpijs/ljcolor.cpp | 13 +++++++++++++
+ prnt/hpijs/ljjetready.cpp | 11 +++++++++++
+ prnt/hpijs/ljmono.cpp | 13 +++++++++++++
+ 3 files changed, 37 insertions(+)
+
+diff --git a/prnt/hpijs/ljcolor.cpp b/prnt/hpijs/ljcolor.cpp
+index 0ecbfc6..db35e98 100644
+--- a/prnt/hpijs/ljcolor.cpp
++++ b/prnt/hpijs/ljcolor.cpp
+@@ -330,6 +330,19 @@ DRIVER_ERROR HeaderLJColor::StartSend ()
+
+ err = thePrinter->Send ((const BYTE *) res, strlen (res));
+
++// Binding directive
++
++ strcpy (res, "@PJL SET BINDING=LONGEDGE\015\012");
++
++#ifdef APDK_AUTODUPLEX
++ if (thePrintContext->QueryDuplexMode () == DUPLEXMODE_TABLET)
++ {
++ strcpy (res, "@PJL SET BINDING=SHORTEDGE\015\012");
++ }
++#endif
++
++ err = thePrinter->Send ((const BYTE *) res, strlen (res));
++
+
+ err = thePrinter->Send ((const BYTE*) EnterLanguage, sizeof (EnterLanguage));
+ ERRCHECK;
+diff --git a/prnt/hpijs/ljjetready.cpp b/prnt/hpijs/ljjetready.cpp
+index 6942d29..d79d409 100644
+--- a/prnt/hpijs/ljjetready.cpp
++++ b/prnt/hpijs/ljjetready.cpp
+@@ -329,6 +329,17 @@ DRIVER_ERROR HeaderLJJetReady::StartSend ()
+ err = thePrinter->Send ((const BYTE *) szScratchStr, strlen (szScratchStr));
+ ERRCHECK;
+
++ // Send the Binding command
++ strcpy (szScratchStr, "@PJL SET BINDING=LONGEDGE\015\012");
++#ifdef APDK_AUTODUPLEX
++ if (thePrintContext->QueryDuplexMode () == DUPLEXMODE_TABLET)
++ {
++ strcpy (szScratchStr, "@PJL SET BINDING=SHORTEDGE\015\012");
++ }
++#endif
++ err = thePrinter->Send ((const BYTE *) szScratchStr, strlen (szScratchStr));
++ ERRCHECK;
++
+ //Set the resolution to 600
+ err = thePrinter->Send ((const BYTE*)ccpPJLSetRes,sizeof(ccpPJLSetRes));
+ ERRCHECK;
+diff --git a/prnt/hpijs/ljmono.cpp b/prnt/hpijs/ljmono.cpp
+index 67a0077..8d3ad4d 100644
+--- a/prnt/hpijs/ljmono.cpp
++++ b/prnt/hpijs/ljmono.cpp
+@@ -212,6 +212,19 @@ DRIVER_ERROR HeaderLJMono::StartSend ()
+ err = thePrinter->Send ((const BYTE *) res, strlen (res));
+ ERRCHECK;
+
++// Binding directive
++
++ strcpy (res, "@PJL SET BINDING=LONGEDGE\015\012");
++
++#ifdef APDK_AUTODUPLEX
++ if (thePrintContext->QueryDuplexMode () == DUPLEXMODE_TABLET)
++ {
++ strcpy (res, "@PJL SET BINDING=SHORTEDGE\015\012");
++ }
++#endif
++ err = thePrinter->Send ((const BYTE *) res, strlen (res));
++ ERRCHECK;
++
+ err = thePrinter->Send ((const BYTE*) EnterLanguage, sizeof (EnterLanguage));
+ ERRCHECK;
+
diff --git a/debian/patches/0006-Make-simple-scan-the-default-scanning-frontend.patch b/debian/patches/0006-Make-simple-scan-the-default-scanning-frontend.patch
new file mode 100644
index 000000000..947b9bc04
--- /dev/null
+++ b/debian/patches/0006-Make-simple-scan-the-default-scanning-frontend.patch
@@ -0,0 +1,56 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:55 +0200
+Subject: Make simple-scan the default scanning frontend
+
+LP: #539015
+---
+ base/utils.py | 17 ++++++++++-------
+ ui5/ui_utils.py | 2 +-
+ 2 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/base/utils.py b/base/utils.py
+index f268cf8..9f9cfb1 100644
+--- a/base/utils.py
++++ b/base/utils.py
+@@ -566,18 +566,21 @@ class UserSettings(object): # Note: Deprecated after 2.8.8 in Qt4 (see ui4/ui_ut
+
+ # Scan
+ self.cmd_scan = ''
+- path = which('xsane')
+-
++ path = which('simple-scan')
+ if len(path) > 0:
+- self.cmd_scan = 'xsane -V %SANE_URI%'
++ self.cmd_scan = 'simple-scan %SANE_URI%'
+ else:
+- path = which('kooka')
++ path = which('xsane')
+ if len(path) > 0:
+- self.cmd_scan = 'kooka'
++ self.cmd_scan = 'xsane -V %SANE_URI%'
+ else:
+- path = which('xscanimage')
++ path = which('kooka')
+ if len(path) > 0:
+- self.cmd_scan = 'xscanimage'
++ self.cmd_scan = 'kooka'
++ else:
++ path = which('xscanimage')
++ if len(path) > 0:
++ self.cmd_scan = 'xscanimage'
+
+ # Photo Card
+ path = which('hp-unload')
+diff --git a/ui5/ui_utils.py b/ui5/ui_utils.py
+index caba339..865d6eb 100644
+--- a/ui5/ui_utils.py
++++ b/ui5/ui_utils.py
+@@ -205,7 +205,7 @@ class UserSettings(QSettings):
+ return ''
+
+ def loadDefaults(self):
+- self.cmd_scan = self.__setup(['xsane -V %SANE_URI%', 'kooka', 'xscanimage'])
++ self.cmd_scan = self.__setup(['simple-scan %SANE_URI%', 'xsane -V %SANE_URI%', 'kooka', 'xscanimage'])
+ self.cmd_fab = self.__setup(['hp-fab'])
+
+
diff --git a/debian/patches/0007-Try-libhpmud.so.0-directly.patch b/debian/patches/0007-Try-libhpmud.so.0-directly.patch
new file mode 100644
index 000000000..7c2131290
--- /dev/null
+++ b/debian/patches/0007-Try-libhpmud.so.0-directly.patch
@@ -0,0 +1,52 @@
+From: Evgeny Golov <evgeni@debian.org>
+Date: Fri, 22 Jul 2016 09:32:56 +0200
+Subject: Try libhpmud.so.0 directly
+
+It's the library we ship.
+
+Closes: #600670
+---
+ scan/sane/marvell.c | 2 +-
+ scan/sane/soap.c | 2 +-
+ scan/sane/soapht.c | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scan/sane/marvell.c b/scan/sane/marvell.c
+index ad267a3..6cac67a 100644
+--- a/scan/sane/marvell.c
++++ b/scan/sane/marvell.c
+@@ -60,7 +60,7 @@ static int bb_load(struct marvell_session *ps, const char *so)
+ int stat=1;
+
+ /* Load hpmud manually with symbols exported. Otherwise the plugin will not find it. */
+- if ((ps->hpmud_handle = load_library("libhpmud.so")) == NULL)
++ if ((ps->hpmud_handle = dlopen("libhpmud.so.0", RTLD_LAZY|RTLD_GLOBAL)) == NULL)
+ {
+ if ((ps->hpmud_handle = load_library("libhpmud.so.0")) == NULL)
+ goto bugout;
+diff --git a/scan/sane/soap.c b/scan/sane/soap.c
+index 07106fe..a45f1a0 100644
+--- a/scan/sane/soap.c
++++ b/scan/sane/soap.c
+@@ -68,7 +68,7 @@ static int bb_load(struct soap_session *ps, const char *so)
+ int stat=1;
+
+ /* Load hpmud manually with symbols exported. Otherwise the plugin will not find it. */
+- if ((ps->hpmud_handle = load_library("libhpmud.so")) == NULL)
++ if ((ps->hpmud_handle = dlopen("libhpmud.so.0", RTLD_LAZY|RTLD_GLOBAL)) == NULL)
+ {
+ if ((ps->hpmud_handle = load_library("libhpmud.so.0")) == NULL)
+ goto bugout;
+diff --git a/scan/sane/soapht.c b/scan/sane/soapht.c
+index 269ab21..df0e807 100644
+--- a/scan/sane/soapht.c
++++ b/scan/sane/soapht.c
+@@ -62,7 +62,7 @@ static int bb_load(struct soap_session *ps, const char *so)
+ int stat=1;
+
+ /* Load hpmud manually with symbols exported. Otherwise the plugin will not find it. */
+- if ((ps->hpmud_handle = load_library("libhpmud.so.0")) == NULL)
++ if ((ps->hpmud_handle = dlopen("libhpmud.so.0", RTLD_LAZY|RTLD_GLOBAL)) == NULL)
+ {
+ if ((ps->hpmud_handle = load_library("libhpmud.so.0")) == NULL)
+ goto bugout;
diff --git a/debian/patches/0008-For-the-Lidil-printers-enable-two-cartridge-modes-bl.patch b/debian/patches/0008-For-the-Lidil-printers-enable-two-cartridge-modes-bl.patch
new file mode 100644
index 000000000..efe1cdcab
--- /dev/null
+++ b/debian/patches/0008-For-the-Lidil-printers-enable-two-cartridge-modes-bl.patch
@@ -0,0 +1,71 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:58 +0200
+Subject: For the Lidil printers,
+ enable two-cartridge modes (black and color cartridge) in the hpcups driver
+ and assign the choices of the "Printout Mode" option to two-cartridge modes
+ in the hpijs driver
+
+LP: #235399
+---
+ prnt/drv/hpijs.drv.in.template | 20 ++++++++++----------
+ 1 file changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/prnt/drv/hpijs.drv.in.template b/prnt/drv/hpijs.drv.in.template
+index 3ae87af..0c60fdc 100644
+--- a/prnt/drv/hpijs.drv.in.template
++++ b/prnt/drv/hpijs.drv.in.template
+@@ -2220,16 +2220,16 @@ le=- -"
+ r=&quot;HEWLETT-PACKARD&quot; -sDeviceModel=&quot;deskjet 3320&quot;"
+ Attribute "FoomaticRIPOption" "PrintoutMode" "enum Composite B"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft" "Quality=300DraftColorCM&&
+-Y"
++YK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft.Gray" "Quality=300DraftGr&&
+ ayscaleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=300ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=300ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal.Gray" "Quality=300Graysc&&
+ aleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High.Gray" "Quality=600Grayscal&&
+ eK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Photo" "Quality=600PhotoCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Photo" "Quality=600PhotoCMYK"
+ Attribute "FoomaticRIPOption" "PageSize" "enum CmdLine A"
+ Attribute "FoomaticRIPOptionSetting" "PageSize=Letter" " -dDEVICEWIDTHPOINTS=612 -&&
+ dDEVICEHEIGHTPOINTS=792"
+@@ -2402,13 +2402,13 @@ le=- -"
+ r=&quot;HEWLETT-PACKARD&quot; -sDeviceModel=&quot;deskjet 3600&quot;"
+ Attribute "FoomaticRIPOption" "PrintoutMode" "enum Composite B"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft" "Quality=300DraftColorCM&&
+-Y"
++YK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft.Gray" "Quality=300DraftGr&&
+ ayscaleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=300ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=300ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal.Gray" "Quality=300Graysc&&
+ aleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High.Gray" "Quality=600Grayscal&&
+ eK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Photo" "Quality=600PhotoCMYKFul&&
+@@ -2598,13 +2598,13 @@ er=&quot;HEWLETT-PACKARD&quot; -sDeviceModel=&quot;Deskjet D4100&quot;&&
+ "
+ Attribute "FoomaticRIPOption" "PrintoutMode" "enum Composite B"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft" "Quality=600DraftColorCM&&
+-Y"
++YK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Draft.Gray" "Quality=600DraftGr&&
+ ayscaleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=600ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal" "Quality=600ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Normal.Gray" "Quality=600Graysc&&
+ aleK"
+- Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMY"
++ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High" "Quality=600ColorCMYK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=High.Gray" "Quality=600Grayscal&&
+ eK"
+ Attribute "FoomaticRIPOptionSetting" "PrintoutMode=Photo" "Quality=600PhotoCMYKFul&&
diff --git a/debian/patches/0009-The-hpfax-CUPS-backend-uses-its-function-bug-which-i.patch b/debian/patches/0009-The-hpfax-CUPS-backend-uses-its-function-bug-which-i.patch
new file mode 100644
index 000000000..4ab70edd8
--- /dev/null
+++ b/debian/patches/0009-The-hpfax-CUPS-backend-uses-its-function-bug-which-i.patch
@@ -0,0 +1,27 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:32:59 +0200
+Subject: The hpfax CUPS backend uses its function bug() (which in turnuses
+ log()) before log() gets imported (with base.g). Made use of log() in bug()
+ optional
+
+LP: #560849
+---
+ fax/backend/hpfax.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/fax/backend/hpfax.py b/fax/backend/hpfax.py
+index 9560e84..7aaef35 100755
+--- a/fax/backend/hpfax.py
++++ b/fax/backend/hpfax.py
+@@ -55,7 +55,10 @@ home_dir = ''
+
+ def bug(msg):
+ syslog.syslog("hpfax[%d]: error: %s\n" % (pid, msg))
+- log.stderr("ERROR: %s\n" % msg)
++ try:
++ log.stderr("ERROR: %s\n" % msg)
++ except:
++ print >> sys.stderr, ("ERROR: %s\n" % msg)
+
+
+ if os.path.exists(config_file):
diff --git a/debian/patches/0010-Simplified-the-construction-of-the-title-line-of-the.patch b/debian/patches/0010-Simplified-the-construction-of-the-title-line-of-the.patch
new file mode 100644
index 000000000..c3416ee06
--- /dev/null
+++ b/debian/patches/0010-Simplified-the-construction-of-the-title-line-of-the.patch
@@ -0,0 +1,51 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:33:00 +0200
+Subject: Simplified the construction of the title line of the hp-systray
+ applet menu,
+ so that the applet-to-indicator converter sni-qt also imports this title
+ line (at least the text of it).
+
+Thanks to Aurelien Gateau for this patch.
+---
+ ui5/systemtray.py | 25 ++++---------------------
+ 1 file changed, 4 insertions(+), 21 deletions(-)
+
+diff --git a/ui5/systemtray.py b/ui5/systemtray.py
+index 5b69d2b..8888dec 100644
+--- a/ui5/systemtray.py
++++ b/ui5/systemtray.py
+@@ -442,30 +442,13 @@ class SystemTrayApp(QApplication):
+ def setMenu(self):
+ self.menu = QMenu()
+
+- title = QWidgetAction(self.menu)
++ title = QAction(self.menu)
+ #title.setDisabled(True)
+
+- hbox = QFrame(self.menu)
+- layout = QHBoxLayout(hbox)
+- # layout.setMargin(3)
+- layout.setContentsMargins(3, 3, 3, 3)
+- layout.setSpacing(5)
+- pix_label = QLabel(hbox)
+
+- layout.insertWidget(-1, pix_label, 0)
+-
+- icon_size = self.menu.style().pixelMetric(QStyle.PM_SmallIconSize)
+- pix_label.setPixmap(self.prop_icon.pixmap(icon_size))
+-
+- label = QLabel(hbox)
+- layout.insertWidget(-1, label, 20)
+- title.setDefaultWidget(hbox)
+-
+- label.setText(self.__tr("HPLIP Status Service"))
+-
+- f = label.font()
+- f.setBold(True)
+- label.setFont(f)
++ title.setText(self.__tr("HPLIP Status Service"))
++ title.setIcon(self.prop_icon)
++ title.setIconVisibleInMenu(True)
+ self.menu.insertAction(None, title)
+
+ if devices:
diff --git a/debian/patches/0011-Make-the-menu-of-the-hp-systray-applet-appearing-whe.patch b/debian/patches/0011-Make-the-menu-of-the-hp-systray-applet-appearing-whe.patch
new file mode 100644
index 000000000..2590fddf0
--- /dev/null
+++ b/debian/patches/0011-Make-the-menu-of-the-hp-systray-applet-appearing-whe.patch
@@ -0,0 +1,25 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:33:01 +0200
+Subject: Make the menu of the hp-systray applet appearing when the applet is
+ converted to an indicator applet by sni-qt and put into the notification
+ area of KDE
+
+LP: #857929
+---
+ ui5/systemtray.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/ui5/systemtray.py b/ui5/systemtray.py
+index 8888dec..ec3574f 100644
+--- a/ui5/systemtray.py
++++ b/ui5/systemtray.py
+@@ -576,6 +576,9 @@ class SystemTrayApp(QApplication):
+
+ elif reason == QSystemTrayIcon.Trigger:
+ #print "single click"
++ self.updateMenu()
++ if not self.menu is None:
++ self.menu.popup(QCursor.pos())
+ pass
+
+ elif reason == QSystemTrayIcon.MiddleClick:
diff --git a/debian/patches/0012-Fix-duplex-descriptor-uninitialized.patch b/debian/patches/0012-Fix-duplex-descriptor-uninitialized.patch
new file mode 100644
index 000000000..b43f28768
--- /dev/null
+++ b/debian/patches/0012-Fix-duplex-descriptor-uninitialized.patch
@@ -0,0 +1,43 @@
+From: Matej Vela <vela@debian.org>
+Date: Fri, 22 Jul 2016 09:33:02 +0200
+Subject: Fix "duplex descriptor uninitialized"
+
+Closes: #583273
+---
+ scan/sane/sclpml.c | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/scan/sane/sclpml.c b/scan/sane/sclpml.c
+index 9a5975f..61500da 100644
+--- a/scan/sane/sclpml.c
++++ b/scan/sane/sclpml.c
+@@ -1084,20 +1084,17 @@ static void init_options( hpaioScanner_t hpaio )
+ hpaio->option[OPTION_ADF_MODE].constraint_type = SANE_CONSTRAINT_STRING_LIST;
+ hpaio->option[OPTION_ADF_MODE].constraint.string_list = hpaio->adfModeList;
+
+- // Duplex scanning is supported
+- if (hpaio->supportsDuplex == 1)
+- {
+- hpaio->option[OPTION_DUPLEX].name = STR_NAME_DUPLEX;
+- hpaio->option[OPTION_DUPLEX].title = STR_TITLE_DUPLEX;
+- hpaio->option[OPTION_DUPLEX].desc = STR_DESC_DUPLEX;
+- hpaio->option[OPTION_DUPLEX].type = SANE_TYPE_BOOL;
+- hpaio->option[OPTION_DUPLEX].unit = SANE_UNIT_NONE;
+- hpaio->option[OPTION_DUPLEX].size = sizeof( SANE_Bool );
+- hpaio->option[OPTION_DUPLEX].cap = SANE_CAP_SOFT_SELECT |
++ hpaio->option[OPTION_DUPLEX].name = STR_NAME_DUPLEX;
++ hpaio->option[OPTION_DUPLEX].title = STR_TITLE_DUPLEX;
++ hpaio->option[OPTION_DUPLEX].desc = STR_DESC_DUPLEX;
++ hpaio->option[OPTION_DUPLEX].type = SANE_TYPE_BOOL;
++ hpaio->option[OPTION_DUPLEX].unit = SANE_UNIT_NONE;
++ hpaio->option[OPTION_DUPLEX].size = sizeof( SANE_Bool );
++ hpaio->option[OPTION_DUPLEX].cap = SANE_CAP_SOFT_SELECT |
+ SANE_CAP_SOFT_DETECT |
+ SANE_CAP_ADVANCED;
+- hpaio->option[OPTION_DUPLEX].constraint_type = SANE_CONSTRAINT_NONE;
+- }
++ hpaio->option[OPTION_DUPLEX].constraint_type = SANE_CONSTRAINT_NONE;
++
+ hpaio->option[GROUP_GEOMETRY].title = STR_TITLE_GEOMETRY;
+ hpaio->option[GROUP_GEOMETRY].type = SANE_TYPE_GROUP;
+ hpaio->option[GROUP_GEOMETRY].cap = SANE_CAP_ADVANCED;
diff --git a/debian/patches/0013-Make-sure-that-the-HPLIP-components-which-access-the.patch b/debian/patches/0013-Make-sure-that-the-HPLIP-components-which-access-the.patch
new file mode 100644
index 000000000..d72a37b67
--- /dev/null
+++ b/debian/patches/0013-Make-sure-that-the-HPLIP-components-which-access-the.patch
@@ -0,0 +1,101 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:33:03 +0200
+Subject: Make sure that the HPLIP components which access the USB (especially
+ the CUPS backends "hp" and "hpfax") do not crash when libusb fails to
+ connect to the USB,
+ for example on machines without USB or with the USB kernel modules not
+ loaded
+
+LP: #1302437
+---
+ io/hpmud/musb.c | 32 +++++++++++++++++++++-----------
+ 1 file changed, 21 insertions(+), 11 deletions(-)
+
+diff --git a/io/hpmud/musb.c b/io/hpmud/musb.c
+index 6e99c15..fe5d50f 100644
+--- a/io/hpmud/musb.c
++++ b/io/hpmud/musb.c
+@@ -695,7 +695,8 @@ static libusb_device *get_libusb_device(const char *uri)
+ int numdevs = 0; /* number of connected devices */
+ int i, conf, iface, altset ;
+
+- libusb_init(&libusb_ctx);
++ i = libusb_init(&libusb_ctx);
++ if (i) goto bugout;
+ numdevs = libusb_get_device_list(libusb_ctx, &libusb_dev_list);
+ for (i=0; i< numdevs; i++)
+ {
+@@ -2054,7 +2055,8 @@ int __attribute__ ((visibility ("hidden"))) musb_probe_devices(char *lst, int ls
+ char serial[128], mfg[128], sz[HPMUD_LINE_SIZE];
+ int r, size=0;
+
+- libusb_init(&ctx);
++ i = libusb_init(&ctx);
++ if (i) goto bugout;
+ numdevs = libusb_get_device_list(ctx, &list);
+
+ if (numdevs <= 0)
+@@ -2155,12 +2157,14 @@ int __attribute__ ((visibility ("hidden"))) musb_probe_devices(char *lst, int ls
+ }//end for loop
+
+ bugout:
+- if (!hd)
++ if (hd)
+ libusb_close(hd);
+ if (confptr)
+ libusb_free_config_descriptor(confptr);
+- libusb_free_device_list(list, 1);
+- libusb_exit(ctx);
++ if (list)
++ libusb_free_device_list(list, 1);
++ if (ctx)
++ libusb_exit(ctx);
+
+ return size;
+ }
+@@ -2186,7 +2190,8 @@ enum HPMUD_RESULT hpmud_make_usb_uri(const char *busnum, const char *devnum, cha
+
+ *bytes_read=0;
+
+- libusb_init(&ctx);
++ i = libusb_init(&ctx);
++ if (i) goto bugout;
+ numdevs = libusb_get_device_list(ctx, &list);
+
+ if (numdevs <= 0)
+@@ -2289,8 +2294,10 @@ bugout:
+ if (hd != NULL)
+ libusb_close(hd);
+
+- libusb_free_device_list(list, 1);
+- libusb_exit(ctx);
++ if (list)
++ libusb_free_device_list(list, 1);
++ if (ctx)
++ libusb_exit(ctx);
+
+ return stat;
+ }
+@@ -2309,7 +2316,8 @@ enum HPMUD_RESULT hpmud_make_usb_serial_uri(const char *sn, char *uri, int uri_s
+
+ *bytes_read=0;
+
+- libusb_init(&ctx);
++ i = libusb_init(&ctx);
++ if (i) goto bugout;
+ numdevs = libusb_get_device_list(ctx, &list);
+
+ if (numdevs <= 0)
+@@ -2335,8 +2343,10 @@ enum HPMUD_RESULT hpmud_make_usb_serial_uri(const char *sn, char *uri, int uri_s
+ stat = HPMUD_R_OK;
+
+ bugout:
+- libusb_free_device_list(list, 1);
+- libusb_exit(ctx);
++ if (list)
++ libusb_free_device_list(list, 1);
++ if (ctx)
++ libusb_exit(ctx);
+
+ return stat;
+ }
diff --git a/debian/patches/0014-Workaround-patch-for-missing-Python3-transition-of-t.patch b/debian/patches/0014-Workaround-patch-for-missing-Python3-transition-of-t.patch
new file mode 100644
index 000000000..b79f0c017
--- /dev/null
+++ b/debian/patches/0014-Workaround-patch-for-missing-Python3-transition-of-t.patch
@@ -0,0 +1,147 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:33:04 +0200
+Subject: Workaround patch for missing Python3 transition of the old
+ (pre-USB-storage) photo memory card support (pcardext) as this part builds
+ in Python3 environments but with pointer-related warnings which are fatal
+ errors for Ubuntu's build servers. The patch silences the warnings but the
+ memory card support is dropped in Python3 environments. This patch is
+ supplied by the HPLIP upstream developers and will be replaced by a more
+ proper solution in the next upstream release of HPLIP (see LP: #1275353)
+
+---
+ pcard/pcardext/pcardext.c | 59 +++++++++++++++++++++++++++++++++++++----------
+ pcard/photocard.py | 2 +-
+ unload.py | 5 ++++
+ 3 files changed, 53 insertions(+), 13 deletions(-)
+
+diff --git a/pcard/pcardext/pcardext.c b/pcard/pcardext/pcardext.c
+index c1a8273..37d979b 100644
+--- a/pcard/pcardext/pcardext.c
++++ b/pcard/pcardext/pcardext.c
+@@ -20,7 +20,7 @@ pcardext - Python extension for HP photocard services
+ Requires:
+ Python 2.2+
+
+-Author: Don Welch
++Author: Don Welch
+
+ \*****************************************************************************/
+
+@@ -38,9 +38,37 @@ typedef int Py_ssize_t;
+
+ int verbose=0;
+
++#if PY_MAJOR_VERSION >= 3
++ #define MOD_ERROR_VAL NULL
++ #define MOD_SUCCESS_VAL(val) val
++ #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
++ #define PyInt_AS_LONG PyLong_AS_LONG
++ #define MOD_DEF(ob, name, doc, methods) \
++ static struct PyModuleDef moduledef = { \
++ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \
++ ob = PyModule_Create(&moduledef);
++
++
++ #define PY_String_Bytes PyBytes_FromStringAndSize
++ #define PY_AsString_Bytes PyBytes_AsStringAndSize
++
++#else
++ #define MOD_ERROR_VAL
++ #define MOD_SUCCESS_VAL(val)
++ #define MOD_INIT(name) void init##name(void)
++ #define MOD_DEF(ob, name, doc, methods) \
++ ob = Py_InitModule3(name, methods, doc);
++
++ #define PY_String_Bytes PyString_FromStringAndSize
++ #define PY_AsString_Bytes PyString_AsStringAndSize
++
++#endif
++
+ PyObject * readsectorFunc = NULL;
+ PyObject * writesectorFunc = NULL;
+
++
++
+ int ReadSector(int sector, int nsector, void *buf, int size)
+ {
+ PyObject * result;
+@@ -56,9 +84,13 @@ int ReadSector(int sector, int nsector, void *buf, int size)
+ if( result )
+ {
+ Py_ssize_t len = 0;
+- PyString_AsStringAndSize( result, &result_str, &len );
++
++ //PyString_AsStringAndSize( result, &result_str, &len );
++ //PyBytes_AsStringAndSize( result, &result_str, &len );
++ PY_AsString_Bytes( result, &result_str, &len );
+
+- if( len < nsector*FAT_HARDSECT )
++
++ if( len < nsector*FAT_HARDSECT )
+ {
+ goto abort;
+ }
+@@ -205,7 +237,9 @@ PyObject * pcardext_read( PyObject * self, PyObject * args )
+
+ if( FatReadFileExt( name, offset, len, buffer ) == len )
+ {
+- return PyString_FromStringAndSize( (char *)buffer, len );
++ // return PyString_FromStringAndSize( (char *)buffer, len );
++ return PY_String_Bytes( (char *)buffer, len );
++ // return PyBytes_FromStringAndSize( (char *)buffer, len );
+ }
+ else
+ {
+@@ -233,14 +267,15 @@ static PyMethodDef pcardext_methods[] =
+
+ static char pcardext_documentation[] = "Python extension for HP photocard services";
+
+-void initpcardext( void )
+-{
+- PyObject * mod = Py_InitModule4( "pcardext", pcardext_methods,
+- pcardext_documentation, (PyObject*)NULL,
+- PYTHON_API_VERSION );
+-
+- if (mod == NULL)
+- return;
++MOD_INIT(pcardext) {
++
++ PyObject* mod ;
++ MOD_DEF(mod, "pcardext", pcardext_documentation, pcardext_methods);
++ if (mod == NULL)
++ return MOD_ERROR_VAL;
++
++ return MOD_SUCCESS_VAL(mod);
++
+ }
+
+
+diff --git a/pcard/photocard.py b/pcard/photocard.py
+index 913dc4e..2c73158 100644
+--- a/pcard/photocard.py
++++ b/pcard/photocard.py
+@@ -30,7 +30,7 @@ from base.codes import *
+ from base import device, utils, exif
+
+ try:
+- from . import pcardext
++ import pcardext
+ except ImportError:
+ if not os.getenv("HPLIP_BUILD"):
+ log.error("PCARDEXT could not be loaded. Please check HPLIP installation.")
+diff --git a/unload.py b/unload.py
+index 3fdd5a3..ce8b069 100755
+--- a/unload.py
++++ b/unload.py
+@@ -44,6 +44,11 @@ except ImportError:
+
+ # Local
+ from base.g import *
++from base.sixext import PY3
++if PY3:
++ log.error("This functionality is not spported in python3 environment.")
++ sys.exit(1)
++
+ from base import device, utils, tui, module
+ from prnt import cups
+
diff --git a/debian/patches/0015-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch b/debian/patches/0015-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
new file mode 100644
index 000000000..4da93880b
--- /dev/null
+++ b/debian/patches/0015-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
@@ -0,0 +1,150 @@
+From: =?utf-8?b?THVib8WhIERvbGXFvmVs?= <lubos@dolezel.info>
+Date: Fri, 22 Jul 2016 09:33:05 +0200
+Subject: Allow non-JPEG scanning on the HP DeskJet 3520 All-in-One and
+ similar devices
+
+LP: #1245578
+---
+ scan/sane/bb_ledm.c | 47 +++++++++++++++++++++++++++++++++++++++++------
+ scan/sane/ledm.c | 12 +++++++-----
+ 2 files changed, 48 insertions(+), 11 deletions(-)
+
+diff --git a/scan/sane/bb_ledm.c b/scan/sane/bb_ledm.c
+index b233d1e..27d73a0 100644
+--- a/scan/sane/bb_ledm.c
++++ b/scan/sane/bb_ledm.c
+@@ -189,7 +189,7 @@ Keep-Alive: 20\r\nProxy-Connection: keep-alive\r\nCookie: AccessCounter=new\r\n0
+ <YStart>%d</YStart>\
+ <Height>%d</Height>\
+ <Format>%s</Format>\
+-<CompressionQFactor>15</CompressionQFactor>\
++<CompressionQFactor>0</CompressionQFactor>\
+ <ColorSpace>%s</ColorSpace>\
+ <BitDepth>%d</BitDepth>\
+ <InputSource>%s</InputSource>\
+@@ -234,6 +234,38 @@ Keep-Alive: 300\r\nProxy-Connection: keep-alive\r\nCookie: AccessCounter=new\r\n
+ # define JOBSTATE_COMPLETED "<j:JobState>Completed</j:JobState>"
+ # define PRESCANPAGE "<PreScanPage>"
+
++static int parse_status_elements(const char *payload, int size, struct wscn_create_scan_job_response *resp)
++{
++ char tag[512];
++ char value[128];
++ char *tail=(char *)payload;
++
++ while (1)
++ {
++ get_tag(tail, size-(tail-payload), tag, sizeof(tag), &tail);
++
++ if (!tag[0])
++ break;
++
++ if (strncmp(tag, "ImageWidth", 10) == 0)
++ {
++ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
++ resp->pixels_per_line = strtol(value, NULL, 10);
++ }
++ else if (strncmp(tag, "ImageHeight", 11) == 0)
++ {
++ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
++ resp->lines = strtol(value, NULL, 10);
++ }
++ else if (strncmp(tag, "BytesPerLine", 12) == 0)
++ {
++ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
++ resp->bytes_per_line = strtol(value, NULL, 10);
++ }
++ }
++ return 0;
++}
++
+ static int parse_scan_elements(const char *payload, int size, struct wscn_scan_elements *elements)
+ {
+ char tag[512];
+@@ -762,8 +794,7 @@ int bb_get_parameters(struct ledm_session *ps, SANE_Parameters *pp, int option)
+ if (ps->currentCompression == SF_RAW && ps->currentScanMode != CE_GRAY8)
+ {
+ /* Set scan parameters based on scan job response values */
+- //pp->lines = pbb->job.lines;
+- pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
++ pp->lines = pbb->job.lines;
+ pp->pixels_per_line = pbb->job.pixels_per_line;
+ pp->bytes_per_line = pbb->job.bytes_per_line;
+ }
+@@ -784,8 +815,8 @@ int bb_get_parameters(struct ledm_session *ps, SANE_Parameters *pp, int option)
+ break;
+ case SPO_BEST_GUESS: /* called by xsane & sane_start */
+ /* Set scan parameters based on best guess. */
+- pp->lines = (int)round(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
+- pp->pixels_per_line = (int)round(SANE_UNFIX(ps->effectiveBrx -ps->effectiveTlx)/MM_PER_INCH*ps->currentResolution);
++ pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
++ pp->pixels_per_line = ps->image_traits.iPixelsPerRow;
+ pp->bytes_per_line = BYTES_PER_LINE(pp->pixels_per_line, pp->depth * factor);
+ break;
+ default:
+@@ -889,7 +920,7 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
+ (int) ((ps->currentBrx / 5548.7133) - (ps->currentTlx / 5548.7133)),//<Width>
+ (int) (ps->currentTly / 5548.7133),//<YStart>
+ (int) ((ps->currentBry / 5548.7133) - (ps->currentTly / 5548.7133)),//<Height>
+- "Jpeg",//<Format>
++ (ps->currentCompression == SF_RAW) ? "Raw" : "Jpeg", //<Format>
+ (! strcmp(ce_element[ps->currentScanMode], "Color8")) ? "Color" : (! strcmp(ce_element[ps->currentScanMode], "Gray8")) ? "Gray" : "Gray",//<ColorSpace>
+ ((! strcmp(ce_element[ps->currentScanMode], "Color8")) || (! strcmp(ce_element[ps->currentScanMode], "Gray8"))) ? 8: 8,//<BitDepth>
+ ps->currentInputSource == IS_PLATEN ? is_element[1] : is_element[2],//<InputSource>
+@@ -987,6 +1018,7 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
+ _DBG("bb_start_scan() read_http_payload FAILED len=%d buf=%s\n", len, buf);
+ break;
+ }
++
+ //For a new scan, buf must contain <PreScanPage>.
+ if (NULL == strstr(buf,PRESCANPAGE))
+ { //i.e Paper is not present in Scanner
+@@ -1005,6 +1037,9 @@ SANE_Status bb_start_scan(struct ledm_session *ps)
+ stat = SANE_STATUS_GOOD;
+ goto bugout;
+ }
++ // Parse buf here
++ parse_status_elements(buf, len, &pbb->job);
++
+ usleep(500000);//0.5 sec delay
+ }//end while()
+
+diff --git a/scan/sane/ledm.c b/scan/sane/ledm.c
+index 9a1ff02..8f04338 100644
+--- a/scan/sane/ledm.c
++++ b/scan/sane/ledm.c
+@@ -170,11 +170,11 @@ static int set_scan_mode_side_effects(struct ledm_session *ps, enum COLOR_ENTRY
+ case CE_GRAY8:
+ case CE_COLOR8:
+ default:
+-// ps->compressionList[j] = STR_COMPRESSION_NONE;
+-// ps->compressionMap[j++] = SF_RAW;
++ ps->compressionList[j] = STR_COMPRESSION_NONE;
++ ps->compressionMap[j++] = SF_RAW;
+ ps->compressionList[j] = STR_COMPRESSION_JPEG;
+ ps->compressionMap[j++] = SF_JPEG;
+- ps->currentCompression = SF_JPEG;
++ ps->currentCompression = SF_RAW;
+ ps->option[LEDM_OPTION_JPEG_QUALITY].cap |= SANE_CAP_SOFT_SELECT; /* enable jpeg quality */
+ break;
+ }
+@@ -679,7 +679,7 @@ SANE_Status ledm_control_option(SANE_Handle handle, SANE_Int option, SANE_Action
+ }
+ else
+ { /* Set default. */
+- ps->currentCompression = SF_JPEG;
++ ps->currentCompression = SF_RAW;
+ stat = SANE_STATUS_GOOD;
+ }
+ break;
+@@ -984,7 +984,9 @@ SANE_Status ledm_start(SANE_Handle handle)
+ }
+ }
+ else
+- ipGetImageTraits(ps->ip_handle, NULL, &ps->image_traits); /* get valid image traits */
++ {
++ ipGetOutputTraits(ps->ip_handle, &ps->image_traits); /* get valid image traits */
++ }
+
+ stat = SANE_STATUS_GOOD;
+
diff --git a/debian/patches/0016-Fix-download-and-installation-of-HP-s-proprietary-pl.patch b/debian/patches/0016-Fix-download-and-installation-of-HP-s-proprietary-pl.patch
new file mode 100644
index 000000000..cc11b0733
--- /dev/null
+++ b/debian/patches/0016-Fix-download-and-installation-of-HP-s-proprietary-pl.patch
@@ -0,0 +1,38 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Fri, 22 Jul 2016 09:33:06 +0200
+Subject: Fix download and installation of HP's proprietary plug-in in Python3
+ environments
+
+LP: #1422004
+---
+ base/pkit.py | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/base/pkit.py b/base/pkit.py
+index f3f1e44..6a848ef 100644
+--- a/base/pkit.py
++++ b/base/pkit.py
+@@ -35,9 +35,12 @@ import dbus
+ import dbus.service
+
+ if PY3:
+- from gi import _gobject as gobject
++ try:
++ from gi._gobject import MainLoop
++ except:
++ from gi.repository.GLib import MainLoop
+ else:
+- import gobject
++ from gobject import MainLoop
+
+ import warnings
+ # Ignore: .../dbus/connection.py:242: DeprecationWarning: object.__init__() takes no parameters
+@@ -207,7 +210,7 @@ if utils.to_bool(sys_conf.get('configure', 'policy-kit')):
+ super(BackendService, self).__init__(connection, path)
+
+ self.name = dbus.service.BusName(self.SERVICE_NAME, connection)
+- self.loop = gobject.MainLoop()
++ self.loop = MainLoop()
+ self.version = 0
+ log.set_level("debug")
+
diff --git a/debian/patches/0017-In-hp-scan-s-manpage-sort-PAGE_SIZES-in-help-for-the.patch b/debian/patches/0017-In-hp-scan-s-manpage-sort-PAGE_SIZES-in-help-for-the.patch
new file mode 100644
index 000000000..a8129805c
--- /dev/null
+++ b/debian/patches/0017-In-hp-scan-s-manpage-sort-PAGE_SIZES-in-help-for-the.patch
@@ -0,0 +1,22 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Fri, 22 Jul 2016 09:33:07 +0200
+Subject: In hp-scan's manpage, sort PAGE_SIZES in help,
+ for the manpage to be reproducibly created
+
+---
+ scan.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scan.py b/scan.py
+index 3587430..b1f70e7 100755
+--- a/scan.py
++++ b/scan.py
+@@ -289,7 +289,7 @@ try:
+ ("", "Coordinates are relative to the upper left corner of the scan area.", "option", False),
+ ("", "Units are specified by -t/--units (default is 'mm').", "option", False),
+ ("Specify the scan area based on a paper size:", "--size=<paper size name>", "option", False),
+- ("", "where <paper size name> is one of: %s" % ', '.join(list(PAGE_SIZES.keys())), "option", False),
++ ("", "where <paper size name> is one of: %s" % ', '.join(sorted(list(PAGE_SIZES.keys()))), "option", False),
+ utils.USAGE_SPACE,
+ ("[OPTIONS] ('file' dest)", "", "header", False),
+ ("Filename for 'file' destination:", "-o<file> or -f<file> or --file=<file> or --output=<file>", "option", False),
diff --git a/debian/patches/0018-Install-check-plugin.py-as-a-script.patch b/debian/patches/0018-Install-check-plugin.py-as-a-script.patch
new file mode 100644
index 000000000..e129db08f
--- /dev/null
+++ b/debian/patches/0018-Install-check-plugin.py-as-a-script.patch
@@ -0,0 +1,29 @@
+From: Julian Andres Klode <jak@debian.org>
+Date: Fri, 22 Jul 2016 09:33:08 +0200
+Subject: Install check-plugin.py as a script
+
+The installer installs check-plugin.py as hp-check-plugin, do the same from the Makefile.
+
+Origin: vendor
+Forwarded: no
+---
+ Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 54a46b5..2db759c 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -178,10 +178,10 @@ if !HPLIP_CLASS_DRIVER
+ dist_cmd_SCRIPTS = align.py info.py print.py toolbox.py clean.py colorcal.py unload.py testpage.py makeuri.py check.py fab.py levels.py \
+ sendfax.py setup.py makecopies.py probe.py timedate.py firmware.py scan.py systray.py plugin.py linefeedcal.py pqdiag.py \
+ faxsetup.py devicesettings.py printsettings.py query.py pkservice.py wificonfig.py diagnose_plugin.py uninstall.py \
+- upgrade.py config_usb_printer.py diagnose_queues.py logcapture.py doctor.py uiscan.py
++ upgrade.py config_usb_printer.py diagnose_queues.py logcapture.py doctor.py uiscan.py check-plugin.py
+
+ homedir = $(hplipdir)
+-dist_home_DATA = check-plugin.py
++dist_home_DATA =
+ dist_home_DATA += hplip_clean.sh
+
+ # base
diff --git a/debian/patches/0019-LaserJet-PostScript-4000-PPD-bugfix.patch b/debian/patches/0019-LaserJet-PostScript-4000-PPD-bugfix.patch
new file mode 100644
index 000000000..beb24efc9
--- /dev/null
+++ b/debian/patches/0019-LaserJet-PostScript-4000-PPD-bugfix.patch
@@ -0,0 +1,36 @@
+From: Jean Tourrilhes <jt@hpl.hp.com>
+Date: Fri, 22 Jul 2016 09:33:10 +0200
+Subject: LaserJet PostScript 4000 PPD bugfix
+
+The PostScript PPD for the HP LaserJet 4000 is buggy, and prevent printing complex documents.
+The 4000 and 4050 are pretty much the same printer. The fix was to extract the missing snipset from the PPD for the 4050 and put it in the PPD for the 4000.
+
+Origin: vendor
+Bug: https://bugs.launchpad.net/hplip/+bug/1298194
+Bug-Debian: https://bugs.debian.org/742766
+---
+ prnt/ps/hp-laserjet_4000_series-ps.ppd | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/prnt/ps/hp-laserjet_4000_series-ps.ppd b/prnt/ps/hp-laserjet_4000_series-ps.ppd
+index db1248c..66c4032 100644
+--- a/prnt/ps/hp-laserjet_4000_series-ps.ppd
++++ b/prnt/ps/hp-laserjet_4000_series-ps.ppd
+@@ -97,6 +97,17 @@
+ *SuggestedWaitTimeout: "120"
+ *PrintPSErrors: True
+
++*% =================================
++*% PostScript Patches
++*% =================================
++*JobPatchFile 1: "
++/limitinterpolate { dup type /dicttype eq { dup /Interpolate known { dup /Interpolate get {
++ 1 1 idtransform 2 index /ImageMatrix get dtransform exch abs 1 exch div exch abs 1 exch div 2 copy lt
++ { exch }if pop 4 lt { dup /Interpolate false put } if } if } if } if
++} bind def
++/image { limitinterpolate systemdict /image get exec } bind def
++/imagemask { limitinterpolate systemdict /imagemask get exec } bind def"
++*End
+
+ *% ===================================
+ *% Installable Options
diff --git a/debian/patches/0020-Patch-UI-files-to-match-upstream-produced-.py-code.patch b/debian/patches/0020-Patch-UI-files-to-match-upstream-produced-.py-code.patch
new file mode 100644
index 000000000..e38ebecca
--- /dev/null
+++ b/debian/patches/0020-Patch-UI-files-to-match-upstream-produced-.py-code.patch
@@ -0,0 +1,65 @@
+From: Julian Andres Klode <jak@debian.org>
+Date: Fri, 22 Jul 2016 09:33:11 +0200
+Subject: Patch UI files to match upstream produced .py code
+
+The update tab was manually patched out in the generated code, and the label_2 was renamed in the code.
+---
+ ui5/devmgr5_base.ui | 31 -------------------------------
+ ui5/wifisetupdialog_base.ui | 2 +-
+ 2 files changed, 1 insertion(+), 32 deletions(-)
+
+diff --git a/ui5/devmgr5_base.ui b/ui5/devmgr5_base.ui
+index 7d0c7f5..09f72bf 100644
+--- a/ui5/devmgr5_base.ui
++++ b/ui5/devmgr5_base.ui
+@@ -547,37 +547,6 @@
+ </item>
+ </layout>
+ </widget>
+- <widget class="QWidget" name="tab_3">
+- <attribute name="title">
+- <string>Page</string>
+- </attribute>
+- <widget class="QPushButton" name="pushButton">
+- <property name="geometry">
+- <rect>
+- <x>280</x>
+- <y>40</y>
+- <width>96</width>
+- <height>27</height>
+- </rect>
+- </property>
+- <property name="text">
+- <string>Install now</string>
+- </property>
+- </widget>
+- <widget class="QLabel" name="label">
+- <property name="geometry">
+- <rect>
+- <x>30</x>
+- <y>45</y>
+- <width>251</width>
+- <height>17</height>
+- </rect>
+- </property>
+- <property name="text">
+- <string>New version of HPLIP-x.x.x is available</string>
+- </property>
+- </widget>
+- </widget>
+ </widget>
+ </widget>
+ </item>
+diff --git a/ui5/wifisetupdialog_base.ui b/ui5/wifisetupdialog_base.ui
+index a85d14c..4e33640 100644
+--- a/ui5/wifisetupdialog_base.ui
++++ b/ui5/wifisetupdialog_base.ui
+@@ -47,7 +47,7 @@
+ </widget>
+ </item>
+ <item row="2" column="0" colspan="3">
+- <widget class="QLabel" name="label_2">
++ <widget class="QLabel" name="MainTitleLabel">
+ <property name="text">
+ <string>&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
+ p, li { white-space: pre-wrap; }
diff --git a/debian/patches/0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch b/debian/patches/0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
new file mode 100644
index 000000000..c3365cbfa
--- /dev/null
+++ b/debian/patches/0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
@@ -0,0 +1,49 @@
+From: Till Kamppeter <till.kamppeter@canonical.com>
+Date: Sat, 24 Sep 2016 10:37:20 +0200
+Subject: Add 'include <cups/ppd.h>' in various places as CUPS 2.2 moved some
+ definitions to ppd.h
+
+---
+ configure.in | 2 +-
+ prnt/hpcups/HPCupsFilter.h | 2 ++
+ prnt/hpijs/hpcupsfax.cpp | 1 +
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/configure.in b/configure.in
+index cabda2d..263374f 100755
+--- a/configure.in
++++ b/configure.in
+@@ -594,7 +594,7 @@ fi
+
+ if test "$class_driver" = "no" && test "$hpijs_only_build" = "no" && test "$hpcups_only_build" = "no"; then
+ AC_CHECK_LIB([cups], [cupsDoFileRequest], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libcups support], 9)])
+- AC_CHECK_HEADERS(cups/cups.h, ,[AC_MSG_ERROR([cannot find cups-devel support], 3)])
++ AC_CHECK_HEADERS(cups/cups.h cups/ppd.h, ,[AC_MSG_ERROR([cannot find cups-devel support], 3)])
+ if test "$libusb01_build" = "yes"; then
+ AC_CHECK_LIB([usb], [usb_init], [LIBS="$LIBS"], [AC_MSG_ERROR([cannot find libusb support], 2)])
+ AC_CHECK_HEADERS(usb.h, ,[AC_MSG_ERROR([cannot find libusb-devel support], 11)])
+diff --git a/prnt/hpcups/HPCupsFilter.h b/prnt/hpcups/HPCupsFilter.h
+index 3d003d5..60f8580 100644
+--- a/prnt/hpcups/HPCupsFilter.h
++++ b/prnt/hpcups/HPCupsFilter.h
+@@ -38,6 +38,8 @@
+ #include <cups/ppd.h>
+ #include "dbuscomm.h"
+
++#include <cups/ppd.h>
++
+ #define DBITMAPFILEHEADER 14
+ #define DBITMAPINFOHEADER 40
+
+diff --git a/prnt/hpijs/hpcupsfax.cpp b/prnt/hpijs/hpcupsfax.cpp
+index 8514775..994e50f 100644
+--- a/prnt/hpijs/hpcupsfax.cpp
++++ b/prnt/hpijs/hpcupsfax.cpp
+@@ -43,6 +43,7 @@
+ #include <arpa/inet.h>
+ #include <math.h>
+ #include <cups/cups.h>
++#include <cups/ppd.h>
+ #include <cups/raster.h>
+ #include <string>
+ #ifdef FALSE
diff --git a/debian/patches/0022-Fix-list-wrapping-in-scan.py-to-fix-generated-manpag.patch b/debian/patches/0022-Fix-list-wrapping-in-scan.py-to-fix-generated-manpag.patch
new file mode 100644
index 000000000..049444dca
--- /dev/null
+++ b/debian/patches/0022-Fix-list-wrapping-in-scan.py-to-fix-generated-manpag.patch
@@ -0,0 +1,23 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Mon, 3 Oct 2016 11:16:48 +0200
+Subject: Fix list wrapping in scan.py to fix generated manpage
+
+---
+ scan.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/scan.py b/scan.py
+index b1f70e7..f3dd546 100755
+--- a/scan.py
++++ b/scan.py
+@@ -248,8 +248,8 @@ try:
+ extra_options=[utils.USAGE_SPACE,
+ ("[OPTIONS] (General)", "", "header", False),
+ ("Scan destinations:", "-s<dest_list> or --dest=<dest_list>", "option", False),
+- ("", "where <dest_list> is a comma separated list containing one or more of: 'file'\*, ", "option", False),
+- ("", "'viewer', 'editor', 'pdf', or 'print'. Use only commas between values, no spaces.", "option", False),
++ ("", "where <dest_list> is a comma separated list containing one or more of: 'file'", "option", False),
++ ("", ", 'viewer', 'editor', 'pdf', or 'print'. Use only commas between values, no spaces.", "option", False),
+ ("Scan mode:", "-m<mode> or --mode=<mode>. Where <mode> is 'gray'\*, 'color' or 'lineart'.", "option", False),
+ ("Scanning resolution:", "-r<resolution_in_dpi> or --res=<resolution_in_dpi> or --resolution=<resolution_in_dpi>", "option", False),
+ ("", "where 300 is default.", "option", False),
diff --git a/debian/patches/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch b/debian/patches/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
new file mode 100644
index 000000000..9a2ffdd0b
--- /dev/null
+++ b/debian/patches/0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
@@ -0,0 +1,28 @@
+From: Gaurav Sood <gaurav-sood@invalid-email.launchpad.net>
+Date: Thu, 4 May 2017 18:32:08 +0200
+Subject: Fix handling of unicode filenames in sixext.py
+
+LP: #1480152
+Closes: #861731
+---
+ base/sixext.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/base/sixext.py b/base/sixext.py
+index 0bf4fc4..311bf72 100644
+--- a/base/sixext.py
++++ b/base/sixext.py
+@@ -110,11 +110,11 @@ if PY3:
+
+
+ def to_string_utf8(s):
+- return s.decode("utf-8")
++ return s.decode("utf-8", 'ignore')
+
+
+ def to_string_latin(s):
+- return s.decode("latin-1")
++ return s.decode("latin-1", 'ignore')
+
+
+ def to_unicode(s, enc=None):
diff --git a/debian/patches/0024-Make-dat2drv-and-locateppd-build-dependent-of-class-.patch b/debian/patches/0024-Make-dat2drv-and-locateppd-build-dependent-of-class-.patch
new file mode 100644
index 000000000..4e3fca456
--- /dev/null
+++ b/debian/patches/0024-Make-dat2drv-and-locateppd-build-dependent-of-class-.patch
@@ -0,0 +1,44 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Mon, 12 Mar 2018 13:37:19 +0100
+Subject: Make dat2drv and locateppd build dependent of class driver enabling;
+ copes with its source code removal from source
+
+---
+ Makefile.am | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 2db759c..b9381e2 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -620,12 +620,14 @@ endif # FAX_BUILD
+ endif # HPCUPS ONLY
+ endif # HPCUPS_INSTALL
+
++if HPLIP_CLASS_DRIVER
+ dat2drvdir = $(hplipdir)
+ dat2drv_PROGRAMS = dat2drv
+ dat2drv_SOURCES = Common.h Dat2drv.cpp Dat2drv.h Normalize.cpp Normalize.h
+ if GCC_GE_47
+ dat2drv_CXXFLAGS = -std=c++11
+ endif
++endif # HPLIP_CLASS_DRIVER
+
+ if HPPS_INSTALL
+ hppsdir = $(cupsfilterdir)
+@@ -636,6 +638,7 @@ hpps_LDADD = -lcups $(DBUS_LIBS)
+ endif #HPPS_INSTALL
+
+
++if HPLIP_CLASS_DRIVER
+ #locate driver
+ locatedriverdir = $(hplipdir)
+ locatedriver_PROGRAMS = locatedriver
+@@ -643,7 +646,6 @@ locatedriver_SOURCES = FindPPD.cpp FindPPD.h
+ if GCC_GE_47
+ locatedriver_CXXFLAGS = -std=c++11
+ endif
+-if HPLIP_CLASS_DRIVER
+ dist_locatedriver_DATA = locatedriver
+ endif #HPLIP_CLASS_DRIVER
+
diff --git a/debian/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch b/debian/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
new file mode 100644
index 000000000..0d694d1ec
--- /dev/null
+++ b/debian/patches/0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
@@ -0,0 +1,112 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Tue, 21 Aug 2018 18:18:10 +0200
+Subject: Remove all ImageProcessor functionality, which is closed-source
+
+---
+ Makefile.am | 14 ++------------
+ prnt/hpcups/HPCupsFilter.cpp | 21 ---------------------
+ 2 files changed, 2 insertions(+), 33 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index b9381e2..839561b 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -166,7 +166,7 @@ if !HPLIP_CLASS_DRIVER
+ dist_hplip_SCRIPTS = hpssd.py __init__.py hpdio.py
+ endif #HPLIP_CLASS_DRIVER
+
+-dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template prnt/hpcups/libImageProcessor-x86_64.so prnt/hpcups/libImageProcessor-x86_32.so
++dist_noinst_DATA += prnt/drv/hpijs.drv.in.template prnt/drv/hpcups.drv.in.template
+ dist_noinst_SCRIPTS += dat2drv.py install.py hplip-install init-suse-firewall init-iptables-firewall class_rpm_build.sh hplipclassdriver.spec createPPD.sh Makefile_dat2drv hpijs-drv
+
+ if !HPLIP_CLASS_DRIVER
+@@ -594,7 +594,7 @@ hpcups_SOURCES = prnt/hpcups/HPCupsFilter.cpp prnt/hpcups/HPCupsFilter.h prnt/hp
+ prnt/hpcups/ImageProcessor.h
+
+ hpcups_CXXFLAGS = $(APDK_ENDIAN_FLAG) $(DBUS_CFLAGS)
+-hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lImageProcessor -lcups -lcupsimage -lz $(DBUS_LIBS)
++hpcups_LDADD = -L./prnt/hpcups/ -ljpeg -ldl -lcups -lcupsimage -lz $(DBUS_LIBS)
+ #else
+ #hpcupsdir = $(cupsfilterdir)
+ #hpcups_PROGRAMS = hpcups
+@@ -686,16 +686,6 @@ endif #HPLIP_CLASS_DRIVER
+
+ install-data-hook:
+ if HPLIP_BUILD
+- if [ \( "$(UNAME)" = "x86_64" -a -d "$(libdir)/" \) ]; then \
+- cp prnt/hpcups/libImageProcessor-x86_64.so $(libdir)/ ; \
+- chmod 775 $(libdir)/libImageProcessor-x86_64.so ; \
+- ln -sf $(libdir)/libImageProcessor-x86_64.so $(libdir)/libImageProcessor.so ; \
+- fi; \
+- if [ \( \( "$(UNAME)" = "i686" -o "$(UNAME)" = "i386" \) -a -d "$(libdir)/" \) ]; then \
+- cp prnt/hpcups/libImageProcessor-x86_32.so $(libdir)/ ; \
+- chmod 775 $(libdir)/libImageProcessor-x86_32.so ; \
+- ln -sf $(libdir)/libImageProcessor-x86_32.so $(libdir)/libImageProcessor.so ; \
+- fi
+ if !HPLIP_CLASS_DRIVER
+ # If scanner build, add hpaio entry to sane dll.conf.
+ if [ "$(scan_build)" = "yes" ]; then \
+diff --git a/prnt/hpcups/HPCupsFilter.cpp b/prnt/hpcups/HPCupsFilter.cpp
+index 5b282d8..0bacfaf 100644
+--- a/prnt/hpcups/HPCupsFilter.cpp
++++ b/prnt/hpcups/HPCupsFilter.cpp
+@@ -31,7 +31,6 @@
+ \*****************************************************************************/
+
+ #include "HPCupsFilter.h"
+-#include "ImageProcessor.h"
+
+ #include <signal.h>
+ #include <sys/wait.h>
+@@ -637,16 +636,10 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+
+
+ sprintf(hpPreProcessedRasterFile, "%s/hp_%s_cups_SwapedPagesXXXXXX",CUPS_TMP_DIR, m_JA.user_name);
+- image_processor_t* imageProcessor = imageProcessorCreate();
+
+ while (cupsRasterReadHeader2(cups_raster, &cups_header))
+ {
+
+- IMAGE_PROCESSOR_ERROR result = imageProcessorStartPage(imageProcessor, &cups_header);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorStartPage failed result = %d\n", result);
+- }
+-
+ current_page_number++;
+
+ if (current_page_number == 1) {
+@@ -745,12 +738,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ color_raster = rgbRaster;
+ black_raster = kRaster;
+
+- result = imageProcessorProcessLine(imageProcessor, m_pPrinterBuffer, cups_header.cupsBytesPerLine);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorProcessLine failed result = %d\n", result);
+- }
+-
+-
+ if ((y == 0) && !is_ljmono) {
+ //For ljmono, make sure that first line is not a blankRaster line.Otherwise printer
+ //may not skip blank lines before actual data
+@@ -780,12 +767,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ }
+ } // for() loop end
+
+- result = imageProcessorEndPage(imageProcessor);
+- if (result != IPE_SUCCESS){
+- dbglog("DEBUG: imageProcessorEndPage failed result = %d\n", result);
+- }
+-
+-
+ m_Job.NewPage();
+ if (err != NO_ERROR) {
+ break;
+@@ -800,8 +781,6 @@ int HPCupsFilter::processRasterData(cups_raster_t *cups_raster)
+ rgbRaster = NULL;
+ }
+
+- imageProcessorDestroy(imageProcessor);
+-
+ unlink(hpPreProcessedRasterFile);
+ return ret_status;
+ }
diff --git a/debian/patches/0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch b/debian/patches/0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch
new file mode 100644
index 000000000..ff3c8350a
--- /dev/null
+++ b/debian/patches/0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch
@@ -0,0 +1,472 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Wed, 3 Oct 2018 15:13:00 +0200
+Subject: Call QMessageBox constructors of PyQT5 with the correct parameters
+
+The whole Python source code of HPLIP contains 40 incorrect calls of
+the QMessageBox constructurs, mostly the list of buttons was given as
+separate arguments instead of a bitwise OR of each button's
+representation value. If the flow of the code hits one of these
+calls (usually when some error or warnings message should be
+displayed or an "Are you sure?" question asked) the GUI app crashes.
+See https://pythonspot.com/pyqt5-messagebox/ for QMessageBox
+documentation.
+This patch corrects all these calls.
+
+Bug-Debian: https://bugs.debian.org/912768
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1745383
+---
+ ui/devmgr4.py | 16 ++++++++--------
+ ui/faxaddrbookform.py | 6 +++---
+ ui/faxsendjobform.py | 6 +++---
+ ui/firmwaredialog.py | 2 +-
+ ui/makecopiesform.py | 4 ++--
+ ui/nodevicesform.py | 2 +-
+ ui/pluginform2.py | 4 ++--
+ ui/printerform.py | 2 +-
+ ui/settingsdialog.py | 4 ++--
+ ui/setupform.py | 10 +++++-----
+ ui/unloadform.py | 2 +-
+ ui/upgradeform.py | 4 ++--
+ ui5/devmgr5.py | 6 ++----
+ ui5/fabwindow.py | 2 +-
+ ui5/nodevicesdialog.py | 3 +--
+ ui5/plugindialog.py | 2 +-
+ ui5/queuesconf.py | 2 +-
+ ui5/setupdialog.py | 6 +++---
+ 18 files changed, 40 insertions(+), 43 deletions(-)
+
+diff --git a/ui/devmgr4.py b/ui/devmgr4.py
+index cc2552f..a868cca 100644
+--- a/ui/devmgr4.py
++++ b/ui/devmgr4.py
+@@ -1422,7 +1422,7 @@ class DevMgr4(DevMgr4_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+ else:
+@@ -2854,7 +2854,7 @@ class DevMgr4(DevMgr4_base):
+ x = QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to remove this device?</b>"),
+- QMessageBox.Yes,
++ QMessageBox.Yes |\
+ QMessageBox.No | QMessageBox.Default,
+ QMessageBox.NoButton)
+ if x == QMessageBox.Yes:
+@@ -2949,7 +2949,7 @@ class DevMgr4(DevMgr4_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -2958,7 +2958,7 @@ class DevMgr4(DevMgr4_base):
+ QMessageBox.warning(self,
+ self.caption(),
+ msg,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -3115,7 +3115,7 @@ class ScrollTestpageView(ScrollView):
+ QMessageBox.information(self,
+ self.caption(),
+ self.__tr("<p><b>A test page should be printing on your printer.</b><p>If the page fails to print, please visit http://hplip.sourceforge.net for troubleshooting and support."),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -3130,7 +3130,7 @@ class ScrollTestpageView(ScrollView):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -3272,7 +3272,7 @@ class ScrollColorCalView(ScrollView):
+ QMessageBox.information(self,
+ self.caption(),
+ self.__tr("<p><b>A test page should be printing on your printer.</b><p>If the page fails to print, please visit http://hplip.sourceforge.net for troubleshooting and support."),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -3287,7 +3287,7 @@ class ScrollColorCalView(ScrollView):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/faxaddrbookform.py b/ui/faxaddrbookform.py
+index 1094622..b233644 100644
+--- a/ui/faxaddrbookform.py
++++ b/ui/faxaddrbookform.py
+@@ -228,7 +228,7 @@ class FaxAddrBookGroupsForm(FaxAddrBookGroupsForm_base):
+ x = QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to delete this group?</b>"),
+- QMessageBox.Yes,
++ QMessageBox.Yes |\
+ QMessageBox.No | QMessageBox.Default,
+ QMessageBox.NoButton)
+ if x == QMessageBox.Yes:
+@@ -421,7 +421,7 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
+ if QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>Annoying Confirmation: Are you sure you want to delete this address book entry?</b>"),
+- QMessageBox.Yes,
++ QMessageBox.Yes |\
+ QMessageBox.No | QMessageBox.Default,
+ QMessageBox.NoButton) == QMessageBox.Yes:
+ db.delete(self.current.entry['name'])
+@@ -451,7 +451,7 @@ class FaxAddrBookForm(FaxAddrBookForm_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ QString(error_text),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/faxsendjobform.py b/ui/faxsendjobform.py
+index 106215c..69f424c 100644
+--- a/ui/faxsendjobform.py
++++ b/ui/faxsendjobform.py
+@@ -210,7 +210,7 @@ class FaxSendJobForm(QMainWindow):
+ QMessageBox.information(self,
+ self.caption(),
+ self.__tr("<p><b>Fax send completed successfully.</b>"),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -219,7 +219,7 @@ class FaxSendJobForm(QMainWindow):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -228,7 +228,7 @@ class FaxSendJobForm(QMainWindow):
+ QMessageBox.warning(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/firmwaredialog.py b/ui/firmwaredialog.py
+index 16b3133..0bcee11 100644
+--- a/ui/firmwaredialog.py
++++ b/ui/firmwaredialog.py
+@@ -109,7 +109,7 @@ class FirmwareDialog(QDialog, FirmwareDialog_Base):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/makecopiesform.py b/ui/makecopiesform.py
+index 27f144b..0fbb573 100644
+--- a/ui/makecopiesform.py
++++ b/ui/makecopiesform.py
+@@ -156,7 +156,7 @@ class MakeCopiesForm(QMainWindow):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -164,7 +164,7 @@ class MakeCopiesForm(QMainWindow):
+ QMessageBox.warning(self,
+ self.caption(),
+ msg,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/nodevicesform.py b/ui/nodevicesform.py
+index 01f6ae5..57a6963 100644
+--- a/ui/nodevicesform.py
++++ b/ui/nodevicesform.py
+@@ -67,7 +67,7 @@ class NoDevicesForm(NoDevicesForm_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/pluginform2.py b/ui/pluginform2.py
+index 64e64aa..76cb023 100644
+--- a/ui/pluginform2.py
++++ b/ui/pluginform2.py
+@@ -173,7 +173,7 @@ class PluginForm2(PluginForm2_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -181,7 +181,7 @@ class PluginForm2(PluginForm2_base):
+ QMessageBox.information(self,
+ self.caption(),
+ text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/printerform.py b/ui/printerform.py
+index 0c6c4f3..7c10ab0 100644
+--- a/ui/printerform.py
++++ b/ui/printerform.py
+@@ -154,7 +154,7 @@ class PrinterForm(QMainWindow):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/settingsdialog.py b/ui/settingsdialog.py
+index 92da225..24f02fd 100644
+--- a/ui/settingsdialog.py
++++ b/ui/settingsdialog.py
+@@ -146,7 +146,7 @@ class SettingsDialog(SettingsDialog_base):
+ ## QMessageBox.warning(self,
+ ## self.caption(),
+ ## self.__tr("<b>One or more email addresses are missing.</b><p>Please enter this information and try again."),
+-## QMessageBox.Ok,
++## QMessageBox.Ok |\
+ ## QMessageBox.NoButton,
+ ## QMessageBox.NoButton)
+ ## return
+@@ -163,7 +163,7 @@ class SettingsDialog(SettingsDialog_base):
+ ## QMessageBox.information(self,
+ ## self.caption(),
+ ## self.__tr("<p><b>Please check your email for a test message.</b><p>If the message doesn't arrive, please check your settings and try again."),
+-## QMessageBox.Ok,
++## QMessageBox.Ok |\
+ ## QMessageBox.NoButton,
+ ## QMessageBox.NoButton)
+
+diff --git a/ui/setupform.py b/ui/setupform.py
+index 307917b..78863fd 100644
+--- a/ui/setupform.py
++++ b/ui/setupform.py
+@@ -602,7 +602,7 @@ class SetupForm(SetupForm_base):
+ if ( QMessageBox.warning(self,
+ self.caption(),
+ warn_text,
+- QMessageBox.Yes,
++ QMessageBox.Yes |\
+ QMessageBox.No,
+ QMessageBox.NoButton) == QMessageBox.Yes ):
+
+@@ -804,7 +804,7 @@ class SetupForm(SetupForm_base):
+ if QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Retry | QMessageBox.Default,
++ QMessageBox.Retry | QMessageBox.Default |\
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+@@ -832,7 +832,7 @@ class SetupForm(SetupForm_base):
+ if QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Retry | QMessageBox.Default,
++ QMessageBox.Retry | QMessageBox.Default |\
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+@@ -1003,7 +1003,7 @@ class SetupForm(SetupForm_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -1011,7 +1011,7 @@ class SetupForm(SetupForm_base):
+ QMessageBox.warning(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/unloadform.py b/ui/unloadform.py
+index 8397a68..ae363e0 100644
+--- a/ui/unloadform.py
++++ b/ui/unloadform.py
+@@ -135,7 +135,7 @@ class UnloadForm(QMainWindow):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui/upgradeform.py b/ui/upgradeform.py
+index 6b9acf5..d0b4184 100644
+--- a/ui/upgradeform.py
++++ b/ui/upgradeform.py
+@@ -118,7 +118,7 @@ class UpgradeForm(UpgradeForm_base):
+ QMessageBox.critical(self,
+ self.caption(),
+ error_text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+@@ -126,7 +126,7 @@ class UpgradeForm(UpgradeForm_base):
+ QMessageBox.information(self,
+ self.caption(),
+ text,
+- QMessageBox.Ok,
++ QMessageBox.Ok |\
+ QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+diff --git a/ui5/devmgr5.py b/ui5/devmgr5.py
+index 498151c..1816a9d 100644
+--- a/ui5/devmgr5.py
++++ b/ui5/devmgr5.py
+@@ -139,8 +139,7 @@ class PluginInstall(QObject):
+ install_plugin = QMessageBox.warning(self.parent,
+ self.parent.windowTitle(),
+ self.__tr("<b>The HPLIP plugin is already installed.</b><p>Do you want to continue and re-install it?"),
+- QMessageBox.Yes,
+- QMessageBox.No,
++ QMessageBox.Yes | QMessageBox.No,
+ QMessageBox.NoButton) == QMessageBox.Yes
+
+ if install_plugin:
+@@ -149,8 +148,7 @@ class PluginInstall(QObject):
+ QMessageBox.critical(self.parent,
+ self.parent.windowTitle(),
+ self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"),
+- QMessageBox.Ok,
+- QMessageBox.NoButton,
++ QMessageBox.Ok | QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+diff --git a/ui5/fabwindow.py b/ui5/fabwindow.py
+index 488b6bb..0b95c94 100644
+--- a/ui5/fabwindow.py
++++ b/ui5/fabwindow.py
+@@ -344,7 +344,7 @@ class FABWindow(QMainWindow, Ui_MainWindow):
+ new_name = to_unicode(self.NameLineEdit.text())
+ if new_name != self.name:
+ if QMessageBox.question(self, self.__tr("Rename?"), "Rename '%s' to '%s'?"%(self.name,new_name), \
+- QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
++ QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.Yes:
+
+ self.db.rename(self.name, new_name)
+ log.debug("Rename %s to %s" % (self.name, new_name))
+diff --git a/ui5/nodevicesdialog.py b/ui5/nodevicesdialog.py
+index 6083f6d..ca86bfc 100644
+--- a/ui5/nodevicesdialog.py
++++ b/ui5/nodevicesdialog.py
+@@ -64,8 +64,7 @@ class NoDevicesDialog(QDialog, Ui_NoDevicesDialog_base):
+ QMessageBox.critical(self,
+ self.windowTitle(),
+ self.__tr("<b>An error occurred.</b><p>Please re-start the Device Manager and try again."),
+- QMessageBox.Ok,
+- QMessageBox.NoButton,
++ QMessageBox.Ok | QMessageBox.NoButton,
+ QMessageBox.NoButton)
+
+
+diff --git a/ui5/plugindialog.py b/ui5/plugindialog.py
+index e3007f9..1c6b338 100644
+--- a/ui5/plugindialog.py
++++ b/ui5/plugindialog.py
+@@ -252,7 +252,7 @@ class PluginDialog(QDialog, Ui_Dialog):
+
+ if QMessageBox.question(self, " ",
+ self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate the plug-in prior to installation.</p>Do you still want to install the plug-in?" %error_str),
+- QMessageBox.Yes | QMessageBox.No) != QMessageBox.Yes:
++ QMessageBox.Yes | QMessageBox.No, QMessageBox.No) != QMessageBox.Yes:
+
+ self.pluginObj.deleteInstallationFiles(download_plugin_file)
+ self.close()
+diff --git a/ui5/queuesconf.py b/ui5/queuesconf.py
+index cf22064..e3c2a02 100644
+--- a/ui5/queuesconf.py
++++ b/ui5/queuesconf.py
+@@ -245,7 +245,7 @@ class QueuesDiagnose(QDialog, Ui_Dialog):
+
+ if QMessageBox.question(self, " ",
+ self.__tr("<b>%s</b><p>Without this, it is not possible to authenticate and validate this tool prior to installation.</p>Do you still want to run Smart Install disabler?" %error_str),
+- QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
++ QMessageBox.Yes | QMessageBox.No, QMessageBox.No) == QMessageBox.Yes:
+ # Disabling without verification.
+ sts, out = utils.run("sh %s"%smart_install_run)
+
+diff --git a/ui5/setupdialog.py b/ui5/setupdialog.py
+index fbfe5ac..120ee15 100644
+--- a/ui5/setupdialog.py
++++ b/ui5/setupdialog.py
+@@ -873,7 +873,7 @@ class SetupDialog(QDialog, Ui_Dialog):
+ self.windowTitle(),
+ warn_text,
+ QMessageBox.Yes|\
+- QMessageBox.No|\
++ QMessageBox.No,
+ QMessageBox.NoButton) == QMessageBox.Yes ):
+ i = 2
+ while True:
+@@ -1108,7 +1108,7 @@ class SetupDialog(QDialog, Ui_Dialog):
+ if QMessageBox.critical(self,
+ self.windowTitle(),
+ error_text,
+- QMessageBox.Retry | QMessageBox.Default,
++ QMessageBox.Retry | QMessageBox.Default |\
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
+@@ -1138,7 +1138,7 @@ class SetupDialog(QDialog, Ui_Dialog):
+ if QMessageBox.critical(self,
+ self.windowTitle(),
+ error_text,
+- QMessageBox.Retry | QMessageBox.Default,
++ QMessageBox.Retry | QMessageBox.Default |\
+ QMessageBox.Cancel | QMessageBox.Escape,
+ QMessageBox.NoButton) == QMessageBox.Cancel:
+ break
diff --git a/debian/patches/0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch b/debian/patches/0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch
new file mode 100644
index 000000000..96a9f4ffd
--- /dev/null
+++ b/debian/patches/0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch
@@ -0,0 +1,40 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Wed, 3 Oct 2018 15:13:00 +0200
+Subject: Fixed incomplete removal of hp-toolbox features,
+ which caused the hp-toolbox not to start
+
+Looking into the ui5/devmgr5.py of the HPLIP Python source code it
+seems that some features got removed by commenting them out, but this
+removal seems not to have been completed, making non-existing objects
+being called during the start of hp-toolbox and so it crashes right
+away.
+
+This patch completes the commenting-out and so makes hp-toolbox start
+up and work again.
+
+Bug-Debian: https://bugs.debian.org/912768
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1789184
+---
+ ui5/devmgr5.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/ui5/devmgr5.py b/ui5/devmgr5.py
+index 1816a9d..c23957a 100644
+--- a/ui5/devmgr5.py
++++ b/ui5/devmgr5.py
+@@ -319,11 +319,11 @@ class DevMgr5(Ui_MainWindow_Derived, Ui_MainWindow, QMainWindow):
+ self.PreferencesAction.setIcon(QIcon(load_pixmap('settings', '16x16')))
+ self.PreferencesAction.triggered.connect(self.PreferencesAction_activated)
+
+- self.DiagnoseQueueAction.setIcon(QIcon(load_pixmap('warning', '16x16')))
+- self.DiagnoseQueueAction.triggered.connect(self.DiagnoseQueueAction_activated)
++ #self.DiagnoseQueueAction.setIcon(QIcon(load_pixmap('warning', '16x16')))
++ #self.DiagnoseQueueAction.triggered.connect(self.DiagnoseQueueAction_activated)
+
+- self.DiagnoseHPLIPAction.setIcon(QIcon(load_pixmap('troubleshoot', '16x16')))
+- self.DiagnoseHPLIPAction.triggered.connect(self.DiagnoseHPLIP_activated)
++ #self.DiagnoseHPLIPAction.setIcon(QIcon(load_pixmap('troubleshoot', '16x16')))
++ #self.DiagnoseHPLIPAction.triggered.connect(self.DiagnoseHPLIP_activated)
+
+ self.ContentsAction.setIcon(QIcon(load_pixmap("help", "16x16")))
+ self.ContentsAction.triggered.connect(self.helpContents)
diff --git a/debian/patches/0028-hp-check-Fix-core.distro-vs.-core.distro_name-mixups.patch b/debian/patches/0028-hp-check-Fix-core.distro-vs.-core.distro_name-mixups.patch
new file mode 100644
index 000000000..5571a1f93
--- /dev/null
+++ b/debian/patches/0028-hp-check-Fix-core.distro-vs.-core.distro_name-mixups.patch
@@ -0,0 +1,51 @@
+From: Francois Gouget <fgouget@free.fr>
+Date: Sat, 6 May 2017 00:00:52 +0200
+Subject: hp-check: Fix core.distro vs. core.distro_name mixups.
+
+core.distro is the index of the distribution and is thus not suitable
+for traces and information messages.
+
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1688684
+---
+ check.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/check.py b/check.py
+index 5d35094..81330b8 100755
+--- a/check.py
++++ b/check.py
+@@ -199,7 +199,7 @@ class DependenciesCheck(object):
+ return
+ elif d == 'hpaio' and not self.scanning_enabled:
+ return
+- elif self.core.distro =="rhel" and "5." in self.distro_version:
++ elif self.core.distro_name =="rhel" and "5." in self.distro_version:
+ if d in ['dbus','python-devel','python-dbus','pyqt4-dbus','libnetsnmp-devel','gcc','make','reportlab','policykit','sane-devel','cups-ddk']:
+ return
+
+@@ -305,14 +305,14 @@ class DependenciesCheck(object):
+ if self.core.distro_version not in vrs and len(vrs):
+ supported_distro_vrs= vrs[len(vrs)-1]
+ log.warn(log.bold("%s-%s version is not supported. Using %s-%s versions dependencies to verify and install..." \
+- %(self.core.distro, self.core.distro_version, self.core.distro, supported_distro_vrs)))
++ %(self.core.distro_name, self.core.distro_version, self.core.distro_name, supported_distro_vrs)))
+
+ tui.header("SYSTEM INFO")
+ Sts, Kernel_info =utils.run("uname -r -v -o")
+ Sts, Host_info =utils.run("uname -n")
+ Sts, Proc_info =utils.run("uname -r -v -o")
+ log.info(" Kernel: %s Host: %s Proc: %s Distribution: %s %s"\
+- %(Kernel_info,Host_info,Proc_info,self.core.distro, self.core.distro_version))
++ %(Kernel_info,Host_info,Proc_info,self.core.distro_name, self.core.distro_version))
+ log.info(" Bitness: %s bit\n"%utils.getBitness())
+ tui.header("HPLIP CONFIGURATION")
+ v = sys_conf.get('hplip', 'version')
+@@ -323,7 +323,7 @@ class DependenciesCheck(object):
+ if self.core.is_auto_installer_support():
+ log.info("HPLIP-Installation: Auto installation is supported for %s distro %s version " %(self.core.distro_name, self.core.distro_version))
+ else:
+- log.warn("HPLIP-Installation: Auto installation is not supported for %s distro %s version " %(self.core.distro, self.core.distro_version))
++ log.warn("HPLIP-Installation: Auto installation is not supported for %s distro %s version " %(self.core.distro_name, self.core.distro_version))
+
+ log.info()
+ log.info(log.bold("Current contents of '/etc/hp/hplip.conf' file:"))
diff --git a/debian/patches/0029-Make-base.g.xint-more-generous-in-what-it-can-take.patch b/debian/patches/0029-Make-base.g.xint-more-generous-in-what-it-can-take.patch
new file mode 100644
index 000000000..08d28b057
--- /dev/null
+++ b/debian/patches/0029-Make-base.g.xint-more-generous-in-what-it-can-take.patch
@@ -0,0 +1,28 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Tue, 6 Nov 2018 17:57:40 +0100
+Subject: Make base.g.xint more generous in what it can take
+
+Fixes hp-doctor in python with version '2.7.15+'
+
+Closes: #912765
+---
+ base/g.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/base/g.py b/base/g.py
+index f73e23f..15e67fc 100644
+--- a/base/g.py
++++ b/base/g.py
+@@ -326,9 +326,9 @@ def cleanup_spinner():
+ # Convert string to int and return a list.
+ def xint(ver):
+ try:
+- l = [int(x) for x in ver.split('.')]
+- except:
+- pass
++ l = [int(x.translate(None, '+~')) for x in ver.split('.')]
++ except ValueError:
++ l = []
+ return l
+
+ # In case of import failure of extension modules, check whether its a mixed python environment issue.
diff --git a/debian/patches/0030-Fix-linking-of-libhpipp-and-the-ext-python-extension.patch b/debian/patches/0030-Fix-linking-of-libhpipp-and-the-ext-python-extension.patch
new file mode 100644
index 000000000..430396fb4
--- /dev/null
+++ b/debian/patches/0030-Fix-linking-of-libhpipp-and-the-ext-python-extension.patch
@@ -0,0 +1,58 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Thu, 6 Dec 2018 20:37:59 +0100
+Subject: Fix linking of libhpipp and the *ext python extensions
+
+Closes: #886391
+---
+ Makefile.am | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index 839561b..a704cdd 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -306,7 +306,7 @@ dist_pcard_DATA = pcard/__init__.py pcard/photocard.py
+ # pcardext
+ pcardextdir = $(pyexecdir)
+ pcardext_LTLIBRARIES = pcardext.la
+-pcardext_la_LDFLAGS = -module -avoid-version
++pcardext_la_LDFLAGS = -module -avoid-version -lpython$(PYTHON_VERSION)m
+ pcardext_la_SOURCES = pcard/pcardext/pcardext.c pcard/fat.c
+ pcardext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
+
+@@ -321,7 +321,7 @@ lib_LTLIBRARIES += libhpipp.la
+ 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
++libhpipp_la_LIBADD = -lcups libhpmud.la
+
+ # cupsext
+ cupsextdir = $(pyexecdir)
+@@ -329,7 +329,7 @@ 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) -Iprotocol
+-cupsext_la_LIBADD = -lcups libhpipp.la
++cupsext_la_LIBADD = -lcups -lpython$(PYTHON_VERSION)m libhpipp.la
+ endif #HPLIP_CLASS_DRIVER
+
+ if !HPLIP_CLASS_DRIVER
+@@ -341,7 +341,7 @@ dist_scan_DATA = scan/__init__.py scan/sane.py
+ # scanext
+ scanextdir = $(pyexecdir)
+ scanext_LTLIBRARIES = scanext.la
+-scanext_la_LDFLAGS = -module -avoid-version -lsane
++scanext_la_LDFLAGS = -module -avoid-version -lsane -lpython$(PYTHON_VERSION)m
+ scanext_la_SOURCES = scan/scanext/scanext.c
+ scanext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
+ endif #SCAN_BUILD
+@@ -351,7 +351,7 @@ endif #!HPLIP_CLASS_DRIVER
+ if !HPLIP_CLASS_DRIVER
+ hpmudextdir = $(pyexecdir)
+ hpmudext_LTLIBRARIES = hpmudext.la
+-hpmudext_la_LDFLAGS = -module -avoid-version
++hpmudext_la_LDFLAGS = -module -avoid-version -lpython$(PYTHON_VERSION)m
+ hpmudext_la_SOURCES = io/mudext/hpmudext.c
+ hpmudext_la_CFLAGS = -I$(PYTHONINCLUDEDIR)
+ hpmudext_la_LIBADD = libhpmud.la
diff --git a/debian/patches/0031-Fix-some-typos-in-BUG-and-DBG-messages.patch b/debian/patches/0031-Fix-some-typos-in-BUG-and-DBG-messages.patch
new file mode 100644
index 000000000..e3d54491d
--- /dev/null
+++ b/debian/patches/0031-Fix-some-typos-in-BUG-and-DBG-messages.patch
@@ -0,0 +1,95 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Fri, 13 Sep 2019 17:22:20 +0200
+Subject: =?utf-8?q?Fix_some_typos_in_BUG=C2=A0and_DBG=C2=A0messages?=
+
+---
+ common/utils.c | 4 ++--
+ prnt/backend/hp.c | 2 +-
+ prnt/hpcups/LJZjStream.cpp | 2 +-
+ protocol/hp_ipp.c | 4 ++--
+ scan/sane/saneopts.h | 2 +-
+ 5 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/common/utils.c b/common/utils.c
+index d8ecee9..e7c5085 100644
+--- a/common/utils.c
++++ b/common/utils.c
+@@ -252,7 +252,7 @@ void *get_library_symbol(void *pLibHandler, const char *szSymbol)
+ void *pSymHandler = NULL;
+ if (pLibHandler == NULL)
+ {
+- BUG("Invalid Library hanlder\n");
++ BUG("Invalid Library handler\n");
+ return NULL;
+ }
+
+@@ -274,7 +274,7 @@ void unload_library(void *pLibHandler)
+ if (pLibHandler)
+ dlclose(pLibHandler);
+ else
+- BUG("Invalid Library hanlder pLibHandler = NULL.\n");
++ BUG("Invalid Library handler pLibHandler = NULL.\n");
+ }
+
+ int createTempFile(char* szFileName, FILE** pFilePtr)
+diff --git a/prnt/backend/hp.c b/prnt/backend/hp.c
+index 07713b2..066866e 100644
+--- a/prnt/backend/hp.c
++++ b/prnt/backend/hp.c
+@@ -666,7 +666,7 @@ static void save_out_file(int fd, int copies, FILE * temp_fp)
+
+ if (NULL == temp_fp)
+ {
+- BUG("ERROR: save_out_file function recieved NULL temp_fp pointer\n");
++ BUG("ERROR: save_out_file function received NULL temp_fp pointer\n");
+ return;
+ }
+
+diff --git a/prnt/hpcups/LJZjStream.cpp b/prnt/hpcups/LJZjStream.cpp
+index 9b06cf8..45a0c7a 100644
+--- a/prnt/hpcups/LJZjStream.cpp
++++ b/prnt/hpcups/LJZjStream.cpp
+@@ -685,7 +685,7 @@ DRIVER_ERROR LJZjStream::preProcessRasterData(cups_raster_t **ppcups_raster, cup
+ return NO_ERROR;
+ }
+
+- dbglog ("DEBUG: Getting Swaped Pages Raster.....\n");
++ dbglog ("DEBUG: Getting Swapped Pages Raster.....\n");
+
+ memcpy(&cups_header, firstpage_cups_header, sizeof(cups_page_header2_t));
+
+diff --git a/protocol/hp_ipp.c b/protocol/hp_ipp.c
+index 24b6b55..9e7c907 100644
+--- a/protocol/hp_ipp.c
++++ b/protocol/hp_ipp.c
+@@ -940,7 +940,7 @@ enum HPMUD_RESULT readChannel(raw_ipp *responseptr, HPMUD_DEVICE hd, HPMUD_CHANN
+ {
+ if(memcmp(&data[*size - CHUNK_DELIMITER_LENGTH], CHUNK_DELIMITER, CHUNK_DELIMITER_LENGTH) == 0)
+ {
+- DBG("Chunk end recieved....\n");
++ DBG("Chunk end received....\n");
+ break;
+ }
+ }
+@@ -949,7 +949,7 @@ enum HPMUD_RESULT readChannel(raw_ipp *responseptr, HPMUD_DEVICE hd, HPMUD_CHANN
+ bytes_remaining -= bytes_read;
+ if(bytes_remaining == 0)
+ {
+- DBG("Complete unchunked data recieved....\n");
++ DBG("Complete unchunked data received....\n");
+ break;
+ }
+ }
+diff --git a/scan/sane/saneopts.h b/scan/sane/saneopts.h
+index fcc460f..2d5a701 100755
+--- a/scan/sane/saneopts.h
++++ b/scan/sane/saneopts.h
+@@ -133,7 +133,7 @@
+
+ #define SANE_NAME_MULTIPICK "multi-pick"
+ #define SANE_TITLE_MULTIPICK SANE_I18N("Multi pick")
+-#define SANE_DESC_MULTIPICK SANE_I18N("Select multipick option for ESCL protocal based devices")
++#define SANE_DESC_MULTIPICK SANE_I18N("Select multipick option for ESCL protocol based devices")
+
+ #define SANE_TITLE_NUM_OPTIONS SANE_I18N("Number of options")
+ #define SANE_TITLE_PREVIEW SANE_I18N("Preview")
diff --git a/debian/patches/0032-Fix-version-pattern-check-to-support-ghostscript-RC-.patch b/debian/patches/0032-Fix-version-pattern-check-to-support-ghostscript-RC-.patch
new file mode 100644
index 000000000..c119fafef
--- /dev/null
+++ b/debian/patches/0032-Fix-version-pattern-check-to-support-ghostscript-RC-.patch
@@ -0,0 +1,26 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Wed, 18 Sep 2019 21:01:21 +0200
+Subject: Fix version pattern check to support ghostscript RC versions
+
+$ gs -v
+GPL Ghostscript RELEASE CANDIDATE 2 9.28 (2019-09-05)
+Copyright (C) 2019 Artifex Software, Inc. All rights reserved.
+
+Without the escaped dot, the version will match as "2 9".
+---
+ installer/dcheck.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/installer/dcheck.py b/installer/dcheck.py
+index ad62c93..a371d15 100644
+--- a/installer/dcheck.py
++++ b/installer/dcheck.py
+@@ -34,7 +34,7 @@ from base import utils, services
+ from base.sixext import to_bytes_utf8
+
+ ver1_pat = re.compile("""(\d+\.\d+\.\d+)""", re.IGNORECASE)
+-ver_pat = re.compile("""(\d+.\d+)""", re.IGNORECASE)
++ver_pat = re.compile("""(\d+\.\d+)""", re.IGNORECASE)
+ PID = 0
+ CMDLINE = 1
+
diff --git a/debian/patches/0033-Fix-the-PIL.Image-version-check-to-work-with-Pillow-.patch b/debian/patches/0033-Fix-the-PIL.Image-version-check-to-work-with-Pillow-.patch
new file mode 100644
index 000000000..14428b42e
--- /dev/null
+++ b/debian/patches/0033-Fix-the-PIL.Image-version-check-to-work-with-Pillow-.patch
@@ -0,0 +1,22 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Wed, 18 Sep 2019 21:09:05 +0200
+Subject: Fix the PIL.Image version check, to work with Pillow > 6
+
+(Debian has Pillow 6.1 from Bullseye on)
+---
+ installer/dcheck.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/installer/dcheck.py b/installer/dcheck.py
+index a371d15..d011c97 100644
+--- a/installer/dcheck.py
++++ b/installer/dcheck.py
+@@ -370,7 +370,7 @@ def get_pil_version():
+ except ImportError:
+ return '-'
+ else:
+- return Image.PILLOW_VERSION
++ return Image.__version__
+
+ def get_libpthread_version():
+ try:
diff --git a/debian/patches/0034-Don-t-gpg-import-but-rely-on-installed-signing_key.a.patch b/debian/patches/0034-Don-t-gpg-import-but-rely-on-installed-signing_key.a.patch
new file mode 100644
index 000000000..f86eaee33
--- /dev/null
+++ b/debian/patches/0034-Don-t-gpg-import-but-rely-on-installed-signing_key.a.patch
@@ -0,0 +1,37 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Wed, 18 Sep 2019 22:11:40 +0200
+Subject: Don't gpg --import, but rely on installed signing_key.asc
+
+---
+ base/validation.py | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/base/validation.py b/base/validation.py
+index d555f12..dfea16c 100644
+--- a/base/validation.py
++++ b/base/validation.py
+@@ -42,9 +42,7 @@ class DigiSign_Verification(object):
+
+
+ class GPG_Verification(DigiSign_Verification):
+- def __init__(self, pgp_site = 'pgp.mit.edu', key = 0x4ABA2F66DBD5A95894910E0673D770CDA59047B9):
+- self.__pgp_site = pgp_site
+- self.__key = key
++ def __init__(self):
+ self.__gpg = utils.which('gpg',True)
+
+ sts, self.__hplipdir = os_utils.getHPLIPDir()
+@@ -83,10 +81,10 @@ class GPG_Verification(DigiSign_Verification):
+
+ def __acquire_gpg_key(self):
+
+- cmd = '%s --homedir %s --no-permission-warning --keyserver %s --recv-keys 0x%X' \
+- % (self.__gpg, self.__gpg_dir, self.__pgp_site, self.__key)
++ cmd = '%s --homedir %s --no-permission-warning --import %s' \
++ % (self.__gpg, self.__gpg_dir, "/usr/share/hplip/signing-key.asc")
+
+- log.info("Receiving digital keys: %s" % cmd)
++ log.info("Importing digital key")
+ status, output = utils.run(cmd)
+ log.debug(output)
+
diff --git a/debian/patches/0035-Shortcut-distros.dat-finding-to-point-to-where-it-is.patch b/debian/patches/0035-Shortcut-distros.dat-finding-to-point-to-where-it-is.patch
new file mode 100644
index 000000000..0f3a515df
--- /dev/null
+++ b/debian/patches/0035-Shortcut-distros.dat-finding-to-point-to-where-it-is.patch
@@ -0,0 +1,35 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Thu, 19 Sep 2019 08:37:21 +0200
+Subject: Shortcut distros.dat finding to point to where it is
+
+---
+ installer/core_install.py | 16 +---------------
+ 1 file changed, 1 insertion(+), 15 deletions(-)
+
+diff --git a/installer/core_install.py b/installer/core_install.py
+index eaecdc6..d690a52 100644
+--- a/installer/core_install.py
++++ b/installer/core_install.py
+@@ -816,21 +816,7 @@ class CoreInstall(object):
+ return [x for x in data.split(',') if x]
+
+ def load_distros(self):
+- if self.mode == MODE_INSTALLER:
+- distros_dat_file = os.path.join('installer', 'distros.dat')
+-
+- elif self.mode == MODE_CREATE_DOCS:
+- distros_dat_file = os.path.join(
+- '..', '..', 'installer', 'distros.dat')
+-
+- else: # MODE_CHECK
+- distros_dat_file = os.path.join(
+- prop.home_dir, 'installer', 'distros.dat')
+-
+- if not os.path.exists(distros_dat_file):
+- log.debug(
+- "DAT file not found at %s. Using local relative path..." % distros_dat_file)
+- distros_dat_file = os.path.join('installer', 'distros.dat')
++ distros_dat_file = '/usr/share/hplip/installer/distros.dat'
+
+ distros_dat = ConfigBase(distros_dat_file)
+ distros_list = self.__fixup_data(
diff --git a/debian/patches/0036-Accelerate-HTTP-check-by-doing-a-HEAD-not-a-GET.patch b/debian/patches/0036-Accelerate-HTTP-check-by-doing-a-HEAD-not-a-GET.patch
new file mode 100644
index 000000000..af4e2b902
--- /dev/null
+++ b/debian/patches/0036-Accelerate-HTTP-check-by-doing-a-HEAD-not-a-GET.patch
@@ -0,0 +1,56 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Thu, 19 Sep 2019 08:47:34 +0200
+Subject: =?utf-8?q?Accelerate_HTTP=C2=A0check_by_doing_a_HEAD=2C_not_a_GET?=
+
+---
+ base/utils.py | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/base/utils.py b/base/utils.py
+index 9f9cfb1..eff780f 100644
+--- a/base/utils.py
++++ b/base/utils.py
+@@ -2248,12 +2248,14 @@ def check_library( so_file_path):
+ return ret_val
+
+
+-def download_via_wget(target):
++def download_via_wget(target, head=False):
+ status = -1
+ wget = which("wget")
+ if target and wget:
+ wget = os.path.join(wget, "wget")
+ cmd = "%s --cache=off --tries=3 --timeout=60 --output-document=- %s" % (wget, target)
++ if head:
++ cmd += " --spider -S"
+ log.debug(cmd)
+ status, output = run(cmd)
+ log.debug("wget returned: %d" % status)
+@@ -2261,12 +2263,14 @@ def download_via_wget(target):
+ log.debug("wget not found")
+ return status
+
+-def download_via_curl(target):
++def download_via_curl(target, head=False):
+ status = -1
+ curl = which("curl")
+ if target and curl:
+ curl = os.path.join(curl, "curl")
+ cmd = "%s --output - --connect-timeout 5 --max-time 10 %s" % (curl, target)
++ if head:
++ cmd += " --head"
+ log.debug(cmd)
+ status, output = run(cmd)
+ log.debug("curl returned: %d" % status)
+@@ -2288,9 +2292,9 @@ def check_network_via_ping(target):
+ return status
+
+ def check_network_connection(url=HTTP_CHECK_TARGET, ping_server=PING_CHECK_TARGET):
+- status = download_via_wget(url)
++ status = download_via_wget(url, head=True)
+ if (status != 0):
+- status = download_via_curl(url)
++ status = download_via_curl(url, head=True)
+ if (status != 0):
+ status = check_network_via_ping(ping_server)
+ return (status == 0)
diff --git a/debian/patches/0037-Enforce-Debian-assumptions.patch b/debian/patches/0037-Enforce-Debian-assumptions.patch
new file mode 100644
index 000000000..f7c49ba7f
--- /dev/null
+++ b/debian/patches/0037-Enforce-Debian-assumptions.patch
@@ -0,0 +1,139 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Sat, 21 Sep 2019 19:02:07 +0200
+Subject: Enforce Debian assumptions:
+
+- The distro version is supported
+- Auto installation is not allowed
+- Do not allow the installer to install "missing" packages by itself
+---
+ installer/core_install.py | 109 +++-------------------------------------------
+ 1 file changed, 5 insertions(+), 104 deletions(-)
+
+diff --git a/installer/core_install.py b/installer/core_install.py
+index d690a52..461a34b 100644
+--- a/installer/core_install.py
++++ b/installer/core_install.py
+@@ -2013,34 +2013,12 @@ class CoreInstall(object):
+ return True
+
+ def validate_distro_version(self):
+- if self.validate_disto():
+- for vers in self.distros[self.distro_name]['versions']:
+- if self.distro_version == vers:
+- return True
+-
+- return False
++ # It's shipped in Debian. It's supported.
++ return True
+
+ def is_auto_installer_support(self, distro_version=DISTRO_VER_UNKNOWN):
+- if not self.distro_name:
+- self.get_distro()
+- try:
+- self.distro_name = self.distros_index[self.distro]
+- except KeyError:
+- log.debug("Auto installation is not supported as Distro Name can't find for distro index [%d]." % (
+- self.distro))
+- return False
+-
+- if distro_version == DISTRO_VER_UNKNOWN:
+- distro_version = self.distro_version
+-
+- if self.distro != DISTRO_UNKNOWN and distro_version != DISTRO_VER_UNKNOWN and self.get_ver_data('supported', False, distro_version):
+- log.debug("Auto installation is supported for Distro =%s version =%s " % (
+- self.distro_name, distro_version))
+- return True
+- else:
+- log.debug("Auto installation is not supported for Distro =%s version =%s " % (
+- self.distro_name, distro_version))
+- return False
++ # No auto install ever.
++ return False
+
+ # Uninstalls the HPLIP package.
+ # Input:
+@@ -2378,83 +2356,6 @@ class CoreInstall(object):
+ log.info("No missing dependencies")
+ return 0
+
+- if mode == INTERACTIVE_MODE:
+- ok, user_input = tui.enter_choice(
+- "Do you want to update repository and Install missing/incompatible packages. (a=install all*, c=custom_install, s=skip):", ['a', 'c', 's'], 'a')
+- if not ok or user_input == 'q':
+- return 1
+- elif user_input == 's':
+- log.info(
+- log.bold("Install manually above missing/incompatible packages."))
+- else:
+- self.close_package_managers()
+-
+- log.info(log.bold("Updating repository"))
+- log.info(log.bold('-' * len("Updating repository")))
+- if pre_depend_cmd:
+- for cmd in pre_depend_cmd:
+- log.info("cmd =%s" % (cmd))
+- sts, out = utils.run(cmd, self.passwordObj)
+- if sts != 0 or "Failed" in out:
+- log.warn(
+- "Failed to update Repository, check if any update/installation is running.")
+-
+- if user_input == 'c':
+- log.info(log.bold("Installing missing/incompatible packages"))
+- log.info(
+- log.bold('-' * len("Installing missing/incompatible packages")))
+- for d in overall_install_cmds:
+- ok, user_input = tui.enter_choice(
+- "Do you want to install '%s' package?(y=yes*, n=no):" % d, ['y', 'n'], 'y')
+- if ok and user_input == 'y':
+- if 'hpaio' in overall_install_cmds[d]:
+- self.update_hpaio()
+- else:
+- log.info("cmd =%s" % overall_install_cmds[d])
+- sts, out = utils.run(overall_install_cmds[
+- d], self.passwordObj)
+- if sts != 0 or "Failed" in out:
+- log.error(
+- "Failed to install '%s' package, please install manually. " % d)
+- if 'cups' in d:
+- if not services.start_service('cups', self.passwordObj):
+- log.error(
+- "Failed to start CUPS service. Please start CUPS manually or restart system.")
+- for cmd in missing_cmd:
+- ok, user_input = tui.enter_choice(
+- "Do you want to run '%s' command?(y=yes*, n=no):" % d, ['y', 'n'], 'y')
+- if ok and user_input == 'y':
+- sts, out = utils.run(cmd, self.passwordObj)
+- if sts != 0 or "Failed" in out:
+- log.error(
+- "Failed to run '%s' command, please run manually. " % d)
+-
+- elif user_input == 'a':
+- log.info(log.bold("Installing Missing/Incompatible packages"))
+- log.info(
+- log.bold('-' * len("Installing Missing/Incompatible packages")))
+- for d in overall_install_cmds:
+- if 'hpaio' in overall_install_cmds[d]:
+- self.update_hpaio()
+- else:
+- log.info("cmd =%s" % overall_install_cmds[d])
+- sts, out = utils.run(overall_install_cmds[
+- d], self.passwordObj)
+- if sts != 0 or "Failed" in out:
+- log.error(
+- "Failed to install '%s' package, please install manually. " % d)
+- if 'cups' in d:
+- if not services.start_service('cups', self.passwordObj):
+- log.error(
+- "Failed to start CUPS sevice. Please start CUPS manually or restart system.")
+- for cmd in missing_cmd:
+- sts, out = utils.run(cmd, self.passwordObj)
+- if sts != 0 or "Failed" in out:
+- log.error(
+- "Failed to run '%s' command, please run manually. " % d)
+-
+- else:
+- log.error("GUI is not yet supported..1")
+- # TBD
++ # Do not allow HPLIP to run APT or anything else, especially not as root.
+
+ return 0
diff --git a/debian/patches/0038-Removed-all-page-size-choices-named-Custom-.-they-br.patch b/debian/patches/0038-Removed-all-page-size-choices-named-Custom-.-they-br.patch
new file mode 100644
index 000000000..7a5c79df4
--- /dev/null
+++ b/debian/patches/0038-Removed-all-page-size-choices-named-Custom-.-they-br.patch
@@ -0,0 +1,96 @@
+From: Till Kamppeter <till.kamppeter@gmail.com>
+Date: Tue, 1 Oct 2019 19:57:58 +0200
+Subject: Removed all page size choices named "Custom". they break with CUPS
+ and are also identical with US Legal
+
+See CUPS upstream issue #5639
+
+Made with:
+ sed -e '/CustomMedia.*"Custom.*612 1008/,+1d' -i prnt/drv/*drv.in.template
+---
+ prnt/drv/hpcups.drv.in.template | 14 --------------
+ prnt/drv/hpijs.drv.in.template | 4 ----
+ 2 files changed, 18 deletions(-)
+
+diff --git a/prnt/drv/hpcups.drv.in.template b/prnt/drv/hpcups.drv.in.template
+index 5895d95..e92b099 100644
+--- a/prnt/drv/hpcups.drv.in.template
++++ b/prnt/drv/hpcups.drv.in.template
+@@ -4118,8 +4118,6 @@ Manufacturer "HP"
+ CustomMedia "JB5.FB/JB5 Borderless 182x257mm" 515.90 728.50 0 0 0 0 "<</cupsInteger0 45/PageSize[515.90 728.50]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize [515.90 728.50]/ImagingBBox null>>setpagedevice"
+
+- CustomMedia "Custom1/Custom 1" 612 1008 8.4 8.4 8.4 8.4 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+
+ CustomMedia "Env10/#10 Envelope 4.125x9.5in" 297 684 8.4 8.4 8.4 8.4 "<</cupsInteger0 81/PageSize[297 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[297 684]/ImagingBBox null>>setpagedevice"
+@@ -4276,8 +4274,6 @@ Manufacturer "HP"
+ "<</cupsInteger0 65/PageSize[498.72 708.48]/ImagingBBox null>>setpagedevice"
+ CustomMedia "B5/B5 182x257" 515.76 728.4 8.4 8.4 8.4 41.04 "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom1" 612 1008 8.4 8.4 8.4 41.04 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Env10/#10 Envelope 4.1x9.5in" 296.88 684 8.4 8.4 8.4 41.04 "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvA2/A2 Envelope 111x146in" 314.88 414 8.4 8.4 8.4 41.04 "<</cupsInteger0 109/PageSize[314.88 414]/ImagingBBox null>>setpagedevice"
+@@ -4395,8 +4391,6 @@ Manufacturer "HP"
+ "<</cupsInteger0 65/PageSize[498.72 708.48]/ImagingBBox null>>setpagedevice"
+ CustomMedia "B5/B5 182x257" 515.76 728.4 8.4 8.4 8.4 36 "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom1" 612 1008 8.4 8.4 8.4 36 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Env10/#10 Envelope 4.1x9.5in" 296.88 684 8.4 8.4 8.4 36 "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvA2/A2 Envelope 111x146in" 314.88 414 8.4 8.4 8.4 36 "<</cupsInteger0 109/PageSize[314.88 414]/ImagingBBox null>>setpagedevice"
+@@ -4525,8 +4519,6 @@ Manufacturer "HP"
+ "<</cupsInteger0 65/PageSize[498.72 708.48]/ImagingBBox null>>setpagedevice"
+ CustomMedia "B5/B5 182x257" 515.76 728.4 8.4 8.4 8.4 36 "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom1" 612 1008 8.4 8.4 8.4 36 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Env10/#10 Envelope 4.1x9.5in" 296.88 684 8.4 8.4 8.4 36 "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvA2/A2 Envelope 111x146in" 314.88 414 8.4 8.4 8.4 36 "<</cupsInteger0 109/PageSize[314.88 414]/ImagingBBox null>>setpagedevice"
+@@ -10149,10 +10141,6 @@ Manufacturer "HP"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ CustomMedia "JB5.FB/Borderless JB5" 515.76 728.4 0 0 0 0 "<</cupsInteger0 45/PageSize [515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom" 612 1008 8.4 8.4 8.4 8.4 "<</cupsInteger0 101/PageSize [612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom.FB/Borderless Custom" 612 1008 0 0 0 0 "<</cupsInteger0 101/PageSize [612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Envelope#10/Envelope #10" 296.88 684 8.4 8.4 8.4 8.4 "<</cupsInteger0 81/PageSize [296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvelopeA2/Envelope A2" 314.88 414 8.4 8.4 8.4 8.4 "<</cupsInteger0 109/PageSize [314.88 414]/ImagingBBox null>>setpagedevice"
+@@ -12205,8 +12193,6 @@ Manufacturer "HP"
+ "<</cupsInteger0 2/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Statement/Statement " 396 612 8.4 8.4 8.4 8.4 "<</cupsInteger0 15/PageSize[396 612]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 15/PageSize[396 612]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom " 612 1008 8.4 8.4 8.4 8.4 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Tabloid/Tabloid " 792 1224 8.4 8.4 8.4 8.4 "<</cupsInteger0 6/PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 6/PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Tabloid.FB/Tabloid Borderless " 792 1224 0 0 0 0 "<</cupsInteger0 6/PageSize[792 1224]/ImagingBBox null>>setpagedevice"
+diff --git a/prnt/drv/hpijs.drv.in.template b/prnt/drv/hpijs.drv.in.template
+index 0c60fdc..71a0ef0 100644
+--- a/prnt/drv/hpijs.drv.in.template
++++ b/prnt/drv/hpijs.drv.in.template
+@@ -7726,8 +7726,6 @@ lity:PenSet=2,Quality:FullBleed=1"
+ "<</cupsInteger0 65/PageSize[498.72 708.48]/ImagingBBox null>>setpagedevice"
+ CustomMedia "B5/B5 182x257" 515.76 728.4 8.4 8.4 8.4 36 "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom1" 612 1008 8.4 8.4 8.4 36 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Env10/#10 Envelope 4.1x9.5in" 296.88 684 8.4 8.4 8.4 36 "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvA2/A2 Envelope 111x146in" 314.88 414 8.4 8.4 8.4 36 "<</cupsInteger0 109/PageSize[314.88 414]/ImagingBBox null>>setpagedevice"
+@@ -7896,8 +7894,6 @@ lity:PenSet=2,Quality:FullBleed=1"
+ "<</cupsInteger0 65/PageSize[498.72 708.48]/ImagingBBox null>>setpagedevice"
+ CustomMedia "B5/B5 182x257" 515.76 728.4 8.4 8.4 8.4 36 "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 45/PageSize[515.76 728.4]/ImagingBBox null>>setpagedevice"
+- CustomMedia "Custom/Custom1" 612 1008 8.4 8.4 8.4 36 "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+- "<</cupsInteger0 101/PageSize[612 1008]/ImagingBBox null>>setpagedevice"
+ CustomMedia "Env10/#10 Envelope 4.1x9.5in" 296.88 684 8.4 8.4 8.4 36 "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ "<</cupsInteger0 81/PageSize[296.88 684]/ImagingBBox null>>setpagedevice"
+ CustomMedia "EnvA2/A2 Envelope 111x146in" 314.88 414 8.4 8.4 8.4 36 "<</cupsInteger0 109/PageSize[314.88 414]/ImagingBBox null>>setpagedevice"
diff --git a/debian/patches/0039-PY3-Fix-dat2drv.py.patch b/debian/patches/0039-PY3-Fix-dat2drv.py.patch
new file mode 100644
index 000000000..d84c1ceb7
--- /dev/null
+++ b/debian/patches/0039-PY3-Fix-dat2drv.py.patch
@@ -0,0 +1,21 @@
+From: Didier Raboud <odyx@debian.org>
+Date: Tue, 1 Oct 2019 21:49:49 +0200
+Subject: PY3: Fix dat2drv.py
+
+---
+ dat2drv.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dat2drv.py b/dat2drv.py
+index 4b3e460..0bee28f 100755
+--- a/dat2drv.py
++++ b/dat2drv.py
+@@ -94,7 +94,7 @@ def usage(typ='text'):
+ def _encode(v):
+ if isinstance(v, text_type):
+ v = v.encode(enc)
+- return v
++ return str(v)
+
+
+
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 000000000..bcd3a00aa
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,39 @@
+0001-Cope-with-prnt-hpcups-ErnieFilter.-cpp-h-removal-by-.patch
+0002-Blank-ink-only-patch-by-Richard-Spencer-Smith.patch
+0003-Fix-missing-charsign.patch
+0004-Corrections-models.dat-entry-for-the-HP-PhotoSmart-P.patch
+0005-Fixed-short-edge-duplex-for-non-PS-laser-printers.patch
+0006-Make-simple-scan-the-default-scanning-frontend.patch
+0007-Try-libhpmud.so.0-directly.patch
+0008-For-the-Lidil-printers-enable-two-cartridge-modes-bl.patch
+0009-The-hpfax-CUPS-backend-uses-its-function-bug-which-i.patch
+0010-Simplified-the-construction-of-the-title-line-of-the.patch
+0011-Make-the-menu-of-the-hp-systray-applet-appearing-whe.patch
+0012-Fix-duplex-descriptor-uninitialized.patch
+0013-Make-sure-that-the-HPLIP-components-which-access-the.patch
+0014-Workaround-patch-for-missing-Python3-transition-of-t.patch
+0015-Allow-non-JPEG-scanning-on-the-HP-DeskJet-3520-All-i.patch
+0016-Fix-download-and-installation-of-HP-s-proprietary-pl.patch
+0017-In-hp-scan-s-manpage-sort-PAGE_SIZES-in-help-for-the.patch
+0018-Install-check-plugin.py-as-a-script.patch
+0019-LaserJet-PostScript-4000-PPD-bugfix.patch
+0020-Patch-UI-files-to-match-upstream-produced-.py-code.patch
+0021-Add-include-cups-ppd.h-in-various-places-as-CUPS-2.2.patch
+0022-Fix-list-wrapping-in-scan.py-to-fix-generated-manpag.patch
+0023-Fix-handling-of-unicode-filenames-in-sixext.py.patch
+0024-Make-dat2drv-and-locateppd-build-dependent-of-class-.patch
+0025-Remove-all-ImageProcessor-functionality-which-is-clo.patch
+0026-Call-QMessageBox-constructors-of-PyQT5-with-the-corr.patch
+0027-Fixed-incomplete-removal-of-hp-toolbox-features-whic.patch
+0028-hp-check-Fix-core.distro-vs.-core.distro_name-mixups.patch
+0029-Make-base.g.xint-more-generous-in-what-it-can-take.patch
+0030-Fix-linking-of-libhpipp-and-the-ext-python-extension.patch
+0031-Fix-some-typos-in-BUG-and-DBG-messages.patch
+0032-Fix-version-pattern-check-to-support-ghostscript-RC-.patch
+0033-Fix-the-PIL.Image-version-check-to-work-with-Pillow-.patch
+0034-Don-t-gpg-import-but-rely-on-installed-signing_key.a.patch
+0035-Shortcut-distros.dat-finding-to-point-to-where-it-is.patch
+0036-Accelerate-HTTP-check-by-doing-a-HEAD-not-a-GET.patch
+0037-Enforce-Debian-assumptions.patch
+0038-Removed-all-page-size-choices-named-Custom-.-they-br.patch
+0039-PY3-Fix-dat2drv.py.patch