Commit Graph

227 Commits

Author SHA1 Message Date
Solomon Peachy bc2e54a694 common: TEST_MODE_NOATTACH still tried to query markers. 2018-05-14 15:13:47 -04:00
Solomon Peachy 7ebfa12b96 mitsud90: Add WIP backend for the Mitsubishi CP-D90DW 2018-05-12 12:15:13 -04:00
Solomon Peachy f76196b32a common: Fix test_mode 2, add enums. 2018-05-12 12:14:03 -04:00
Solomon Peachy ad03177aca common: The beginings of a test mode.
Currently only functional bit is to have it skip actual printing.

Partial implementation to have it bypass attachment is next.
2018-05-09 23:25:52 -04:00
Solomon Peachy 390c5e2bf6 all: push printer type lookup into common code. 2018-05-09 23:09:01 -04:00
Solomon Peachy 189b1099d3 common: Fix badnenss in EXTRA_VID/PID/TYPE parsing.
I obviously never tested it, because it's clearly bogus.
2018-05-09 22:29:21 -04:00
Solomon Peachy b176a1ce6c common: Fix incorrect length computation in IEEE1284 code.
(was setting the terminating NUL 2 bytes further than proper)
2018-05-01 20:36:18 -04:00
Solomon Peachy 2091835307 common: Apparently I can't count properly. 2018-04-30 05:55:42 -04:00
Solomon Peachy 03cce1efc8 common: Bugfix for marker output when printer doesn't report a max. 2018-04-29 14:06:27 -04:00
Solomon Peachy 06dbf0fa91 common: Change backend->attach API to allow status returns 2018-04-28 19:22:05 -04:00
Solomon Peachy 1e6604d05a common: Support for CUPS command stream parsing! 2018-04-28 19:22:05 -04:00
Solomon Peachy 032c7568ab common: Infrastructure for doing marker status dumps globally. 2018-04-28 19:22:02 -04:00
Solomon Peachy fa2a54d29e misc: Fix a handful of bugs identified by clang-analyze 2018-04-27 10:17:16 -04:00
Solomon Peachy c3d9a9b151 misc: Fix up a pile of cppcheck warnings.
* memory leaks in error paths
 * not checking return values in a couple of places
 * logic errors in s1245
2018-04-26 14:45:32 -04:00
Solomon Peachy 6c5a905083 common: Don't forget to call libusb_exit() where appropriate. 2018-04-17 09:30:43 -04:00
Solomon Peachy 9307aeef72 dnpds40: Add Citizen CW-01 support to the DNP/Citizen backend.
Supports the legacy spool format, but the intent is to move Gutenprint
to generating the native data stream.
2018-04-11 07:45:56 -04:00
Solomon Peachy 7939d501d7 all: Move all backend names into aliases tables.
Update all printer entries to have unique names.  As long as the USB
VID/PID is unique, each "backend" appears unique!
2018-03-16 15:35:00 -04:00
Solomon Peachy 320c84f770 common: Add support for backends to support aliases.
This also renames the reported names for mitsu9550, dnpds40, and
kodak6800 to mitsu9xxx, dnp_citizen, and kodak68x0.  Backwards
compatibility is maintained!
2018-03-16 13:35:17 -04:00
Solomon Peachy ad3409b600 It's 2018, update appropriately. 2018-02-22 06:02:49 -05:00
Solomon Peachy 0cfd77ce12 common: Use CUPS_BACKEND_RETRY for most error situations. 2018-02-16 10:34:30 -05:00
Solomon Peachy 8192578a7a common: set 'connecting-to-device' state approriately. 2018-02-16 10:17:47 -05:00
Solomon Peachy 5325aa57c5 common: Set the altsetting only if there's more than one option.
Make the errors a bit more meaningful.
2018-02-16 09:37:47 -05:00
Solomon Peachy 5f6f238458 common: Allow for a variable number of claim attempts.
This is to enable smarter retry policies.

At the moment, doing a scan means we only perform one attempt, so we
don't block if a printer is busy.  Trying to attach, on the other hand,
we still retry multiple times.

