[sane-devel] sanei_usb_read_bulk: problem in handling of NAK

m. allan noah anoah at pfeiffer.edu
Tue May 30 21:59:08 UTC 2006


On Fri, 26 May 2006, Wittawat Yamwong wrote:

> On Friday 26 May 2006 21:52, Lauri Pirttiaho wrote:
>> [...]
>> I would propose changing the behavior of sanei_usb_read bulk
>> so that in the case of NAK (resource temporarily unavailable)
>> the size is returned as 0 and the return value is set
>> either to SANE_STATUS_GOOD (read OK, just no data
>> at this moment) or SANE_STATUS_BUSY (device can not
>> respond right now). Both will work even though probably
>> the latter one is more in line with the meaning of USB NAK
>> in this case.
>
> I vote for the latter (SANE_STATUS_BUSY) so that it is possible to distinguish
> between NAK and zero-length packet.

sanei already makes this distinction. zero length packet will come back as 
SANE_STATUS_EOF, if the return value was 0 instead of negative (which i 
find slightly misleading)

allan

-- 
"so don't tell us it can't be done, putting down what you don't know.
money isn't our god, integrity will free our souls" - Max Cavalera



More information about the sane-devel mailing list