Bug 749235 - No method for setting e.g. media size
Summary: No method for setting e.g. media size
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cups-pk-helper
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Marek Kašík
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: RejectedNTH
Depends On:
Blocks: 749270
TreeView+ depends on / blocked
 
Reported: 2011-10-26 14:41 UTC by Tim Waugh
Modified: 2012-04-16 16:05 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-04-16 16:05:24 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Add method PrinterSetSettings (10.38 KB, patch)
2012-01-18 15:54 UTC, Marek Kašík
no flags Details | Diff

Description Tim Waugh 2011-10-26 14:41:25 UTC
Description of problem:
To set the default media size for a queue, the correct way to do it is with a CUPS-Add-Printer IPP request, including a "media" attribute.  That is how lpadmin implements this command:

lpadmin -p printer -o media=iso_a4

However, the cups-pk-helper implementation of addPrinter has no allowance for arbitrary attributes, making this problematic.

For setting the page size, the closest we can get is to modify the PPD's PageSize attribute and use that file with PrinterAddWithPpdFile... however, it means we have to fetch the PPD first, so it's a bit ugly.

My recommendation: add a method PrinterSetSettings with in_signature "sass" which would do this:

num_options = cupsParseOptions (opts, num_options, &options);
req = ippNewRequest(CUPS_ADD_MODIFY_PRINTER); /* or _CLASS, as needed */
ippAddString (..., "printer-uri", ..., uri);
ippAddString (..., "requesting-user-name", ...);
cupsEncodeOptions2 (req, num_options, options, IPP_TAG_PRINTER);
req = cupsDoRequest (..., request, "/admin/");

i.e. it would perform a CUPS-Add-Printer request with just options.

Version-Release number of selected component (if applicable):
cups-pk-helper-0.1.3-2.fc16.x86_64

Comment 1 Marek Kašík 2012-01-17 11:09:41 UTC
Hi,

I implemented the new method as described in comment #1 but it doesn't change the PPD file. I've looked into source code of the lpadmin and I see that it catches the PPD, change it and send it back to CUPS (if the PPD is available). Or am I wrong?

Marek

Comment 2 Marek Kašík 2012-01-17 11:41:12 UTC
(In reply to comment #1)
> I implemented the new method as described in comment #1 but it doesn't change

I meant description, not comment #1.

Comment 3 Tim Waugh 2012-01-17 16:20:20 UTC
Oh, yes, I see.  I hadn't spotted that part...

In a future release of CUPS there will be no support for PPDs in any case, only IPP attributes.

Until then, I guess cups-pk-helper will have to do the same thing: read in the PPD, call ppdMarkDefaults() and cupsMarkOptions(), and write that file out again.  As cups-pk-helper doesn't need to support changing the cupsIPPSupplies/cupsSNMPSupplies attributes, it can be simplified a bit, only adjusting *Default[...] attributes, and special-casing for PageRegion/PaperDimension/ImageableArea.

Want me to send you a patch to do that?

Comment 4 Marek Kašík 2012-01-17 16:38:01 UTC
Hi Tim,

thank you for your offer. I'll prepare the patch myself.

Regards

Marek

Comment 5 Marek Kašík 2012-01-18 15:54:57 UTC
Created attachment 556061 [details]
Add method PrinterSetSettings

Here is an implementation of the method in cups-pk-helper. But I think now that since we already need to parse the PPD for "*Default" entries we should just modify the method "PrinterAddOptionDefault" to do that. This would be compatible with current version and we can add the new method to the next release.

What do you think Tim?

Marek

Comment 6 Tim Waugh 2012-01-26 11:42:35 UTC
Doesn't PrinterAddOptionDefault append "-default" to the provided option names?  You must be sure to set "media" (which changes the PPD file) and not "media-default" (which does not).

Comment 7 Marek Kašík 2012-03-22 11:19:26 UTC
New method PrinterAddOption, which fixes this bug, was added in 0.2.2 release of cups-pk-helper.
Since we are after beta change deadline, I'm proposing this bug as a nice-to-have bug for F17 (rebase of cups-pk-helper to 0.2.2).

Marek

Comment 8 Kamil Páral 2012-03-22 11:47:51 UTC
(In reply to comment #7)
> Since we are after beta change deadline, I'm proposing this bug as a
> nice-to-have bug for F17 (rebase of cups-pk-helper to 0.2.2).
> 
> Marek

Hi, if you want to have this included in F17 Beta, you need to propose it as F17Beta-accepted. F17-accepted is for the final release, and by that time you probably manage to push the update into stable repos.

Comment 9 Marek Kašík 2012-03-22 11:58:32 UTC
(In reply to comment #8)
> (In reply to comment #7)
> > Since we are after beta change deadline, I'm proposing this bug as a
> > nice-to-have bug for F17 (rebase of cups-pk-helper to 0.2.2).
> > 
> > Marek
> 
> Hi, if you want to have this included in F17 Beta, you need to propose it as
> F17Beta-accepted. F17-accepted is for the final release, and by that time you
> probably manage to push the update into stable repos.

OK, I'll try to get it into beta.

Comment 10 Fedora Update System 2012-03-23 08:59:28 UTC
cups-pk-helper-0.2.2-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/cups-pk-helper-0.2.2-1.fc17

Comment 11 Adam Williamson 2012-03-29 00:09:17 UTC
Discussed at 2012-03-28 go/no-go meeting, acting as an NTH review meeting. Rejected as NTH: we can't see any reason this needs to make the beta images, it will be fine going out as an update. People don't often print from the installer or from a Beta live image.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers

Comment 12 Fedora Update System 2012-04-12 03:09:31 UTC
cups-pk-helper-0.2.2-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.