Skip to content

Commit 9df1ca5

Browse files
committed
libusb backend: respond to DRAIN command only after reading print_fd
1 parent 510ebb3 commit 9df1ca5

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

backend/usb-libusb.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -440,17 +440,6 @@ print_device(const char *uri, /* I - Device URI */
440440
if (FD_ISSET(g.wakeup_pipe[0], &input_set))
441441
read(g.wakeup_pipe[0], &dummy, 1);
442442

443-
/*
444-
* If drain output has finished send a response...
445-
*/
446-
447-
if (g.drain_output && !nfds && !g.print_bytes)
448-
{
449-
/* Send a response... */
450-
g.drain_output = 0;
451-
cupsSideChannelWrite(CUPS_SC_CMD_DRAIN_OUTPUT, CUPS_SC_STATUS_OK, NULL, 0, 1.0);
452-
}
453-
454443
/*
455444
* Check if we have print data ready...
456445
*/
@@ -491,6 +480,17 @@ print_device(const char *uri, /* I - Device URI */
491480
(int)g.print_bytes);
492481
}
493482

483+
/*
484+
* If drain output has finished send a response...
485+
*/
486+
487+
if (g.drain_output && !nfds && !g.print_bytes)
488+
{
489+
/* Send a response... */
490+
g.drain_output = 0;
491+
cupsSideChannelWrite(CUPS_SC_CMD_DRAIN_OUTPUT, CUPS_SC_STATUS_OK, NULL, 0, 1.0);
492+
}
493+
494494
if (g.print_bytes)
495495
{
496496
iostatus = libusb_bulk_transfer(g.printer->handle,

0 commit comments

Comments
 (0)