(The attach retry logic needs to be revved next..)
2018-02-16 07:38:39 -05:00
Solomon Peachy 713d48ab1b common: don't issue an altsetting if not necessary. 2018-01-09 12:42:00 -05:00
Solomon Peachy ff9f34572e Trailing whitespace fixes. 2017-11-25 10:45:51 -05:00
Solomon Peachy 5b40d2e216 All: Add 'SPDX-License-Identifier' headers to all source files.
(GPL-3.0+ for everything but the S6145 backend, which is GPL-3.0+
   with an additional permission)
2017-11-17 13:34:26 -05:00
Solomon Peachy 56cd04bd2a all: Clean up the manufacturer override field in the devices. 2017-11-08 19:19:00 -05:00
Solomon Peachy 6c99b08b2d common: Numerous improvements to device enumeration
* Put off claiming interface as long as possible
 * Scan through all interfaces and altsettings
 * Do the enumeration/scanning in only one place
2017-11-08 14:02:30 -05:00
Solomon Peachy c4fa5c580c Initial magiccard commit.
Status queries work!  Still need to handle printjob parsing.

And, for that matter, still havenm't figured out printjob encoding.
2017-08-06 22:16:51 -04:00
Solomon Peachy b2649a6eb6 common: Handle wildcard USB PIDs from a given vendor (use pid of 0xffff) 2017-08-06 22:16:27 -04:00
Solomon Peachy 487ccc9f71 Fix up bad whitespacing. 2017-07-10 20:15:56 -04:00
Solomon Peachy 11829f2f45 Merge a pile spelling fixes from Ville Skyttä <scop@sf> 2017-05-05 08:11:04 -04:00
Solomon Peachy e6d700a7c7 common: Add ability to override USB transfer limit and timeouts. 2017-04-19 23:06:34 -04:00
Solomon Peachy 9049274d74 Doc updates. 2017-03-01 15:40:26 -05:00
Solomon Peachy cd1f20d79c It's now 2017; Update copyright year for the code that's seen changes. 2017-01-13 08:39:53 -05:00
Solomon Peachy 1b71437dd2 common: don't log PAGE counts if being used in CUPS context, as
Gutenprint already does this.
2017-01-12 07:59:39 -05:00
Solomon Peachy 182754c549 Get rid of some extra semicolons. 2016-12-15 09:37:31 -05:00
Solomon Peachy 1aebe61253 mitsup95d: Add in support for the Mitsubishi P95D. 2016-12-03 23:33:18 -05:00
Solomon Peachy 2ae41d59ff canonselphyneo: Add a new backend for the CP820/910/1000/1200 printers. 2016-12-02 23:49:22 -05:00
Solomon Peachy 2fb2f56623 common: Minor internal rearrangement to make future changes simpler. 2016-12-02 22:26:54 -05:00
Solomon Peachy 546dad9fae common: Fix querying of the IEEE1284 string when per-interface classes are used. 2016-11-17 12:16:29 -05:00
Solomon Peachy afa0bbb891 common: Only claim the interface once when probing.
And only query IEEE1284 data on PRINTER class devices.
2016-11-01 20:19:39 -04:00
Solomon Peachy 8ade2d3a16 mitsu70x: Figured out lifetime print count!
At least on the EK305 (and presumably, K60)
2016-10-31 19:32:38 -04:00
Solomon Peachy 1f034a8a40 common: don't retry the interface claiming if it's not a BUSY error.
And don't try to urlencode a serial number that we know was bogus.
2016-10-26 17:15:27 -04:00
Solomon Peachy 45d46409b4 common: Pull a couple of unnecessary globals into main(). 2016-10-20 22:01:32 -04:00
Solomon Peachy da1dea2605 common: Replace a magic number with a libusb-defined sysmbol
And add a comment about iterating through interfaces and altsettings.

(This doesn't matter for any supported printers, but it's possible that
 could change...)
