philpem / printer-driver-ptouch

P-Touch PT-series and QL-series printer driver for Linux (under CUPS)
GNU General Public License v2.0
97 stars 24 forks source link

Patch for PT-P300BT support #7

Closed andrew867 closed 3 years ago

andrew867 commented 3 years ago

Here is a patch to support the PT-P300BT based off a patch by @dogtopus (Issue on pytouch-cube). Feel free to update the copyright if it doesn't fit the spirit of the project.

Note this printer connects via Bluetooth SPP, you should be able to send the data to the /dev/tty. SPP device on macOS or the /dev/rfcomm SPP device on Linux.

diff -Naru a/driver/ptouch-pt.xml b/driver/ptouch-pt.xml
--- a/driver/ptouch-pt.xml  2020-09-08 10:12:16.000000000 -0230
+++ b/driver/ptouch-pt.xml  2021-01-06 20:05:00.000000000 -0330
@@ -99,6 +99,9 @@
   <printer>
    <id>printer/Brother-PT-9600</id>
   </printer>
+  <printer>
+   <id>printer/Brother-PT-P300BT</id>
+  </printer>
  </printers>
 </driver>
diff -Naru a/printer/Brother-PT-P300BT.xml b/printer/Brother-PT-P300BT.xml
--- a/printer/Brother-PT-P300BT.xml 1969-12-31 20:30:00.000000000 -0330
+++ b/printer/Brother-PT-P300BT.xml 2021-01-06 20:44:40.000000000 -0330
@@ -0,0 +1,80 @@
+<!--
+Copyright (c) 2021 Andrew Green <me@andrewgreen.ca>
+
+This file is part of ptouch-driver.
+
+ptouch-driver is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+ptouch-driver is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with ptouch-driver; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+USA
+-->
+<printer id="printer/Brother-PT-P300BT">
+  <make>Brother</make>
+  <model>PT-P300BT</model>
+  <pcmodel>P300BT</pcmodel>
+  <mechanism>
+    <thermal/>
+    <!--not "color"-->
+    <resolution>
+      <dpi>
+        <x>180</x>
+        <y>180</y>
+      </dpi>
+    </resolution>
+  </mechanism>
+  <url>https://www.brother.ca/en/p/PTP300BT</url>
+  <lang>
+    <proprietary />
+  </lang>
+  <autodetect>
+    <general>
+      <ieee1284>MFG:Brother;CMD:PT-CBP;MDL:P300BT;CLS:PRINTER;</ieee1284>
+      <commandset>PT-CBP</commandset>
+      <description>Brother PT-P300BT</description>
+      <manufacturer>Brother</manufacturer>
+      <model>PT-P300BT</model>
+    </general>
+  </autodetect>
+  <functionality>D</functionality>
+  <driver>ptouch-pt</driver>
+  <unverified/>
+  <!--no "contrib_url"-->
+  <comments>
+    <en>
+      Tape width 3.5mm to 12mm.
+      Prints 20mm per second.
+      Printer connects via Bluetooth SPP.
+    </en>
+  </comments>
+  <select>
+    <option id="opt/Brother-PT-LegacyTransferMode" />
+    <option id="opt/Brother-PTQL-Resolution">
+      <enum_val id="ev/180dpi" />
+    </option>
+    <option id="opt/Brother-PTQL-BytesPerLine">
+      <enum_val id="ev/16" />
+    </option>
+    <option id="opt/Brother-PTQL-LabelPreamble" />
+    <option id="opt/Brother-PT-PageSize">
+      <arg_defval>ev/tz-12</arg_defval>
+      <enum_val id="ev/tz-4" />
+      <enum_val id="ev/tz-6" />
+      <enum_val id="ev/tz-9" />
+      <enum_val id="ev/tz-12" />
+    </option>
+    <option id="opt/Brother-PTQL-PixelTransfer">
+      <enum_val id="ev/RLE" sense="false" />
+    </option>
+    <option id="opt/Brother-PTQL-AutoCut" />
+  </select>
+</printer>
dogtopus commented 3 years ago

You shouldn't need rfcomm devices on linux. CUPS supports RFCOMM devices natively via the bluetooth://protocol backed by bluez-cups.

Also I'm okay with the copyright notice: It was a long time ago that I abandoned the patch and I wasn't really spending time on it to polish it to a usable state anyway. It was mostly just throwing stuff together and I don't really feel like claiming copyright on such stuff.

That being said: I still have the printer and I can test your PR/patch and give feedbacks.

philpem commented 3 years ago

Can you please either -- upload the patch as an attachment (if Github supports it), or create a fork, push your changes and open a pull request?

I'd prefer a pull request as it makes things a lot easier to merge on my end :)

I have no objection to the copyright notice, though you have reminded me that the AUTHORS text file needs updating (the list in the README is current)

philpem commented 3 years ago

Merged, thanks for the patch :)