mitsu: Don't abort on attaching if the library isn't loaded.

Instead, only abort on job parsing, and even then only if it's necessary.
This commit is contained in:
Solomon Peachy 2020-02-27 11:53:31 -05:00
parent a0e3326316
commit 6505ec5d91
3 changed files with 21 additions and 14 deletions

View File

@ -599,10 +599,8 @@ static int mitsu70x_attach(void *vctx, struct libusb_device_handle *dev, int typ
#if defined(WITH_DYNAMIC)
/* Attempt to open the library */
if (mitsu_loadlib(&ctx->lib, ctx->type))
return CUPS_BACKEND_FAILED;
#else
WARNING("Dynamic library support not enabled, using internal fallback code\n");
#endif
WARNING("Dynamic library support not loaded, will be unable to print.");
struct mitsu70x_printerstatus_resp resp;
int ret;
@ -1094,7 +1092,6 @@ repeat:
}
if (!ctx->lib.dl_handle) {
// XXXFALLBACK write fallback code?
ERROR("!!! Image Processing Library not found, aborting!\n");
mitsu70x_cleanup_job(job);
return CUPS_BACKEND_CANCEL;

View File

@ -302,15 +302,14 @@ static int mitsu9550_attach(void *vctx, struct libusb_device_handle *dev, int ty
ctx->type == P_MITSU_9810)
ctx->is_98xx = 1;
if (!ctx->is_98xx) goto skip;
if (ctx->is_98xx) {
#if defined(WITH_DYNAMIC)
/* Attempt to open the library */
if (mitsu_loadlib(&ctx->lib, ctx->type))
return CUPS_BACKEND_FAILED;
#else
WARNING("Dynamic library support not enabled, will be unable to print.");
/* Attempt to open the library */
if (mitsu_loadlib(&ctx->lib, ctx->type))
#endif
skip:
WARNING("Dynamic library support not loaded, will be unable to print.");
}
if (test_mode < TEST_MODE_NOATTACH) {
if (mitsu9550_get_status(ctx, (uint8_t*) &media, 0, 0, 1))
return CUPS_BACKEND_FAILED;
@ -457,6 +456,13 @@ hdr_done:
/* Read in CP98xx data tables if necessary */
if (ctx->is_98xx && !job->is_raw && !ctx->m98xxdata) {
char full[2048];
if (!ctx->lib.dl_handle) {
ERROR("!!! Image Processing Library not found, aborting!\n");
mitsu9550_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
snprintf(full, sizeof(full), "%s/%s", corrtable_path, MITSU_M98xx_DATATABLE_FILE);
DEBUG("Reading in 98xx data from disk\n");

View File

@ -613,10 +613,8 @@ static int mitsud90_attach(void *vctx, struct libusb_device_handle *dev, int typ
#if defined(WITH_DYNAMIC)
/* Attempt to open the library */
if (mitsu_loadlib(&ctx->lib, ctx->type))
return CUPS_BACKEND_FAILED;
#else
WARNING("Dynamic library support not enabled, will be unable to print.");
#endif
WARNING("Dynamic library support not loaded, will be unable to print.");
}
return CUPS_BACKEND_OK;
@ -767,6 +765,12 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
/* CP-M1 has... other considerations */
if (ctx->type == P_MITSU_M1 && !job->is_raw) {
if (!ctx->lib.dl_handle) {
ERROR("!!! Image Processing Library not found, aborting!\n");
mitsud90_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
int ret = mitsu_apply3dlut(&ctx->lib, CPM1_LUT_FNAME,
job->databuf,
be16_to_cpu(job->hdr.cols),