Skip to content

Commit

Permalink
Mark Brother printer driver as experimental (not working with my prin…
Browse files Browse the repository at this point in the history
…ters) and add configure option.
  • Loading branch information
michaelrsweet committed Jan 16, 2024
1 parent f22b455 commit 71c3920
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 6 additions & 2 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
17 changes: 17 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ ac_subst_files=''
ac_user_opts='
enable_option_checking
with_systemd
enable_experimental
enable_debug
enable_maintainer
enable_sanitizer
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 :
Expand Down
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down
4 changes: 3 additions & 1 deletion lprint-brother.c
Original file line number Diff line number Diff line change
@@ -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


//
Expand Down Expand Up @@ -564,3 +565,4 @@ lprint_brother_status(

return (true);
}
#endif // LPRINT_EXPERIMENTAL
9 changes: 7 additions & 2 deletions lprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion lprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 5 additions & 1 deletion xcode/config.h
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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 */
4 changes: 2 additions & 2 deletions xcode/lprint.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand All @@ -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 */; };
Expand Down Expand Up @@ -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 */,
Expand Down

0 comments on commit 71c3920

Please sign in to comment.