Commit Graph

286 Commits

Author SHA1 Message Date
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
Solomon Peachy 59917b8d35 Fix a small pile of bugs introduced recently.
Patch from:  Geoff Youngs <g.youngs@livelinktechnology.net>
2014-02-11 16:33:53 -05:00
Solomon Peachy 1e8c0ae99a Silence a pile of 'cppcheck' warnings.
...And fix a legitimate bug in the process!
2014-02-11 13:41:55 -05:00
Solomon Peachy dae7ad28e6 core: Make the banner include a reference to the license and a warranty
disclaimer.  And add a GPL license reference to the cmdline ( -G )
2014-02-11 00:22:37 -05:00
Solomon Peachy c60b07e958 common: Consistent cmdline help indentation. 2014-02-10 23:22:01 -05:00
Solomon Peachy 49e58f59ef common: Increase the read timeout to 10 seconds.
(The shinko printer has a long wait time on some commands)
2014-02-10 22:45:50 -05:00
Solomon Peachy 5c42e2baaa common: Fix glitch in command line parsing. 2014-02-10 22:25:20 -05:00
Solomon Peachy cd99cb534d common: Fix serial number matching. 2014-02-10 22:23:26 -05:00
Solomon Peachy d7db0bbdbe Massive overhaul of command line handling.
Completely untested with real printers.

That happens tonight!  :)
2014-02-10 20:10:36 -05:00
Solomon Peachy 3a5abe1bf8 common: Clean up CUPS URI generation a bit:
* Use proper URLEncoding for all URI components.  The old code only
   handled spaces.
 * URLEncode the serial number too.

Don't URLEncode the product strings returned in the CUPS search results.
2014-02-09 23:46:02 -05:00
Solomon Peachy b53448859c common: More graceful error detction and handling for the
backend-specific get_serno() call.  If we fail to attach to the printer
(it is probably busy), then don't try anything else with this device and
ignore it.
2014-02-09 23:21:16 -05:00
Solomon Peachy 9820807542 common: Eliminate the libusb bus/device fake serial number entirely.
Upon discussions with the Gutenprint folks, it seems to cause more
problems for the common cases than it solves for the specific cases.
2014-02-09 10:23:57 -05:00
Solomon Peachy 57e0024197 common: When using old libusb, report fake serial numbers of
'Bxxx_UNKDEV' instead of 'Bxxx_P255'.
2014-02-09 07:26:07 -05:00
Solomon Peachy 2e3cf70dba common: Re-add the libusb < 1.0.13 workarounds.
It comes with a GIANT WARNING if you are affected by the workaround.
2014-02-08 18:41:29 -05:00
Solomon Peachy 36069a88b6 common: the re-unification of libusb/libusbx means we need to
change our traps a little.

Also, since we just require libusb 1.0.13+, get rid of the workaround.
2014-02-08 15:49:26 -05:00
Solomon Peachy 2b867a323a common: Require libusb/libusbx >= 1.0.13
We technically need 1.0.12 or newer, but there's no way to detect that
at compile time since there was no VERSION definition in the libusb
headers until 1.0.13
2014-02-03 11:29:19 -05:00
Solomon Peachy 54d6f1a4ee get rid of obsolete debug code. 2014-01-26 14:45:12 -05:00
Solomon Peachy 6c335ea1e4 Update copyright notice; it's 2014 now! 2014-01-23 16:07:25 -05:00
Solomon Peachy 6acc8b553c backends: say "## copies remaining" to differentiate between pages. 2014-01-22 09:10:34 -05:00
Solomon Peachy 312c210c2a common: We can't detect EOF situations in global code.
And fix enumeration in the presence of multiple printer types.
2014-01-20 19:48:36 -05:00
Solomon Peachy 75de99c103 common: Add core support for multi-page print jobs.
If the backend supports it, restart the backend if we detect additional
data waiting.  Hopefully that detection is sane.
2014-01-17 22:58:03 -05:00
Solomon Peachy 82c72fcd99 Add a 'C' size test print for the Canon SELPHY ES1. 2014-01-13 05:41:48 -05:00
Solomon Peachy 766ca01f0d whitespace fixes. 2014-01-12 17:26:29 -05:00
Solomon Peachy db65d25feb common: Add a generic read_data() call. 2013-12-21 22:39:15 -05:00
Solomon Peachy 875ebd2d76 all: Silence nearly all DEBUG outputs unless DYESUB_DEBUG is set in the
environment.
2013-12-21 22:15:18 -05:00
Solomon Peachy 138d10551b common: Fix incorrect help text.
To use a specific device, use 'DEVICE=...' rather than 'SERIAL=...'

