From: Bernd Herd codeberg@herdsoft.com
--- dlls/sane.ds/ds_ctrl.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/sane.ds/ds_ctrl.c b/dlls/sane.ds/ds_ctrl.c index 9564ffe80d6..0ff0bc69a3a 100644 --- a/dlls/sane.ds/ds_ctrl.c +++ b/dlls/sane.ds/ds_ctrl.c @@ -282,11 +282,39 @@ TW_UINT16 SANE_PendingXfersGet (pTW_IDENTITY pOrigin, twRC = TWRC_FAILURE; activeDS.twCC = TWCC_SEQERROR; } + else if (activeDS.currentState < 6) + { + /* We have not yet started scanning */ + pPendingXfers->Count = activeDS.capXferCount; + twRC = TWRC_SUCCESS; + activeDS.twCC = TWCC_SUCCESS; + + } + else if (activeDS.remainingImages != -1) + { + /* The application gave us a counter with CAP_XFERCOUNT */ + pPendingXfers->Count = activeDS.remainingImages; + twRC = TWRC_SUCCESS; + activeDS.twCC = TWCC_SUCCESS; + } + else if (activeDS.currentState == 7) + { + /* We are already scanning a frame, so there obviously is one */ + pPendingXfers->Count = -1; + twRC = TWRC_SUCCESS; + activeDS.twCC = TWCC_SUCCESS; + } else { pPendingXfers->Count = -1; - if (SANE_CALL( start_device, NULL )) + if (SANE_Start()) + { + /* No more frames... tell the application */ pPendingXfers->Count = 0; + activeDS.currentState = 5; + SANE_Cancel(); + SANE_Notify(MSG_CLOSEDSREQ); + } twRC = TWRC_SUCCESS; activeDS.twCC = TWCC_SUCCESS; }