[sane-devel] Questions about the genesys backend and the corresponding frontends (Wolfson Microelectronics)

2006-03-04 Thread Jean-Baka Domelevo-Entfellner
Hi!
Following on my project to include support for the OpticFilm 7200 (by
Plustek) to the genesys backend, I have some questions to the
maintainer(s) of the latter:

1) Are the AFEs taken into account for the moment all made by Wolfson
? The Genesys_Frontend stuctures are different for the UMAX, ST12,
HP2400c, etc. I wonder why.

2) Concerning this same structure, I don't understand exactly the
meaning of the four values put in reg and the three put in reg2.
Apparently being register contents corresponding to extra registers
(we already have the three gain registers and the three offset
registers), it would allow for seven configuration registers for the
AFE, which looks far too much for me. In my case the AFE is the
AD9826, and it has only two 8-bit configuration registers.

3) At the same point, in sign, correct me if this is not the sign
bit (bit#8, i.e. the ninth of the field) of the offset for each of the
three channels.

4) There seem to be some mistakes (or things I don't understand :-))
in the addresses given to the sanei_genesys_fe_write_data function, in
genesys.c and genesys_gl841.c. For instance, for the red gain, I can
see the address 0x28, which doesn't seem to match the Wolfson WM8192
chip documentation (please indicate which is the exact AFE used, but I
think the register addresses are pretty much the same for all WM
chips).

5) As I could have other questions in the near future, please allow me
to write directly to you (dear maintainer(s)) in the future, cause it
could become boring for the other readers of the list. Problem is I
don't know who is in the current maintainer's team concerning the
genesys backend (Pierre ? St?phane ? Gerhard ? Henning ? Maybe I will
do some kind of temporary restricted ml...)

See you, and thanks for your help.
JB


[sane-devel] Questions about the genesys backend and the corresponding frontends (Wolfson Microelectronics)

2006-03-04 Thread Pierre Willenbrock
Hello

Jean-Baka Domelevo-Entfellner schrieb:
 Following on my project to include support for the OpticFilm 7200 (by
 Plustek) to the genesys backend, I have some questions to the
 maintainer(s) of the latter:
 
 1) Are the AFEs taken into account for the moment all made by Wolfson
 ? The Genesys_Frontend stuctures are different for the UMAX, ST12,
 HP2400c, etc. I wonder why.

Currently, the only tested AFE for the gl841 part is the Wolfson WM8199.
The code for AFEs is in no way universally useable. It would be better
to add function tables for the AFEs, as done for gl646 chip and gl841 chip.

 2) Concerning this same structure, I don't understand exactly the
 meaning of the four values put in reg and the three put in reg2.
 Apparently being register contents corresponding to extra registers
 (we already have the three gain registers and the three offset
 registers), it would allow for seven configuration registers for the
 AFE, which looks far too much for me. In my case the AFE is the
 AD9826, and it has only two 8-bit configuration registers.

The WM8199 has three registers for each of gain and offset. Additionally
it has six registers for various configuration settings, registers 1-3,
6, 8 and 9. Some AFEs use register 0.

 3) At the same point, in sign, correct me if this is not the sign
 bit (bit#8, i.e. the ninth of the field) of the offset for each of the
 three channels.

Some AFEs are able to invert their input channels.

 4) There seem to be some mistakes (or things I don't understand :-))
 in the addresses given to the sanei_genesys_fe_write_data function, in
 genesys.c and genesys_gl841.c. For instance, for the red gain, I can
 see the address 0x28, which doesn't seem to match the Wolfson WM8192
 chip documentation (please indicate which is the exact AFE used, but I
 think the register addresses are pretty much the same for all WM
 chips).

I looked at my documentation and found register 0x28 to be the red
channel gain, for WM8199 and WM8192. The relevant info is this:

address description
101000  PGA Gain (Red)

hidden on page 23 for WM8192 and page 24 for WM8199.
101000(binary)==0x28(hex).

 5) As I could have other questions in the near future, please allow me
 to write directly to you (dear maintainer(s)) in the future, cause it
 could become boring for the other readers of the list. Problem is I
 don't know who is in the current maintainer's team concerning the
 genesys backend (Pierre ? St?phane ? Gerhard ? Henning ? Maybe I will
 do some kind of temporary restricted ml...)

You are welcome to write directly to me.

Regards,
  Pierre


[sane-devel] [RFC] additional sanei_usb API to queue multiple URBs asynchronly

2006-03-04 Thread René Rebe
Hi,

On Friday 03 March 2006 08:10, Gerhard Jaeger wrote:
 On Thursday 02 March 2006 13:06, Ren? Rebe wrote:
  Hi all - again,
  
  On Wednesday 01 March 2006 22:53, Ren? Rebe wrote:
   Hi all,
   
   I currently review how to further improve the SANE/Avision backend to
   get to the scanners maximal thruput, e.g. what the Windows driver
   get's out of those devices.
   
   The 16kB buffer of the Linux usbfs devio looks like a showstopper and
   the kernel people indicate it is not likely to be removed / resolved 
   easily or
   soon.
   
   Another option would be to queue more URBs and handle the completion
   asynchonously. Would anyone veto when I further extend the API with
   async flavours?
  
  Further investigation reviels just improving libusb to queue multiple URBs
  might be enough.
  
  Comments welcome,
  
 Hi Ren?,
 
 FOA I'm curious about the transferrate you expect on your devices - guess
 these are USB2.0 high-speed ones.
 I currently could not estimate the impact on the backends I maintain, but
 I think improving libusb ain't not a bad idea. Esp. when keeping in mind,
 that newer devices provide higher resolutions and need the full cap
 of USB2.0...
 
 Keep us (me) informed about your progress - I'll test that even on my
 slower devices.

Attached is my libusb patch. The error path needs some thinking. It speeds
up the latest, fasted Avision devices by a factor of two, making my backend
even slightly faster (~20%) than the windows driver ,-)!

The transfer rate is now in the 10MB/s range if I calculated correctly. (20
color pages ++ per minutes @300dpi). The rate for duplex might be even higher
but I tweaked my backend just today to support large enough buffers for
the deinterlacing in that case and need to meassure this again when I'm
in the office with the AV220C2, tomorrow or so.

An _async interface to queue the protocol pro- and epilogue would speed
it up even further ,-) (by some percent)

Queue multiple URBs for buffer 16kB to reduce time slots without USB
i/o.

  - Rene Rebe r...@exactcode.de

