summaryrefslogtreecommitdiff
path: root/bjnp-levels.c
diff options
context:
space:
mode:
Diffstat (limited to 'bjnp-levels.c')
-rw-r--r--bjnp-levels.c28
1 files changed, 19 insertions, 9 deletions
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