From f277d30a521b4a52fa424c0d87b83558c3c12920 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 24 Aug 2009 11:37:40 +0000 Subject: [PATCH] - Fixed state reasons handling problems (bug #501338). --- hplip-clear-previous-state-reasons.patch | 29 +++++++++++++++++++ hplip-state-reasons-newline.patch | 36 ++++++++++++++++++++++++ hplip.spec | 14 ++++++++- 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 hplip-clear-previous-state-reasons.patch create mode 100644 hplip-state-reasons-newline.patch diff --git a/hplip-clear-previous-state-reasons.patch b/hplip-clear-previous-state-reasons.patch new file mode 100644 index 0000000..ed2b4ec --- /dev/null +++ b/hplip-clear-previous-state-reasons.patch @@ -0,0 +1,29 @@ +diff -up hplip-3.9.8/prnt/backend/hp.c.clear-previous-state-reasons hplip-3.9.8/prnt/backend/hp.c +--- hplip-3.9.8/prnt/backend/hp.c.clear-previous-state-reasons 2009-08-04 22:35:33.000000000 +0100 ++++ hplip-3.9.8/prnt/backend/hp.c 2009-08-24 09:55:28.941900902 +0100 +@@ -570,6 +570,14 @@ static int loop_test(HPMUD_DEVICE dd, HP + { + int status, stat; + const char *pstate, *old_state=NULL; ++ static int first_time = 1; ++ ++ if (first_time) ++ { ++ first_time = 0; ++ old_state = ("media-empty-error,media-jam-error," ++ "cover-open-error,toner-empty-error,other"); ++ } + + while (1) + { +@@ -768,6 +776,10 @@ int main(int argc, char *argv[]) + pthread_cond_init(&pa.done_cond, NULL); + pthread_create(&pa.tid, NULL, (void *(*)(void*))pjl_read_thread, (void *)&pa); + } ++ ++ /* Clear any errors left over from a previous run. */ ++ loop_test (hd, cd, &pa, argv[0], printer, argv[2], argv[1], ++ argv[3]); + } + + stat = hpmud_write_channel(hd, cd, buf+total, size, EXCEPTION_TIMEOUT, &n); diff --git a/hplip-state-reasons-newline.patch b/hplip-state-reasons-newline.patch new file mode 100644 index 0000000..ed7163f --- /dev/null +++ b/hplip-state-reasons-newline.patch @@ -0,0 +1,36 @@ +diff -up hplip-3.9.8/prnt/backend/hp.c.state-reasons-newline hplip-3.9.8/prnt/backend/hp.c +diff -up hplip-3.9.8/prnt/hpijs/hpcups.cpp.state-reasons-newline hplip-3.9.8/prnt/hpijs/hpcups.cpp +--- hplip-3.9.8/prnt/hpijs/hpcups.cpp.state-reasons-newline 2009-08-24 10:40:32.407070376 +0100 ++++ hplip-3.9.8/prnt/hpijs/hpcups.cpp 2009-08-24 11:04:14.374016107 +0100 +@@ -315,7 +315,7 @@ int HPCups::initContext (char **argv) + m_pSys->pPC->constructor_error != PLUGIN_LIBRARY_MISSING && + m_pSys->DisplayStatus != DISPLAY_PRINTING_CANCELED) + { +- BUG("PrintContext creation failed, error = %d", m_pSys->pPC->constructor_error); ++ BUG("PrintContext creation failed, error = %d\n", m_pSys->pPC->constructor_error); + return 1; + } + +@@ -347,11 +347,11 @@ int HPCups::initContext (char **argv) + case WARN_LOW_INK_YELLOW: + case WARN_LOW_INK_MULTIPLE_PENS: + { +- BUG ("STATE: +marker-supply-low-warning\n"); ++ fputs ("STATE: +marker-supply-low-warning\n", stderr); + break; + } + default: +- BUG ("STATE: -marker-supply-low-warning\n"); ++ fputs ("STATE: -marker-supply-low-warning\n", stderr); + } + } + +@@ -678,7 +678,7 @@ void CancelPrintJob (int sig) + int main (int argc, char **argv) + { + int iRet = hpCups.ProcessJob (argc, argv); +- BUG("hpcups: returning status %d from main", iRet); ++ BUG("hpcups: returning status %d from main\n", iRet); + return iRet; + } + diff --git a/hplip.spec b/hplip.spec index 8464a34..532eacf 100644 --- a/hplip.spec +++ b/hplip.spec @@ -1,7 +1,8 @@ +%define __find_provides %{_datadir}/system-config-printer/postscriptdriver.prov Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.9.8 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2+ and MIT Group: System Environment/Daemons Conflicts: system-config-printer < 0.6.132 @@ -17,6 +18,8 @@ Patch1: hplip-hpcups-reorder.patch Patch2: hplip-strstr-const.patch Patch3: hplip-ui-optional.patch Patch4: hplip-no-asm.patch +Patch5: hplip-clear-previous-state-reasons.patch +Patch6: hplip-state-reasons-newline.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires(pre): /sbin/service @@ -109,6 +112,12 @@ rm -rf $RPM_BUILD_DIR/%{name}-%{version} # Make sure to avoid handwritten asm. %patch4 -p1 -b .no-asm +# Clear previous state reasons in the hp backend (bug #501338). +%patch5 -p1 -b .clear-previous-state-reasons + +# Don't hide state reason changes by missing out newlines in stderr. +%patch6 -p1 -b .state-reasons-newline + %build %configure \ --enable-scan-build --enable-gui-build --enable-fax-build \ @@ -310,6 +319,9 @@ fi exit 0 %changelog +* Mon Aug 24 2009 Tim Waugh 3.9.8-8 +- Fixed state reasons handling problems (bug #501338). + * Fri Aug 21 2009 Tomas Mraz - 3.9.8-7 - rebuilt with new openssl