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: Notification Errors not displayed in OS X 10.2



Robert,

You are running into the issue that I covered in a recent email to the printing list ..

"CUPS today (that means 1.1.x) does not have a mechanism for "immediate" notifications; messages from server-side modules are "queued". On the client-side we check for state changes every 5 seconds. This opens up the possibility of missing state changes that happen with the 5 second window. CUPS 1.2 will have better notification support but for now, this is limitation that we all have to live with. ..."

We have plans to overcome this limitation in a future release. But for Jaguar the guideline is to code your PM so that important events are not lost because less important ones occur within the same 5 second window. So in your case you can see from the cups log that within a 5 second window, an error event (kPMEventErrorOccurred) is followed by a job progress event (kPMEventJobProgress). Since you can't print with the door open, your PrintPage function should immediately exit its pmJobStreamGetNextBandProc loop and return an error result.

-Paul

P.S. See below for additional comments.


On Wednesday, February 26, 2003, at 11:54 AM, email@hidden wrote:

The log below was captured from the terminal using OS 10.2.3
(with Debug log level). We currently query for printer status upon
entry to BeginJob and PrintPage, but nowhere else. In this test,
I opened the printer cover so the printer would report an error.
(This is a Tioga driver, not a CUPS one.)

D [26/Feb/2003:14:28:35 -0500] Entering RasterModule Initialize...
D [26/Feb/2003:14:28:35 -0500] *jobContext=$0x6bb70
D [26/Feb/2003:14:28:35 -0500] ...0=RasterModule Initialize

D [26/Feb/2003:14:28:35 -0500] Entering RasterModule BeginJob...
D [26/Feb/2003:14:28:35 -0500] *jobContext=$0x6bb70
D [26/Feb/2003:14:28:35 -0500] TEngine::TEngine called
D [26/Feb/2003:14:28:35 -0500] TEngine::GetTicketInfo called
D [26/Feb/2003:14:28:35 -0500] TEngine::OpenJob called...
D [26/Feb/2003:14:28:35 -0500] >>> calling getStatus from OpenJob...
D [26/Feb/2003:14:28:35 -0500] Buffer sizes is (first = 4096, subsequent =
32768)
D [26/Feb/2003:14:28:35 -0500] ioThread started
D [26/Feb/2003:14:28:35 -0500] -->
TEngine::HandleErrorDisplay(statusType=7, statusOrError=$29501 or 169217)
called
D [26/Feb/2003:14:28:35 -0500] --> CreateEventDict(4001, 7) called
D [26/Feb/2003:14:28:35 -0500] --> kPMEventCodeKey=4001
D [26/Feb/2003:14:28:35 -0500] --> kPMErrorCodeKey=-1006
D [26/Feb/2003:14:28:35 -0500] --> kPMErrorExplanationKey='Someone
crossed the streams!')
D [26/Feb/2003:14:28:35 -0500] --> kPMErrorTextKey=<some error text>
D [26/Feb/2003:14:28:35 -0500] --> calling notifyProc(*mJobContextPtr
=$0x6bb70)
--> (Error 7) printer door. -0500] fatal: Door open

This should appear as
E [26/Feb/2003:14:28:35 -0500] fatal: Door open

D [26/Feb/2003:14:28:35 -0500] TEngine::getStatus called: statusType=7,
printerStatus=$29501
D [26/Feb/2003:14:28:35 -0500] ...0=TEngine::OpenJob
D [26/Feb/2003:14:28:35 -0500] ...0=RasterModule BeginJob

D [26/Feb/2003:14:28:36 -0500] Entering RasterModule PrintPage...

It appears you allowed BeginJob to return with noErr, so JobManager calls PrintPage.

D [26/Feb/2003:14:28:36 -0500] *jobContext=$0x6bb70
D [26/Feb/2003:14:28:36 -0500] sendJobProgressEvent: currentPage: 1
currentCopy: 1 currentSheet 1 percent: 0
D [26/Feb/2003:14:28:36 -0500] TEngine::OpenPage called...
D [26/Feb/2003:14:28:36 -0500] >>> calling getStatus from OpenPage...
D [26/Feb/2003:14:28:36 -0500] -->
TEngine::HandleErrorDisplay(statusType=7, statusOrError=$29501 or 169217)
called
D [26/Feb/2003:14:28:36 -0500] --> CreateEventDict(4001, 7) called
D [26/Feb/2003:14:28:36 -0500] --> kPMEventCodeKey=4001
D [26/Feb/2003:14:28:36 -0500] --> kPMErrorCodeKey=-1006
D [26/Feb/2003:14:28:36 -0500] --> kPMErrorExplanationKey='Someone
crossed the streams!')
D [26/Feb/2003:14:28:36 -0500] --> kPMErrorTextKey=<some error text>
D [26/Feb/2003:14:28:36 -0500] --> calling notifyProc(*mJobContextPtr
=$0x6bb70)
D [26/Feb/2003:14:28:36 -0500] TEngine::getStatus called: statusType=7,
printerStatus=$29501
D [26/Feb/2003:14:28:36 -0500] ...0=TEngine::OpenPage
D [26/Feb/2003:14:28:36 -0500] TEngine::PrintBand(bandPtr, size=1986336,
order=0, height=198, depth=32)
D [26/Feb/2003:14:28:39 -0500] TEngine::PrintBand(bandPtr, size=1986336,
order=1, height=198, depth=32)
D [26/Feb/2003:14:28:39 -0500] sendJobProgressEvent: currentPage: 1
currentCopy: 1 currentSheet 1 percent: 13

