diff options
author | Didier Raboud <odyx@debian.org> | 2020-02-13 10:59:10 +0100 |
---|---|---|
committer | Didier Raboud <odyx@debian.org> | 2020-02-13 10:59:10 +0100 |
commit | 8c74e1b72c41a6530fd316736510a53b4cc570c8 (patch) | |
tree | 549b682f0316c5458e151ae029d086c41f7085ab | |
parent | 11874d78e076f2255fc3229a8ad89c164762bcb8 (diff) |
New upstream version 2.0.3
-rw-r--r-- | ChangeLog | 458 | ||||
-rw-r--r-- | bjnp-commands.c | 17 | ||||
-rw-r--r-- | bjnp-commands.h | 2 | ||||
-rw-r--r-- | bjnp-debug.c | 26 | ||||
-rw-r--r-- | bjnp-discover.c | 4 | ||||
-rw-r--r-- | bjnp-io.c | 4 | ||||
-rw-r--r-- | bjnp-io.h | 6 | ||||
-rw-r--r-- | bjnp-levels.c | 28 | ||||
-rw-r--r-- | bjnp-protocol.h | 4 | ||||
-rw-r--r-- | bjnp-utils.c | 6 | ||||
-rw-r--r-- | bjnp.c | 2 | ||||
-rw-r--r-- | bjnp.h | 5 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.ac | 2 |
14 files changed, 84 insertions, 500 deletions
@@ -1,460 +1,32 @@ ------------------------------------------------------------------------ -r161 | llagendijk | 2018-02-21 16:59:27 +0100 (Wed, 21 Feb 2018) | 5 lines - -Updated license to GPLv2 OR LATER, to make it possible to use cups-bjnp with -cups 2.3 that changed to Apache License 2.0, which is GPLv2 incompatible. -There are no other changes. Released as cups-bjnp-2.0.1 - ------------------------------------------------------------------------- ------------------------------------------------------------------------- -r90 | llagendijk | 2014-03-28 21:49:00 +0100 (Fri, 28 Mar 2014) | 4 lines - -Fix parsing of the stats response for newer printers: -There is no length field in the response -Changed version to 0.9.1 - ------------------------------------------------------------------------- -r89 | llagendijk | 2014-03-27 23:36:05 +0100 (Thu, 27 Mar 2014) | 2 lines - -Updated Changelog - ------------------------------------------------------------------------- -r88 | llagendijk | 2014-03-27 23:32:11 +0100 (Thu, 27 Mar 2014) | 4 lines - -Added a check that paper out is seen a number of times before reporting it -Removed paperout handling from bjnp-runloop and rely only on a timer based -call to the reporting routines - ------------------------------------------------------------------------- -r87 | llagendijk | 2014-03-20 22:45:59 +0100 (Thu, 20 Mar 2014) | 2 lines - -Fix level reporting that does not always work when sprintf is used with dest string also used as source - ------------------------------------------------------------------------- -r86 | llagendijk | 2014-03-15 22:09:20 +0100 (Sat, 15 Mar 2014) | 6 lines - -Changed license to GPLv2 -hack to make distcheck work -Removed rpmbuild -Updated rpm spec (untested) -Added COPYING - ------------------------------------------------------------------------- -r85 | llagendijk | 2014-03-15 19:47:45 +0100 (Sat, 15 Mar 2014) | 2 lines - -Added README.levels - ------------------------------------------------------------------------- -r84 | llagendijk | 2014-03-15 17:55:06 +0100 (Sat, 15 Mar 2014) | 2 lines - -Fix typo introduced when reformatting - ------------------------------------------------------------------------- -r83 | llagendijk | 2014-03-15 17:53:58 +0100 (Sat, 15 Mar 2014) | 2 lines - -Reformatted all source code using astyle - ------------------------------------------------------------------------- -r82 | llagendijk | 2014-03-15 14:11:28 +0100 (Sat, 15 Mar 2014) | 2 lines - -Added output for marker-high-levels for ink level reporting - ------------------------------------------------------------------------- -r81 | llagendijk | 2014-03-10 22:41:44 +0100 (Mon, 10 Mar 2014) | 2 lines - -Correcting paper empty value for DJS: PR is transient, but ID really seems to indicate out of paper - ------------------------------------------------------------------------- -r80 | llagendijk | 2014-03-09 00:16:14 +0100 (Sun, 09 Mar 2014) | 3 lines - -Code cleanup -Paper out detection rewritten using DJS as PID does not work as expected - ------------------------------------------------------------------------- -r79 | llagendijk | 2014-03-08 19:21:06 +0100 (Sat, 08 Mar 2014) | 2 lines - -Minor improvement to text of vendor specific ink warnings/errors: add ink in text - ------------------------------------------------------------------------- -r78 | llagendijk | 2014-03-08 19:11:39 +0100 (Sat, 08 Mar 2014) | 3 lines - -Fix 2 cases in cups.c dereferencing printer where it migh be NULL -Safety fix in bjnp_get_printer_status so it does not crash when printer is NULL - ------------------------------------------------------------------------- -r77 | llagendijk | 2014-03-08 18:51:32 +0100 (Sat, 08 Mar 2014) | 3 lines - -Bumped version to 1.9.0 -Changed configure to use cups-config for auto-detection of cupsbackenddir - ------------------------------------------------------------------------- -r76 | llagendijk | 2014-03-08 15:34:21 +0100 (Sat, 08 Mar 2014) | 2 lines - -Make compile work also on older GCC version 4.4.7 on RHEL6 - ------------------------------------------------------------------------- -r75 | llagendijk | 2014-03-05 01:00:58 +0100 (Wed, 05 Mar 2014) | 5 lines - -Added ink-level reporting -Added a working out-of-paper detection -Improved error handling -Still needs a lot of testing - ------------------------------------------------------------------------- -r74 | llagendijk | 2014-01-22 17:23:23 +0100 (Wed, 22 Jan 2014) | 2 lines - -Create 1.2.2 release - ------------------------------------------------------------------------- -r73 | llagendijk | 2014-01-22 14:04:40 +0100 (Wed, 22 Jan 2014) | 3 lines - -- Fix crash on newer printers that sen an xml-document for printer status -- Some code reorg - ------------------------------------------------------------------------- -r72 | llagendijk | 2013-11-06 17:11:04 +0100 (Wed, 06 Nov 2013) | 2 lines - -Fix mistake in error hadling of read - ------------------------------------------------------------------------- -r71 | llagendijk | 2013-11-06 17:10:39 +0100 (Wed, 06 Nov 2013) | 2 lines - -Corrected comment on resource not being used - ------------------------------------------------------------------------- -r70 | llagendijk | 2013-10-23 17:14:32 +0200 (Wed, 23 Oct 2013) | 2 lines - -Fix possible buffer overflow in response buffer - ------------------------------------------------------------------------- -r69 | llagendijk | 2013-10-23 17:06:44 +0200 (Wed, 23 Oct 2013) | 2 lines - -DEbug loggin improvement: use stdou when we can not write to the logfile - ------------------------------------------------------------------------- -r68 | llagendijk | 2013-02-23 22:15:08 +0100 (Sat, 23 Feb 2013) | 2 lines - -README cleanup - ------------------------------------------------------------------------- -r67 | llagendijk | 2013-02-23 21:15:28 +0100 (Sat, 23 Feb 2013) | 2 lines - -Release 1.2.1 - ------------------------------------------------------------------------- -r66 | llagendijk | 2013-01-22 22:25:22 +0100 (Tue, 22 Jan 2013) | 3 lines - -Re-add reading tcp_print_response body and payload size into 2 reads. -An MX700 does not send both in one write - ------------------------------------------------------------------------- -r65 | llagendijk | 2013-01-21 23:36:17 +0100 (Mon, 21 Jan 2013) | 2 lines - -Remove configure and config.h.in, should not be in svn - ------------------------------------------------------------------------- -r64 | llagendijk | 2013-01-21 19:44:41 +0100 (Mon, 21 Jan 2013) | 2 lines - -corrected length of job command - ------------------------------------------------------------------------- -r62 | llagendijk | 2012-11-27 22:22:01 +0100 (Tue, 27 Nov 2012) | 2 lines - -Updated configure.ac for 1.2 release - ------------------------------------------------------------------------- -r61 | llagendijk | 2012-10-20 11:49:58 +0200 (Sat, 20 Oct 2012) | 3 lines - -Corrected definition of bjnp_command_t and bjnp_response_t: older compilers complained about redefinition in bjnp_protocol.h. -In bjnp_protocol.h we only define bjnp_command_u and bjnp_response_u - ------------------------------------------------------------------------- -r60 | llagendijk | 2012-10-01 15:19:38 +0200 (Mon, 01 Oct 2012) | 2 lines - -Minor edits - ------------------------------------------------------------------------- -r58 | llagendijk | 2012-09-29 15:56:24 +0200 (Sat, 29 Sep 2012) | 3 lines - -Fixed a crash that occured when an IPv6 reponse came from a gloabal address. We tried to -add the link-local address. This does not make sense as we do not know the scope_id. - ------------------------------------------------------------------------- -r57 | llagendijk | 2012-09-26 00:08:06 +0200 (Wed, 26 Sep 2012) | 3 lines - -Fix for missing initializations (crash on F15 on printer discovery) -Updated NEWS - ------------------------------------------------------------------------- -r56 | llagendijk | 2012-09-22 22:56:55 +0200 (Sat, 22 Sep 2012) | 2 lines - -Added bjnp-protocol.h to Makefile.am - ------------------------------------------------------------------------- -r55 | llagendijk | 2012-09-22 22:51:46 +0200 (Sat, 22 Sep 2012) | 6 lines - -More refactoring: -- split bjnp.h in a common include and one for the protocol definitions -- combined definitions for the protocol commands and responses in common types -- cleanup of configure.ac - - ------------------------------------------------------------------------- -r54 | llagendijk | 2012-09-22 00:37:43 +0200 (Sat, 22 Sep 2012) | 3 lines - -Cleaned up includes -Fixed compilation on MacOSX - ------------------------------------------------------------------------- -r53 | llagendijk | 2012-09-21 22:10:33 +0200 (Fri, 21 Sep 2012) | 3 lines - -Fixed side channel handling: this fixes the long standing -"Failed to read side channel" bug - ------------------------------------------------------------------------- -r52 | llagendijk | 2012-09-01 00:42:37 +0200 (Sat, 01 Sep 2012) | 3 lines - -Added IPv6 support -Refactoring of bjnp-io into 3 files - ------------------------------------------------------------------------- -r50 | llagendijk | 2011-07-05 22:44:10 +0200 (Tue, 05 Jul 2011) | 2 lines - -Last updates to specfile, re-added configure - ------------------------------------------------------------------------- -r49 | llagendijk | 2011-06-26 00:20:51 +0200 (Sun, 26 Jun 2011) | 7 lines - -Release 1.0 -Added forward lookup after reverse lookup to avoid problems with -buggy routers -IPv6 fixes -Removed some unused code - - ------------------------------------------------------------------------- -r48 | llagendijk | 2010-11-27 21:51:37 +0100 (Sat, 27 Nov 2010) | 2 lines - -Fix bjnp-runloop as cups 1.3 does not have CUPS_SC_CMD_NONE - ------------------------------------------------------------------------- -r43 | llagendijk | 2010-11-26 20:41:26 +0100 (Fri, 26 Nov 2010) | 2 lines - -Released 0.5.5 without further changes - ------------------------------------------------------------------------- -r42 | llagendijk | 2010-10-08 23:21:11 +0200 (Fri, 08 Oct 2010) | 2 lines - -Remove autogenerated Makefile.in - ------------------------------------------------------------------------- -r41 | llagendijk | 2010-10-08 23:20:24 +0200 (Fri, 08 Oct 2010) | 4 lines - -Added fixes for issues reported by Ron Murray in Sourceforge patches tracker ID: 3083455. -The MP990 appears to have some (?) IPv6 support, make sure we ignore IPv6 addresses for now. -Also corrected some minor bugs - ------------------------------------------------------------------------- -r40 | llagendijk | 2009-05-29 22:17:42 +0200 (Fri, 29 May 2009) | 3 lines - -0.5.4: removed autogeneration of spec file. It causes too much pain -No functional changes. No need to update - ------------------------------------------------------------------------- -r39 | llagendijk | 2009-05-16 21:20:14 +0200 (Sat, 16 May 2009) | 13 lines - -- reverted changes to spec file generation - Fixed some rpmlint comments that show up only on complete package but - not when rpmlint is run on spec file - - -M configure -M Makefile.in -M conf/rpmbuild -A + cups-bjnp.spec.in -D cups-bjnp.spec.dist.in -M configure.ac -M Makefile.am - ------------------------------------------------------------------------- -r38 | llagendijk | 2009-05-16 18:13:31 +0200 (Sat, 16 May 2009) | 6 lines - -2009-05-16: -Fixed size of sequence number -Fixed bug in printer detection that failed on FreeBSD (forgot to set -address family for bind call in bjnp_send_broadcast) -Fixed silly mistakes in configure script - ------------------------------------------------------------------------- -r37 | llagendijk | 2009-05-16 18:05:22 +0200 (Sat, 16 May 2009) | 3 lines - -update changelog in spec file for 0.5 release - - ------------------------------------------------------------------------- -r36 | llagendijk | 2009-03-12 21:31:38 +0100 (Thu, 12 Mar 2009) | 2 lines - -Release 0.5 version with only minor documentation changes - ------------------------------------------------------------------------- -r35 | llagendijk | 2009-02-28 12:45:27 +0100 (Sat, 28 Feb 2009) | 2 lines - -Added AC_MAINTAINER_MODE to configure.ac to avoid automatic rebuilding of autoconf stuff - ------------------------------------------------------------------------- -r34 | llagendijk | 2009-02-28 12:18:49 +0100 (Sat, 28 Feb 2009) | 2 lines - -added aclocal.m4 - ------------------------------------------------------------------------- -r33 | llagendijk | 2009-02-28 12:10:54 +0100 (Sat, 28 Feb 2009) | 2 lines - -added config.h.in - ------------------------------------------------------------------------- -r32 | llagendijk | 2009-02-28 11:58:47 +0100 (Sat, 28 Feb 2009) | 2 lines - -Added Makefile.in - ------------------------------------------------------------------------- -r31 | llagendijk | 2009-02-19 22:56:44 +0100 (Thu, 19 Feb 2009) | 2 lines - -Added NEWS - ------------------------------------------------------------------------- -r30 | llagendijk | 2009-02-19 22:54:32 +0100 (Thu, 19 Feb 2009) | 2 lines - -updated cups-bjnp.spec.in with latest changes - ------------------------------------------------------------------------- -r29 | llagendijk | 2009-02-19 22:49:57 +0100 (Thu, 19 Feb 2009) | 3 lines - -added autoconf output files to make building easier - - ------------------------------------------------------------------------- -r28 | llagendijk | 2009-02-19 22:45:28 +0100 (Thu, 19 Feb 2009) | 2 lines - -Added configure - ------------------------------------------------------------------------- -r27 | llagendijk | 2009-02-19 22:42:59 +0100 (Thu, 19 Feb 2009) | 2 lines - -added conf directory with Makefile fragments required for rpmbuild - ------------------------------------------------------------------------- -r26 | llagendijk | 2009-02-19 22:39:16 +0100 (Thu, 19 Feb 2009) | 2 lines - -added README - ------------------------------------------------------------------------- -r25 | llagendijk | 2009-02-19 22:37:25 +0100 (Thu, 19 Feb 2009) | 2 lines - -Changed to more gnu compliant INSTALL and ChangeLog - ------------------------------------------------------------------------- -r24 | llagendijk | 2009-02-19 22:35:55 +0100 (Thu, 19 Feb 2009) | 2 lines - -iChanges due to CUPs dependency removal - ------------------------------------------------------------------------- -r23 | llagendijk | 2009-02-19 22:33:27 +0100 (Thu, 19 Feb 2009) | 6 lines - -Added support for OS's where getifaddr() is missing -Added checks for case where getifaddr reports ptp link -Changes for autoconf support (include config.h) -Removed cups dependencies - - ------------------------------------------------------------------------- -r22 | llagendijk | 2009-02-19 22:30:18 +0100 (Thu, 19 Feb 2009) | 2 lines - -Addedmissing \n to debug statement - ------------------------------------------------------------------------- -r21 | llagendijk | 2009-02-19 22:29:12 +0100 (Thu, 19 Feb 2009) | 2 lines - -debugging improvements (log to file) - ------------------------------------------------------------------------- -r20 | llagendijk | 2009-02-19 22:27:49 +0100 (Thu, 19 Feb 2009) | 2 lines - -Debug setting improvement - ------------------------------------------------------------------------- -r19 | llagendijk | 2009-02-19 22:21:39 +0100 (Thu, 19 Feb 2009) | 2 lines +r166 | llagendijk | 2020-02-08 15:54:52 +0100 (Sat, 08 Feb 2020) | 5 lines -Added autoconf support +- Fixed GCC10 compile errors: + - ftime is obsolete: replaced by gettimeofday() + - some structs were missing extern in headers files +- Increased status buffer size to accomodate newer printers that send a much larger status ------------------------------------------------------------------------ -r16 | llagendijk | 2008-11-18 23:49:30 +0100 (Tue, 18 Nov 2008) | 2 lines +r164 | llagendijk | 2019-08-10 14:37:38 +0200 (Sat, 10 Aug 2019) | 2 lines -Use only cups-bjnp.spec.in in svn +Fixed compilation error on GCC 9 ------------------------------------------------------------------------ -r15 | llagendijk | 2008-11-18 23:47:46 +0100 (Tue, 18 Nov 2008) | 2 lines +r163 | llagendijk | 2018-02-21 18:04:28 +0100 (Wed, 21 Feb 2018) | 2 lines -removed make-dist as it is site-specific +Corrected NEWS ------------------------------------------------------------------------ -r13 | llagendijk | 2008-11-18 23:38:05 +0100 (Tue, 18 Nov 2008) | 7 lines +r162 | llagendijk | 2018-02-21 17:47:22 +0100 (Wed, 21 Feb 2018) | 2 lines -Release 0.4 -Added keep-alive for TCP connections to avoid that printer closes connection when no -data is recieved for 30 sec (may occur due to a slow filer) -Added a 15 sec delay at the end of a printjob as some printers may not allow new -connections otherwise -Rewrote makefile target for rpm +Updated Changelog & NEWS. Fixed version number in configure.ac ------------------------------------------------------------------------ -r11 | llagendijk | 2008-10-09 23:12:10 +0200 (Thu, 09 Oct 2008) | 2 lines - -Updated spec files for 0.3 release - ------------------------------------------------------------------------- -r10 | llagendijk | 2008-10-09 22:44:18 +0200 (Thu, 09 Oct 2008) | 2 lines - -Minor updates related to DIST_DIR im Makefile - ------------------------------------------------------------------------- -r9 | llagendijk | 2008-10-07 23:26:58 +0200 (Tue, 07 Oct 2008) | 4 lines - -improved sanity check on results of gethostbyaddr. Makae sure hostname is not NULL -and check for noname as some buggy routers seem to report that when no name is -available on a reverse lookup - ------------------------------------------------------------------------- -r8 | llagendijk | 2008-10-04 21:25:25 +0200 (Sat, 04 Oct 2008) | 2 lines - -Updated TODO file, - ------------------------------------------------------------------------- -r7 | llagendijk | 2008-10-04 21:00:05 +0200 (Sat, 04 Oct 2008) | 11 lines - -- sone cleanup with feedback from Sane-BJNP (revised protocol codes etc) -- added new/ improved compiler flags that trap more mistakes -- corrected warnings found with new compilerflags -- fixed a bug in scanning our interfaces when ifa_addr could be 0 (reported by Matt McHenry <jerith@speakeasy.org>) -- added a number of items found during development of the bjnp interface for the sane pixma backend)to the TODO list -- changed throttle pause from 3 sec to 40 msec. Improves performance. Recommended by Zedo. -- changed printbuffer to 4k. Recommended by Zedo, the Turboprint people -- Added a version string printout when incorrect number of arguments is recieved on command line -- added retry on udp failures - - ------------------------------------------------------------------------- -r5 | llagendijk | 2008-08-09 16:49:29 +0200 (Sat, 09 Aug 2008) | 1 line - -cups-bjnp-0.2 ------------------------------------------------------------------------- -r2 | llagendijk | 2008-08-09 16:36:51 +0200 (Sat, 09 Aug 2008) | 2 lines - -import of CUPS-BJNP-0.1 - ------------------------------------------------------------------------- -r1 | llagendijk | 2008-08-09 16:33:56 +0200 (Sat, 09 Aug 2008) | 3 lines +r161 | llagendijk | 2018-02-21 16:59:27 +0100 (Wed, 21 Feb 2018) | 5 lines -mkdir trunk +Updated license to GPLv2 OR LATER, to make it possible to use cups-bjnp with +cups 2.3 that changed to Apache License 2.0, which is GPLv2 incompatible. +There are no other changes. Released as cups-bjnp-2.0.1 ------------------------------------------------------------------------ diff --git a/bjnp-commands.c b/bjnp-commands.c index fbf0aa8..e8706a3 100644 --- a/bjnp-commands.c +++ b/bjnp-commands.c @@ -1,7 +1,7 @@ /* * Low level TCP and UDP IO communication implementation for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,8 @@ clear_cmd(bjnp_command_t *cmd) } static void -bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, bjnp_command_t *cmd, char cmd_code, +bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, bjnp_command_t *cmd, + char cmd_code, int command_len) { /* @@ -47,7 +48,7 @@ bjnp_set_command_header(uint8_t dev_type, uint16_t seq_no, uint16_t session_id, } void bjnp_defaults_set_command_header(bjnp_command_t *cmd, char cmd_code, - int command_len) + int command_len) { bjnp_set_command_header(BJNP_CMD_PRINT, 0, 0, cmd, cmd_code, command_len); } @@ -55,10 +56,10 @@ void bjnp_defaults_set_command_header(bjnp_command_t *cmd, char cmd_code, int bjnp_printer_set_command_header(printer_t *printer, bjnp_command_t *cmd, char cmd_code, - int command_len) + int command_len) { - bjnp_set_command_header( /* printer-> dev_type */ BJNP_CMD_PRINT, ++printer->serial, - printer->session_id, cmd, cmd_code, command_len); + bjnp_set_command_header(/* printer-> dev_type */ BJNP_CMD_PRINT, ++printer->serial, + printer->session_id, cmd, cmd_code, command_len); return printer->serial; } @@ -222,7 +223,7 @@ bjnp_get_status(printer_t *printer, char *status_buf) clear_cmd(&cmd); bjnp_printer_set_command_header(printer, &cmd, CMD_UDP_GET_STATUS, - sizeof(cmd.udp_get_status)); + sizeof(cmd.udp_get_status)); bjnp_hexdump(LOG_DEBUG2, "Get printer status", (char *) &cmd, sizeof(cmd.udp_get_status)); @@ -288,7 +289,7 @@ int bjnp_send_job_details(http_addr_t *addr, const char *user, const char *title clear_cmd(&cmd); bjnp_defaults_set_command_header(&cmd, CMD_UDP_PRINT_JOB_DET, - sizeof(cmd.udp_job_details)); + sizeof(cmd.udp_job_details)); /* create payload */ diff --git a/bjnp-commands.h b/bjnp-commands.h index eb15a05..77030be 100644 --- a/bjnp-commands.h +++ b/bjnp-commands.h @@ -1,7 +1,7 @@ /* * Low level TCP and UDP command function definitions for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/bjnp-debug.c b/bjnp-debug.c index b48dcdf..533542a 100644 --- a/bjnp-debug.c +++ b/bjnp-debug.c @@ -2,7 +2,7 @@ * debug support code * Part of: * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,7 +20,7 @@ #include <stdio.h> #include <stdarg.h> -#include <sys/timeb.h> +#include <sys/time.h> #include <errno.h> #include "bjnp.h" @@ -139,7 +139,7 @@ bjnp_hexdump(bjnp_loglevel_t level, char *header, const void *d_, } - bjnp_debug(level, "%s\n", header); + bjnp_debug(level, "%s (%d bytes)\n", header, len); ofs = 0; while (ofs < len) { @@ -192,7 +192,7 @@ bjnp_debug(bjnp_loglevel_t level, const char *fmt, ...) { va_list ap; char printbuf[1024]; - struct timeb timebuf; + struct timeval timebuf; int sec; int msec; @@ -211,14 +211,16 @@ bjnp_debug(bjnp_loglevel_t level, const char *fmt, ...) /* all log messages may go to the own logfile */ if (debug_file != NULL) { - ftime(&timebuf); + gettimeofday(&timebuf, NULL); - if ((msec = timebuf.millitm - start_msec) < 0) { + msec = timebuf.tv_usec / 1000; + + if ((msec - start_msec) < 0) { msec += 1000; - timebuf.time -= 1; + timebuf.tv_sec -= 1; } - sec = timebuf.time - start_sec; + sec = timebuf.tv_sec - start_sec; fprintf(debug_file, "%8s: %03d.%03d %s", level2str(level), sec, msec, printbuf); @@ -234,12 +236,12 @@ bjnp_set_debug_level(const char *level, const char *filename) * set debug level to level (string) */ - struct timeb timebuf; + struct timeval timebuf; char loglevel[16]; - ftime(&timebuf); - start_sec = timebuf.time; - start_msec = timebuf.millitm; + gettimeofday(&timebuf, NULL); + start_sec = timebuf.tv_sec; + start_msec = timebuf.tv_usec / 1000; /* * Set log level diff --git a/bjnp-discover.c b/bjnp-discover.c index 0ee67ed..f0f9222 100644 --- a/bjnp-discover.c +++ b/bjnp-discover.c @@ -1,7 +1,7 @@ /* * Printer discovery implementation for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * * This program is free software: you can redistribute it and/or modify @@ -337,7 +337,7 @@ int bjnp_discover_printers(struct printer_list *printers) clear_cmd(&cmd); memset(broadcast_addr, 0, sizeof(broadcast_addr)); - memset(&printer_sa, 0 , sizeof(printer_sa)); + memset(&printer_sa, 0, sizeof(printer_sa)); bjnp_debug(LOG_DEBUG, "sanei_bjnp_find_devices:\n"); for (i = 0; i < BJNP_SOCK_MAX; i++) { @@ -1,7 +1,7 @@ /* * Higher level bjnp IO communication implementation for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -67,7 +67,7 @@ bjnp_close_printer(printer_t *printer) close(printer->fd); } - bjnp_debug(LOG_DEBUG2, "Finish printjob\n"); + bjnp_debug(LOG_DEBUG, "Finish printjob\n"); bjnp_send_close(printer); free_printer(printer); } @@ -1,7 +1,7 @@ /* * Higher level bjnp IO communication implementation for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ typedef enum bjnp_ink_level_t { LEVEL_UNKNOWN = 3 } bjnp_ink_level_t; -struct printer_s { +typedef struct printer_s { int fd; /* tcp socket for the printer */ http_addr_t printer_sa; /* address struct for printer */ @@ -103,6 +103,6 @@ struct printer_s { int first_output; /* at first output we report additional info */ time_t last_level_report; /* last time we reported the levels */ -} printer_s; +} printer_t; #endif diff --git a/bjnp-levels.c b/bjnp-levels.c index 270d7be..e7fd530 100644 --- a/bjnp-levels.c +++ b/bjnp-levels.c @@ -1,7 +1,7 @@ /* * Printer status, Ink-level and paper status related functions for the * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2014 by Louis Lagendijk + * Copyright 2014-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,7 +70,7 @@ static struct { /* end of array record */ - { NULL, NULL, NULL, NULL, "10", "100" } + { NULL, NULL, NULL, NULL, "10", "100" } }; #define reset_capability(a,b) b &= ~(a) @@ -91,7 +91,7 @@ static int cart_type(char *desc) } /* unrecognized carttridge */ - bjnp_debug(LOG_NOTICE, "Unknown cartdige type %s, please report via %s!\n", + bjnp_debug(LOG_NOTICE, "Unknown cartdige type %s, please report via %s!\n", desc, BJNP_REPORT_URL); return 0; } @@ -437,12 +437,13 @@ static int report_ink_status_messages(printer_t *printer, char *status_buf, char level_empty = 0; int no_cartridges = 0; int cartridge_type; + int retval = 0; char *p; if ((printer->reporting_capabilities & BJNP_REPORT_INK_STATUS) == 0 || get_argument(status_buf, INK_WARNING_TOKEN, warnings, BJNP_ARG_MAX, "ink status") == 0) { reset_capability(BJNP_REPORT_INK_STATUS, printer->reporting_capabilities); - return LEVEL_OK; + return BJNP_OK; } /* now parse cartridges */ @@ -454,7 +455,9 @@ static int report_ink_status_messages(printer_t *printer, char *status_buf, bjnp_debug(LOG_ERROR, "error in parsing warning levels in status reponse, " "warning levels not supported! token = %s\n", token); - return !level_empty; + + /* allow printing to continue */ + return BJNP_OK; } *p = '\0'; @@ -468,9 +471,10 @@ static int report_ink_status_messages(printer_t *printer, char *status_buf, cartridge_type) { bjnp_debug(LOG_ERROR, "error in parsing warning levels in status reponse, " - "warning sequence does not match! token = %s\n", + "cartridge order does not match! token = %s\n", token); - return !level_empty; + /* allow printing to continue */ + return BJNP_OK; } } @@ -510,14 +514,20 @@ static int report_ink_status_messages(printer_t *printer, char *status_buf, } if (no_cartridges == 0) { + /* nothing to output */ bjnp_debug(LOG_ERROR, "No cartridges found!\n"); - return LEVEL_OK; + return BJNP_OK; } printer->global_ink_warning_level = report_standard_ink_warnings( printer->global_ink_warning_level, level_low, level_empty); - return level_empty; + + if (level_empty != 0) { + retval = BJNP_NO_INK; + } + + return retval; } static int diff --git a/bjnp-protocol.h b/bjnp-protocol.h index d2e875e..63f03da 100644 --- a/bjnp-protocol.h +++ b/bjnp-protocol.h @@ -1,7 +1,7 @@ /* * BJNP protocol definitions for the * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +62,7 @@ struct __attribute__((__packed__)) bjnp_header { /* command definition */ -union __attribute__((__packed__)) bjnp_command_u { +typedef union __attribute__((__packed__)) bjnp_command_u { struct bjnp_header header; struct __attribute__((__packed__)) { struct bjnp_header header; diff --git a/bjnp-utils.c b/bjnp-utils.c index ebd703d..821113b 100644 --- a/bjnp-utils.c +++ b/bjnp-utils.c @@ -1,7 +1,7 @@ /* * utility functions * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -280,8 +280,8 @@ get_printer_host(const http_addr_t printer_addr, char *name, int *port, /* do reverse name lookup, if hostname cannot be found, return IP-addr */ - if ((error = getnameinfo(&(printer_addr.addr) , sa_size(printer_addr), - name, BJNP_HOST_MAX , NULL, 0, NI_NAMEREQD)) + if ((error = getnameinfo(&(printer_addr.addr), sa_size(printer_addr), + name, BJNP_HOST_MAX, NULL, 0, NI_NAMEREQD)) != 0) { bjnp_debug(LOG_DEBUG, "Name for %s not found : %s\n", ip_address, gai_strerror(error)); @@ -1,6 +1,6 @@ /* * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * Based on cups AppSocket sources * Copyright 2007 by Apple Inc. @@ -1,7 +1,7 @@ /* * Data structures and definitions for * bjnp backend for the Common UNIX Printing System (CUPS). - * Copyright 2008-2014 by Louis Lagendijk + * Copyright 2008-2020 by Louis Lagendijk * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,8 +35,7 @@ #define BJNP_PRINTBUF_MAX 4096 /* size of printbuffer */ #define BJNP_CMD_MAX 2048 /* size of BJNP response buffer */ -#define BJNP_RESP_MAX 2048 /* size of BJNP response buffer */ -#define BJNP_STATUS_MAX 2048 /* max size for status string */ +#define BJNP_STATUS_MAX 8192 /* max size for status string */ #define BJNP_IEEE1284_MAX 1024 /* max. allowed size of IEEE1284 id */ #define BJNP_METHOD_MAX 16 /* max length of method */ #define BJNP_HOST_MAX 128 /* max length of hostname or address */ @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for cups-bjnp 2.0.2. +# Generated by GNU Autoconf 2.69 for cups-bjnp 2.0.3. # # Report bugs to <louis.lagendijk@gmail.com>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='cups-bjnp' PACKAGE_TARNAME='cups-bjnp' -PACKAGE_VERSION='2.0.2' -PACKAGE_STRING='cups-bjnp 2.0.2' +PACKAGE_VERSION='2.0.3' +PACKAGE_STRING='cups-bjnp 2.0.3' PACKAGE_BUGREPORT='louis.lagendijk@gmail.com' PACKAGE_URL='' @@ -1278,7 +1278,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures cups-bjnp 2.0.2 to adapt to many kinds of systems. +\`configure' configures cups-bjnp 2.0.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1344,7 +1344,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of cups-bjnp 2.0.2:";; + short | recursive ) echo "Configuration of cups-bjnp 2.0.3:";; esac cat <<\_ACEOF @@ -1446,7 +1446,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -cups-bjnp configure 2.0.2 +cups-bjnp configure 2.0.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1923,7 +1923,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by cups-bjnp $as_me 2.0.2, which was +It was created by cups-bjnp $as_me 2.0.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2788,7 +2788,7 @@ fi # Define the identity of the package. PACKAGE='cups-bjnp' - VERSION='2.0.2' + VERSION='2.0.3' cat >>confdefs.h <<_ACEOF @@ -5653,7 +5653,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by cups-bjnp $as_me 2.0.2, which was +This file was extended by cups-bjnp $as_me 2.0.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5719,7 +5719,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -cups-bjnp config.status 2.0.2 +cups-bjnp config.status 2.0.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index d1ab1e6..dab0762 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT([cups-bjnp], [2.0.2], [louis.lagendijk@gmail.com]) +AC_INIT([cups-bjnp], [2.0.3], [louis.lagendijk@gmail.com]) AC_CONFIG_SRCDIR([bjnp.c]) AM_INIT_AUTOMAKE([gnu]) |