The documentation (readme) was correct.
2013-12-20 11:14:20 -05:00
Solomon Peachy 13e25a4c95 common: Ensure we properly define URI_PREFIX as part of the build. 2013-12-18 18:28:13 -05:00
Solomon Peachy 64dda99d30 common: We need to URLify the manufacturer string too! 2013-12-18 07:48:30 -05:00
Solomon Peachy 4715a088e3 common: unify the debug messages, set DYESUB_DEBUG before invoking. 2013-12-11 07:49:57 -05:00
Solomon Peachy ccf44058ab dsp_ds40: Initial pass at a backend.
As far as a backend is concerned, it's just a passthrough.  However, it
has command-line options.
2013-12-03 22:21:44 -05:00
Solomon Peachy 9201105c66 all: Fixed all compiler warnings. 2013-11-23 19:51:55 -05:00
Solomon Peachy e79080796d mitsu70x: Actually add it to the backend list. 2013-11-23 14:57:06 -05:00
Solomon Peachy 97ce8262b7 common: It helps to include the kodak605 backend. 2013-11-21 22:04:48 -05:00
Solomon Peachy be8eec4f2d common: Return better CUPS error codes, and document them. 2013-09-30 15:15:28 +01:00
Solomon Peachy 6ce1ab9768 commmon: Fix unintialized error.
o
2013-09-30 14:52:05 +01:00
Solomon Peachy 88444f5644 common: Fix backend detection problem identified by Geoff Youngs.
When I unified the backends, I broke the CUPS backend detection.
2013-09-30 13:16:04 +01:00
Solomon Peachy 7a7bdf9fab all: Update URL to the public git repo. 2013-08-20 20:10:21 -04:00
Solomon Peachy ccf8ad9e59 common: when we're not in scan mode, attach to the first matching
printer we find.
2013-08-19 18:33:32 -04:00
Solomon Peachy 884919b5fe common: Clean up some gcc warnings (when -Wextra is used) 2013-07-26 16:18:35 -04:00
Solomon Peachy 953ebd91ec common: Move backend id/version log to where we init the backend. 2013-07-26 07:44:53 -04:00
Solomon Peachy 1d655d722a common: Log the backend name and version when printing starts. 2013-07-26 07:42:33 -04:00
Solomon Peachy 576fd4de33 common: If an open fails, it's almost certainly becase we're not root. 2013-07-25 14:21:36 -04:00
Solomon Peachy 051cf386b5 common: Claim the device before calling the backend's query_serno() call. 2013-07-24 20:54:14 -04:00
Solomon Peachy b7851a3df1 common: Add support for a backend-specific serno call.
(Nothing uses it just yet)
2013-07-24 13:49:06 -04:00
Solomon Peachy d01cb80428 common: libusbx is not the same as libusb.
The libusb_get_port_number() call was added in libusbx 1.0.12.
libusbx 1.0.13 added a macro to detect what version of libusb was in use.
So key off that macro's presence; otherwise we don't know at build time.
2013-07-20 19:10:15 -04:00
Solomon Peachy db0650da55 common: Fix EXTRA_PID/VID/TYPE not matching.. 2013-07-19 22:21:15 -04:00
Solomon Peachy e2a1a057fa common: Fix printer matching for all backends other than SELPHY. 2013-07-19 19:53:08 -04:00
Solomon Peachy 4b9e689548 backend: Fix crash bug. 2013-07-19 11:12:14 -04:00
Solomon Peachy a7a75cb7c9 common: add an 'early_parse' backend hook
Also fix 'query_only' usage to properly bypass the open/read.
2013-07-19 10:13:35 -04:00
Solomon Peachy 660cd2f3b0 all: split apart backend init into separate init/attach calls.
Also fixed every backend, 'dev' wasn't being set properly.
2013-07-19 09:23:53 -04:00
Solomon Peachy 3e306886bd common: Tweak to internal API for future use. 2013-07-19 07:44:20 -04:00
Solomon Peachy 67b09c95be common: Fix enumeration and output formatting.
Canon SELPHY backend is definitely broken; we don't try to parse the
file until after we've probed for the device.  Doesn't affect CUPS
operation.
2013-07-18 23:54:43 -04:00
Solomon Peachy 2730a145d4 all: Move USB device IDs into respective backends.
This is also untested.
2013-07-18 23:39:36 -04:00
Solomon Peachy 587dd52247 common: Fix enumeration which was fixed looking for a SONY type. 2013-07-18 23:22:24 -04:00
Solomon Peachy 32da54ee36 common: Fix a segfault when backend provides no cmdline handler. 2013-07-18 23:12:40 -04:00
Solomon Peachy 1e0f679eb4 selphy: Final backend migrated to new unified model.
None of this has been tested!
2013-07-18 23:00:58 -04:00
Solomon Peachy 060b6763fb s2145: Migrate to new unified backend.
UNTESTED.
2013-07-18 22:10:56 -04:00
Solomon Peachy d20f1e2049 kodak1400: Merge into new multi-call paradigm. 2013-07-18 21:05:33 -04:00
Solomon Peachy b038aa71c1 kodak6800: 75% of new backend migration completed. Main loop is all that's left. 2013-07-18 18:03:40 -04:00
Solomon Peachy 40604d6664 common: Finish multi-exec handling, including auto backend detection based on environment and/or argv[0]
Now ready to try porting another backend into this framework.
2013-07-18 12:45:35 -04:00
Solomon Peachy 0ca04120a8 common: Placeholder for backend detection 2013-07-18 08:51:02 -04:00
Solomon Peachy be8c5c494f unification: Rearrange internals quite a lot.
Only Sony UP-DR150 driver is converted.

