From 71c3920758a583efeeb818deacbde1bae2466e45 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 16 Jan 2024 11:56:50 -0500 Subject: [PATCH] Mark Brother printer driver as experimental (not working with my printers) and add configure option. --- Makefile.in | 2 +- README.md | 5 +++-- config.h.in | 8 ++++++-- configure | 17 +++++++++++++++++ configure.ac | 7 +++++++ lprint-brother.c | 4 +++- lprint.c | 9 +++++++-- lprint.h | 6 +++++- xcode/config.h | 6 +++++- xcode/lprint.xcodeproj/project.pbxproj | 4 ++-- 10 files changed, 56 insertions(+), 12 deletions(-) diff --git a/Makefile.in b/Makefile.in index e521a21..edea19f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ # # Makefile for LPrint, a Label Printer Application # -# Copyright © 2019-2023 by Michael R Sweet +# Copyright © 2019-2024 by Michael R Sweet # # Licensed under Apache License v2.0. See the file "LICENSE" for more # information. diff --git a/README.md b/README.md index 73b1af7..7cf9056 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ LPrint depends on: - A POSIX-compliant "make" program (both GNU and BSD make are known to work), - A C99 compiler (both Clang and GCC are known to work), - [PAPPL](https://www.msweet.org/pappl) 1.2 or later. -- [CUPS](https://openprinting.github.io/cups) 2.2 or later (for libcups). +- [CUPS](https://openprinting.github.io/cups) 2.4 or later or + [libcups](https://github.com/OpenPrinting/libcups) 3.0 or later. Supported Printers @@ -44,7 +45,7 @@ The following printers are currently supported: - DYMO LabelWriter printers - Seiko Instruments SLP printers -- TSPL printers such as the Rollo X1038 +- TSPL/TSPL2 printers such as the Rollo X1038 - Zebra/Eltron EPL2 printers - Zebra ZPL printers diff --git a/config.h.in b/config.h.in index 64fc212..dd0783f 100644 --- a/config.h.in +++ b/config.h.in @@ -1,7 +1,7 @@ // // Configuration header file for LPrint, a Label Printer Utility // -// Copyright © 2019-2023 by Michael R Sweet. +// Copyright © 2019-2024 by Michael R Sweet. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. @@ -10,5 +10,9 @@ // Version number #define LPRINT_VERSION "" #define LPRINT_MAJOR_VERSION 1 -#define LPRINT_MINOR_VERSION 1 +#define LPRINT_MINOR_VERSION 3 #define LPRINT_PATCH_VERSION 0 + + +// Enable experimental drivers? +#define LPRINT_EXPERIMENTAL 0 diff --git a/configure b/configure index 8e28941..56e2e1e 100755 --- a/configure +++ b/configure @@ -688,6 +688,7 @@ ac_subst_files='' ac_user_opts=' enable_option_checking with_systemd +enable_experimental enable_debug enable_maintainer enable_sanitizer @@ -1323,6 +1324,7 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-experimental turn on experimental drivers, default=no --enable-debug turn on debugging, default=no --enable-maintainer turn on maintainer mode, default=no --enable-sanitizer build with AddressSanitizer, default=no @@ -3952,6 +3954,21 @@ fi +# Check whether --enable-experimental was given. +if test ${enable_experimental+y} +then : + enableval=$enable_experimental; +fi + +if test x$enable_experimental = xyes +then : + + printf "%s\n" "#define LPRINT_EXPERIMENTAL 1" >>confdefs.h + + +fi + + # Check whether --enable-debug was given. if test ${enable_debug+y} then : diff --git a/configure.ac b/configure.ac index 2885a04..285dff6 100644 --- a/configure.ac +++ b/configure.ac @@ -162,6 +162,13 @@ AC_ARG_WITH([systemd], AS_HELP_STRING([--with-systemd[=PATH]], [install systemd ]) +dnl Support for experimental drivers... +AC_ARG_ENABLE([experimental], AS_HELP_STRING([--enable-experimental], [turn on experimental drivers, default=no])) +AS_IF([test x$enable_experimental = xyes], [ + AC_DEFINE([LPRINT_EXPERIMENTAL]) +]) + + dnl Extra compiler options... AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [turn on debugging, default=no])) AC_ARG_ENABLE([maintainer], AS_HELP_STRING([--enable-maintainer], [turn on maintainer mode, default=no])) diff --git a/lprint-brother.c b/lprint-brother.c index 87513cb..be9c785 100644 --- a/lprint-brother.c +++ b/lprint-brother.c @@ -1,13 +1,14 @@ // // Brother driver for LPrint, a Label Printer Application // -// Copyright © 2023 by Michael R Sweet. +// Copyright © 2023-2024 by Michael R Sweet. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. // #include "lprint.h" +#ifdef LPRINT_EXPERIMENTAL // @@ -564,3 +565,4 @@ lprint_brother_status( return (true); } +#endif // LPRINT_EXPERIMENTAL diff --git a/lprint.c b/lprint.c index 88b2931..42cb4a3 100644 --- a/lprint.c +++ b/lprint.c @@ -52,7 +52,9 @@ static pappl_system_t *system_cb(int num_options, cups_option_t *options, void * static pappl_pr_driver_t lprint_drivers[] = { // Driver list -#include "lprint-brother.h" +#ifdef LPRINT_EXPERIMENTAL +# include "lprint-brother.h" +#endif // LPRINT_EXPERIMENTAL #include "lprint-dymo.h" #include "lprint-epl2.h" #include "lprint-sii.h" @@ -273,9 +275,12 @@ driver_cb( data->testpage_cb = lprintTestPageCB; // Use the corresponding sub-driver callback to set things up... +#ifdef LPRINT_EXPERIMENTAL if (!strncmp(driver_name, "brother_", 8)) ret = lprintBrother(system, driver_name, device_uri, device_id, data, attrs, cbdata); - else if (!strncmp(driver_name, "dymo_", 5)) + else +#endif // LPRINT_EXPERIMENTAL + if (!strncmp(driver_name, "dymo_", 5)) ret = lprintDYMO(system, driver_name, device_uri, device_id, data, attrs, cbdata); else if (!strncmp(driver_name, "epl2_", 5)) ret = lprintEPL2(system, driver_name, device_uri, device_id, data, attrs, cbdata); diff --git a/lprint.h b/lprint.h index 5c7433c..a458ecf 100644 --- a/lprint.h +++ b/lprint.h @@ -108,7 +108,9 @@ typedef ipp_copycb_t ipp_copy_cb_t; # define LPRINT_TESTPAGE_MIMETYPE "application/vnd.lprint-test" # define LPRINT_TESTPAGE_HEADER "T*E*S*T*P*A*G*E*" -# define LPRINT_BROTHER_PT_CBP_MIMETYPE "application/vnd.brother-pt-cbp" +# ifdef LPRINT_EXPERIMENTAL +# define LPRINT_BROTHER_PT_CBP_MIMETYPE "application/vnd.brother-pt-cbp" +# endif // LPRINT_EXPERIMENTAL # define LPRINT_EPL2_MIMETYPE "application/vnd.eltron-epl" # define LPRINT_SLP_MIMETYPE "application/vnd.sii-slp" # define LPRINT_TSPL_MIMETYPE "application/vnd.tsc-tspl" @@ -156,7 +158,9 @@ extern bool lprintMediaSave(pappl_printer_t *printer, pappl_pr_driver_data_t *da extern bool lprintMediaUI(pappl_client_t *client, pappl_printer_t *printer); extern void lprintMediaUpdate(pappl_printer_t *printer, pappl_pr_driver_data_t *data); +# ifdef LPRINT_EXPERIMENTAL extern bool lprintBrother(pappl_system_t *system, const char *driver_name, const char *device_uri, const char *device_id, pappl_pr_driver_data_t *data, ipp_t **attrs, void *cbdata); +# endif // LPRINT_EXPERIMENTAL extern bool lprintDYMO(pappl_system_t *system, const char *driver_name, const char *device_uri, const char *device_id, pappl_pr_driver_data_t *data, ipp_t **attrs, void *cbdata); extern bool lprintEPL2(pappl_system_t *system, const char *driver_name, const char *device_uri, const char *device_id, pappl_pr_driver_data_t *data, ipp_t **attrs, void *cbdata); extern bool lprintSII(pappl_system_t *system, const char *driver_name, const char *device_uri, const char *device_id, pappl_pr_driver_data_t *data, ipp_t **attrs, void *cbdata); diff --git a/xcode/config.h b/xcode/config.h index 6894123..4dd7089 100644 --- a/xcode/config.h +++ b/xcode/config.h @@ -1,7 +1,7 @@ // // Xcode configuration header file for LPrint, a Label Printer Application // -// Copyright © 2019-2023 by Michael R Sweet. +// Copyright © 2019-2024 by Michael R Sweet. // // Licensed under Apache License v2.0. See the file "LICENSE" for more // information. @@ -12,3 +12,7 @@ #define LPRINT_MAJOR_VERSION 1 #define LPRINT_MINOR_VERSION 3 #define LPRINT_PATCH_VERSION 0 + + +// Enable experimental drivers? +/*#undef LPRINT_EXPERIMENTAL */ diff --git a/xcode/lprint.xcodeproj/project.pbxproj b/xcode/lprint.xcodeproj/project.pbxproj index a68b5b7..00cdfda 100644 --- a/xcode/lprint.xcodeproj/project.pbxproj +++ b/xcode/lprint.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 2715B53225FD7FC200C0BBF6 /* lprint-zpl.c in Sources */ = {isa = PBXBuildFile; fileRef = 2715B52D25FD7FC200C0BBF6 /* lprint-zpl.c */; }; 2715B53325FD7FC200C0BBF6 /* lprint-common.c in Sources */ = {isa = PBXBuildFile; fileRef = 2715B53025FD7FC200C0BBF6 /* lprint-common.c */; }; 2715B53425FD7FC200C0BBF6 /* lprint-dymo.c in Sources */ = {isa = PBXBuildFile; fileRef = 2715B53125FD7FC200C0BBF6 /* lprint-dymo.c */; }; + 271DBD422B56EB3A00475159 /* lprint-brother.c in Sources */ = {isa = PBXBuildFile; fileRef = 27712E3D2B12A48B0032AE30 /* lprint-brother.c */; }; 272FF1992966330F008C4F4F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 272FF1982966330F008C4F4F /* Security.framework */; }; 273A4980276BB83B00C3B44E /* lprint-epl2.c in Sources */ = {isa = PBXBuildFile; fileRef = 273A497F276BB83B00C3B44E /* lprint-epl2.c */; }; 273A4982276BCE3100C3B44E /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 273A4981276BCE3100C3B44E /* libjpeg.a */; }; @@ -26,7 +27,6 @@ 277343B42964620400380814 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 277343B32964620400380814 /* Cocoa.framework */; }; 277BC9BE23D88C930022AC4D /* libpam.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 27FBEEEF2396995C00BB195A /* libpam.tbd */; }; 2790DD5625FB037A00686B4C /* libpappl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2790DD5525FB037A00686B4C /* libpappl.a */; }; - 27E485952B55DFCC00202288 /* lprint-brother.c in Sources */ = {isa = PBXBuildFile; fileRef = 27712E3D2B12A48B0032AE30 /* lprint-brother.c */; }; 27E485962B55DFCC00202288 /* lprint-sii.c in Sources */ = {isa = PBXBuildFile; fileRef = 27712E3E2B12A48B0032AE30 /* lprint-sii.c */; }; 27E485972B55DFCC00202288 /* lprint-tspl.c in Sources */ = {isa = PBXBuildFile; fileRef = 27712E3B2B12A48B0032AE30 /* lprint-tspl.c */; }; 27EC68942967B17700ABB3EE /* lprint-common.c in Sources */ = {isa = PBXBuildFile; fileRef = 2715B53025FD7FC200C0BBF6 /* lprint-common.c */; }; @@ -410,7 +410,7 @@ buildActionMask = 2147483647; files = ( 27FBEEE52396988300BB195A /* lprint.c in Sources */, - 27E485952B55DFCC00202288 /* lprint-brother.c in Sources */, + 271DBD422B56EB3A00475159 /* lprint-brother.c in Sources */, 2715B53325FD7FC200C0BBF6 /* lprint-common.c in Sources */, 2715B53425FD7FC200C0BBF6 /* lprint-dymo.c in Sources */, 273A4980276BB83B00C3B44E /* lprint-epl2.c in Sources */,