Within 5 seconds of the above error event, a JobProgressEvent occurs and this will prevent us detecting the above error event.

D [26/Feb/2003:14:28:42 -0500] sendJobProgressEvent: currentPage: 1
currentCopy: 1 currentSheet 1 percent: 13
D [26/Feb/2003:14:28:42 -0500] TEngine::PrintBand(bandPtr, size=1986336,
order=1, height=198, depth=32)
D [26/Feb/2003:14:28:44 -0500] sendJobProgressEvent: currentPage: 1
currentCopy: 1 currentSheet 1 percent: 20
D [26/Feb/2003:14:28:44 -0500] TEngine::PrintBand(bandPtr, size=1986336,
order=1, height=198, depth=3
// (more
band printing here)
D [26/Feb/2003:14:29:16 -0500] sendJobProgressEvent: currentPage: 1
currentCopy: 1 currentSheet 1 percent: 100
D [26/Feb/2003:14:29:16 -0500] TEngine::PrintBand(bandPtr, size=1825824,
order=2, height=182, depth=32)
D [26/Feb/2003:14:29:18 -0500] 0=TEngine::ClosePage(fAbort=0) called...
D [26/Feb/2003:14:29:28 -0500] ...printPageBands returned 0
D [26/Feb/2003:14:29:28 -0500] ...0=RasterModule PrintPage

D [26/Feb/2003:14:29:28 -0500] Entering RasterModule EndJob...
D [26/Feb/2003:14:29:28 -0500] *jobContext=$0x6bb70
D [26/Feb/2003:14:29:28 -0500] TEngine::CloseJob called
D [26/Feb/2003:14:29:28 -0500] TEngine::~TEngine called
D [26/Feb/2003:14:29:28 -0500] TEngine::FreeCommonMemory called
D [26/Feb/2003:14:29:28 -0500] ...0=RasterModule EndJob

D [26/Feb/2003:14:29:28 -0500] Entering RasterModule Terminate...
D [26/Feb/2003:14:29:28 -0500] *jobContext=$0x6bb70
D [26/Feb/2003:14:29:28 -0500] ...0=RasterModule Terminate

E [26/Feb/2003:14:29:28 -0500] PID 455 stopped with status 18!
D [26/Feb/2003:14:29:28 -0500] UpdateJob: job 950, file 0 is complete.
D [26/Feb/2003:14:29:28 -0500] StopJob: id = 950, force = 0
I [26/Feb/2003:14:29:28 -0500] Saving printers.conf...
D [26/Feb/2003:14:29:28 -0500] StopJob: printer state is 5

I originally returned kPMGeneralError from BeginJob, which was not
the right thing to do, although it did stop the queue in 10.2.3, and also
displayed the appropriate error alert in 10.1.5. Now BeginJob returns
0 if a status error is detected. Under 10.1.5, the error is reported at the
end of the job, but error reporting still does not occur under 10.2.3,
though
the terminal log shows I sent an error notification. (The "Error 7" error
text looks messed up because I use '/r' for line endings instead of '/n'.)

As shown in the log, I add EventCode, ErrorCode, ErrorExplanation, and
ErrorText keys to the notification dict. Under Mac OS X 10.1.5 the (bold)
"explanation" text does not display. Should it? Does the alert need to be
posted after BeginJob to be valid in OS X 10.2? Also, is the
kPMErrorCodeKey required? If so, what "OS Error" values are required,
and how is this key used?

The important keys are the event code (kPMKeyEventCode) and the error text (kPMErrorTextKey). When you report a non-recoverable error (kPMEventErrOccurred ) JobManager turns this into
fprintf (stderr, "ERROR: fatal: your error text string\n");
and when your report a recoverable error (kPMEventRecoverableErrOccurred) ...
fprintf (stderr, "WARNING: recoverable: your error text string\n");
We don't use the error code key (kPMErrorCodeKey) unless you fail to provide an error text key. And we don't write the error explanation text (kPMErrorExplanationKey) into the cups log.


Thanks in advance for the help.
_______________________________________________
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: 
 >Notification Errors not displayed in OS X 10.2 (From: 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.