Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for CUPS printer instances #34

Conversation

michaelweghorn
Copy link

Don't just always use the cups_dest_t's name
for the printer name, but also take it's instance member into account and if present, append that for the name used for the CPDB printer name, separated by a slash character.

Since PrinterCUPS::name is now assigned a newly
allocated string in get_new_PrinterCUPS, free
it again in free_PrinterCUPS.

While previously, CUPS printers instances were not available at all, they are now presented as separate printers.

For example, if there's a PDF printer, a printer instance with a different default resolution can be created using

lpoptions -p PDF/someinstance -o Resolution=1200dpi

and a PDF/someinstance printer now also shows up in cpdb-text-frontend from cpdb-libs, while it
wasn't without this commit in place.

FWIW, the modified default value for the
option as set above currently doesn't show up with cpdb-libs git master as of commit cc51ac3c48c9e5cede90aaedb13dc1333bde3b60 when using the

get-all-options PDF/someinstance CUPS

command, but the same is true when changing a default value for the default instance, i.e. using

lpoptions -p PDF -o Resolution=1200dpi

, so this seems to be a separate issue and unrelated to the added CUPS printer instance support.

Don't just always use the `cups_dest_t`'s `name`
for the printer name, but also take it's `instance`
member into account and if present, append that for
the name used for the CPDB printer name, separated by
a slash character.

Since `PrinterCUPS::name` is now assigned a newly
allocated string in `get_new_PrinterCUPS`, free
it again in `free_PrinterCUPS`.

While previously, CUPS printers instances were not
available at all, they are now presented as separate
printers.

For example, if there's a PDF printer, a printer instance
with a different default resolution can be created using

    lpoptions -p PDF/someinstance -o Resolution=1200dpi

and a `PDF/someinstance` printer now also shows up
in `cpdb-text-frontend` from cpdb-libs, while it
wasn't without this commit in place.

FWIW, the modified default value for the
option as set above currently doesn't show up with
cpdb-libs git master as of commit cc51ac3c48c9e5cede90aaedb13dc1333bde3b60
when using the

    get-all-options PDF/someinstance CUPS

command, but the same is true when changing a default
value for the default instance, i.e. using

    lpoptions -p PDF -o Resolution=1200dpi

, so this seems to be a separate issue and unrelated to
the added CUPS printer instance support.
@michaelweghorn michaelweghorn force-pushed the michaelweghorn/add_cups_printer_instance_support branch from 0f43a67 to db1347e Compare August 5, 2024 07:31
@tillkamppeter tillkamppeter merged commit 3c3fc98 into OpenPrinting:master Aug 5, 2024
@tillkamppeter
Copy link
Member

Thank you very much @michaelweghorn !

@michaelweghorn michaelweghorn deleted the michaelweghorn/add_cups_printer_instance_support branch August 5, 2024 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants