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

2006-05-30 Thread m. allan noah
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


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

2006-05-28 Thread m. allan noah
On Fri, 26 May 2006, Lauri Pirttiaho wrote:
 When using libusb method in sanei_usb the behavior of
 sanei_usb_read bulk seems to be that in responese to
 NAK (errno -ETIMEDOUT, strerror saying Resource
 temporarily unavailable, which means the device
 can not temporarily provide more data)
 the sanei_usb_read_bulk calls usb_clear_halt
 and then returns SANEI_STATUS_IO_ERROR.

certain fujitsu scanners have trouble resetting the data0/1 usb toggle 
properly, generally at the first command after the scanner is opened. 
libusb returns to sane -ETIMEDOUT, and errno is EAGAIN (Resource 
temporarily unavailable).

the clear_halt does not help, i have tried both ways.


 Now because of the usb_clear_halt there is no longer access
 to the errno so this particular reason for the IO error
 can not be distinguished from others after sanei_usb_read
 bulk returns.

i do not understand this- errno still exists on my system, even after the 
clear call? are you saying that you want the negative read_size error 
returned?


 The solution in Avision backend seems to be that the
 errors from sanei_usb_read bulk are completely ignored and
 the function is called repeatedly until all data has been
 read. A temporary solution but maybe not the best one.


for some scanners, perhaps the only method that works.

 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.

what about all the other possible error codes that might be returned? what 
about using a callback mechanism like sanei_scsi does for sense data? then 
the backend can tell exactly what sane status it wants returned. 
unfortunately, i am not sure about the returns from non-libusb libs.

allan


 With best regards,

 Lauri Pirttiaho
 Oulu
 Finland

 ...
 Luukku Plus paketilla p??set eroon tila- ja turvallisuusongelmista.
 Hanki Luukku Plus ja helpotat el?m??si. http://www.mtv3.fi/luukku


 --
 sane-devel mailing list: sane-devel@lists.alioth.debian.org
 http://lists.alioth.debian.org/mailman/listinfo/sane-devel
 Unsubscribe: Send mail with subject unsubscribe your_password
 to sane-devel-requ...@lists.alioth.debian.org


-- 
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
From azummo-li...@towertech.it  Sun May 28 23:44:36 2006
From: azummo-li...@towertech.it (Alessandro Zummo)
Date: Sun May 28 23:46:03 2006
Subject: [sane-devel] Re: Epson CX11 network scan support?
In-Reply-To: 20060523083805.ga29...@apartia.fr
References: 20060522105248.gb28...@apartia.fr 87hd3habf9@geek.avasys.jp
20060523083805.ga29...@apartia.fr
Message-ID: 20060529014436.2dbd07ed@inspiron

On Tue, 23 May 2006 10:38:05 +0200
Louis-David Mitterrand vindex+lists-sane-de...@apartia.org wrote:

  IIRC, Alessandro Zummo hacked up something to make scanning via TCP/IP
  work.  See 
  

  http://lists.alioth.debian.org/pipermail/sane-devel/2006-January/015986.html
  
  for details.
 
 Thanks, this looks promising.
 
 Will this work soon be integrated into sane?

 Hi,

  I've been unable to work on the driver recently. I'd say the job is half done,
 because comms works fine but a lot of testing needs to be made to fully
 support the scanner.

  I've posted the generic network code in this ml, but I don't think
 it has been included in SANE yet. This is a required step.

  The epson2 driver I've posted uses this code to communicate
 to the scanner. 

  It would have been easier if Epson had released the specs. :)

  If I can find a few people that can code some bits, the driver could
 be completed in a decent timeframe.

-- 

 Best regards,

 Alessandro Zummo,
  Tower Technologies - Turin, Italy

  http://www.towertech.it



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

2006-05-26 Thread Gerard Klaver
On Fri, 2006-05-26 at 22:52 +0300, Lauri Pirttiaho wrote:
 Hello,
 
 I have encountered a problem with bulk read that might
 benefit from some change in sanei_usb. This problem
 becomes visible in a fast machine like AMD64 and seems
 to have been seen in Avision backend and now in cs3200f.
 
 When using libusb method in sanei_usb the behavior of
 sanei_usb_read bulk seems to be that in responese to
 NAK (errno -ETIMEDOUT, strerror saying Resource
 temporarily unavailable, which means the device 
 can not temporarily provide more data) 
 the sanei_usb_read_bulk calls usb_clear_halt
 and then returns SANEI_STATUS_IO_ERROR.
 
 Now because of the usb_clear_halt there is no longer access
 to the errno so this particular reason for the IO error
 can not be distinguished from others after sanei_usb_read
 bulk returns.
 
 The solution in Avision backend seems to be that the
 errors from sanei_usb_read bulk are completely ignored and
 the function is called repeatedly until all data has been
 read. A temporary solution but maybe not the best one.
 
 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.
 
 With best regards,
 
 Lauri Pirttiaho
 Oulu
 Finland
 
It seems i get for my sq930x SANE webcam backend (under development)
the same errors. But when i do a init and read images with the MS driver
and then a reboot (Linux) and start my sq930x backend i don't get that
sort of errors but can do bulk reads with no problems.
-- 

m.vr.gr.
Gerard Klaver



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

2006-05-26 Thread Wittawat Yamwong
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. 

Regards
-- 
Wittawat Yamwong
Hannover, Germany