Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CPLPrinterIsRemote crashes Print Center



Thanks to some more sleuthing by Eric, we've narrowed the problem down to CreatePrinterTickets and CreatePrintingDialogExtensionsPaths. As you may recall, during queue creation on Jaguar, PrintJobMgr calls these two PM functions and auto-generates a PPD file based on the results. If you are running into problems with queue creation, one of the first things to check is whether a valid PPD file was successfully created.

Here's a brief description of the PPD auto-generation sequence:

1. PrintJobMgr calls your PM's Initialize function, then CreatePrinterTickets(). Your PM returns a PrinterInfo ticket and a JobTemplate. Then PrintJobMgr calls CreatePrintingDialogExtensionsPaths() and your PM returns a list of its PDEs. Finally we call Terminate(). The results of CreatePrinterTickets() and CreatePrintingDialogExtensionsPaths() are written to stdout in XML format so it's important your code does not contain any printf's.

2. Next we register your ColorSync profiles (listed in your PrinterInfo ticket) and set your default profile (specified in your JobTemplate).

3. Then we create the PPD file. Initially the file is written to /tmp. Here's where we expect to find certain keys in your PrinterInfo and JobTemplate.

- For the *Manufacturer key value, we take the first word from your PrinterInfo's kPMMakeAndModelNameKey. (Note that we have an exception for "Hewlett Packard" but otherwise we assume your company name does not contain any space chars.) If the kPMMakeAndModelNameKey is missing, we default to "unknown" but obviously it makes sense for you to provide this key.

- For the *Product key value, we use your PrinterInfo's kPMPrinterLongNameKey.

- For the *ModelName value, we use your PrinterInfo's kPMMakeAndModelNameKey.

- For the *ShortNickName value, we use your PrinterInfo's kPMPrinterShortNameKey.

- For the *NickName value, we currently use the kPMPrinterLongNameKey but this is a mistake. We should use kPMMakeAndModelNameKey because PMPrinterGetMakeAndModelName() gets the *NickName value. We are hoping to fix this bug in the next software update; I erroneously said it was fixed in 10.2.4.

- PPD files must contain paper size information; for each paper size listed in your JobTemplate's kPMPaperInfoList we generate *PageSize, *PageRegion, *ImageableArea, *PaperDimension keys.

- Other mandatory keywords are hardcoded. Also keywords required by CUPS (* cupsVersion, * cupsManualCopies, *cupsFilter) are written into the PPD file.

- Last but not least we write your PrinterInfo, JobTemplate and PDE list into the PPD file as a long list of *%XML comments.

4. If we managed to write a complete PPD file, we send a CUPS_ADD_PRINTER request to the CUPS daemon. CUPS creates the queue and your PM's PPD file is copied to /etc/cups/ppd/. Print Center adds your queue to its list, and from the command line lpstat will confirm your queue is set up.

Once again, I recommend you all become familiar with the PPD specification (available from http://partners.adobe.com/asn/developer/technotes/postscript.html).

IMPORTANT MESSAGE FOLLOWS!

Our code contains plenty of checks for things like missing keys (typically we insert "unknown" when a key is missing). And we try to handle the case where your PM returns NULL for a PrinterInfo ticket, a JobTemplate or its PDE paths. But I suspect we don't cover all cases. If you run into one of these edge cases, PLEASE report a Radar bug. That's the best way to make sure we support your PM. And if you need advice to workaround any of these bugs, feel welcome to contact me or get in touch with DTS.

-Paul


On Monday, February 24, 2003, at 02:06 PM, Eric Cole wrote:

I am writing a set of print driver plugins (IO, PBM, PM, PDE) and have gotten to the point where the printer is incorrectly added.

In the PBM, I enter some information and click add. The printer is added, the IOM and PM are called, Print Center Terminates the PBM, and hangs. All the controls have been removed from the window and the sheet is about to close.

I assume it is some data that I am not adding or adding incorrectly to some return value. If I attempt to add the printer while GDB is attached to Print Center, then error 4 is reported and the printer is not added.

Once Print Center crashes, it will crash every time it is opened. Viewing the printers at http://127.0.0.1:631/printers will return an empty list regardless of what valid printers there are. I must delete the new PPD from /etc/cups/ppd/ and send a kill -HUP to cupsd, then go back to the web page and remove the now visible printer before anything works again.

The generated PPD seems to be valid, at least nothing in plain text is obviously wrong.

Here is the bottom of the 66 function stack crawl from GDB:

#0 0x90025724 in recvfrom ()
#1 0x93a24604 in httpGets ()
#2 0x93a24ce0 in httpUpdate ()
#3 0x93a2d9d8 in cupsDoFileRequest ()
#4 0x95246014 in CPLPrinterIsRemote ()
#5 0x000053dc in ?? ()
#6 0x000126ac in ?? ()
#7 0x00012a30 in ?? ()
#8 0x930ac01c in -[NSToolbarItem _validateAsCommonItem:] ()
#9 0x930cc110 in -[NSToolbar validateVisibleItems] ()
#10 0x9313f84c in -[NSToolbarView _doDelayedValidateVisibleToolbarItems] ()
#11 0x907fd32c in __NSFireDelayedPerform ()
#12 0x901632f0 in __CFRunLoopDoTimer ()
#13 0x90148e48 in __CFRunLoopRun ()
#14 0x90180fe4 in CFRunLoopRunSpecific ()
#15 0x93159a20 in -[NSMoveHelper _doAnimation] ()
#16 0x931e21a4 in -[NSMoveHelper(Sheets) _closeSheet:andMoveParent:] ()
#17 0x931e2098 in -[NSWindow(Sheets) _orderOutRelativeToWindow:] ()
#18 0x931e99a4 in -[NSCarbonWindow _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] ()
#19 0x9311e994 in -[NSWindow _close] ()
#20 0x9315468c in -[NSWindow close] ()
#21 0x0001598c in ?? ()
#22 0x00015cfc in ?? ()
#23 0x0001c01c in ?? ()
#24 0x969a2244 in DispatchEventToHandlers ()

Has anyone had similar problems? Any suggestions on what might be wrong?

Thanks
Eric
_______________________________________________
printing mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/printing
Do not post admin requests to the list. They will be ignored.
_______________________________________________
printing mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/printing
Do not post admin requests to the list. They will be ignored.

References: 
 >CPLPrinterIsRemote crashes Print Center (From: Eric Cole <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.