summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-05-13 22:29:41 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-05-13 22:29:41 +0000
commit178cb7369d104b95acb92929f36956a38765c84c (patch)
tree4563f57a75df1c4145d25d3ebecf1d3152022362 /backend
parentf11a948a02771f78f50b530880a0269d4b4f58eb (diff)
Merge changes from CUPS 1.4svn-r8628.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1495 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'backend')
-rw-r--r--backend/usb-darwin.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/backend/usb-darwin.c b/backend/usb-darwin.c
index 8d3fe4f81..9dcd2c6ee 100644
--- a/backend/usb-darwin.c
+++ b/backend/usb-darwin.c
@@ -318,6 +318,8 @@ print_device(const char *uri, /* I - Device URI */
{
char serial[1024]; /* Serial number buffer */
OSStatus status; /* Function results */
+ IOReturn iostatus, /* Current IO status */
+ prev_iostatus = 0; /* Previous IO status */
pthread_t read_thread_id, /* Read thread */
sidechannel_thread_id;/* Side-channel thread */
int have_sidechannel = 0; /* Was the side-channel thread started? */
@@ -646,28 +648,48 @@ print_device(const char *uri, /* I - Device URI */
{
bytes = g.print_bytes;
- status = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
+ iostatus = (*g.classdriver)->WritePipe(g.classdriver, (UInt8*)print_ptr, &bytes, 0);
/*
* Ignore timeout errors, but retain the number of bytes written to
* avoid sending duplicate data (<rdar://problem/6254911>)...
*/
- if (status == kIOUSBTransactionTimeout)
- status = 0;
+ if (iostatus == kIOUSBTransactionTimeout)
+ iostatus = 0;
- if (status || bytes < 0)
+ /*
+ * Ignore stall errors, since we clear any stalls in the class driver...
+ */
+
+ if (iostatus == kIOUSBPipeStalled)
+ iostatus = 0;
+
+ /*
+ * Ignore the first "aborted" status we get, since we might have
+ * received a signal (<rdar://problem/6860126>)...
+ */
+
+ if (iostatus == kIOReturnAborted && prev_iostatus != kIOReturnAborted)
+ {
+ prev_iostatus = iostatus;
+ iostatus = 0;
+ }
+ else
+ prev_iostatus = iostatus;
+
+ if (iostatus || bytes < 0)
{
/*
* Write error - bail if we don't see an error we can retry...
*/
- OSStatus err = (*g.classdriver)->Abort(g.classdriver);
+ IOReturn err = (*g.classdriver)->Abort(g.classdriver);
_cupsLangPuts(stderr, _("ERROR: Unable to send print data!\n"));
- fprintf(stderr, "DEBUG: USB class driver WritePipe returned %ld\n",
- (long)status);
- fprintf(stderr, "DEBUG: USB class driver Abort returned %ld\n",
- (long)err);
+ fprintf(stderr, "DEBUG: USB class driver WritePipe returned %x\n",
+ iostatus);
+ fprintf(stderr, "DEBUG: USB class driver Abort returned %x\n",
+ err);
status = job_canceled ? CUPS_BACKEND_FAILED : CUPS_BACKEND_STOP;
break;
}