Skip to content

Commit

Permalink
ppdLoadAttributes(): Apply cfIEEE1284NormalizeMakeModel() to NickName
Browse files Browse the repository at this point in the history
The PPD's NickName sometimes contains manufacturer and model,
sometimes only the model, not the manufacturer. And manufacturer names
can be completely missing or messy.

By using cfIEEE1284NormalizeMakeModel() we clean this up and have
clear manufacturer names, for better answers print clients and correct
application of quirk rules, especially by the ppdFilterPDFToPS()
filter function.

Improved solution for Pull Request #21.
  • Loading branch information
tillkamppeter committed Sep 21, 2023
1 parent 6bc2deb commit 50dd893
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ppd/ppd-ipp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1383,10 +1383,13 @@ ppdLoadAttributes(
printer_input_tray, (int)strlen(printer_input_tray));
}

// printer-make-andXS-model
char make_model[128]; // Manufacturer and Model value

snprintf(make_model, sizeof(make_model), "%s %s", ppd->manufacturer, ppd->nickname);
// printer-make-and-model
char make_model[256]; // Manufacturer and Model value
if (cfIEEE1284NormalizeMakeModel(ppd->nickname, ppd->manufacturer,
CF_IEEE1284_NORMALIZE_HUMAN,
NULL, make_model, sizeof(make_model),
NULL, NULL, NULL) == NULL)
snprintf(make_model, sizeof(make_model), "%s", ppd->nickname);
ippAddString(attrs, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-make-and-model",
NULL, make_model);

Expand Down
1 change: 1 addition & 0 deletions ppd/ppd.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
# include <cups/raster.h>
# include <cupsfilters/log.h>
# include <cupsfilters/driver.h>
# include <cupsfilters/ieee1284.h>


//
Expand Down

0 comments on commit 50dd893

Please sign in to comment.