Still to-do in common code:
	* Backend selection based on URI (ie CUPS mode)
	* Backend selection based on BACKEND or argv[0] (ie standalone mode)
2013-07-18 08:46:44 -04:00
Solomon Peachy fc66186e4c common: Don't re-attach after scanning device IDs. 2013-07-17 23:40:48 -04:00
Solomon Peachy be94ac3fff all: Unify find_and_enumerate function.
Also means pushing device IDs etc into a table.

This is all *UNTESTED*
2013-07-17 23:39:31 -04:00
Solomon Peachy 937c687274 all: Simplify print_scan_output() a bit, eliminate the obsolete 'valid' argument. 2013-07-17 22:43:49 -04:00
Solomon Peachy f70d028ac2 common: When no serial number is known, use the bus/portnum 2013-07-16 21:08:33 -04:00
Solomon Peachy b4b2b4c00f common: Log the USB Manufacturer ID too. 2013-07-06 21:05:00 -04:00
Solomon Peachy fec7e6d776 common: Fix more USB descriptor parsing bugs. 2013-07-06 20:58:23 -04:00
Solomon Peachy e1ea0359fd common: bump revision. 2013-07-06 10:12:19 -04:00
Solomon Peachy df9a207f8e all: add xxx_to_cpu macros as well. 2013-07-06 09:10:01 -04:00
Solomon Peachy 6c0e25ae4b all: Add a common lib version too. 2013-06-30 13:01:17 -04:00
Solomon Peachy 46aff13042 all: Fix enumeration, and fix send_data for larger sizes. 2013-06-30 12:05:32 -04:00
Solomon Peachy 310ae8c241 all: Move the device serial number matching code into common lib. 2013-06-30 11:32:41 -04:00
Solomon Peachy 0e82760201 all: Start merging common enumeration tasks, starting with url-ification. 2013-06-30 11:15:03 -04:00
Solomon Peachy a9705d88e3 common: Display an error if we don't transfer everything. 2013-06-29 21:35:45 -04:00
Solomon Peachy 9d050b4370 all: Clean up use of <arpa/inet.h> 2013-06-29 12:25:06 -04:00
Solomon Peachy 5c14b2d289 common: Remove duplicate error macros. 2013-06-28 07:50:24 -04:00
Solomon Peachy 293241b39f all: Start moving common code out into a separate library.
The goal is to avoid code duplication.

There's a lot of similar functionality remaining.
2013-06-27 23:02:34 -04:00