--- libusb-0.1.11/linux.c   2006-03-02 15:33:58.0 +
+++ libusb-0.1.11-improved/linux.c  2006-03-03 08:26:55.0 +
@@ -162,11 +162,14 @@
 static int usb_urb_transfer(usb_dev_handle *dev, int ep, int urbtype,
char *bytes, int size, int timeout)
 {
-  struct usb_urb urb;
+  int nurbs;
+  struct usb_urb* urbs;
   unsigned int bytesdone = 0, requested;
   struct timeval tv, tv_ref, tv_now;
   struct usb_urb *context;
-  int ret, waiting;
+  int rc = 0, ret = 0, waiting, i;
+
+  fd_set writefds;
 
   /*
* HACK: The use of urb.usercontext is a hack to get threaded applications
@@ -190,36 +193,47 @@
 tv_ref.tv_sec++;
   }
 
-  do {
-fd_set writefds;
+  /* allocate and fill all URBs */
+  nurbs = (size + MAX_READ_WRITE - 1) / MAX_READ_WRITE;
+  //fprintf (stderr, nurbs: %d\n, nurbs);
+  urbs = malloc (sizeof(struct usb_urb) * nurbs);
+  for (i = 0; i  nurbs; ++i) {
 
-requested = size - bytesdone;
+requested = size - i * MAX_READ_WRITE;
 if (requested  MAX_READ_WRITE)
   requested = MAX_READ_WRITE;
 
-urb.type = urbtype;
-urb.endpoint = ep;
-urb.flags = 0;
-urb.buffer = bytes + bytesdone;
-urb.buffer_length = requested;
-urb.signr = 0;
-urb.actual_length = 0;
-urb.number_of_packets = 0; /* don't do isochronous yet */
-urb.usercontext = NULL;
+urbs[i].type = urbtype;
+urbs[i].endpoint = ep;
+urbs[i].flags = 0;
+urbs[i].buffer = bytes + i * MAX_READ_WRITE;
+urbs[i].buffer_length = requested;
+urbs[i].signr = 0;
+urbs[i].actual_length = 0;
+urbs[i].number_of_packets = 0; /* don't do isochronous yet */
+urbs[i].usercontext = NULL;
 
-ret = ioctl(dev-fd, IOCTL_USB_SUBMITURB, urb);
+//fprintf (stderr, submitting urb %d\n, i);
+ret = ioctl(dev-fd, IOCTL_USB_SUBMITURB, urbs[i]);
 if (ret  0) {
   USB_ERROR_STR(-errno, error submitting URB: %s, strerror(errno));
-  return ret;
+   rc = ret;
+  goto end;
 }
+  }
 
-FD_ZERO(writefds);
-FD_SET(dev-fd, writefds);
+  FD_ZERO(writefds);
+  FD_SET(dev-fd, writefds);
 
-restart:
+  /* wait 'till all URBs completed */
+  for (i = 0; i  nurbs; ) {
 waiting = 1;
 context = NULL;
-while (!urb.usercontext  ((ret = ioctl(dev-fd, IOCTL_USB_REAPURBNDELAY, 
context)) == -1)  waiting) {
+//fprintf (stderr, waiting for URB %d\n, i);
+
+while (!urbs[i].usercontext 
+   ((ret = ioctl(dev-fd, IOCTL_USB_REAPURBNDELAY, context)) == -1) 
+   waiting) {
   tv.tv_sec = 0;
   tv.tv_usec = 1000; // 1 msec
   select(dev-fd + 1, NULL, writefds, NULL, tv); //sub second wait
@@ -229,52 +243,66 @@
 gettimeofday(tv_now, NULL);
 
 if ((tv_now.tv_sec  tv_ref.tv_sec) ||
-((tv_now.tv_sec == tv_ref.tv_sec)  (tv_now.tv_usec = 
tv_ref.tv_usec)))
+   ((tv_now.tv_sec == tv_ref.tv_sec)  (tv_now.tv_usec = 

[sane-devel] howto Duplex

2006-03-04 Thread abel deuring
abel deuring wrote:

 Perhaps the PIL source code file Sane/_sane.c is to blame. The
 function SaneDev_snap expects that sane_start has been called, but
 makes all other calls to the Sane library functions needed to
 retrieve an image (sane_getparameters and sane_read) -- and finally
 calls sane_cancel. This last call should optionally be disabled: I'd
 guess that it resets the backend so that backside data of a
 duplex scan is discarded.

Just for the record: my guess about the cause of the bug was right;
a fix will be included in PIL 1.6. Thanks to Horst Herb for testing
the patch.

Abel


[sane-devel] Problems with Epson 3490 Photo

2006-03-04 Thread Gerrit Einhoff
Hello,

I cannot get my Epson 3490 to run (see log below). Different from the other 
two posters with 3490-problems in the last week, it doesn't even get to the 
firmware-download.

Any help is much appreciated! Please cc me on answers.

Thanks!
 - Gerrit

houdini:~# tail -n 15 /var/log/syslog
Mar  4 22:24:37 localhost kernel: hub 2-0:1.0: state 5 ports 2 chg  evt 
0004
Mar  4 22:24:37 localhost kernel: ohci_hcd :02:06.1: GetStatus 
roothub.portstatus [1] = 0x00010101 CSC PPS CCS
Mar  4 22:24:37 localhost kernel: hub 2-0:1.0: port 2, status 0101, change 
0001, 12 Mb/s
Mar  4 22:24:37 localhost kernel: hub 2-0:1.0: debounce: port 2: total 100ms 
stable 100ms status 0x101
Mar  4 22:24:37 localhost kernel: ohci_hcd :02:06.1: GetStatus 
roothub.portstatus [1] = 0x00100103 PRSC PPS PES CCS
Mar  4 22:24:37 localhost kernel: usb 2-2: new full speed USB device using 
ohci_hcd and address 12
Mar  4 22:24:37 localhost kernel: ohci_hcd :02:06.1: GetStatus 
roothub.portstatus [1] = 0x00100103 PRSC PPS PES CCS
Mar  4 22:24:37 localhost kernel: usb 2-2: default language 0x0409
Mar  4 22:24:37 localhost kernel: usb 2-2: new device strings: Mfr=1, 
Product=2, SerialNumber=0
Mar  4 22:24:37 localhost kernel: usb 2-2: Product: EPSON Scanner
Mar  4 22:24:37 localhost kernel: usb 2-2: Manufacturer: EPSON
Mar  4 22:24:37 localhost kernel: usb 2-2: hotplug
Mar  4 22:24:37 localhost kernel: usb 2-2: adding 2-2:1.0 (config #1, 
interface 0)
Mar  4 22:24:37 localhost kernel: usb 2-2:1.0: hotplug
Mar  4 22:24:37 localhost kernel: hub 2-0:1.0: state 5 ports 2 chg  evt 
0004

houdini:~# uname -a
Linux houdini 2.6.12.3 #5 SMP Sat Aug 27 11:58:55 CEST 2005 i686 GNU/Linux

houdini:~# lsusb
Bus 002 Device 012: ID 04b8:0122 Seiko Epson Corp.
Bus 002 Device 001: ID :
Bus 001 Device 003: ID 0c45:1050 Microdia
Bus 001 Device 002: ID 045e:001e Microsoft Corp. IntelliMouse Explorer
Bus 001 Device 001: ID :

houdini:~# dpkg -l|grep sane-backends
ii  sane-backends cvs060304-1Package created 
with checkinstall 1.5.3

houdini:~# export SANE_DEBUG_SNAPSCAN=255

houdini:~# scanimage -d snapscan:libusb:002:012
[sanei_debug] Setting debug level of snapscan to 255.
[snapscan] sane_snapscan_init
[snapscan] sane_snapscan_init: Snapscan backend version 1.4.53
[snapscan] add_usb_device(/dev/.static/dev/usb/scanner0 bus=usb)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(/dev/.static/dev/usb/scanner0)
[snapscan] add_usb_device: error opening device /dev/.static/dev/usb/scanner0: 
Invalid argument
[snapscan] add_usb_device(libusb:002:012)
[snapscan] add_usb_device: Detected (kind of) an USB device
[snapscan] snapscani_usb_open(libusb:002:012)
[snapscan] add_usb_device: Checking if 0x04b8 is a supported USB vendor ID
[snapscan] snapscani_check_device()
[snapscan] mini_inquiry
[snapscan] snapscan_cmd
[snapscan] snapscani_usb_cmd(0,0xbff78ac2,6,0xbff78a9e,0xbff78ac8 (36))
[snapscan] atomic_usb_cmd(0,0xbff78ac2,6,0xbff78a9e,0xbff78ac8 (36))
[snapscan] usb_cmd(0,0xbff78ac2,6,0xbff78a9e,0xbff78ac8 (36))
[snapscan] usb_cmd: cmdlen=6, datalen=0
[snapscan] usb_write: writing:  0x12 0x00 0x00 0x00 0x24 0x00
[snapscan] Written 6 bytes
[snapscan] usb_read: reading:  0xf9 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] usb_read: reading:  0x06 0x00 0x02 0x02 0x49 0x00 0x00 0x00 0x45 
0x50 ...
[snapscan] Read 36 bytes
[snapscan] usb_read: reading:  0xfb 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] snapscani_check_device: Is vendor EPSON model EPSON Scanner a 
supported scanner?
[snapscan] snapscani_get_model_id(EPSON Scanner, 0, 2)
[snapscan] snapscani_get_model_id: looking up scanner for ID 0x04b8,0x0122.
[snapscan] snapscani_get_model_id: scanner identified
[snapscan] snapscani_check_device: Autodetected driver: Perfection 3490
[snapscan] snapscani_usb_close(0)
[snapscan] 1st read 3 write 1
[snapscan] snapscani_usb_cmd(0,0xbff78afe,6,0x0,0x0 (0))
[snapscan] atomic_usb_cmd(0,0xbff78afe,6,0x0,0x0 (0))
[snapscan] usb_cmd(0,0xbff78afe,6,0x0,0x0 (0))
[snapscan] usb_cmd: cmdlen=6, datalen=0
[snapscan] usb_write: writing:  0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Written 6 bytes
[snapscan] usb_read: reading:  0xfb 0x00 0x00 0x00 0x00 0x00 0x00 0x00
[snapscan] Read 8 bytes
[snapscan] 2nd read 4 write 2
[snapscan] snapscani_init_device_structure()
[snapscan] sane_snapscan_open (libusb:002:012, 0xbff79ce8)
[snapscan] find_device
[snapscan] sane_snapscan_open: Allocating 129024 bytes as scanner buffer.
[snapscan] sane_snapscan_open: allocated scanner structure at 0x8053b40
[snapscan] open_scanner
[snapscan] snapscani_usb_open(libusb:002:012)
[snapscan] sane_snapscan_open: waiting for scanner to warm up.
[snapscan] wait_scanner_ready
[snapscan] test_unit_ready
[snapscan] snapscan_cmd
[snapscan] snapscani_usb_cmd(0,0xbff79af6,6,0x0,0x0 (0))
[snapscan] atomic_usb_cmd(0,0xbff79af6,6,0x0,0x0 (0))
[snapscan]