Package: ptouch-driver
Version: 1.3-7
Severity: important
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu trusty ubuntu-patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

The attached patch resolves an issue whereby ptouch-driver sends a
QL-specific command (ESC i A "Enable Cutter") to all printers, not just
QL-series devices. This causes printing to fail on the PT-2450DX (with
an Interface Error shown on the panel) and probably other printers in
the Brother P-Touch series too.


  * Add patch send-esc-i-A-for-QL-only.patch


Thanks for considering the patch.


-- System Information:
Debian Release: wheezy/sid
  APT prefers saucy-updates
  APT policy: (500, 'saucy-updates'), (500, 'saucy-security'), (500, 'saucy'), 
(100, 'saucy-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.11.0-17-generic (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
=== modified file '.pc/applied-patches'
--- .pc/applied-patches	2011-08-29 12:27:35 +0000
+++ .pc/applied-patches	2014-03-04 22:51:59 +0000
@@ -1,2 +1,3 @@
 foomatic-data-fixes.patch
 send-esc-i-A.patch
+send-esc-i-A-for-QL-only.patch

=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control	2012-09-26 14:34:28 +0000
+++ debian/control	2014-03-04 22:50:44 +0000
@@ -9,7 +9,7 @@
                libcups2-dev,
                libcupsimage2-dev,
                foomatic-db-engine,
-               pyppd (>= 0.4.9-6~)
+               pyppd (>= 1.0.1)
 Vcs-Git: git://anonscm.debian.org/collab-maint/ptouch-driver.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/ptouch-driver.git
 Homepage: http://www.diku.dk/hjemmesider/ansatte/panic/P-touch/

=== added file 'debian/patches/send-esc-i-A-for-QL-only.patch'
--- debian/patches/send-esc-i-A-for-QL-only.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/send-esc-i-A-for-QL-only.patch	2014-03-04 20:27:25 +0000
@@ -0,0 +1,50 @@
+Index: ptouch-driver/rastertoptch.c
+===================================================================
+--- ptouch-driver.orig/rastertoptch.c	2014-03-04 20:06:59.000000000 +0000
++++ ptouch-driver/rastertoptch.c	2014-03-04 20:27:19.000000000 +0000
+@@ -685,7 +685,8 @@
+ inline void
+ emit_feed_cut_mirror (bool do_feed, unsigned feed,
+                       bool do_cut,
+-                      bool do_mirror) {
++                      bool do_mirror,
++                      bool is_ulp) {
+   /* Determine feed nibble */
+   unsigned feed_nibble;
+   if (do_feed) {
+@@ -698,7 +699,14 @@
+   /* Determine mirror print bit*/
+   unsigned char mirror_bit = do_mirror ? 0x80 : 0x00;
+   /* Combine & emit printer command code */
+-  putchar (ESC); putchar ('i'); putchar ('A'); putchar ((char) (do_cut ? 0x01 : 0x00));
++  if (is_ulp) {
++    /* ESC i A is Enable Cutter -- used for QL-560 only, according to
++     * <http://www.undocprint.org/formats/page_description_languages/brother_p-touch>
++     * The QL-560 (actually the whole QL series) uses ULP mode, so we check for that.
++     * The PT2450DX uses RLE and throw an INTERFACE ERROR if it sees this command.
++     */
++    putchar (ESC); putchar ('i'); putchar ('A'); putchar ((char) (do_cut ? 0x01 : 0x00));
++  }
+   putchar (ESC); putchar ('i'); putchar ('M');
+   putchar ((char) (feed & 0x1f) | auto_cut_bit | mirror_bit);
+ }
+@@ -807,7 +815,8 @@
+     /* We only know how to feed after each page */
+     emit_feed_cut_mirror (perform_feed == CUPS_ADVANCE_PAGE, feed,
+                           cut_media == CUPS_CUT_PAGE,
+-                          mirror == CUPS_TRUE);
++                          mirror == CUPS_TRUE,
++                          job_options->pixel_xfer == ULP);
+   /* Set media and quality if label preamble is requested */
+   unsigned page_size_y = new_page_options->page_size [1];
+   unsigned image_height_px = lrint (page_size_y * vres / 72.0);
+@@ -1527,7 +1536,8 @@
+            perform_feed == CUPS_ADVANCE_JOB,
+            new_page_options->feed,
+            cut_media == CUPS_CUT_PAGE || cut_media == CUPS_CUT_JOB,
+-           new_page_options->mirror == CUPS_TRUE);
++           new_page_options->mirror == CUPS_TRUE,
++           job_options->pixel_xfer == ULP);
+         /* Emit eject marker */
+         putchar (PTC_EJECT);
+       }

=== modified file 'debian/patches/series'
--- debian/patches/series	2010-09-13 10:00:00 +0000
+++ debian/patches/series	2014-03-04 22:51:47 +0000
@@ -1,2 +1,3 @@
 foomatic-data-fixes.patch
 send-esc-i-A.patch
+send-esc-i-A-for-QL-only.patch

=== modified file 'rastertoptch.c'
--- rastertoptch.c	2011-08-29 12:27:35 +0000
+++ rastertoptch.c	2014-03-04 22:51:59 +0000
@@ -685,7 +685,8 @@
 inline void
 emit_feed_cut_mirror (bool do_feed, unsigned feed,
                       bool do_cut,
-                      bool do_mirror) {
+                      bool do_mirror,
+                      bool is_ulp) {
   /* Determine feed nibble */
   unsigned feed_nibble;
   if (do_feed) {
@@ -698,7 +699,14 @@
   /* Determine mirror print bit*/
   unsigned char mirror_bit = do_mirror ? 0x80 : 0x00;
   /* Combine & emit printer command code */
-  putchar (ESC); putchar ('i'); putchar ('A'); putchar ((char) (do_cut ? 0x01 : 0x00));
+  if (is_ulp) {
+    /* ESC i A is Enable Cutter -- used for QL-560 only, according to
+     * <http://www.undocprint.org/formats/page_description_languages/brother_p-touch>
+     * The QL-560 (actually the whole QL series) uses ULP mode, so we check for that.
+     * The PT2450DX uses RLE and throw an INTERFACE ERROR if it sees this command.
+     */
+    putchar (ESC); putchar ('i'); putchar ('A'); putchar ((char) (do_cut ? 0x01 : 0x00));
+  }
   putchar (ESC); putchar ('i'); putchar ('M');
   putchar ((char) (feed & 0x1f) | auto_cut_bit | mirror_bit);
 }
@@ -807,7 +815,8 @@
     /* We only know how to feed after each page */
     emit_feed_cut_mirror (perform_feed == CUPS_ADVANCE_PAGE, feed,
                           cut_media == CUPS_CUT_PAGE,
-                          mirror == CUPS_TRUE);
+                          mirror == CUPS_TRUE,
+                          job_options->pixel_xfer == ULP);
   /* Set media and quality if label preamble is requested */
   unsigned page_size_y = new_page_options->page_size [1];
   unsigned image_height_px = lrint (page_size_y * vres / 72.0);
@@ -1527,7 +1536,8 @@
            perform_feed == CUPS_ADVANCE_JOB,
            new_page_options->feed,
            cut_media == CUPS_CUT_PAGE || cut_media == CUPS_CUT_JOB,
-           new_page_options->mirror == CUPS_TRUE);
+           new_page_options->mirror == CUPS_TRUE,
+           job_options->pixel_xfer == ULP);
         /* Emit eject marker */
         putchar (PTC_EJECT);
       }

Reply via email to