2016-10-09 08:40:15 -04:00
Solomon Peachy a1395541d9 commmon: Fix help text. 2016-09-20 20:43:28 -04:00
Solomon Peachy 4a8e5dbd4e common: Use the first instead of last matching set of bulk endpoints
Apparently the Mitsu K60/Kodak 305 enumerate differently on Linux vs
Windows -- With the latter, there's only two endpoints, but on Linux,
there's an additional OUT endpoint which works for everything except
image bulk transfers.
2016-09-01 02:59:49 -04:00
Solomon Peachy 332ef60933 common: Log the page counts with the 'PAGE' log target. 2016-08-16 20:49:04 -04:00
Solomon Peachy d0751a838e common: Fix a memory leak in the libusb code. 2016-07-19 18:46:10 -04:00
Solomon Peachy 827c6965c5 Common: Get rid of the -S, -V, -P, -T options.
They won't work until after we attach to the backend, but we need them
before we attach.  Rely on the environment variables instead.
2016-07-14 21:42:28 -04:00
Solomon Peachy 52e4b827cd whitspace cleanups. 2016-01-24 16:59:56 -05:00
Solomon Peachy 8e35e5608b all: It's 2016 now, update the copyright text.
Also, correct the initial dates for a few of the backends.
2016-01-24 09:44:19 -05:00
Solomon Peachy f7cb38dc29 common: One more fix. 2015-11-17 23:06:09 -05:00
Solomon Peachy f69834c963 common: fix the last commit. 2015-11-17 22:54:43 -05:00
Solomon Peachy 4bce137651 common: Fix a memory leak. 2015-11-17 22:34:56 -05:00
Solomon Peachy ced2e11884 bump a couple of things. 2015-09-13 10:31:00 -04:00
Solomon Peachy 2469be69be common: Get rid of an unused variable. 2015-09-13 09:56:18 -04:00
Solomon Peachy eb053ceb1a common: Export current page to backends. 2015-08-29 08:24:54 -04:00
Solomon Peachy 82ea661415 common: move uint16_to_packed_bcd() into common code. 2015-08-25 18:09:24 -04:00
Solomon Peachy db0c7d8b99 all: Eliminate the multi-stage cmdline parsing.
Unfortunately this means we lose the '-B backend' method, but the
overall control flow is much, much simpler now.
2015-08-13 21:09:56 -04:00
Solomon Peachy de8a32424c all: Unified approach to extra_vid/pid/type
This required a modification to all attach() methods.

Also, fix canonselphy's parsing/attachment code.
2015-08-12 22:56:29 -04:00
Solomon Peachy f67a8f8ea5 common: Eliminate early_parse() from backend.
only canonselphy used it.  This also showed that extra_vid/pid was broken.
2015-08-12 22:51:45 -04:00
Solomon Peachy 20f6d05b8a common: Rework the early cmdline argument parsing code to improve robustness
Also move fast_return out of individual backends and into common code.
2015-08-12 21:02:11 -04:00
Solomon Peachy 114202d7f5 shinko6145: Add a preliminary backend. Does NOT include library work. 2015-07-26 23:05:21 -04:00
Solomon Peachy 2181ae04b9 all: Clean up a small pile of warnings that clang-analyzer found. 2015-07-04 11:03:52 -04:00
Solomon Peachy cd03e9a22f misc: Fix some unitialized variable warnings that show up with -Os 2015-07-04 10:12:57 -04:00
Solomon Peachy 4489c1c0a5 misc: Clean up buffer overflows identified by cppcheck 2015-07-04 09:45:48 -04:00
Solomon Peachy 6a02bf8554 common: A few minor cleanups. 2015-07-04 09:13:42 -04:00
Solomon Peachy 9b3f7cbb66 s6245: Add a preliminary backend for the Shinko S6245 2015-07-02 23:32:16 -04:00
Solomon Peachy 3965f237ed common: Handle problems claming the USB interface.
...Retry a few times, and sleep between each one.
2015-07-02 19:44:26 -04:00
Solomon Peachy 992e551a02 all: Fix command like parsing when the argument has an option.
This was a longstanding bug.  Oops.
2015-06-30 21:33:02 -04:00
Solomon Peachy 24c3550feb all: Ensure all malloc() failures are caught and logged. 2015-06-23 20:48:52 -04:00
Solomon Peachy dc7ba45fe2 s1245: Create a new backend for the Shinko s1245.
Shinko S1245 uses a different command language as the other Shinko
models, so it's not going to share much commonality with the 2145
backend.
2015-02-08 12:11:16 -05:00
Solomon Peachy ccd644af7e common: more debug fixes. 2015-01-07 21:48:07 -05:00
Solomon Peachy ce9d0df04b debug: Fix hex dump code. 2015-01-07 10:22:03 -05:00
Solomon Peachy b731dc04f8 Update copyright notice. 2015-01-05 21:39:22 -05:00
Solomon Peachy eda139a9db common: formatting fixes. 2014-12-31 14:01:32 -05:00
Solomon Peachy fef3b0e0ec common: Format the hex dumps a little more coherently, 16-byte lines. 2014-12-31 13:55:57 -05:00
Solomon Peachy da5ae0e152 mitsu9550: Initial WIP of the Mitsubishi CP-9550DW-S backend.
Just committing it so I don't lose it.
2014-12-11 16:16:56 -05:00
Solomon Peachy 8d05fbb67f cw01: Initial support for the Citizen CW-01 printers 2014-10-06 21:56:55 -04:00
Solomon Peachy 6a52422961 common: Fix parsing of '-d' and add a third '-D' level to enable full
data dumps.
2014-06-03 20:27:23 -04:00
Solomon Peachy 812c26a29c dnpds40: use CUPS_BACKEND_* return codes. 2014-04-20 11:51:06 -04:00
Solomon Peachy 12d05eccba common: Replicate CUPS return codes.
General philosophy:

 OK      (self explanatory)
 FAILED   general failures (eg unexpected printer response)
 HOLD     wrong-media-loaded and other job-specific failures
 STOP     printer out of media, or other non-job-specific failures
 CANCEL   job failed to load or parse
 RETRY    temporary failure, retry later
 RETRY_CURRENT temp failure, retry immediately
2014-04-20 11:05:27 -04:00
Solomon Peachy 51a567e543 common: Fix crash when libusb_init() fails. 2014-03-26 09:20:09 -04:00
Solomon Peachy 18308e21c6 common: Fix bugs from last commit. 2014-03-13 19:50:48 -04:00
Solomon Peachy 7e2b3cc7aa common: Major overhaul of manuf/product strings to key off of the IEEE1284 data.
This mostly matches what the CUPS libusb backend generates.
2014-03-13 10:58:33 -04:00
Solomon Peachy 45f41a2f7d debug output fixes. 2014-03-12 13:45:36 -04:00
Solomon Peachy cf6517afc2 Fix some typos. 2014-03-12 10:55:35 -04:00
Solomon Peachy b8ee4cea94 Require use of '-DD' to enable raw data dumps. 2014-03-12 10:53:26 -04:00
Solomon Peachy b517d2ab72 Update version, and update blacklist. 2014-03-11 10:39:52 -04:00
Solomon Peachy 70dff0caca build: libusb < 1.0.10 doesn't support libusb_get_version() 2014-03-11 10:31:59 -04:00
Solomon Peachy e4d70d679f common: Add an argument to specify the number of copies. [ -d ]
It's annoying, this lack of letters.  :)
2014-02-12 09:30:43 -05:00
Solomon Peachy b8242fe847 common: if backend_cmd fails, abort cleanly instead of possibly trying
to print.
2014-02-11 22:33:10 -05:00
Solomon Peachy db099ec35b common: Disable backend args when running in CUPS backend mode.
it'll only confuse the hell out of things.
2014-02-11 22:32:17 -05:00
Solomon Peachy 43b3e68bb2 common: Support passing args to backend even when printing.
Should even work for CUPS print invocations, though it's not really a
good idea.
2014-02-11 22:30:57 -05:00
Solomon Peachy 7d4f19377b common: Trying to clean up the control flow when cmdline args are used.
In theory CUPS operation now respects global options.

But not backend options.  No print mode handles backend options just yet.
2014-02-11 22:16:46 -05:00
Solomon Peachy 12358843c7 common: Don't print '-B backendname' in help when called as a specific backend. 2014-02-11 20:13:39 -05:00
Solomon Peachy 5f8780cc3c More cppcheck-driven fixes. Mainly a bunch of memory leaks. 2014-02-11 20:11:33 -05:00
Solomon Peachy 5a4ff83750 common: Log the libusb release when running with debugging output. 2014-02-11 16:40:11 -05:00