[sane-devel] Xerox Travel Scanner 100 under Red Hat

2010-07-21 Thread Pierre Willenbrock
Jane85 schrieb:
 
 
 
 Pierre Willenbrock-2 wrote:


 Okay, then please try the attached patch. If that works, try to reduce
 the time in the usleep until it breaks again.

 Regards,
   Pierre


 
 I copied the patch to the folder sane-backends-git20100716. Then I used:
 $patch -p1  patch_name
 $make clean
 $make install

Oops, patch was wrong, used incorrect register. Please try the attached
patch(reverting the original one before). (Or manually replace the 6D/6d
by 6C/6c in the affected code.)

 The result of scanimage is identical. The log is attached.
 
 I noticed, the device name is changed after every unsuccessful attempt of
 scaning (genesys:libusb:001:010, then genesys:libusb:001:011). Is it
 important?
 

For some reason, the scanner disconnects and reconnects on the USB,
every time getting a new address. This was already clear from the logs.
There is pretty much no other way to get Connection timed out from
libusb with these scanners.

Regards,
  Pierre
-- next part --
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Try-to-reduce-current-inrush-of-DP665-and-rebrands.patch
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100721/0f52fb97/attachment.txt


[sane-devel] Xerox Travel Scanner 100 under Red Hat

2010-07-21 Thread Pierre Willenbrock
Jane85 schrieb:
 
 
 Pierre Willenbrock-2 wrote:


 Oops, patch was wrong, used incorrect register. Please try the attached
 patch(reverting the original one before). (Or manually replace the 6D/6d
 by 6C/6c in the affected code.)


 
 I tried the new patch. The new log seems very similar to previous. One is
 attached.
 
 Regards,
   Jane.
 
 http://old.nabble.com/file/p29225422/xeroxTS100.sanei2.log
 xeroxTS100.sanei2.log 

Okay, i am officially out of ideas. To me, this looks very much like
defective hardware.

Does this scanner work with any other systems, for example with the
original Windows driver?

Regards,
  Pierre



[sane-devel] Xerox Travel Scanner 100 under Red Hat

2010-07-20 Thread Pierre Willenbrock
Jane85 schrieb:
 
 I used 'export SANE_DEBUG_SANEI_USB=255' then retried 'scanimage ?d genesys 
 picture1.pnm'.
 New log is attached. The file with the result of 'dmesg' is attached also.
 
 Regards,
   Jane.
 
 http://old.nabble.com/file/p29211849/xeroxTS100.sanei.log
 xeroxTS100.sanei.log 
 http://old.nabble.com/file/p29211849/dmesg.log dmesg.log 
 

To me, this looks very much like a hardware problem. The last thing
succeeding is enabling power to the rest of the scanner electronics. Can
you try a different usb port and a different cable?

If that fails, are you able to recompile sane-backends with a small patch?

Regards,
  Pierre



[sane-devel] Xerox Travel Scanner 100 under Red Hat

2010-07-20 Thread Pierre Willenbrock
Jane85 schrieb:
 
 There are two usb ports on my computer. I tried both ports, also I tried
 another usb cable. If it is necessary I can attach the logs. But the new
 logs are identical with the old logs.
 
 I able to recompile sane-backends with a patch.
 
 Regards,
  Jane.

Okay, then please try the attached patch. If that works, try to reduce
the time in the usleep until it breaks again.

Regards,
  Pierre
-- next part --
An embedded and charset-unspecified text was scrubbed...
Name: 0001-Try-to-reduce-current-inrush-of-DP665-and-rebrands.patch
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100720/921d26f8/attachment.txt


[PATCH] Try to reduce current inrush of DP665 (and rebrands)

2010-07-20 Thread Pierre Willenbrock
This first puts a 27 Ohm resistor between USB power and non-gl841
electronics before actually directly connecting.
---
 backend/genesys_gl841.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/backend/genesys_gl841.c b/backend/genesys_gl841.c
index 0a614fa..4a4fabf 100644
--- a/backend/genesys_gl841.c
+++ b/backend/genesys_gl841.c
@@ -3533,6 +3533,15 @@ gl841_save_power(Genesys_Device * dev, SANE_Bool enable) 
{
if (dev-model-gpo_type == GPO_DP665 
 || dev-model-gpo_type == GPO_DP685)
  {
+   /* enable GPIO9 */
+   sanei_genesys_read_register(dev, 0x6D, val);
+   sanei_genesys_write_register(dev, 0x6D, val | 0x01);
+   dev-reg[reg_0x6d].value |= 0x01;
+   dev-calib_reg[reg_0x6d].value |= 0x01;
+
+   usleep(100);
+
+   /* enable GPO17 */
sanei_genesys_read_register(dev, 0x6B, val);
sanei_genesys_write_register(dev, 0x6B, val | REG6B_GPO17);
dev-reg[reg_0x6b].value |= REG6B_GPO17;
-- 
1.7.1


--000907020100030800010206--



[sane-devel] LiDE40 support description file

2010-05-03 Thread Pierre Willenbrock
CCing sane-devel, as i don't really know the policy for the last item.

Gernot Hassenpflug schrieb:
 Hello Pierre,
 
 I attach the diff for the genesys doc/description/genesys.desc where I
 added the LiDE40 as good (change from untested).

When sending patches, please use git format-patch, git diff or diff -u,
if applicable, the earlier ones prefered over the later ones. When using
the git variants, make sure git knows the right e-mail address. I will
apply this one manually.

 I am not sure what the condition is that it becomes complete, as far
 as I could tell it performed all the scans well: B/W, gray, color, as
 far as Xsane can do.

complete means all features of the scanner are supported. I am currently
unsure to what extent this is true for the LiDE 40 etc. scanners.

 I am also not sure if I should send the diff to you or to Stef, or someone 
 else.

I think the best is to send them to the list so all of the potentially
interested parties can have a look at them. If the patches are good,
they will probably get picked up by someone.

Regards,
  Pierre



[sane-devel] Canon DR-2020U incompatible with canon_dr

2010-04-19 Thread Pierre Willenbrock
m. allan noah schrieb:
 On Mon, Apr 19, 2010 at 10:33 AM, Fabian Eichst?dt f.eichstaedt at fabz.de 
 wrote:
 Hi all!
 We recently aquired a Canon DR-2020U scanner and I tried to test it
 with a recent sane git-snapshot. It compiled without problems and
 I tried to use it with the canon_dr backend. This failed.
 Allan Noah told me that this model uses a very different control method
 than the other DR scanners and thus the canon_dr backend cannot work.

 I made a scan with Windows XP and logged the USB Commands with USBSnoop.
 This logfile is available for download here (ca. 4.3 MB):
 http://dl.dropbox.com/u/3879521/CANON-DR2020U_UsbSnoop.log.bz2

 Maybe this is helpful for somebody interested in creating a suitable backend
 for this scanner. I would be glad to be able to use this scanner with Linux.
 
 Looks like mostly alot of 1 or 2 byte control transfers, with bulk for
 the image data. Perhaps one of the genesys authors could look at it?

This decodes fine assuming genesys gl842 or gl843 protocol and at least
the frontend registers and status registers are at the right place. This
machine has a register space going up to (at least) register 0xff, so it
is not one of the currently supported chip versions. Also, my script
finds at least one unknown control transfer.

Regards,
  Pierre



[sane-devel] Backend for plustek Opticbook 3600

2010-03-03 Thread Pierre Willenbrock
stef schrieb:
 Le mardi 2 mars 2010 16:40:21 Chris Berry, vous avez ?crit :
 Hey guys, I resolved the issue I was having with the dark_shading
 calibration. The lamp was turning off fine but the | REG03_LAMPPWR in
 gl842_begin_scan was turning the light back on for the scan :/ . Having
 resolved this there is still a black line down the center of the page.
 The black_shading.pnm file is now completely black and the
 white_shading.pnm file is mostly white with some dark edges.

 Any thoughts on how I sort this out now? Is it related to the number of
 sensor pixels or the shading area or something?

 Chris

   Hello,
 
   the black patterns are often used to detect the exact geometry of the 
 scanner. What is reliable is these black/white areas, while the casing may 
 vary. For instance the HP2400/HP2300 and HP3670 have a black corner which is 
 aligned on the exact vertical margin of the visible scan area.So the 
 dark 
 edges may be harmless if they are outside the effective scan area used for 
 final scan.
   For the big black vertical line (which is a third of the width of the 
 picture), it seems that shading coefficients sent aren't send in the correct 
 format. It's hard to tell without the code, but the results looks like 
 'planar' format (for CIS) was used when 'chunky' format (for CCD) was needed. 
 Surely an issue in the genesys_send_shading_coefficient() where 
 compute_coefficient() is for chunky, compute_planar_coefficient() is for 
 planar and the CCD_CANONLIDE35 case looks for the planar case to me. Pierre 
 may confirm this last point.

yes, CCD_CANONLIDE35 should have been named CIS_CANONLIDE35, and that
section is for planar shading. That whole case will go away sometime in
the future and be replaced by a call to compute_planar_coefficient.

Regards,
  Pierre



[sane-devel] SniffUSB: URB direction and TransferFlags IN/OUT confusion

2010-02-25 Thread Pierre Willenbrock
Gernot Hassenpflug schrieb:
 On Thu, Feb 25, 2010 at 1:05 AM, m. allan noah kitno455 at gmail.com wrote:
 Attached is a copy of a script I wrote that clears up these verbose
 logs. I don't know if it is the most recent version, I cannot reach my
 development machine, and i just found this copy with google :)
 
 Thanks for that, I had seen it but since I haven't grokked the basics
 yet, I was using the messy output.
 
 cat UsbSnoop.log | perl spike4.pl  UsbSnoop.out
 
 Very nice  clean indeed.
 
 I am still confused on the questions below, while reading more to see
 if the answers appear:
 
 1) there are 4 endpoints:
*?0x which has both IN and OUT version;
*   0x0007 which is a bulk type, seems to be for OUT only;
*   0x0088 which is a bulk type, seems to be for both IN and OUT;
*   0x0089 which is an interrupt type, seems to be for both IN and 
 OUT.
   whereas I thought only endpoint 0x can have both IN and OUT
 use, while all other endpoints are either IN or OUT, but not both.
 
 Are endpoints apart from the default 0x able to have both IN
 and OUT now? Or did I misunderstand the log file (and spike4 output
 also)?

The bulk endpoints are either in or out. The type is encoded (iirc) in
bit7 of the endpoint number, 1 means in, 0 means out. usbsnoop always
dumps the buffer when a request goes down to the device, even when it is
about to be overwritten.

 
 2)  snoop headings like   URB 16 going down   andURB
 16 coming back   are both followed by:
  TransferFlags= 0002 (USBD_TRANSFER_DIRECTION_OUT,
 USBD_SHORT_TRANSFER_OK)
 whereas I thought that down means the endpoint must be OUT
 direction, and back must be IN direction.
 
 So I expected a URB coming back to contain a TransferFlags with
 DIRECTION_IN, but often it has instead DIRECTION_OUT. Is that
 relevant?

This is just the USB Request Block(URB) that goes down to the lower
levels of the usb stack and coming back from there. It is just the same
URB going through usbsnoop in different directions, as evidenced by the
same URB number. Remember that usbsnoop sits in the stack and acts like
a filter, and that urb processing happens asynchronously.

Regards,
  Pierre



[sane-devel] SniffUSB: URB direction and TransferFlags IN/OUT confusion

2010-02-25 Thread Pierre Willenbrock
Gernot Hassenpflug schrieb:
 On Thu, Feb 25, 2010 at 7:05 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 Gernot Hassenpflug schrieb:
 On Thu, Feb 25, 2010 at 1:05 AM, m. allan noah kitno455 at gmail.com 
 wrote:
 /../
 Are endpoints apart from the default 0x able to have both IN
 and OUT now? Or did I misunderstand the log file (and spike4 output
 also)?

 The bulk endpoints are either in or out. The type is encoded (iirc) in
 bit7 of the endpoint number, 1 means in, 0 means out. usbsnoop always
 dumps the buffer when a request goes down to the device, even when it is
 about to be overwritten.
 
 Hello Pierre, thank you for that. And especially for the tip on where
 usbsnoop sits: without thinking I'd assumed I was seeing communication
 between Host and Function (device), but now that I have gotten through
 about 1/3 of the USB 2.0 spec document (after reading most of the USB
 tutorials I could find) I have to realize I don't know what I am
 looking at exactly!
 
 2)  snoop headings like   URB 16 going down   andURB
 16 coming back   are both followed by: /../

 This is just the USB Request Block(URB) that goes down to the lower
 levels of the usb stack and coming back from there. It is just the same
 URB going through usbsnoop in different directions, as evidenced by the
 same URB number. Remember that usbsnoop sits in the stack and acts like
 a filter, and that urb processing happens asynchronously.
 
 OK, I'll post again after I digest that, and more specs, to figure out
 when the host is talking to the function (device). I see from the
 specs that there is also a hub between the two, but as far as I can
 tell it should be transparent to sniffusb.
 
 Recap: the host has buffers, the function (device) has endpoints. The
 endpoints (except default) have to be configured before being used (I
 see that info fine in the sniff logs), and they are unidirectional
 (except default which is bi-directional). Some URBs show
 TransferBuffer length but no data, but I guess I will examine the spec
 docs and log further to find out what I am missing in understanding.
 
 Thanks for the useful comments and helpful tips so far everyone,

The stuff around the URBs is not exactly part of the specs, it is merely
a good way to handle usb communication.

What happens is this: The device driver(mass-storage driver, hid-driver
etc) sends requests that go to the host controller driver that tells the
host controller to make it happen. For that, the information in the URB
is used to create a request structure and put it into one of the queues
of the host controller. Later, the host controller tells its driver that
this request has been worked on. The host controller driver then
modifies the URB accordingly(status codes, data received) and sends it
back to the driver.

On Windows, in between the host controller and the driver, there can be
filters, and that is the place where usbsnoop hooks into.

The above information is mostly from memory of my little excursions into
why SnoopyPro stops working when packets are  1024(or so) bytes.

I hope this helps you understand how the operating system side of things
work.

Regards,
  Pierre



[sane-devel] Backend for plustek Opticbook 3600

2010-02-24 Thread Pierre Willenbrock
stef schrieb:
 Le mercredi 24 f?vrier 2010 03:00:16 Chris Berry, vous avez ?crit :
 Hey Stef,

 I think I have sorted out the white shading data but the black is still
 a mystery. I have uploaded some files to the project site (here
 http://sites.google.com/site/bez625/updates-1/update240210 ) these are
 at shading lines set to 400 but for the scan to work even a little bit I
 needed to change the lines to 20 (this removes the light blue lines at
 the bottom of the white_shading.pnm).

 As you will be able to see the black_shading400.pnm is all white, I have
 no idea how to alter this. You can see from the white_shading400.pnm the
 full calibration area so I am at a loss really. Have you encountered
 this problem before?

 Thanks

 Chris

   Hello,
 
   judging from the 2 pictures, there is no black area to scan. You should 
 then  
 rather use the GENESYS_FLAG_DARK_WHITE_CALIBRATION (like the lide 35) flag 
 instead of GENESYS_FLAG_DARK_CALIBRATION. The shading data will be taken from 
 an all white area and black data will be inferred from the small black areas 
 still in the picture.
   

GENESYS_FLAG_DARK_WHITE_CALIBRATION is just a way to scan the black and
white strip in one go. Chris, you should try to figure out if the
backend goes through genesys_dark_shading_calibration with
GENESYS_FLAG_DARK_CALIBRATION, and if so, why the lamp does not switch off.

Regards,
  Pierre



[sane-devel] Backend for plustek Opticbook 3600

2010-02-24 Thread Pierre Willenbrock
Chris Berry schrieb:
 On 02/24/2010 10:33 AM, Pierre Willenbrock wrote:
 stef schrieb:
   
 Le mercredi 24 f?vrier 2010 03:00:16 Chris Berry, vous avez ?crit :
 
 Hey Stef,

 I think I have sorted out the white shading data but the black is still
 a mystery. I have uploaded some files to the project site (here
 http://sites.google.com/site/bez625/updates-1/update240210 ) these are
 at shading lines set to 400 but for the scan to work even a little
 bit I
 needed to change the lines to 20 (this removes the light blue lines at
 the bottom of the white_shading.pnm).

 As you will be able to see the black_shading400.pnm is all white, I
 have
 no idea how to alter this. You can see from the white_shading400.pnm
 the
 full calibration area so I am at a loss really. Have you encountered
 this problem before?

 Thanks

 Chris


 Hello,

 judging from the 2 pictures, there is no black area to scan. You
 should then
 rather use the GENESYS_FLAG_DARK_WHITE_CALIBRATION (like the lide 35)
 flag
 instead of GENESYS_FLAG_DARK_CALIBRATION. The shading data will be
 taken from
 an all white area and black data will be inferred from the small
 black areas
 still in the picture.
 
  
 GENESYS_FLAG_DARK_WHITE_CALIBRATION is just a way to scan the black and
 white strip in one go. Chris, you should try to figure out if the
 backend goes through genesys_dark_shading_calibration with
 GENESYS_FLAG_DARK_CALIBRATION, and if so, why the lamp does not switch
 off.

 Regards,
Pierre


 Hi Pierre / Stef,
 
 I was wondering the same thing but the lamp does indeed go off. I'm not
 sure why the scan is so light, I had no idea which area it was scanning
 from I have been playing with the dark_white calibration and i seem
 to be getting somewhere, here (
 http://sites.google.com/site/bez625/updates-1/update240210lateron ) are
 some scans.
 
 Should I abandon the work with DARK_WHITE and see if I can fix the issue
 with DARK_CALIBRATION?

Hi Chris,

DARK_WHITE mode uses static thresholds on the scanned data to determine
whether a given pixel is white or black, so it will find nearly nothing
in the black category. DARK_CALIBRATION should be working on any scanner
that can successfully disable its lamp, still leaving the analog data
processing powered. Obviously, the scanning head should be about the
calibration area, so there is no external light even with the lid open.

In short: try to figure out what goes wrong in DARK_CALIBRATION.
DARK_WHITE_CALIBRATION will not help you. Perhaps the lamp needs more
time to turn off?

Regards,
  Pierre



[sane-devel] Canon Canoscan LIDE 50 w/ Ubuntu 9.10

2010-02-22 Thread Pierre Willenbrock
chrome://messenger/locale/messengercompose/composeMsgs.properties:
 Hello Stef,
 
 Thank you for your prompt reply.
 
 Please find in the attachment the requested debug.log file.
 
 Thank you in advance for your help, have a good day.

Hi Georg,

thanks for the log, this is a known and fixed bug. Either use sane
1.0.19 or git, any commit after 2009-06-03. You can also try to only
patch commit a0ea955e91837156d2112c0ffd12c8afebe86efa into your local
copy. The latter two solutions require to recompile sane-backends.

Regards,
  Pierre



[sane-devel] CanoScan LiDE 100 to work with ubuntu

2009-06-26 Thread Pierre Willenbrock
Hi Sivananda,

sivananda schrieb:
 Dear Mr. Pierre,
 
 I have problem with CanoScan LiDE 100 to work with ubuntu. The reason
 behind my worry is I have purchased these scanners( more than 5000
 pieces) for school at very remote places but found not working. I got
 your references from the community and would appeal to help me.

I am very sorry, but i don't have the time to add support for GL843
based scanners. Although this chip is similar to the gl841/2, it is
different enough to require a new sub backend in the genesys backend.

I can help the implementor with usb-decoding scripts for gl843 and my
knowledge about the gl841/2 chips.

Again, i am sorry i cannot help.

Regards,
  Pierre



[sane-devel] Canon LiDE 50 CanoScan (04a9:2213) is broken with 1.0.20

2009-06-22 Thread Pierre Willenbrock
Ozan ?a?layan schrieb:
 Hi,
 
 I've just noticed that my Canon LiDE 50 is broken with sane-backends 1.0.20 
 (1.0.19 was OK). I've bisected it to:
 
Thanks for bisecting, but this bug should be fixed in git master. See
bug #311691.

Regards,
  Pierre



[sane-devel] [GIT] post-receive failure on push

2009-05-19 Thread Pierre Willenbrock
Julien BLACHE schrieb:
 Ilia Sotnikov hostcc at gmail.com wrote:
 
 Hi,
 
 ** Updating scanners lists
 From git://git.debian.org/sane/sane-backends
764aa7c..e232f54  master - origin/master
 Updating 354b9a5..e232f54
 backend/.gitignore: needs update
 frontend/.gitignore: needs update
 include/sane/.gitignore: needs update
 tools/.gitignore: needs update
 error: Entry 'backend/.gitignore' not uptodate. Cannot merge.
 error: hooks/post-receive exited with error code 128
 
 Hmm fixed by checking out the problematic files and pulling
 manually. Don't know what happened, we'll see if it reoccurs.
 
 JB.
 

Hi,

the post-receive hook failed again:

 ** Updating scanners lists
 From git://git.debian.org/sane/sane-backends  
6462162..34717f1  master - origin/master  
 Updating 6462162..34717f1 
 Fast forward  
  ChangeLog |   20 ++  
  backend/abaton.c  |   16 +-  
  backend/agfafocus.c   |   16 +-  
  backend/apple.c   |   16 +-  
  backend/artec.c   |   12 +-  
  backend/artec_eplus48u.c  |4 +-  
  backend/as6e.h|2 +-  
  backend/avision.c |   16 +-  
  backend/bh.c  |   12 +-  
  backend/canon.c   |   10 +-  
  backend/canon_dr.c|   12 +-  
  backend/cardscan.c|   10 +-  
  backend/coolscan.c|   18 +-  
  backend/coolscan2.c   |2 +-  
  backend/coolscan3.c   |   18 +-  
  backend/dc210.c   |   12 +-  
  backend/dc240.c   |   12 +-  
  backend/dc25.c|   10 +-  
  backend/dll.c |   10 +-  
  backend/dmc.c |   14 +-  
  backend/epjitsu.c |   10 +-  
  backend/epson.c   |   16 +-  
  backend/epson2-io.c   |8 +-  
  backend/epson2.c  |   16 +-  
  backend/epson2.h  |6 +-  
  backend/epson2_net.c  |   12 +-  
  backend/epson2_net.h  |2 +-  
  backend/epson2_scsi.c |4 +-  
  backend/epson2_scsi.h |2 +-  
  backend/epson_scsi.c  |4 +-  
  backend/epson_scsi.h  |2 +-  
  backend/epson_usb.c   |2 +-  
  backend/fujitsu.c |   12 +-  
  backend/genesys.c |2 +-  
  backend/genesys.conf.in   |3 +   
  backend/genesys_devices.c |   82 ++  
  backend/genesys_gl646.c   |  586 +-
  backend/genesys_gl646.h   |  634 
 +
  backend/genesys_gl841.c   |2 +-  
  
  backend/genesys_low.h |2 +   
  
  backend/gphoto2.c |   12 +-  
  
  backend/gt68xx.c  |2 +-  
  
  backend/hp-accessor.c |2 +-  
  
  backend/hp-device.c   |2 +-  
  
  backend/hp-handle.c   |6 +-  
  
  backend/hp-hpmem.c|2 +-  
  
  backend/hp-option.c   |6 +-  
  
  backend/hp-scl.c  |   10 +-  
  
  backend/hp.c  |   14 +-  
  
  backend/hp.h  |4 +-  
  
  backend/hp3500.c  |   14 +-  
  
  backend/hp5590.c  |   10 +-  
  
  backend/hp5590_cmds.c |4 +-  
  
  backend/hp5590_low.c  |6 +-  
  
  backend/hp5590_low.h  |2 +-  
  
  backend/lexmark_low.c |2 +-  
  
  backend/microtek.c|   16 +-  
  
  backend/microtek2.c   |2 +-  
  
  backend/mustek.c  |2 +-   

[sane-devel] GL841 to be added to the genesys backend

2009-04-03 Thread Pierre Willenbrock
Charles Dahl schrieb:
 Hi,
 
 Just a quick line to see if anyone knows when this will be
 accomplished? It seems this has been going on for quite a while.
 
 CanoScan 8600FUSB 0x04a9/0x2229   Unsupported GL841 based, to 
 be
 added to genesys backend
 

Hi Charles,

to my knowledge, no work to support the CanoScan 8600F has been done,
yet. There are a few GL841-based scanners supported by the genesys
backend, but i'd guess none of them is compatible with the 8600F.

Regards,
  Pierre



[sane-devel] Genesys sheetfed scanner update

2009-03-17 Thread Pierre Willenbrock
Hi Jack,

Jack McGill schrieb:
 To list and Pierre,
 
 I recently received a Visioneer XP100, rev 3,  usb vid x04a7 pid
 0x049b, which has a GL842 chip inside. The model number on the 
 bottom of the scanner is 85-0110-200. This scanner works very well 
 using the Visioneer Roadwarrior settings. I think they are identical 
 twins ;-). Pierre, can you add this scanner to the cvs?

Thanks for testing.

 Also, I have a Pentax DS Mobile 600 that works pretty well using 
 the Visioneer Roadwarrior settings. I am going to tweak some of the 
 settings, before I ask to have this added to cvs.
 
 I will be getting a DocketPort 485 in a couple of days. This is an 
 A4, duplex scanner. I will try it out using the XP300 settings and 
 report back.
 
 Also, if anyone else wants to try out their GL84x sheetfed scanner, 
 8 bit depth scanning is not working, but 16 bit scanning is working. 
 Pierre recommends the following scanning command:
 
 scanimage -x440 -y50 --resolution 75 --mode color --depth 16
 --disable-interpolation=yes  img.pnm

The 8 bit scanning problem should be fixed in CVS(Bad generic gamma
table), so --depth 16 can be dropped. (And --disable-interpolation=yes
is there by mistake.)

Regards,
  Pierre



[sane-devel] genesys backend update

2009-03-02 Thread Pierre Willenbrock
Hi,

i added support for Ambir(Syscan) DocketPort 665 and Visioneer
Roadwarrior, thanks to the hardware donation of Jack McGill. Those two
use the same mainboard, only differently sized sensors. There may be
other models using this mainboard, and adding support should be simple.
Attached is a photo of the mainboard.

GL841/2 based sheetfed scanners are still lacking calibration support,
as those cannot calibrate on their own, and the support code for user
assisted calibration is not written yet. (At least i cannot think of a
way to do white-level calibration. Black-level is easy.)

Regards,
  Pierre
-- next part --
A non-text attachment was scrubbed...
Name: syscan.jpg
Type: image/jpeg
Size: 11296 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20090302/a4ce8802/attachment.jpg
 


[sane-devel] upcoming changes for the genesys backend

2009-02-23 Thread Pierre Willenbrock
Hello,

stef schrieb:
   I'm answering you through the mailing list since my private mail has 
 been 
 bounced back by some blacklisting system.

Sorry about that, looks like that blacklist is collecting more
legitimate smtp-servers than it used to. I removed it from my
mailserver-config.

   First I am OK with all the changes you are proposing. Just go for it. 
   On my side I'm about to commit a big rewrite of the gl646 part 
 internals in 
 order to make adding new devices easier, and have a cleaner calibration 
 process that will be used by the XP200. 
   I have modified device descriptions tables in genesys_devices.c to have 
 an ID 
 which is then used when initializing structs. It also brings untested support 
 for the HP3670 in all color modes.
   I expect to commit all this Tuesday.

Then i am going to push the three in the original mail today, and merge
the rest of my changes later this week.

Regards,
  Pierre



[sane-devel] usbsniff

2009-02-09 Thread Pierre Willenbrock
Hello Roland,

Roland Graf schrieb:
 Hello Pierre,
 
 I tried the testprog under root. I think in root I must have the permission 
 for the device. I controlled the the line 86 for the device and vendor ID. 
 The 
 vendor ID and the device ID are correct.
 
 Every time the same error: Device not found
 
 I have an other question. For thus I programmed in the past only under ATARI 
 ST 520 and Windows on programming environments and under Linux only some 
 shell-scripts or ebuilds is there under Linux the possibility to do a line by 
 line debugging like in Turbo Pascal or Visual Basic for applications? Can you 
 give me some hint?
 

For debugging under linux, the tool of choice is gdb. There are various
gui frontends, if you want something graphical.

 I had in past errors that my E-Mail didn't reach you directly. Please let me 
 know whether you read my mails from pierre at pirsoft.dnsalias.org or sane-
 devel at lists.alioth.debian.org?

Your e-mail is reaching me without problems(as a matter of fact, your
e-mail reached me twice, as should this answer, which is no problem). I
just tend to not answer until having something substantial to say, which
in turn can take some time. Or are you getting e-mail bounces? That
would be an entirely different problem.

 Last but not least I have a final question. Are you reachable maybe under IRC 
 or VoIP? In special cases we may contact us directly, if you agree.

No VoIP, and i usually don't use IRC, but i can dust my irc client off,
if needed.

Regards,
  Pierre

 
 
 Am Sonntag 08 Februar 2009 16:49:12 schrieb Pierre Willenbrock:
 Roland Graf schrieb:
 Hallo Pierre,

 the testprogram gives me only an:

 roland roland # /home/roland/Doku/G4010/testprog
 Fatal: Device not found!
 roland roland #

 With #lsusb I can see the scanner. I
 Best regards

 Roland
 Hello Roland,

 either my guess for your device-id was wrong(0x03f0:0x4505, see
 usb_con.c:86), or you are lacking permissions to access the device.

 Regards,
   Pierre





[sane-devel] usbsniff

2009-02-08 Thread Pierre Willenbrock
Roland Graf schrieb:
 Hallo Pierre,
 
 the testprogram gives me only an:
 
 roland roland # /home/roland/Doku/G4010/testprog
 Fatal: Device not found!
 roland roland #
 
 With #lsusb I can see the scanner. I
 Best regards
 
 Roland
 

Hello Roland,

either my guess for your device-id was wrong(0x03f0:0x4505, see
usb_con.c:86), or you are lacking permissions to access the device.

Regards,
  Pierre

 
 Am Samstag 07 Februar 2009 21:55:11 schrieben Sie:
 Roland Graf schrieb:
 Hallo Pierre,

 was it possible to decode my log?

 Thanks

 Roland
 Hello Roland,

 try this small program. If i got it right, this should replay your
 usbsniff. It will dump any data received on stdout, so it should
 probably be redirected into a file. All you need is a working libusb and
 compilation environment, compilation is done by the usual make.

 A quick way to view the resulting data is to convert it into a
 portable-gray-map(.pgm) by prepending P5 width height 255  or P5
 width height 65535  (note the final space), depending on whether
 you want to see the data interpreted as 8 bit or 16 bit. If the byte
 order is not correct for 16 bit, just add another space before the
 real data(the least significant byte can be ignored for now). For
 width and height you need to experiment. xv and display are able
 to show 16 bit pgm.

 I did not have a close look at the actual mode the gl843 is programmed
 to, but for cis sensors, color information is transfered in three lines,
 each line taken with one of the three led colors, for ccd sensors the
 usual per pixel color information is used.

 Regards,
   Pierre
 
 
 
 




[sane-devel] usbsniff

2009-02-05 Thread Pierre Willenbrock
Roland Graf schrieb:
 Hallo Pierre,
 
 was it possible to decode my log?
 
 Thanks
 
 Roland
 

Hi Roland,

it decodes fine, but i need to find some time to put the test program
together. My scripts decode the usbsniff into some pseudo c-code, that
needs to be cleaned/modified to work.

Regards,
  Pierre

 
 Am Montag 26 Januar 2009 22:13:50 schrieben Sie:
 roland.graf at alice.it schrieb:
 Hallo Pierre,

 I send you the log in Tar.gz format.


 Best regards

 Roland
 Hi Roland,

 i successfully extracted the log. Hopefully, i will be able to decode it
 sometime this week.

 Regards,
   Pierre
 
 
 




[sane-devel] usbsniff

2009-02-05 Thread Pierre Willenbrock
robert w hall schrieb:
 In message 498B15E0.9070805 at pirsoft.dnsalias.org, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org writes
 
 it decodes fine, but i need to find some time to put the test program
 together. My scripts decode the usbsniff into some pseudo c-code, that
 needs to be cleaned/modified to work.
 
 OOH - is this generally useful and available please??
 

My scripts are genesys gl84[12] and (possibly) gl843 specific, in that
it decodes the register output and prepares bulk transports for easy
reuse in c-arrays(it stuffs commas in between values).

Generally, the problem is with stuff that requires action depending on
the values read back from the scanner, and getting the timing critical
stuff right. Most of the time, one can get away with just replaying the
log, ignoring timestamps, and ignoring the values coming back. This does
not work f.E. for moving the scanning head back to home position(at
least if you are interested in knowing that the head reached that position).

I have seen a tool for usb log replay somewhere, but forgot the name.

My scripts can be found at www.pirsoft-dsl-dropzone.de.

Regards,
  Pierre



[sane-devel] CanoScan LiDE 60: Document feeder jammed

2009-01-25 Thread Pierre Willenbrock
Yes, feeder jammed is a bad error message. I see we have
SANE_STATUS_HW_LOCKED now -- that is probably a better error code. Fixed
in cvs.

Regards,
  Pierre

Tobias Preclik schrieb:
 Thanks for sorting this out. Didn't know the device has a lock switch
 and was confused by the document feeder jammed message. Anyways
 
 Thanks,
 Tobias
 
 m. allan noah wrote:
 Is the scanner head locked?

 allan

 On Sun, Jan 25, 2009 at 4:19 PM, Tobias Preclik sane at tobias.preclik.de 
 wrote:
 Hello devs,

 I just tried to configure my CanoScan LiDE 60 scanner with linux. I
 installed sane-1.0.19 with the genesys backend and libusb support
 enabled. The scanner is detected with sane-find-scanner and scanimage -L
 also lists it (also as a user). In other words it should work. However
 scanning does not work: The light flashes for an instant and the
 scanning head quivers for an instant but then the following message is
 reported:

 $ scanimage  test.pnm
 [genesys_gl841] **
 [genesys_gl841] **
 [genesys_gl841]   
 [genesys_gl841]   Extremely low Brightness detected.  
 [genesys_gl841]   Check the scanning head is  
 [genesys_gl841]   unlocked and moving.
 [genesys_gl841]   
 [genesys_gl841] **
 [genesys_gl841] **
 scanimage: sane_start: Document feeder jammed

 I'm not sure if it helps but I appended some dll debug output. Any Ideas
 what is going wrong? Please let me know if you need more debugging
 information.

 regards,
 Tobias

 [dll] sane_get_devices: found 1 devices
 [dll] sane_open: trying to open `genesys:libusb:001:014'
 [dll] sane_open: open successful
 [dll]
 sane_control_option(handle=0x60f870,option=0,action=0,value=0x7fff4df6daa8,info=(nil))
 [dll]
 sane_control_option(handle=0x60f870,option=0,action=0,value=0x7fff4df6c9ac,info=(nil))
 [dll] sane_get_option_descriptor(handle=0x60f870,option=0)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=1)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=2)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=3)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=4)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=5)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=6)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=7)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=8)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=9)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=10)
 [dll]
 sane_control_option(handle=0x60f870,option=10,action=0,value=0x60a5e0,info=(nil))
 [dll] sane_get_option_descriptor(handle=0x60f870,option=11)
 [dll]
 sane_control_option(handle=0x60f870,option=11,action=0,value=0x60a5e4,info=(nil))
 [dll] sane_get_option_descriptor(handle=0x60f870,option=12)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=13)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=14)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=15)
 [dll] sane_get_option_descriptor(handle=0x60f870,option=16)
 [dll]
 sane_control_option(handle=0x60f870,option=8,action=0,value=0x7fff4df6c9a8,info=(nil))
 [dll]
 sane_control_option(handle=0x60f870,option=9,action=0,value=0x7fff4df6c9a8,info=(nil))
 [dll]
 sane_control_option(handle=0x60f870,option=8,action=0,value=0x7fff4df6da9c,info=(nil))
 [dll] sane_get_option_descriptor(handle=0x60f870,option=10)
 [dll]
 sane_control_option(handle=0x60f870,option=10,action=1,value=0x7fff4df6daa0,info=0x7fff4df6c99c)
 [dll]
 sane_control_option(handle=0x60f870,option=9,action=0,value=0x7fff4df6da9c,info=(nil))
 [dll] sane_get_option_descriptor(handle=0x60f870,option=11)
 [dll]
 sane_control_option(handle=0x60f870,option=11,action=1,value=0x7fff4df6daa0,info=0x7fff4df6c99c)
 [dll] sane_start(handle=0x60f870)
 [genesys_gl841] **
 [genesys_gl841] **
 [genesys_gl841]   
 [genesys_gl841]   Extremely low Brightness detected.  
 [genesys_gl841]   Check the scanning head is  
 [genesys_gl841]   unlocked and moving.
 [genesys_gl841]   
 [genesys_gl841] **
 [genesys_gl841] **
 scanimage: sane_start: Document feeder jammed
 [dll] sane_cancel(handle=0x60f870)
 [dll] sane_close(handle=0x60f870)
 [dll] sane_exit: exiting
 [dll] sane_exit: calling backend `genesys's exit function
 [dll] sane_exit: finished

 --
 sane-devel mailing list: sane-devel at lists.alioth.debian.org
 http://lists.alioth.debian.org/mailman/listinfo/sane-devel
 Unsubscribe: Send mail with 

[sane-devel] Backend HP4010

2009-01-21 Thread Pierre Willenbrock
Roland Graf schrieb:
 Am Samstag, 17. Januar 2009 15:41:51 schrieben Sie:
 Roland Graf schrieb:
 Hello Pierre,

 I'm the owner of an HP G4010, and I would collaborate with you to insert
 this scanner in the genesys backend.

 I read in the mailing lists that it is not absolutely clear whether the
 scanner has an GL841 or an GL843 chip. If you need an answer I can open
 my scanner and have a look. Over this I can do USB-Sniffing to look what
 does the scanner, and testing.

 My Programming capabilities in C medium good. In past I programmed in
 Pascal, Lisp, Visual Basic.

 Please let me know.
 Hello Roland,

 an usb snoop usually is enough information to determine if the scanner
 uses the usual gl84{1,2} protocol. Some tools for analysis can be found
 here[1]. If you cannot make sense of the log, you can send it to me for
 analysis. (Please send the log anyways, that way i can give you better
 help. The first few MB of a scan should be enough.)

 Please take a look at the mails about the Canon LiDE 90 in the
 sane-devel list archive[2], they should give you a good idea what needs
 to be done to get a gl84{1,2} based scanner to work.

 Regards,
   Pierre

 [1] http://pirsoft-dsl-dropzone.de/
 [2] http://lists.alioth.debian.org/pipermail/sane-devel
 
 Hello Pierre,
 
 for now I cannot make sense of the log so I send it to you for analysis.
 
 I send you four different versions in different scanmodes.
 
 All these versions are scans with preview and then the final scan.
 
 Thanks
 
 Best regards
 
 Roland
 

Hello Roland,

thanks for the logs. These have been taken with SnoopyPro, so my scripts
cannot work on them. Additionally, SnoopyPro stops working after the
first big usb-bulk-transfer, explaining the small size of the logs.

Analysis of the logs showed that the gl841/2 protocol is used. There are
register accesses beyond register 0x87, so this is definitely not an
gl841/2, but likely one of its successors, probably gl843.

For the genesys backend, this means that we need new chip specific code.
We need to modify either genesys_gl646.c or genesys_gl841.c until your
scanner works(renaming it to genesys_gl843 on that way). This can be
made easier by creating a test-program, that initializes the scanner and
then scans something. If you send a usb snoop taken with
sniffusb(referenced on [1]), i can try to create that test-program.

Regards,
  Pierre

[1] http://pirsoft-dsl-dropzone.de/



[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-16 Thread Pierre Willenbrock
Dhi Aurrahman schrieb:
 Dear All!
 
 I have CanonScan LiDE 50 with me (working well with SANE genesys backend),
 but I need to have a buttons-daemon for it.
 Anyone could help me how to do it? I think the first step is to snoop the
 USB message sent by the button when it is pressed.
 If you have experience on developing button daemon, please share it with me.
 
 Thanks!
 

Hi Dio,

the code needed for button support is now available in the genesys
backend from sane-backends cvs. If you did not already find it, there is
sanebuttonsd in experimental cvs(in button-daemon/). It works great if
you reduce the sleep at the end of the mainloop to 100ms
(f.e. usleep(10)).

This is for Canon LiDE 35/40/50 only, so if anyone with a Canon LiDE 60
wants his scanners buttons to work, he needs to add the flags for the
buttons to the corresponding model struct and try if that works.

Regards,
  Pierre



[sane-devel] Small build fixes

2009-01-15 Thread Pierre Willenbrock
Hi list,

i tried to build sane with different source and build directories and
ended up needing the attached patch to tools/Makefile.in. I am not sure
if i got the build-directory creation right, but it works for different
source/build directories as well as when they are identical. If no one
objects, i will commit this in about 2 days.

Regards,
  Pierre
-- next part --
A non-text attachment was scrubbed...
Name: sane-build-fixes.diff
Type: text/x-patch
Size: 1341 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20090115/c9a78b67/attachment.bin
 


[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-10 Thread Pierre Willenbrock
m. allan noah schrieb:
 On Fri, Jan 9, 2009 at 5:02 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
[...]
 
 Another question: Is it okay to only look at the hardware state if the
 frontend asks for the state of the option? That way shorter presses can
 be lost, if the frontend does not poll often enough.
 
 In my case, the scanners are smart enough to buffer the button presses
 for 3 seconds, and I effectively read the status of all the buttons
 from the scanner every time you ask for the value of the first option.
 So, as long as the front-end reads within that 3 second window, no
 presses are lost.
 
 If your machines dont buffer, then you might need a thread just to
 read the status really quickly? Do you know how frequently the windows
 driver reads the buttons?

The genesys chips don't help at detecting hardware buttons. The only
sensor logic in the chip is for the home-sensor. The rest is GPIO.
The windows driver polls at 2Hz, this is not much better than the
polling frequency of sanebuttonsd(1Hz). I'll go for the non-threaded
variant for now, while making the logic work if the polling function is
called more often than the sane options are looked at.

 Before i start to ask more similar questions: Is this documented
 somewhere? I looked at the html-version of the standard, but could only
 find the capabilities thing for buttons.
 
 Nothing is documented. Everything we are discussing now came about
 from prior threads on this list, and thru several iterations of button
 support and button daemon work i did for users of the fujitsu backend.
 IOW, this might not work for your scanners, so we should modify it if
 required.

Thanks for your answers,
  Pierre



[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-10 Thread Pierre Willenbrock
m. allan noah schrieb:
 On Sat, Jan 10, 2009 at 1:11 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 m. allan noah schrieb:
 On Fri, Jan 9, 2009 at 5:02 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 [...]
 Another question: Is it okay to only look at the hardware state if the
 frontend asks for the state of the option? That way shorter presses can
 be lost, if the frontend does not poll often enough.
 In my case, the scanners are smart enough to buffer the button presses
 for 3 seconds, and I effectively read the status of all the buttons
 from the scanner every time you ask for the value of the first option.
 So, as long as the front-end reads within that 3 second window, no
 presses are lost.

 If your machines dont buffer, then you might need a thread just to
 read the status really quickly? Do you know how frequently the windows
 driver reads the buttons?
 The genesys chips don't help at detecting hardware buttons. The only
 sensor logic in the chip is for the home-sensor. The rest is GPIO.
 
 Is it possible for a user to press and release the button and have the
 driver 'lose' it if you dont read the GPIO pins during the 'pressed'
 inteval?

Exactly like that. And the windows driver has the same problem.

 The windows driver polls at 2Hz, this is not much better than the
 polling frequency of sanebuttonsd(1Hz). I'll go for the non-threaded
 variant for now, while making the logic work if the polling function is
 called more often than the sane options are looked at.
 
 1Hz from sanebuttonsd has generated some complaints about being too
 slow. I think we should bump it up to 2hz, so that might help.
 
 Before i start to ask more similar questions: Is this documented
 somewhere? I looked at the html-version of the standard, but could only
 find the capabilities thing for buttons.
 Nothing is documented. Everything we are discussing now came about
 from prior threads on this list, and thru several iterations of button
 support and button daemon work i did for users of the fujitsu backend.
 IOW, this might not work for your scanners, so we should modify it if
 required.
 Thanks for your answers,
 
 NP-
 
 allan




[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-10 Thread Pierre Willenbrock
m. allan noah schrieb:
 On Sat, Jan 10, 2009 at 2:55 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 m. allan noah schrieb:
 On Sat, Jan 10, 2009 at 1:11 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 m. allan noah schrieb:
 On Fri, Jan 9, 2009 at 5:02 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
 [...]
 Another question: Is it okay to only look at the hardware state if the
 frontend asks for the state of the option? That way shorter presses can
 be lost, if the frontend does not poll often enough.
 In my case, the scanners are smart enough to buffer the button presses
 for 3 seconds, and I effectively read the status of all the buttons
 from the scanner every time you ask for the value of the first option.
 So, as long as the front-end reads within that 3 second window, no
 presses are lost.

 If your machines dont buffer, then you might need a thread just to
 read the status really quickly? Do you know how frequently the windows
 driver reads the buttons?
 The genesys chips don't help at detecting hardware buttons. The only
 sensor logic in the chip is for the home-sensor. The rest is GPIO.
 Is it possible for a user to press and release the button and have the
 driver 'lose' it if you dont read the GPIO pins during the 'pressed'
 inteval?
 Exactly like that. And the windows driver has the same problem.
 
 Ahh, I love cheap scanners :) How fast would you have to poll the
 scanner to get short presses? 10Hz?

In my exerience, at 10Hz it is hard to press short enough for the press
to not get noticed. 2Hz is too slow, 8Hz is okay, and above 12Hz it is
impossible to lose presses, even when hammering the button like mad. At
least, you cannot be sure if the software lost the press or you didn't
press the button properly.

The shortest single presses i managed were 20ms, averaging at 40ms.
Normal presses are 70-110ms. Now one could calculate the odds for a
missed button press, but i will not go there.

Regards,
  Pierre



[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-09 Thread Pierre Willenbrock
m. allan noah schrieb:
 On Wed, Jan 7, 2009 at 1:09 PM, Pierre Willenbrock
 pierre at pirsoft.dnsalias.org wrote:
[...]

 I have no experience with the sane interface itself, so comments/patches
 are gladly accepted.
 
 We have settled on exposing buttons via options with:
 opt-cap = SANE_CAP_SOFT_DETECT | SANE_CAP_HARD_SELECT | SANE_CAP_ADVANCED;
 
 Then the frontend should poll such options occasionally to collect
 presses. If all buttons are read in one command, the backend should
 take care to only call it in a way that will not lose button presses.
 The fujitsu backend does this by maintaining two booleans for each
 button, one of the value last read from the scanner, and one stating
 if it has been read by the frontend yet. When the frontend asks for a
 button a second time, i get all the values and cache them.
 

So, the boolean value of the option represents the current state of the
button, which is TRUE if the button was down anytime since the last time
the frontend looked? Or is it additionally FALSE, if the option was TRUE
when read last time, and the button up anytime since then?

Another question: Is it okay to only look at the hardware state if the
frontend asks for the state of the option? That way shorter presses can
be lost, if the frontend does not poll often enough.

Before i start to ask more similar questions: Is this documented
somewhere? I looked at the html-version of the standard, but could only
find the capabilities thing for buttons.

Regards,
  Pierre



[sane-devel] buttons-daemon for SANE genesys scanner

2009-01-07 Thread Pierre Willenbrock
Dhi Aurrahman schrieb:
 Dear All!
 
 I have CanonScan LiDE 50 with me (working well with SANE genesys backend),
 but I need to have a buttons-daemon for it.
 Anyone could help me how to do it? I think the first step is to snoop the
 USB message sent by the button when it is pressed.
 If you have experience on developing button daemon, please share it with me.
 

Hi Dio,

the buttons are on gpio pins:
GPIO1: SCAN button
GPIO2: FILE button
GPIO3: E-MAIL button
GPIO4: COPY button

these need to be polled, 0 means pressed. There is a remote possibility
that the used power saving mode renders the buttons useless.

The one thing missing is button support in the genesys backend. Since
this needs polling, it is probably best to hook into the
option-getter(if there is such a thing) and do the polling there(two usb
control transfers). Alternatively we could do the polling in a thread.

I have no experience with the sane interface itself, so comments/patches
are gladly accepted.

Regards,
  Pierre





[sane-devel] Bypassing calibration in CanoScan LiDE 60

2008-12-24 Thread Pierre Willenbrock
Tom Brush schrieb:
 For a scanner-camera project featured in Make magazine, (
 http://makezine.com/14/scannercamera/ ) the author uses SANE to bypass the
 calibration step, because it would fail after his physical modifications to
 the sensor.  The model he uses is a Canon CanoScan LiDE 20.  His actual
 directions can be found at: http://www.make-digital.com/make/vol14/?folio=78
 The modifications in the Plustek driver config. file are as follow:
 
 On line 105, change option skipCalibration 0 to option skipCalibration 1
 On line 111, change option skipFine 0 to option skipFine 1
 On line 116, change option skipFineWhite 0 to option skipFineWhite 1
 
 The scanner I have is the CanoScan LiDE 60, which uses a different driver,
 the Genesys.  None of the equivalent config. options are available.  I am
 new to this, but is there a way to perform a similar command to skip the
 calibration steps for the CanoScan 60?
 

Hi Tom,

you can bypass the whole calibration process but you need to change the
sourcecode for this, and recompile and install sane.
The changes needed are commenting out lines 3707 to 3714 in genesys.c
and changing lines 2888 and 2889 of genesys_gl841.c from
 ((flags  SCAN_FLAG_DISABLE_SHADING)?
  OPTICAL_FLAG_DISABLE_SHADING:0) |
to
 OPTICAL_FLAG_DISABLE_SHADING |

I don't think calibration will get in your way, but it requires a
working lamp. There is a cheap way to switch the lamp off during scan:
change line 4118 of genesys_gl841.c from
 0
to
 SCAN_FLAG_DISABLE_LAMP

It is possible to completely disable the lamp, for this, change lines
2892 and 2893 from
 ((flags  SCAN_FLAG_DISABLE_LAMP)?
 OPTICAL_FLAG_DISABLE_LAMP:0)
to
 OPTICAL_FLAG_DISABLE_LAMP

You may need to change values on lines 100, 101 in genesys_devices.c.
Those are the analog offset(line 100) and gain(line 101), in hexadecimal.

Regards,
  Pierre



[sane-devel] LiDE 90

2008-12-03 Thread Pierre Willenbrock
guillaume.gastebois at free.fr schrieb:
 Hello,
 
 I'm back with my LiDE 90. No more significant result since month. I don't 
 know where to find.
 Just a little question. I see in windows snoop that inversion bit is set in 
 frontend, not in sane.
 Is it possible that this inversion has an effect on calibration and scanning 
 (different full scall...) ?

In theory, there should be no difference, since the digital filtering
would essentially stay the same, when using inverted/non-inverted or
arbitrarily biased input, and the analog stages cannot be changed in
polarity via programming.

 I want to test with inversion, but I can't find in genesys backend code where 
 to software reinvert datas.

You can't find that code, because there is no code. For use with
inverted data from the adc, you'd need to change all calibration
procedures to handle that data, and add a stage into the filter chain.
The filter chain is the stuff around genesys_conv.c, you can probably
adapt one of the reorder functions. That, or processing the data
directly from the scanner to appear non-inverted to the rest of the
calibration logic. This would still need changes to at least the shading
calibration, since the coefficients are different for inverted input.

 Can someone help me ?
 I did some new snoop (without calibration phase ?) using usbsnoop and parsed 
 it using parseusbsnoop_gl841.awk from John Dalton (thank you).
 They can be found at : 
 http://ggastebois.free.fr/lide90_snoop/UsbSnoop_600_216x17.4_nocal.log and 
 http://ggastebois.free.fr/lide90_snoop/UsbSnoop_600_216x17.4_nocal_parsed.log 
 (be carefull with headake !)
 
 Regards
 Guillaume
 

Regards,
  Pierre



[sane-devel] question about the motor struct of genesys backend

2008-09-10 Thread Pierre Willenbrock
stef schrieb:
   Hello Pierre,
 
   I am currently studying how to add support for the HP2400/G2410 to the 
 gl646 
 part of the genesys backend. I am currently trying to figure out how to fill 
 the values for the motor struct in genesys_devices. How did you find the 
 current values, are they provisional for most models but exact for LiDE 35, 
 or are they ready to use ?
   In case they need to be changed, on which data may I base the changes ?

The values in the motor struct are specific to the mechanical design of 
the scanner. Currently, the gl841 part only supports devices that seem 
to be very similar(at least mechanical) to my LiDE 35, so the motor 
struct is just reused/copied.

Originally, the values were derived from the linear curves(only in step 
number domain, not in time domain...) sent by the windows driver. Later 
i experimentally improved them (and had to back off quite a bit after 
complaints). I ended up with a stepping slope that keeps the scanning 
head going, even when the scanner is held in such a way that the head 
must go upwards.

In absence of an initial curve, one could start with very slow stepping 
and improve that.

The values inside the motor struct are not critical to get right, most 
of the time the maximum speed is capped by the maximum exposure time. 
Only during pure feeds(scanning head going back) or using low resolution 
scans the final speeds in the motor struct really improve anything. 
(This is probably not true for scanners that do multiple motor power modes.)

Regards,
   Pierre

PS.: make sure you use an exposure calculation method and a slope 
generator that actually uses the values in the motor struct. Slope 
generation and exposure calculation is a mess, in part due to my changes.



[sane-devel] LiDE 90 Calibration

2008-09-04 Thread Pierre Willenbrock
guillaume.gastebois at free.fr schrieb:
 Hello,
 
 It seems that in Windows snoop calibration of LiDE 90 is done with
  half CCD even if scanning is in full sensor resolution.
 Is it so in sane ?
 
 If not, is it usefull to implement it ? Where to do that ?

To be on the safe side, all calibration steps are using the same 
settings(minus motor control, but that is hardly calibratable) as the 
final scan. This is to keep all possibly hidden parameters the same.

Theoretically, it would be okay to just keep the calibration for one 
half and one full calibration setting, since that is the only setting 
that may change the sensor characteristics. It should be possible to 
calculate the rest.

If the function that scales from full resolution to half resolution is 
known(for example the average), one could theoretically calculate that, 
too, but if it is not the average, this may get complicated. (My scanner 
sort of adds adjacent pixels.)

The LED, offset and gain calibration steps can(should be able to) work 
with any resolution, only the shading calibration needs to be adjusted 
to fill the correct locations of the shading calibration data set.

The former steps can be found in genesys_gl841.c. The shading 
calibration is in genesys.c:

* genesys_flatbed_calibration
controls all calibration steps

* sanei_genesys_init_shading_data
clears the shading data. not strictly needed, both chips have a setting 
to ignore the shading data.

* dev-model-cmd_set-init_regs_for_shading
sets up the scanning parameters(call into the chip specific vtable).

* genesys_dark_shading_calibration
* genesys_dummy_dark_shading
* genesys_white_shading_calibration
* genesys_dark_white_shading_calibration
Different methods to acquire dark and bright samples to be stored in 
dev-dark_average_data and dev-white_average_data.

* genesys_send_shading_coefficient
finally calculates and sends the shading coefficients. look in the 
CCD_CANONLIDE90 case for the actual code doing the calculations. This 
has not seen a lot of changes after i got it to work. This uses the data 
stored in dev-dark_average_data and dev-white_average_data.

The main changes needed would be in the init_regs_for_scanning and 
genesys_send_shading_coefficient functions. The rest should work with that.

This could be very useful when the calibration cache code gets commited, 
because it would reduce the number of calibrations to at most 2. 
(Currently it is in the experimental repository, and i could not get 
myself to add support in the gl646-part, yet.)

 Regards
 Guillaume

Regards,
   Pierre



[sane-devel] LiDE 90

2008-08-22 Thread Pierre Willenbrock
Hi,

guillaume.gastebois at free.fr schrieb:
 Hello,
 Thank you for answer Pierre.
 Some questions again !
 
 Hi Guillaume,
 Guillaume Gastebois schrieb:
 Hello,

 I'm back with my LiDE 90 !

 I see in my windows logs the following sequence for gpios (reg 0x6C) :
 02
 12
 0e
 1a
 0a
 0e/3e (3e for half ccd log) (seems to be scanning moment)
 0e
 0a
 0e/3e (3e for half ccd log)
 02

 
 Did you see some GPIO sequences necessary like with your lide 35 scanner ?

I cannot say what is needed for the LiDE 90. If your scanner works 
without initialization sequences, that is from fixed initial values, 
great. If it does not, you are in for searching a working sequence. 
Bonus points if it can setup the scanner from all(even bogus) initial 
states.

 From what i can see, i guess you don't need an init sequence like the 
lide 35 does.

 [SNIP] 
 Why did I have half image with GPIO13/14 to 0 ?
 That question cannot be answered without knowledge of the actual 
 electrical connections. I'd just accept the fact that GPIO13/14 needs to 
 be switched together.
 
 In one 1200dpi log, I get the value 0x22 for reg 0x6C. (but I'm not sure of 
 this log).

There could be some feature that is needed for higher resolutions, like 
enabling additional line drivers or something, with a safety circuit 
forcing the other line low when this feature is disabled. Just 
speculating, however.

 Subsidiary question : where in the code to play to modify default 0x6C 
 register 
 value before calibration, before scanning and after scanning ?
 
 So you think that I just have to find the good value and let it from begining 
 to the end the same ?

Minus changes needed for setting up different known features, yes.

 Why windows driver plays with reg 0x6C ?

I would think that they are changing these registers directly, i.E. for 
every bit they change in software they do an extra write. Alternatively, 
they could set/reset the bits on demand, for Example irrelevant bits for 
motor feed not getting changed.

 The genesys_gl841-part unifies the setup for calibration scans and 
 regular scans. The mid level functions get a set of parameters 
 describing what, where and how to scan, and setup everything for that.
 Those functions are: gl841_init_motor_regs_off, gl841_init_motor_regs, 
 gl841_init_motor_regs_scan for the motor control part, 
 gl841_init_optical_regs_off, gl841_init_optical_regs_scan for the 
 optical control part. gl841_init_scan_regs and gl841_feed pose as 
 frontends for these functions.

 Before scanning, each of the mid level functions sets the bits that 
 control parts of the scanner relating to the given function. For 
 example, gl841_init_optical_regs_scan sets the bits needed for half-ccd 
 mode, while gl841_init_motor_regs_scan will be responsible to setup a 
 given motor power mode.
 
 OK It answers my question about changing 0x6C value ?

If that is a question, i don't get it.

 [SNIP]
 
 Regards
 Guillaume
 

Regards,
   Pierre



[sane-devel] Support for Canon LiDE 80

2008-08-22 Thread Pierre Willenbrock
Hi Keith,

Vital Mission Software schrieb:
 I would like to see if I can get my LiDE 80 to work. It is marked as 
 unsupported since 2007-01-28. It appears in the udev/libsane.rules, but 
 not in genesys_devices.c. However, that does include support for LiDE 
 up to 60 and I note that the tables for 50 and 60 differ in only one 
 number.
 
 Would it be safe to copy the 60 table and call it the 80 table?
 
 If so, is it likely to work?

That does not work out of the box, see the thread starting at
http://lists.alioth.debian.org/pipermail/sane-devel/2005-December/015752.html

Here is another attempt to get it to work:
http://lists.alioth.debian.org/pipermail/sane-devel/2008-February/020959.html

I don't remember exactly how far the two attempts got, skimming the 
emails i get the impression that the motor control worked, but the 
optical system could not be coaxed to deliver data.

  Keith Harwood.

Regards,
   Pierre



[sane-devel] LiDE 90

2008-08-20 Thread Pierre Willenbrock
Hi Guillaume,
Guillaume Gastebois schrieb:
 Hello,
 
 I'm back with my LiDE 90 !
 
 I see in my windows logs the following sequence for gpios (reg 0x6C) :
 02
 12
 0e
 1a
 0a
 0e/3e (3e for half ccd log) (seems to be scanning moment)
 0e
 0a
 0e/3e (3e for half ccd log)
 02
 
 With tests I identifies GPIO11 as home switch (with 1 scanner doesn't 
  see home position any more) and GPIO14 as half CCD.
 But it doesn't seems to be so simple. Why windows driver plays with home 
 switch ?

The home switch is of the photoelectric variety most of the time, so 
switching it off saves a few milli Amperes.

 Why did I have half image with GPIO13/14 to 0 ?

That question cannot be answered without knowledge of the actual 
electrical connections. I'd just accept the fact that GPIO13/14 needs to 
be switched together.

 Subsidiary question : where in the code to play to modify default 0x6C 
 register 
  value before calibration, before scanning and after scanning ?

The genesys_gl841-part unifies the setup for calibration scans and 
regular scans. The mid level functions get a set of parameters 
describing what, where and how to scan, and setup everything for that.
Those functions are: gl841_init_motor_regs_off, gl841_init_motor_regs, 
gl841_init_motor_regs_scan for the motor control part, 
gl841_init_optical_regs_off, gl841_init_optical_regs_scan for the 
optical control part. gl841_init_scan_regs and gl841_feed pose as 
frontends for these functions.

Before scanning, each of the mid level functions sets the bits that 
control parts of the scanner relating to the given function. For 
example, gl841_init_optical_regs_scan sets the bits needed for half-ccd 
mode, while gl841_init_motor_regs_scan will be responsible to setup a 
given motor power mode.

If you really need to do things differently for calibration and regular 
scanning(which i doubt), you need to look at 
gl841_init_regs_for_coarse_calibration, gl841_init_regs_for_shading, 
gl841_init_regs_for_scan, gl841_offset_calibration, 
gl841_coarse_gain_calibration, gl841_led_calibration. IIRC the init_regs 
functions are called before the actual action is done, and the resulting 
register set is directly written to the scanner. The actual calibration 
happens in the other functions, using or not using the previously setup 
registers. All of these call gl841_init_scan_regs and gl841_feed to get 
their work done, but the register set can be modified after that call.

The initial bit-fiddling (if needed) happens in gl841_init_registers, 
starting off from the values stored in genesys_devices.c:
static Genesys_Gpo Gpo[].

 Regards
 Guillaume

Regards,
   Pierre



[sane-devel] CIS scanners: to calibrate or not to calibrate :) this is the question (my scanner is mad and lazy :)

2008-06-29 Thread Pierre Willenbrock
Rene Rebe schrieb:
 litlle girl wrote:
 AFE settings looks more stable:

 grep \[gt68xx\] afe ./*
 ./color-1.log:[gt68xx] afe 0x0f 0x04 0x10 0x05 0x0f 0x04
 ./color-2.log:[gt68xx] afe 0x0f 0x04 0x10 0x05 0x0f 0x04
 ./color-3.log:[gt68xx] afe 0x0f 0x04 0x10 0x05 0x0f 0x04
 ./gray-1.log:[gt68xx] afe 0x0f 0x04 0x10 0x05 0x0f 0x04
 ./gray-2.log:[gt68xx] afe 0x0f 0x04 0x0f 0x04 0x0f 0x04
 ./gray-3.log:[gt68xx] afe 0x0f 0x04 0x0f 0x04 0x0e 0x03
 ./lineart-1.log:[gt68xx] afe 0x0f 0x04 0x0f 0x04 0x0e 0x03
 ./lineart-2.log:[gt68xx] afe 0x0f 0x04 0x0f 0x04 0x0e 0x03
 ./lineart-3.log:[gt68xx] afe 0x0f 0x04 0x0f 0x04 0x0f 0x04
 
 Aside exposure and AFE the backend probably uploads a
 scaling value for each image sensor element (white / dark
 shading etc.?) that should be pretty constant.
 
 (And no, I still have not read the genesys backend source
   to verify what it's doing, this is just from other
   educated experience.)

I don't know what the gt68xx uses for calibration data,
but the highly experimental genesys/calibration-cache code stores(in 
memory only) for each combination of color mode and resolution:
* exposure time
* AFE offset and gain
* per pixel offset and gain(actually just the black/white levels, but 
the offset and gain are fully defined by those)

 I bet the Windows driver also does not re-calibrate every
 scan, at least the Mac driver for the Canon Lide 70 does
 only calibrate once after unpacking.
 
 Yours,
 

Regards,
   Pierre



[sane-devel] Question about Genesys_Frontend

2008-04-26 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 In genesys backend, we can find :
 
 typedef struct
 {
u_int8_t reg[4];
u_int8_t sign[3];
u_int8_t offset[3];
u_int8_t gain[3];
u_int8_t reg2[3];
 } Genesys_Frontend;
 
 
 but in WM8199 regs don't have the same name.
 For me registers addresses are :
 
 reg[0]=0x01,reg[1]=0x02,reg[2]=0x03,reg[3]=0x06,
 sign[0]=?,sign[1]=?,sign[2]=?,
 offset[0]=0x20,offset[1]=0x21,offset[2]=0x22,
 gain[0]=0x28,gain[1]=0x29,gain[2]=0x2a,
 reg2[0]=0x08,reg2[1]=0x09,reg2[2]=?,
 
 I anybody able to replace ? and/or correct mistakes in text before ?

There are some AFEs that use these registers, and some, that don't. If 
the windows driver does not set them, most likely they are not 
used/defined and ignored by the AFE. So it should be safe to set them to 0.

 Thanks
 
 Regards
 Guillaume

Regards,
   Pierre



[sane-devel] (no subject)

2008-04-26 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Is there a possibility to determine a maximum of parameter like :
 
 typedef struct
 {
   int optical_res; (OK, for me 2400)
   int black_pixels;(don't know how to determine)
   int dummy_pixel; (content of 0x34 ?)
   int CCD_start_xoffset;   (test of page upper border ?)
The ccd line first gives a few dummy pixels, then there are a few black 
pixels, to enable the afe to do per-line black level compensation. 
CCD_start_xoffset counts into one of these. I didn't need to change 
these, yet.

   int sensor_pixels; (just 216/2.54*2400 ?)
i would think so.

   int fau_gain_white_ref;  (don't know how to determine)
   int gain_white_ref;(don't know how to determine)
the two above are used in calibration of some gl646-models.

   u_int8_t regs_0x08_0x0b[4];  (OK windows snoop)
   u_int8_t regs_0x10_0x1d[14]; (OK windows snoop)
   u_int8_t regs_0x52_0x5e[13]; (OK windows snoop)
   float red_gamma; (don't know how to determine)
   float green_gamma;   (don't know how to determine)
   float blue_gamma;(don't know how to determine)
As ccd cells are largely linear in response, these should very probably 
be 1.0. But i don't know if they are even used. Anyways, gamma tables 
are definitely not used for 16bit modes on gl841/2.

   u_int16_t *red_gamma_table;  (OK NULL)
   u_int16_t *green_gamma_table;(OK NULL)
   u_int16_t *blue_gamma_table; (OK NULL)
 } Genesys_Sensor;



 or :
 
 typedef struct
 {
   SANE_Int base_ydpi;(4800 ? : Lide90 is 2400x4800)
   SANE_Int optical_ydpi; (4800 ? : Lide90 is 2400x4800)
   SANE_Int max_step_type;(don't know how to determine)
   SANE_Int power_mode_count; (don't know how to determine)
   Genesys_Motor_Slope slopes[2][3];  (don't know how to determine)
 } Genesys_Motor;

Unless you figure out multiple power modes, power_mode_count needs to be 
set to 1. This is intended for scanners that can use a reduced power 
mode for smoother head moves, when speed is not needed(high resolution 
scans with slow moving head).

The stepper motors used are capable of doing full steps or half steps, 
most of the time. the gl842 handles quarter step, gl843 seems to handle 
eighth step, too. This is reflected by max_step_type:
max_step_type ! smallest steps
   0   ! full
   1   ! half
   2   ! quarter
   3   ! eighth

base_ydpi is very probably 2400 dpi. manufacturers tend to go by the 
maximum possible value, which would be 4800 when using a 2400 dpi 
full-step drive in half-step mode. The relationship between 
optical_ydpi, max_step_type and base_ydpi is thus:

optical_ydpi = base_ydpi * 2 ^ max_step_type

The slopes-array is fixed to 2x3, but the used size is:
slopes[power_mode_count][max_step_type+1]

Each slope describes a speed slope for a specific motor setting. These 
slopes are needed for acceleration/deceleration of the scanning head, as 
the stepper motors are not powerful enough to get the head to full 
speed in a single step.

The backend selects one fitting the requested mode, higher power mode 
indexes give better quality but less speed, same with step modes, 
although higher step modes(higher step divider) may be forced by the 
requested mode(2400 ydpi on my scanner forces half step mode, because 
full steps only do 1200dpi).

The gl84x reads the time it needs to wait between each step from a table 
submitted by the backend. Thus, the units of the slopes reflects this: 
All speeds are merely times between steps.

maximum_start_speed is the maximum speed this slope can start at. This 
is the maximum speed the head can reach from a stand-still. 
maximum_speed is the maximum final speed, after doing acceleration. The 
backend may generate a slope that does stay slower than any one of 
these, but it will do a slope when the head needs to go faster than 
maximum_start_speed. The minimum_steps gives how many steps a 
acceleration to maximum_speed needs to take. When the head does not need 
to reach this speed, the backend may decide to take fewer steps. g 
brings some non-linearity.

The values here can be found by experiment, or by analyzing the slope 
tables from an usb log. The values from the windows driver may be a bit 
conservative. When experimenting, one would decrease the values of 
maximum_speed, maximum_start_speed and minimum_steps until the head 
fails to speed up, and then increase them a bit. Positioning the scanner 
such that the head goes upwards gives a nice safety margin while 
experimenting. A final warning: when doing this, you may destroy your 
scanner. Although i doubt that the loud noises from a not-moving head 
stem from slipping gears, but instead from the stepper motor itself 
oscillating back and forth.

 
 Guillaume Gastebois schrieb:
 Hello,

 I remember that LiDE 90 is a 2400DPI scanner. And I did nothing in code to
 port
 that. I backend ready for 

[sane-devel] LiDE 90 half ccd

2008-04-26 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 No progress on 2400dpi. DPIHW is 2400 and dpiset 600 for a 300dpi scan.
 Don't know where to look yet for that problem !

I'd try to get a log from a 2400dpi scan from windows and compare.

 about byte nibbles modifying reg_0x79 from 0x3f to 0x3e (very few 
 contrasted image) or 0x40(black image) gives me bad images !!!
 
 What is effect of this register on clk3 ?? It's very sensible.

register 0x77 to 0x79 describe a bitmask, that determines when the clk3 
signal is high or low. For 0x0003f(lsb is register 0x79), this would give:

time===  ! next pixel
bit of 0x79! 0x78  !0x77! 0x79
0 1 2 3 4 5 6 7!0 1 2 3 4 5 6 7!0 1!0 1 2 3 4 5 6...
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 
___ ___
|___|   |

0x40 is this:

bit of 0x79! 0x78  !0x77! 0x79
0 1 2 3 4 5 6 7!0 1 2 3 4 5 6 7!0 1!0 1 2 3 4 5 6...
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
 _   _
___| |_| |

As you can see, this gives a very short pulse, which will probably not 
be recognized by the ccd, while 0x3e just shortens the clock pulse at 
the beginning. The datasheet mentions that the scanner does not need to 
use the full 18 bits of the bitmask, but uses the first 6, 12 or 18 bits 
depending on the scanning mode. 12 seems to be correct for the mode the 
backend programs for cis scanners.

Please try if modifying bitmask for clk4(0x7a to 0x7c iirc) shows any 
effects. Also, other values you may want to try on clk3: 0xff03f, 
0xff801f, 0xffc00f. Another thing to try may be to send two clock 
pulses, for example 0x001c7. If clk3 is connected to the ccd, this may 
give interesting results(like, reducing the resolution by half), but for 
the 4-bit latch/D-FlipFlop, only the last clock pulse before the gl841 
samples the data bits is relevant.

 regards,
 Guillaume

Regards,
   Pierre




[sane-devel] LiDE 90 half ccd

2008-04-23 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I remember that LiDE 90 is a 2400DPI scanner. And I did nothing in code to 
 port
 that. I backend ready for 2400dpi (I think so regarding portion of code) ?

I am not sure, as there could not happen any testing. But in theory, it 
should work. In the future, there should be some afford made to make 
other resolutions than 2400, 1200 and 600 work, but these 3 are trivial 
with this chip.

 I write 2400 dpi in genesys_sensor for lide 90. But how to know pixel number 
 for
 CCD sensor ?

I guess the manufacturer is not lying about the density of the ccd, so 
that should be enough. The rest of the settings is in real units. The 
backend calculates the exact number of pixel from the density and the 
width of the scanning area.

 After writing 2400 dpi in sensor, I get quarter sized images !!! Why ?
 
 With 600 dpi in sensor I get full sized images with (300dpi scanning) or 
 without
 half_ccd (1200dpi scanning) (with my code for gpio 14).
 
 Regards
 Guillaume

I'd first try to get the correct gpio setting for a full resolution 
scan(i.E. at 2400dpi). If you cannot get a full-width-scan, look for the 
DPISET register, and try half/twice the dpi there. Also, make sure the 
DPIHW is set for the 2400dpi mode.
When that works, figure out how to setup gpios for half_ccd mode. From 
the view of the current code base, you are done here. You can try to 
find a quarter_ccd mode(which would show up as half-width in the 
half_ccd modes), and leave a comment in the code, or even implement the 
quarter_ccd mode for real.

Regards,
   Pierre




[sane-devel] LiDE 90 half ccd

2008-04-20 Thread Pierre Willenbrock
Hi,

Guillaume Gastebois schrieb:
 Hello,
 
 Guillaume Gastebois schrieb:
 Hello,

 Me again !

 I'm trying to find what are GPIO14,13,12 and 11 for.

 I find GPIO11=home switch and must be 0.
 I thought I found GPIO14 was half CCD but by adding :
 /* gpio part. here: for canon lide 90 */
 if (dev-model-gpo_type == GPO_CANONLIDE90)
 {
 r = sanei_genesys_get_address (reg, 0x6c);
 if (half_ccd)
 r-value |= 0x20;
 else
 r-value = ~0x20;
 }

 With code before and command scanimage, I get half sized image.
 Scanimage gives me these parameters :
  pixels: 2574
  lines: 3531
  depth: 8
  channels: 1
  exposure_time: 5600
  xres: 300
  yres: 300
  half_ccd: yes
  stagger: 0
  max_shift: 0
 
 Why is half ccd activated ?

The parameters above represent what the backend tries to program. If you 
put a x-resolution below half of the optical resolution into scanimage, 
the backend determines it can use the faster scanning mode, i.E. half_ccd.

If you do not do anything to enable half_ccd-mode, you should get only 
half of the scanning area in x-direction for resolution below half 
optical resolution, and the full scanning area for resolutions above. Is 
it possible that your scanner is able to use not only a half-ccd-mode, 
but even a quarter-ccd-mode?

 I tryed with 0x1a=0x20 and it doesn't change anything. Doese it mean 
 that clk3 is not used ?

If you did that with ck3map and ck4map == 0, it would seem that clk3 and 
clk4 are unused. No idea why the windows driver sets these, then.

This is how i think your scanner works:

WM81xx  | | GL84x
OP[3:0] +-o-+ OP[3:0]
 |  |   .. |
 |  |   | 4-bit- | |
   MCLK  |  '--+ latch  ++ OP[7:4]
^---'  '---^' |
 |  '-+ which clock?
 '+ MCLK

The 4-bit-latch is the VHC175.

This WM81xx frontend sends its 16bit data in 4 bit nibbles, changing 
state on the falling and rising edges of MCLK, or, more exactly, up to 
20ns later(from the WM8152 datasheet, this seems to be long considering 
the time for one MCLK period is 41ns):

MCLK __---
OP[3:0]  ##
|41ns-|
   || less than 20ns
^   ^   sample here

therefore, it is probably safe to sample exactly on the edges. The 
WM8152 sets bits 7 to 4 when seeing a falling edge of MCLK, so the 4 bit 
latch can sample these on the next rising edge of MCLK. Then, it holds 
its output stable for the rest of the period. bits 3 to 0 are set when 
receiving a rising edge, so the GL84x should sample on the falling edge. 
The VHC175 samples on rising edges. This means, the clock used for the 
latch could be MCLK.

How does our problem with the high nibble of the second byte being 
similar to the low nibble of the first byte fit into this?

The 4 bit latch could be sampling at the same time as the WM81xx changes 
its outputs, this would lead to a mix of both informations. Maybe this 
does not happen for the first high nibble, because the WM81xx has 
slightly different timing for that case. This could be fixed by figuring 
out which clock the latch uses, and adjusting the rising/falling edges. 
When the latch does not get a clock, the gl84x should get the same 4 
bits over and over again(perhaps 0?) as high nibble, but usable low 
nibbles. (Similar can happen with the gl84x sampling at bad times, but i 
think the result would look different.)

Some random ideas:
It may be helpful if we could get the AFE to output an alternating bit 
pattern for each nibble. Lacking this possibility, reducing the gain and 
fiddling with the offset may be an option, too.

The above(including disabling clocks) will very probably lead to no 
usable image or working calibration. Instead, we need to examine the 
results of offset/coarse calibration. These two steps dump raw image data.

 in genesys_gl841.c line ~2053 I had image compressed x2 in the left and
 second right part black with 0x6c=12 and not with 0x6c=1a. Strange.

 I decided to comment out these lines yet for tests.

 In genesys_841.c I see conditions with GPO_CANONLIDE35 for gl841_feed
 function (lines ~4309 and ~4913). I added GPO_CANONLIDE90 too. What is
 this function for ? Is it usefull to add lide 90 ?
 no, these don't help your scanner. the feed is used to position the 
 scanning head at the white calibration strip. This is(should not) be 
 needed for your scanner.

 
 Regards
 Guillaume
 

Regards,
   Pierre



[sane-devel] LiDE 90

2008-04-17 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Me again !
 
 I'm trying to find what are GPIO14,13,12 and 11 for.
 
 I find GPIO11=home switch and must be 0.
 I thought I found GPIO14 was half CCD but by adding :
 /* gpio part. here: for canon lide 90 */
 if (dev-model-gpo_type == GPO_CANONLIDE90)
 {
 r = sanei_genesys_get_address (reg, 0x6c);
 if (half_ccd)
 r-value |= 0x20;
 else
 r-value = ~0x20;
 }
 
 in genesys_gl841.c line ~2053 I had image compressed x2 in the left and
 second right part black with 0x6c=12 and not with 0x6c=1a. Strange.
 
 I decided to comment out these lines yet for tests.
 
 In genesys_841.c I see conditions with GPO_CANONLIDE35 for gl841_feed
 function (lines ~4309 and ~4913). I added GPO_CANONLIDE90 too. What is
 this function for ? Is it usefull to add lide 90 ?

no, these don't help your scanner. the feed is used to position the 
scanning head at the white calibration strip. This is(should not) be 
needed for your scanner.

 tests I made were :
 0x1a=00 and 0x6c=02 : bad calibration vertical lines
 0x1a=00 and 0x6c=0a : bad calibration vertical lines (motor sometimes
 locks at the end with noise).
 0x1a=00 and 0x6c=12 : image like before (small calibration problems)
 0x1a=00 and 0x6c=1a : image like before (small calibration problems)
 0x1a=00 and 0x6c=22 : bad calibration vertical lines
 0x1a=00 and 0x6c=2a : bad calibration vertical lines
 0x1a=00 and 0x6c=32 : very good quality image but take only the half
 left part of the page
 0x1a=00 and 0x6c=3a : very good quality image but take only the half
 left part of the page
 
 0x1a=24 and 0x6c=02 or 0a or 12 or 1a or 22 or 2a or 32 or 3a : always
 black image!
 
 All the results can be found on :
 http://ggastebois.free.fr/lide90_snoop/test_00 (for tests with 0x1a=00)
 http://ggastebois.free.fr/lide90_snoop/test_24 (for tests with 0x1a=24)
 
 The number in the tar name is the value off 0x6c. I think looking at
 0x6c=32 or 3a is very interesting.
 
 Why sane always produces black images with same 0x1a value as windows
 driver 

Because the rest of the clock registers are setup incorrectly. This 
probably leads to the CCD bar not getting correct pulses to move the 
electrical charges. No charge means black pixel. It should be possible 
to simulate the behavior when the clock generators are switched to 
automatic, but this default behavior is not well documented.

 Regards
 Guillaume
 
 ps. : Pierre can you send me a sample entropy processed offset image to
 see what I must obtain. Thank you.

Attached is the result of the dark part of a shading calibration run. 
When doing offset calibration, most of the time i only see a single 
line(sometimes with a wraparound into the next line).

Note that the image is nearly symmetrical to the diagonal axis, meaning 
two consecutive bytes are uncorrelated. The result of the white part 
shows a larger band, typical around 20 pixels width, but with a lot of 
speckles(which is in no way an indicator of problems).

Regards,
   Pierre

-- next part --
A non-text attachment was scrubbed...
Name: correl.png
Type: image/png
Size: 1997 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080417/bc0a379c/attachment.png
 


[sane-devel] LiDE 90

2008-04-17 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Me again !
 
 I'm trying to find what are GPIO14,13,12 and 11 for.
 
 I find GPIO11=home switch and must be 0.
 I thought I found GPIO14 was half CCD but by adding :
 /* gpio part. here: for canon lide 90 */
 if (dev-model-gpo_type == GPO_CANONLIDE90)
 {
 r = sanei_genesys_get_address (reg, 0x6c);
 if (half_ccd)
 r-value |= 0x20;
 else
 r-value = ~0x20;
 }
 
 in genesys_gl841.c line ~2053 I had image compressed x2 in the left and
 second right part black with 0x6c=12 and not with 0x6c=1a. Strange.
 
 I decided to comment out these lines yet for tests.
 
 In genesys_841.c I see conditions with GPO_CANONLIDE35 for gl841_feed
 function (lines ~4309 and ~4913). I added GPO_CANONLIDE90 too. What is
 this function for ? Is it usefull to add lide 90 ?
 
 tests I made were :
 0x1a=00 and 0x6c=02 : bad calibration vertical lines
 0x1a=00 and 0x6c=0a : bad calibration vertical lines (motor sometimes
 locks at the end with noise).
 0x1a=00 and 0x6c=12 : image like before (small calibration problems)
 0x1a=00 and 0x6c=1a : image like before (small calibration problems)
 0x1a=00 and 0x6c=22 : bad calibration vertical lines
 0x1a=00 and 0x6c=2a : bad calibration vertical lines
 0x1a=00 and 0x6c=32 : very good quality image but take only the half
 left part of the page
 0x1a=00 and 0x6c=3a : very good quality image but take only the half
 left part of the page
 
 0x1a=24 and 0x6c=02 or 0a or 12 or 1a or 22 or 2a or 32 or 3a : always
 black image!

try 0x1a=0x24 with
   dev-reg[reg_0x77].value = 0x00;
   dev-reg[reg_0x78].value = 0x00;
   dev-reg[reg_0x79].value = 0x3f;
   dev-reg[reg_0x7a].value = 0x00;
   dev-reg[reg_0x7b].value = 0x00;
   dev-reg[reg_0x7c].value = 0x3f;

if this does not work, try adding more bits/removing bits from ck3map or 
ck4map(for example 0:0f:ff, or 0:00:0f) or inverting one of the maps.
(My scanner uses clock1 and clock2, clock2 is just clock1 inverted, so 
there is only one map. Using 0:00:3f on ck1map works for me, but so does 
00:0f:ff and 00:00:0f.) I guess the default is a 50% duty cycle for the 
clocks. The number of master clocks the clock1/clock2/clock3/clock4 is 
set high then depends on the actual number of master clocks per pixel.

 All the results can be found on :
 http://ggastebois.free.fr/lide90_snoop/test_00 (for tests with 0x1a=00)
 http://ggastebois.free.fr/lide90_snoop/test_24 (for tests with 0x1a=24)
 
 The number in the tar name is the value off 0x6c. I think looking at
 0x6c=32 or 3a is very interesting.
 
 Why sane always produces black images with same 0x1a value as windows
 driver 
 
 Regards
 Guillaume
 
 ps. : Pierre can you send me a sample entropy processed offset image to
 see what I must obtain. Thank you.




[sane-devel] LiDE 90 Half CCD

2008-04-09 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I see in genesys_gl841.c line 2503 :
 
 /* gpio part. here: for canon lide 35 */
 
 r = sanei_genesys_get_address (reg, 0x6c);
 if (half_ccd)
   r-value = ~0x80;
 else
   r-value |= 0x80;
 
 Does it mean that for LiDE 35 GPIO16 is half CCD IO ? Because in LiDE 90, I
 identify GPIO 14 for that.

The GPIO16 is used as half CCD IO. Correct.

 Another thing : In windows snoop, only GPIO 14, 13, 12 and 11 changes state. 
 Is
 it possible that scanner need different gpio state between calibration and
 scanning (and different calibration phases) ? Where to add gpio state change
 code in backend to change gpio between different phases ?

There is no way to know what GPIO 11, 12, 13 do without some experiments 
(or tracing the wires on the pcb, which i advise against).

For example, one GPIO could shut off the LED drivers(thus making black 
level calibration easier), another could be used to save power(as is 
GPIO 9 in Canon LiDE 35).

Currently, i think the only possibly useful GPIOs for calibration and 
scanning are the half ccd and the black led selectors, of which the 
latter is not needed(At least my scanner does not need it, even when 
doing black-level calibration on a white target).

 Thank you.
 
 Regards
 Guillaume

Regards,
   Pierre




[sane-devel] Canon LiDE 90

2008-04-06 Thread Pierre Willenbrock
Hi Guillaume,

Sorry for not answering sooner.

Guillaume Gastebois schrieb:
 Hello,
 
 Selon Pierre Willenbrock :
 Guillaume Gastebois schrieb:
  Hello,
   Yesterday I added CCD_CANONLIDE90 in genesys.c. I did two 
 successive scans
  (result on http://ggastebois.free.fr/lide90_snoop/25_test1.zip).
  The first one gives a bright image (1_test1.txt), the second a dark 
 image
  (3_test1.txt). Which log seeems to be the best for calibration ? (in
  3_test1.txt, I see device I/O errors !!!)
  What are good values for offset_calibration: black/white pixels ?
   Another thing : Pierre, you send me few weeks ago a code named 
 entropy2D.c. I
  compile it with : gcc -c entropy2D.c, gcc -lm -o entropy2D 
 entropy2D.o. No
  errors. I call it with entropy2D ./offset1_1.pnm and it makes 
 nothing and newer
  gives hand back !!! What did I wrong ??? (I want to test common 
 nibbles).

 it accepts data on stdin, and outputs a pgm on stdout:
 ./entropy2D  ./offset1_1.pnm  histogram.pgm
 
 OK, works. Can you tell me what you think about attached image 
 (entropy2D of offset1_1.pnm) ?

The stairs at the top show that for two adjacent bytes, if the first 
byte is 0x00, the probability is high for the next byte to be in the 
range of 0x00 to 0x1f or 0x80 to 0x7f, for 0x02 the same with 0x20 to 
0x3f and 0xa0 to 0xbf:
0x00: 0x00..0x1f, 0x80..0x9f
0x02: 0x20..0x3f, 0xa0..0xbf
0x04: 0x40..0x5f, 0xc0..0xdf
0x06: 0x60..0x7f, 0xe0..0xff
Interestingly, the least significant bit of the first byte is nearly 
always 0. If it is not, it seems the second byte is then
0x01: 0x10..0x1f, 0x90..0x9f
0x03: 0x30..0x3f, 0xb0..0xbf
0x05: 0x50..0x5f, 0xd0..0xdf
At the left there are uncorrelated adjacent bytes(probably the second 
byte of one sample and the first byte of the next). Here, the lsb of the 
(now) second byte is nearly always 0, supporting the theory above.

This leads to my theory, that the higher nibble of second byte 
duplicates the lower nibble of the first byte, except for bit7, which 
seems uncorrelated.

Ideally, the first and second byte of a data sample are uncorrelated, 
leading to a uniform strip at the top and the left(very much like there 
is already on the left, but without the vertical bars).


  For scanner locks up writing 0x41=0xf4, It signify that scanner 
 things he's not
  hat home position. (home position : 0x41=0xfc). I thing it will be 
 interessting
  to move a little bit head. How to do that ? My explanation is that 
 on previous
  scan, the head has pressed home switch, but if head after that 
 moves (less than
  a millimeter is enought) switch can no more be pressed. So moving 
 back head may
  be usefull (but Isn't still made ?)

 To my knowledge, if the backend tests register 0x41, it thinks the 
 scanning head should be moving, but it apparently is not.

 
 I didn't see something important : it only apears on scanner powerup. 
 Locks up is away after pressing button 3 or 4 (not 1 ou 2 !). It's a 
 power up issue.

I can imagine that an incorrect setup of gpios leads to this.

   I did another ant work : comparing all regs from windows snoop to 
 sane and I
  find these differences :
   addr |sane   |windows|comments
  
 _|___|___|__
  

  09   |10 |21 |MCNTSET[1:0] CLKSET[1:0] BACKSCAN ENHANCE 
 SHORTTG NWAIT
  16   |20 |02 |CTRLHI TOSHIBA TGINV CK1INV CK2INV CTRLINV 
 CKDIS CTRLDIS
  19   |50 |ff |EXPDMY[7:0]
  1a   |00 |24 |X X MANUAL3 MANUAL1 CK4INV CK3INV LINECLP X
  1d   |02 |04 |CK4LOW CK3LOW CK1LOW TGSHLD[4:0]
  52   |02 |02 |RHI[4:0]
  53   |07 |04 |RLOW[4:0]
  54   |00 |02 |GHI[4:0]
  55   |00 |04 |GLOW[4:0]
  56   |00 |02 |BHI[4:0]
  57   |00 |04 |BLOW[4:0]
  5d   |00 |20 |HISPD[7:0]
  5e   |02 |41 |DECSEL[2:0] STOPTIM[4:0]
  5f   |00 |40 |FMOVDEC[7:0]
  67   |00 |40 |STEPSEL[1:0] MTRPWM[5:0]
  68   |00 |40 |FSTPSEL[1:0] FASTPWM[5:0]
  69   |00 |08 |FSHDEC[7:0]
  6a   |00 |04 |FMOVNO[7:0]
  70   |21 |05 |X X X RSH[4:0]
  72   |00 |07 |X X X CPH[4:0]
  73   |00 |09 |X X X CPL[4:0]
  75   |00 |01 |CK1MAP[15:8]
  76   |00 |ff |CK1MAP[7:0]
  79   |00 |3f |CK3MAP[7:0]
  7c   |00 |1e |CK4MAP[7:0]
  7d   |00 |11 |CK1NEG CK3NEG CK4NEG RSNEG CPNEG BSMPNEG 
 VSMPNEG DLYSET
  7f   |00 |50 |BSMPDLY[1:0] VSMPDLY[1:0] LEDCNT[3:0]
  82   |00 |0f |ROFFSET[7:0]
  84   |00 |0e |GOFFSET[7:0]
  86   |00 |0d |BOFFSET[7:0]
   I think regs 09, 16, 19, 1a, 1d, 52, 53, 54, 55, 56, 57, 70, 72, 
 73, 75, 76, 79,
  7c, 7d, 7f may be interessting, but I'll try to modify all.
 
 If i write 0x16=02, 0x1a=24 and 0x1d=04 : I get some bad image (gray 
 with horizontal black lines).
 
 With others regs, no change.

It could be interesting to play around with the other registers, when 
0x16/0x1a/0x1d are set.

   My next work

[sane-devel] Canon LiDE 90

2008-04-06 Thread Pierre Willenbrock
Pierre Willenbrock schrieb:
 
 Now for the real reason i am answering: I did play around with my 
 scanner, trying to get the shading calibration to work only on the white 
 strip. The trick was to do a real scan over the white strip, not just 
 sampling a single line over and over again. This is how it is done for 
 the gl646 side, but i did disable that in my test-version because it led 
 to fewer changes. For the LiDE 35, normally this is done, too, but over 
 the full calibration area, which contains a white and a black strip. 
 (That way, i get the white and black shading data in one scan. 
 Obviously, this is only possible when there _is_ a black strip.)

To clarify this, my patch (and probably your code base) does a scan over 
the strip, too.




[sane-devel] Canon LiDE 90

2008-03-26 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Yesterday I added CCD_CANONLIDE90 in genesys.c. I did two successive scans
 (result on http://ggastebois.free.fr/lide90_snoop/25_test1.zip).
 The first one gives a bright image (1_test1.txt), the second a dark image
 (3_test1.txt). Which log seeems to be the best for calibration ? (in
 3_test1.txt, I see device I/O errors !!!)
 What are good values for offset_calibration: black/white pixels ?
 
 Another thing : Pierre, you send me few weeks ago a code named entropy2D.c. I
 compile it with : gcc -c entropy2D.c, gcc -lm -o entropy2D entropy2D.o. No
 errors. I call it with entropy2D ./offset1_1.pnm and it makes nothing and 
 newer
 gives hand back !!! What did I wrong ??? (I want to test common nibbles).

it accepts data on stdin, and outputs a pgm on stdout:
./entropy2D  ./offset1_1.pnm  histogram.pgm

 For scanner locks up writing 0x41=0xf4, It signify that scanner things he's 
 not
 hat home position. (home position : 0x41=0xfc). I thing it will be 
 interessting
 to move a little bit head. How to do that ? My explanation is that on previous
 scan, the head has pressed home switch, but if head after that moves (less 
 than
 a millimeter is enought) switch can no more be pressed. So moving back head 
 may
 be usefull (but Isn't still made ?)

To my knowledge, if the backend tests register 0x41, it thinks the 
scanning head should be moving, but it apparently is not.

 
 I did another ant work : comparing all regs from windows snoop to sane and I
 find these differences :
 
 addr |sane   |windows|comments
 _|___|___|__
 09   |10 |21 |MCNTSET[1:0] CLKSET[1:0] BACKSCAN ENHANCE SHORTTG NWAIT
 16   |20 |02 |CTRLHI TOSHIBA TGINV CK1INV CK2INV CTRLINV CKDIS CTRLDIS
 19   |50 |ff |EXPDMY[7:0]
 1a   |00 |24 |X X MANUAL3 MANUAL1 CK4INV CK3INV LINECLP X
 1d   |02 |04 |CK4LOW CK3LOW CK1LOW TGSHLD[4:0]
 52   |02 |02 |RHI[4:0]
 53   |07 |04 |RLOW[4:0]
 54   |00 |02 |GHI[4:0]
 55   |00 |04 |GLOW[4:0]
 56   |00 |02 |BHI[4:0]
 57   |00 |04 |BLOW[4:0]
 5d   |00 |20 |HISPD[7:0]
 5e   |02 |41 |DECSEL[2:0] STOPTIM[4:0]
 5f   |00 |40 |FMOVDEC[7:0]
 67   |00 |40 |STEPSEL[1:0] MTRPWM[5:0]
 68   |00 |40 |FSTPSEL[1:0] FASTPWM[5:0]
 69   |00 |08 |FSHDEC[7:0]
 6a   |00 |04 |FMOVNO[7:0]
 70   |21 |05 |X X X RSH[4:0]
 72   |00 |07 |X X X CPH[4:0]
 73   |00 |09 |X X X CPL[4:0]
 75   |00 |01 |CK1MAP[15:8]
 76   |00 |ff |CK1MAP[7:0]
 79   |00 |3f |CK3MAP[7:0]
 7c   |00 |1e |CK4MAP[7:0]
 7d   |00 |11 |CK1NEG CK3NEG CK4NEG RSNEG CPNEG BSMPNEG VSMPNEG DLYSET
 7f   |00 |50 |BSMPDLY[1:0] VSMPDLY[1:0] LEDCNT[3:0]
 82   |00 |0f |ROFFSET[7:0]
 84   |00 |0e |GOFFSET[7:0]
 86   |00 |0d |BOFFSET[7:0]
 
 I think regs 09, 16, 19, 1a, 1d, 52, 53, 54, 55, 56, 57, 70, 72, 73, 75, 76, 
 79,
 7c, 7d, 7f may be interessting, but I'll try to modify all.
 
 My next work will be analysing windows snoop for gpio transaction.
 
 Regards
 Guillaume
 




[sane-devel] Canon LiDE 90

2008-03-20 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 You can find attached a patch which works like my original code (with 
 different contrast and calibration between 2 scans...).
 
 I removed controversed comments (sorry).

Thanks for the patch. I see that you added DAC_CANONLIDE90 at one place. 
  This is probably needed at others places, too. (especially in 
genesys.c, iirc the way to encode the shading calibration data depends 
on one of the xx_type variables.)

Then i see the LiDE 35's GPIO initialization sequence is used. Are you 
willing to play around with the involved bits to find the state 
transitions that don't reset the scanner? This is not strictly 
necessary, as the sequence works. But there may be some subtleties 
hiding there. Try adding delays between the state transitions when 
testing that, fast switching through the sequence sometimes leads to 
inconsistent results. (By state i mean the state of the gpio pins 
configured as output.)

For the LiDE 35 i found at least these constraints(i had a small state 
table that showed the allowed transitions, but i can't find it now):
- GPO17 cannot be switched on when GPIO8 is off
- GPIO9 cannot be switched off when GPIO8 is off

 I see in some case that my scanner locks writing : [genesys] 
 sanei_genesys_read_register (0x41, 0xf4) completed and to unlock I have 
 to push one of the 4 buttons !! Idea about that ?

The scan is not starting for some reason. I don't know what causes that. 
May be a power issue, depending on correctly setting the gpios or sth 
like that.

 Regards
 Guillaume

Regards,
   Pierre



[sane-devel] Canon LiDE 90

2008-03-20 Thread Pierre Willenbrock
Ralf Haueisen schrieb:
 I tried again, an now not even pressing a button help.
 What code do you need, and how can i get it?
 

Please try the patch from Guillaume Gastebois.

Regards,
   Pierre



[sane-devel] Canon LiDE 90

2008-03-20 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
   Hello,
  
   You can find attached a patch which works like my original code (with
   different contrast and calibration between 2 scans...).
  
   I removed controversed comments (sorry).

 Thanks for the patch. I see that you added DAC_CANONLIDE90 at one place.
   This is probably needed at others places, too. (especially in
 genesys.c, iirc the way to encode the shading calibration data depends
 on one of the xx_type variables.)

 DAC_CANONLIDE90 appears only in genesys_devices.c and genesys_gl841.c.

(i think you meant DAC_CANONLIDE35.) That is correct, but there is also 
CCD_CANONLIDE35, which is used in genesys.c when setting up the shading 
calibration data.

 
 Then i see the LiDE 35's GPIO initialization sequence is used. Are you
 willing to play around with the involved bits to find the state
 transitions that don't reset the scanner? This is not strictly
 necessary, as the sequence works. But there may be some subtleties
 
 If i dont add same constraint as lide 35 I get black image output.

see? mine does simply powercycle when trying to use it without that 
(not so) magic sequence.

 hiding there. Try adding delays between the state transitions when
 testing that, fast switching through the sequence sometimes leads to
 inconsistent results. (By state i mean the state of the gpio pins
 configured as output.)

 How to do that 

I used my small test program[1], modified to exercise the transitions of 
interest. As i mentioned above, my scanner is pretty unforgiving to the 
wrong sequence, so the program failed early when something went wrong.

 For the LiDE 35 i found at least these constraints(i had a small state
 table that showed the allowed transitions, but i can't find it now):
 - GPO17 cannot be switched on when GPIO8 is off
 - GPIO9 cannot be switched off when GPIO8 is off

   I see in some case that my scanner locks writing : [genesys]
   sanei_genesys_read_register (0x41, 0xf4) completed and to unlock I have
   to push one of the 4 buttons !! Idea about that ?

replugging does help, too? (If not, this may be interesting)

 The scan is not starting for some reason. I don't know what causes that.
 May be a power issue, depending on correctly setting the gpios or sth
 like that.
 
 The windows snoop may say that but I remember fixing gpio regs with thos
 snoop
 Must be investigated but later.
 
   Regards
   Guillaume

 Regards,
Pierre
 
 It remains the bigest problem : calibration. Because I get different
 contrast and sometimes vertical contrasted lines (bad shading). To be
 continued.

Another problem is the duplicated nibble in the data from the afe.

At least now there is a patch enabling basic support for this scanner, 
which could be integrated into sane without causing the other scanners 
to stop working.

 Regards
 Guillaume

Regards,
   Pierre

[1] http://pirsoft-dsl-dropzone.de/canon-lide35.tbz2



[sane-devel] Canon LiDE 90

2008-03-19 Thread Pierre Willenbrock
Hi Guillaume,

Pierre Willenbrock schrieb:
 Guillaume Gastebois schrieb:
 Pierre Willenbrock schrieb:
 But this seems to be basically working. Please send your changes leading
 to a usable scan, so i can integrate them.
 For now, my code is ugly. I only modified lide60 to lide90. But you can 
 find genesys_gl841.c and genesys_devices.c in 
 http://ggastebois.free.fr/lide90_snoop/sources
 
 Will merge that.
 

please check if the attached patch against current cvs gives basic 
scanning ability with the Canon LiDE 90.

Sorry for the delay.

Regards,
   Pierre
-- next part --
A non-text attachment was scrubbed...
Name: canon-lide-90.diff
Type: text/x-patch
Size: 7930 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080319/9f3fa7bd/attachment.bin
 


[sane-devel] Canon LiDE 90

2008-03-19 Thread Pierre Willenbrock
Volker Grabsch schrieb:
 On Wed, Mar 19, 2008 at 03:24:45PM +0100, Pierre Willenbrock wrote:
 +  ,
 +  /* CANONLIDE90 */
 +  {
 +/*
 +00 :
 +02 : image ?? la con et inverse video
 +0a : image ?? la con et inverse video et moteur ne stoppe pas ?? la fin du 
 scan
 +0e : ne reconnait plus la position home
 +10 : mieux toujours une ligne verticale ?? gauche et en inverse video
 +12 : comme 10
 +18 : comme 10
 +1a : comme 10
 +38 : image de tr??s bonne qualit?? mais ecras??e de 50% en largeur
 +3a : comme 38
 +3e : comme 0e
 +3c : le moteur essaye en vain de tourner
 +*/
 
 Why are these comments written in french instead of english?
 

These are from his original sources. I couldn't match the other two to 
the right values. The translation for these is somewhere in the mail 
archive, but i was too lazy to dig them out. I don't speak french, so 
i'd be grateful if someone translates the other two instances. On the 
other hand, it is probably better to put this info into the page of this 
scanner:
http://www.sane-project.org/unsupported/canon-lide-90.html

 Greets,
 
 Volker

Regards,
   Pierre



[sane-devel] Canon LiDE 90

2008-03-19 Thread Pierre Willenbrock
Ralf Haueisen schrieb:
 Hi.
 
 I just downloaded the current version from the CVS, an applied the patches. 
 But sane does not find the scanner.
 sane-find-scanner is ok, but scanimage not. in /etc/sane.d/genesys.conf I 
 have added the ID of the scanner.
 I tried everything as root, so acces-rights should not be the reason.
 
 Ralf
 

Does scanimage -L list the scanner? If not, i need to look deeper into 
the probing-code..

Regards,
   Pierre



[sane-devel] Canon LiDE 90

2008-03-19 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 
Volker Grabsch schrieb:
  On Wed, Mar 19, 2008 at 03:24:45PM +0100, Pierre Willenbrock wrote:
  +  ,
  +  /* CANONLIDE90 */
  +  {
  +/*
  +00 :
  +02 : image ?? la con et inverse video
  +0a : image ?? la con et inverse video et moteur ne stoppe 
 pas ?? la fin du scan
  +0e : ne reconnait plus la position home
  +10 : mieux toujours une ligne verticale ?? gauche et en 
 inverse video
  +12 : comme 10
  +18 : comme 10
  +1a : comme 10
  +38 : image de tr??s bonne qualit?? mais ecras??e de 50% en 
 largeur
  +3a : comme 38
  +3e : comme 0e
  +3c : le moteur essaye en vain de tourner
  +*/
 
  Why are these comments written in french instead of english?
 
   
 
 I'm the author of these unpolite comments. These were written for my 
 personnal information and developpement. I forget to delete them. I 
 think they must be deleted from patch.
 
 Regards
 
 Guillaume

I won't argue with the author, so i will not commit these comments. I 
see that my proposed patch does not work for at least one Canon LiDE 90 
owner. Does it work for you?

Regards,
   Pierre




[sane-devel] Canon LiDE 90

2008-03-11 Thread Pierre Willenbrock
Hi,

Guillaume Gastebois schrieb:
 Hello,
 
 
 What about only setting register 0x7f? that one should do something
 without needing to setup reg 0x1a.
 
 Not better I think. Result : 
 http://ggastebois.free.fr/lide90_snoop/10_test0.tar

I forgot that there is a switch-on-bit for that, too: bit0 of reg[0x7d].
Please try with that one set.
(And that tar seems to be truncated)

 I didn't expect reg[0x1a]=0x24 to work without setting the corresponding
 clock bit masks. What happens if you leave line 1159 commented and set
 regs 0x74-0x7d(my guess: works without changes in behaviour)? Does
 setting regs 0x71-0x73 change anything (line 1159 still commented)?

 Result of setting only 0x75 0x76 0x79 0x7c 0x7d (not 0x7f) : 
 http://ggastebois.free.fr/lide90_snoop/10_test1.tar
 
 Result of setting 0x71 0x72 0x73 0x75 0x76 0x79 0x7c 0x7d (not 0x7f) :
 http://ggastebois.free.fr/lide90_snoop/10_test2.tar

The same as without setting them at all. So the bits in 0x1a are
probably switching from some internal bit masks to those in 0x71 to
0x7c. And changing the switching point of RS didn't change anything, either.

 (I have only little understanding of the actual relative timing and use
 of all clock signals going out to the ccd/afe, so i am guessing and
 doing experiments.)

 But this seems to be basically working. Please send your changes leading
 to a usable scan, so i can integrate them.
 For now, my code is ugly. I only modified lide60 to lide90. But you can 
 find genesys_gl841.c and genesys_devices.c in 
 http://ggastebois.free.fr/lide90_snoop/sources

Will merge that.

 Another thing : when I make several scan with sane backend and sane 
 command line, I have alternatively brite and dark images !!! Why ???
 The calibration is probably giving widely differing results with
 different starting conditions. It swings between two states. But you
 shouldn't see this after the gl842 did its shading correction. Then, the
 problem is probably overexposure of the ccd cells. Try reducing the
 upper threshold in genesys_gl841.c:4383

if (avge  2000) {
expr = (expr * 2000) / avge;
expg = (expg * 2000) / avge;
expb = (expb * 2000) / avge;

 Reducing the lower threshold may be needed, too. The current values for
 your scanner are:
 expr: 1235
 expg: 1235
 expb: 675

 No guarantee that this helps at all.
 I tryed that (upper threshold to 1500 and lower to 250 and it doesn't 
 work. You can find the same test as test2 without the same result on : 
 http://ggastebois.free.fr/lide90_snoop/10_test2b.tar (I just make two 
 consecutive scanimage without recompiling sane).

That is not unexpected.

 One other thing : we can see vertical lines with different contrast on 
 result images. What is it ?

The shading correction not doing its work correctly. I see similar
behavior when using the method of scanning a single line multiple times
with/without lights for acquisition of dark/bright levels. I don't see
this when using a scan over my black+white calibration area. Currently,
i don't know what causes this difference.

 Regards
 Guillaume

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-03-09 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I'm back.
 
 Today I made two tests : one with un commenting line 1159 and adding 
 regs 0x71, 0x72, 0x73, 0x75, 0x76, 0x79, 0x7c, 0x7d, 0x7f in 
 gl841_init_registers.
 Result is a totally black image 
 (http://ggastebois.free.fr/lide90_snoop/04_test1.tar).
 
 The other is with un commenting line 1159 and without adding regs 0x71, 
 0x72, 0x73, 0x75, 0x76, 0x79, 0x7c, 0x7d, 0x7f in gl841_init_registers.
 Result is a totally black image too 
 (http://ggastebois.free.fr/lide90_snoop/04_test2.tar).

What about only setting register 0x7f? that one should do something
without needing to setup reg 0x1a.

I didn't expect reg[0x1a]=0x24 to work without setting the corresponding
clock bit masks. What happens if you leave line 1159 commented and set
regs 0x74-0x7d(my guess: works without changes in behaviour)? Does
setting regs 0x71-0x73 change anything (line 1159 still commented)?

(I have only little understanding of the actual relative timing and use
of all clock signals going out to the ccd/afe, so i am guessing and
doing experiments.)

But this seems to be basically working. Please send your changes leading
to a usable scan, so i can integrate them.

Regards,
  Pierre

 Regards
 Guillaume
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 I modified these registers. But the scanner locks writting continiously :
 [genesys] sanei_genesys_read_register (0x41, 0xf4) completed.

 I modified 0x1a=0x24 and 0x1d=0x02 in Genesys_Sensor. In log I see 
 0x1d=0x02 but 0x1a=0x00 ??
 For the missing change of 0x1a: The code block for setting this value
 (along with 0x1b..0x1d, which is then hardcoded to 0x02) is commented
 out, genesys_gl841.c:1159. This is probably the case, because they were
 not needed for my specific scanner.

 I cannot explain the lockup. I'd play around with different sets of
 registers and see if they work. But i guess, register 0x1a is a key to
 get the rest working.

 I will be long for next answer as I take one week holidays !
 I hope you had a nice week holidays.

 Regards,
   Pierre

 regards
 Guillaume

 Pierre Willenbrock a ?crit :
 Hi,

 Guillaume Gastebois schrieb:
 Hello,

 So, we need to check what parts of the clocking we need to setup
 differently.

 Candidates:

 reg   sane  windows
 0x1a  0x00  0x24 enable clock 3,4 manual output, invert clock 4
 0x1d  0x04  0x02 just a smaller toggle shoulder.
 0x71  0x00  0x05 RS signal seems to be not used.
 0x72  0x00  0x07 CP signal seems to be not used.
 0x73  0x00  0x09 CP signal seems to be not used.
 0x75  0x00  0x01 clock 1 bitmap
 0x76  0x00  0xff clock 1 bitmap
 0x79  0x00  0x3f clock 3 bitmap
 0x7c  0x00  0x1e clock 4 bitmap
 0x7d  0x00  0x11 change RS on falling edge of system clock, use DLY
 0x7f  0x00  0x50 delay each of BSMP and VSMP by 8.33ns (DLY)

 The clock 1 stuff seems to be not needed, as it is in automatic mode.
 But clock 3/4 look interesting. The delay of BSMP/VSMP may be useful, 
 too.

 0x1a was still 0x24. I modified 0x1d which was 0x04 to 0x02. Result is 
 on http://ggastebois.free.fr/lide90_snoop/22_test1.tar.

 I doesn't find where to modify 0x71-0x7f !!!
 Add them to gl841_init_registers.

 Another thing : I always have a brither vertical line where there is a
 small black rectangle in the calibration area.
 The small black rectangle is included when acquiring the white level.
 Reduce shading_lines(second to last entry) in Genesys_Model to 250, that
 way it is not seen anymore.

 Done, works.

 Oh, and please update from cvs again. A small mistake in
 gl841_bulk_write_registers made the debug register dumps useless.

 Done.


 Another thing : when I make several scan with sane backend and sane 
 command line, I have alternatively brite and dark images !!! Why ???
 The calibration is probably giving widely differing results with
 different starting conditions. It swings between two states. But you
 shouldn't see this after the gl842 did its shading correction. Then, the
 problem is probably overexposure of the ccd cells. Try reducing the
 upper threshold in genesys_gl841.c:4383

  if (avge  2000) {
  expr = (expr * 2000) / avge;
  expg = (expg * 2000) / avge;
  expb = (expb * 2000) / avge;

 Reducing the lower threshold may be needed, too. The current values for
 your scanner are:
 expr: 1235
 expg: 1235
 expb: 675

 No guarantee that this helps at all.

 Regards
 Guillaume
 Further, we need to figure out a way to get the LEDs go completely dark.
 0x101 is just about half of 675. I will experiment a bit with my
 scanner, to find out if the gl842 can do that.

 Regards,
   Pierre




 




[sane-devel] Canon LiDE 90

2008-03-01 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I modified these registers. But the scanner locks writting continiously :
 [genesys] sanei_genesys_read_register (0x41, 0xf4) completed.
 
 I modified 0x1a=0x24 and 0x1d=0x02 in Genesys_Sensor. In log I see 
 0x1d=0x02 but 0x1a=0x00 ??

For the missing change of 0x1a: The code block for setting this value
(along with 0x1b..0x1d, which is then hardcoded to 0x02) is commented
out, genesys_gl841.c:1159. This is probably the case, because they were
not needed for my specific scanner.

I cannot explain the lockup. I'd play around with different sets of
registers and see if they work. But i guess, register 0x1a is a key to
get the rest working.

 I will be long for next answer as I take one week holidays !

I hope you had a nice week holidays.

Regards,
  Pierre

 regards
 Guillaume
 
 Pierre Willenbrock a ?crit :
 Hi,

 Guillaume Gastebois schrieb:
 Hello,

 So, we need to check what parts of the clocking we need to setup
 differently.

 Candidates:

 reg   sane  windows
 0x1a  0x00  0x24 enable clock 3,4 manual output, invert clock 4
 0x1d  0x04  0x02 just a smaller toggle shoulder.
 0x71  0x00  0x05 RS signal seems to be not used.
 0x72  0x00  0x07 CP signal seems to be not used.
 0x73  0x00  0x09 CP signal seems to be not used.
 0x75  0x00  0x01 clock 1 bitmap
 0x76  0x00  0xff clock 1 bitmap
 0x79  0x00  0x3f clock 3 bitmap
 0x7c  0x00  0x1e clock 4 bitmap
 0x7d  0x00  0x11 change RS on falling edge of system clock, use DLY
 0x7f  0x00  0x50 delay each of BSMP and VSMP by 8.33ns (DLY)

 The clock 1 stuff seems to be not needed, as it is in automatic mode.
 But clock 3/4 look interesting. The delay of BSMP/VSMP may be useful, too.

 0x1a was still 0x24. I modified 0x1d which was 0x04 to 0x02. Result is 
 on http://ggastebois.free.fr/lide90_snoop/22_test1.tar.

 I doesn't find where to modify 0x71-0x7f !!!
 Add them to gl841_init_registers.

 Another thing : I always have a brither vertical line where there is a
 small black rectangle in the calibration area.
 The small black rectangle is included when acquiring the white level.
 Reduce shading_lines(second to last entry) in Genesys_Model to 250, that
 way it is not seen anymore.

 Done, works.

 Oh, and please update from cvs again. A small mistake in
 gl841_bulk_write_registers made the debug register dumps useless.

 Done.


 Another thing : when I make several scan with sane backend and sane 
 command line, I have alternatively brite and dark images !!! Why ???
 The calibration is probably giving widely differing results with
 different starting conditions. It swings between two states. But you
 shouldn't see this after the gl842 did its shading correction. Then, the
 problem is probably overexposure of the ccd cells. Try reducing the
 upper threshold in genesys_gl841.c:4383

if (avge  2000) {
expr = (expr * 2000) / avge;
expg = (expg * 2000) / avge;
expb = (expb * 2000) / avge;

 Reducing the lower threshold may be needed, too. The current values for
 your scanner are:
 expr: 1235
 expg: 1235
 expb: 675

 No guarantee that this helps at all.

 Regards
 Guillaume
 Further, we need to figure out a way to get the LEDs go completely dark.
 0x101 is just about half of 675. I will experiment a bit with my
 scanner, to find out if the gl842 can do that.

 Regards,
   Pierre


 




[sane-devel] Canon LiDE 90

2008-02-23 Thread Pierre Willenbrock
Hi,

Guillaume Gastebois schrieb:
 Hello,
 
 So, we need to check what parts of the clocking we need to setup
 differently.

 Candidates:

 reg   sane  windows
 0x1a  0x00  0x24 enable clock 3,4 manual output, invert clock 4
 0x1d  0x04  0x02 just a smaller toggle shoulder.
 0x71  0x00  0x05 RS signal seems to be not used.
 0x72  0x00  0x07 CP signal seems to be not used.
 0x73  0x00  0x09 CP signal seems to be not used.
 0x75  0x00  0x01 clock 1 bitmap
 0x76  0x00  0xff clock 1 bitmap
 0x79  0x00  0x3f clock 3 bitmap
 0x7c  0x00  0x1e clock 4 bitmap
 0x7d  0x00  0x11 change RS on falling edge of system clock, use DLY
 0x7f  0x00  0x50 delay each of BSMP and VSMP by 8.33ns (DLY)

 The clock 1 stuff seems to be not needed, as it is in automatic mode.
 But clock 3/4 look interesting. The delay of BSMP/VSMP may be useful, too.

 
 0x1a was still 0x24. I modified 0x1d which was 0x04 to 0x02. Result is 
 on http://ggastebois.free.fr/lide90_snoop/22_test1.tar.
 
 I doesn't find where to modify 0x71-0x7f !!!

Add them to gl841_init_registers.

 Another thing : I always have a brither vertical line where there is a
 small black rectangle in the calibration area.
 The small black rectangle is included when acquiring the white level.
 Reduce shading_lines(second to last entry) in Genesys_Model to 250, that
 way it is not seen anymore.

 
 Done, works.
 
 Oh, and please update from cvs again. A small mistake in
 gl841_bulk_write_registers made the debug register dumps useless.

 
 Done.
 
 
 Another thing : when I make several scan with sane backend and sane 
 command line, I have alternatively brite and dark images !!! Why ???

The calibration is probably giving widely differing results with
different starting conditions. It swings between two states. But you
shouldn't see this after the gl842 did its shading correction. Then, the
problem is probably overexposure of the ccd cells. Try reducing the
upper threshold in genesys_gl841.c:4383

  if (avge  2000) {
  expr = (expr * 2000) / avge;
  expg = (expg * 2000) / avge;
  expb = (expb * 2000) / avge;

Reducing the lower threshold may be needed, too. The current values for
your scanner are:
expr: 1235
expg: 1235
expb: 675

No guarantee that this helps at all.

 Regards
 Guillaume

Further, we need to figure out a way to get the LEDs go completely dark.
0x101 is just about half of 675. I will experiment a bit with my
scanner, to find out if the gl842 can do that.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-22 Thread Pierre Willenbrock
Hi,

Guillaume Gastebois schrieb:
 Hello,
 
 I updated from CVS and modified flag GENESYS_FLAG_DARK_WHITE_CALIBRATION
 in GENESYS_FLAG_DARK_CALIBRATION.
 
 Summary of current modifications :
 genesys_devices.c : see attachment
 genesys_gl841.c : added SCAN_FLAG_DISABLE_LAMP (line 4461),
 commented status = gl841_feed(dev, 280) (line 4241 and 4843), modified
 0 to 150 in for (i = 150; i  num_pixels; i++) (line 4617 and 4733).
   ^^^ 450 is probably still better.
 
 Tonight I play with 52-57 regs.
 
 I test 01/03/00/00/00/00, 01/04/00/00/00/00, 01/05/00/00/00/00,
 02/03/00/00/00/00, 02/04/00/00/00/00, 02/05/00/00/00/00.

None of these are perfect, the best seems to be 2/4.

I thought a bit about these results, and conclude that this scanner does
not use a WM819x, which can output 2*8 bits, but instead uses one which
only does 4*4bits. This also matches that the chip did not react when
changing the data output mode.

As the GL842 cannot handle that format, another chip is put in between,
converting the 4*4 to 2*8bits. This way, when the analog frontend is
located in the scanning head, it is only needed to wire 4 data pins
instead of 8.

For correct timing, this seems to need additional clocks. We seem to be
always sampling on the signal edge, which leads to the glitches in the data.

(The chip in between is very probably the VHC175, latching its inputs on
the higher 4 bits from the AFE. Then, when the lower 4 bits are
available, the GL842 reads them directly from the AFE, together with the
high bits from the VHC175. Just the clock used by the VHC175 is not known.)

So, we need to check what parts of the clocking we need to setup
differently.

Candidates:

reg   sane  windows
0x1a  0x00  0x24 enable clock 3,4 manual output, invert clock 4
0x1d  0x04  0x02 just a smaller toggle shoulder.
0x71  0x00  0x05 RS signal seems to be not used.
0x72  0x00  0x07 CP signal seems to be not used.
0x73  0x00  0x09 CP signal seems to be not used.
0x75  0x00  0x01 clock 1 bitmap
0x76  0x00  0xff clock 1 bitmap
0x79  0x00  0x3f clock 3 bitmap
0x7c  0x00  0x1e clock 4 bitmap
0x7d  0x00  0x11 change RS on falling edge of system clock, use DLY
0x7f  0x00  0x50 delay each of BSMP and VSMP by 8.33ns (DLY)

The clock 1 stuff seems to be not needed, as it is in automatic mode.
But clock 3/4 look interesting. The delay of BSMP/VSMP may be useful, too.

 Result of experiment can be found on :
 http://ggastebois.free.fr/lide90_snoop/21_tests.tar
 
 Is that true that as written in genesys_devices.c : /*[GB](HI|LOW) not
 needed for cis */ because bests results are found with regs 52-57 with
 01/03/05/07/09/11 !! Results of this test on :
 http://ggastebois.free.fr/lide90_snoop/21_test2.tar

Sorry, that one does look no better than the 01/03/00/00/00/00 variant.
Anyway, color scans would be missing colors if [GB](HI|LOW) were used.

 Another thing : I always have a brither vertical line where there is a
 small black rectangle in the calibration area.

The small black rectangle is included when acquiring the white level.
Reduce shading_lines(second to last entry) in Genesys_Model to 250, that
way it is not seen anymore.

 To finish, I find that images seems to be more in relief as reality. Do
 you understand what I say ? To speak clearly, when there is 0.1mm real
 relief between paper and glass, on the image we have an impression of
 1mm relief ! Why 

I don't know if you think of the same thing as i do, but the light and
optics are probably looking at the original at an angle, thus increasing
the size of shadows and other structures.

 Regards
 Guillaume


 P.S. : Where is located this new code for GENESYS_FLAG_DARK_CALIBRATION
 ? I used meld to see differences between my genesys_gl841.c file and
 this from CVS and only see my modifications !!!

The only thing that was missing was disabling the lamp when the
genesys_dark_shading_calibration requests that. That change is just the
small bit in genesys_gl841.c, gl841_set_lamp_power.

Oh, and please update from cvs again. A small mistake in
gl841_bulk_write_registers made the debug register dumps useless.

Regards,
  Pierre

 Pierre Willenbrock a ?crit :
 Pierre Willenbrock schrieb:
 Hi,

 Guillaume Gastebois schrieb:
 Hello,

 So, what's the next step ? Re-enabling shading ?
 Yes, but only after the shading-calibration is able to get black level
 information.(This really needs a better api..)

 I commited a prerequisite for shading calibration to work for your
 scanner. When enabling shading, update from cvs and then use
 GENESYS_FLAG_DARK_CALIBRATION instead of
 GENESYS_FLAG_DARK_WHITE_CALIBRATION.

 Regards,
   Pierre

 Do you think that last modification for (i = 150; i... is necessary ?
 Yes. Some time back, that part of the code just used the middle half of
 the scan, exactly to drop the dummy black pixels at the begin. That
 didn't work too well, missing some low black levels.

 Is it time to fine tune registers 52... ?
 Try

[sane-devel] Canon LiDE 90

2008-02-21 Thread Pierre Willenbrock
Pierre Willenbrock schrieb:
 Hi,
 
 Guillaume Gastebois schrieb:
 Hello,

 So, what's the next step ? Re-enabling shading ?
 
 Yes, but only after the shading-calibration is able to get black level
 information.(This really needs a better api..)

I commited a prerequisite for shading calibration to work for your
scanner. When enabling shading, update from cvs and then use
GENESYS_FLAG_DARK_CALIBRATION instead of
GENESYS_FLAG_DARK_WHITE_CALIBRATION.

Regards,
  Pierre

 Do you think that last modification for (i = 150; i... is necessary ?
 
 Yes. Some time back, that part of the code just used the middle half of
 the scan, exactly to drop the dummy black pixels at the begin. That
 didn't work too well, missing some low black levels.
 
 Is it time to fine tune registers 52... ?
 
 Try increasing register 53, 55, 57 by one. Attached is a small program,
 that shows the probability of any two-byte pair appearing in a file. It
 takes the file as input and dumps an portable anymap(pnm) as output.
 I created that program for something completely unrelated, but it proved
 useful.
 
 I used it on offset1_1.pnm(as offset1_0.pnm is only black).
 The image should show a fuzzy vertical and horizontal bar, near
 top/left. Currently, the horizontal bar is more a line, the vertical bar
 is correct(it shows the relationship between the low byte of one pixel
 and the high byte of the _next_ pixel).
 
 Regards
 Guillaume
 
 Regards,
   Pierre
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 Yep, I write for (j = 150; j instead of for (i = 150; i.
 Now second set seems good. Result is on : 
 http://ggastebois.free.fr/lide90_snoop/20_test1.tar

 Hi,

 i am sorry, i actually wanted 450, but didn't realize until just now. I
 missed that the calibration dump images are really grayscale images,
 although stored in color pnms. 1 pixel in image is 3 pixels for the
 calibration...

 I hope this fixes that part of the calibration.

 Regards,
   Pierre

 Regards
 Guillaume

 




[sane-devel] Canon LiDE 90

2008-02-21 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Selon Pierre Willenbrock pierre at pirsoft.dnsalias.org:
 
 Hi,

 Guillaume Gastebois schrieb:
 Hello,

 So, what's the next step ? Re-enabling shading ?
 Yes, but only after the shading-calibration is able to get black level
 information.(This really needs a better api..)
 
 How to do that ? Do you mean a better api adapted to lide 90 or for all 
 genesys
 backend ? Do you have some code ?

It is not as bad as i initially thought, the functions for receiving
black/white level information for shading are already available. But
there is some code duplication between genesys.c and
genesys_gl841.c/genesys_gl646.c. All three need to gather black/white
level information, for the various calibrations.

 Do you think that last modification for (i = 150; i... is necessary ?
 Yes. Some time back, that part of the code just used the middle half of
 the scan, exactly to drop the dummy black pixels at the begin. That
 didn't work too well, missing some low black levels.

 Is it time to fine tune registers 52... ?
 Try increasing register 53, 55, 57 by one. Attached is a small program,
 that shows the probability of any two-byte pair appearing in a file. It
 takes the file as input and dumps an portable anymap(pnm) as output.
 I created that program for something completely unrelated, but it proved
 useful.

 I used it on offset1_1.pnm(as offset1_0.pnm is only black).
 The image should show a fuzzy vertical and horizontal bar, near
 top/left. Currently, the horizontal bar is more a line, the vertical bar
 is correct(it shows the relationship between the low byte of one pixel
 and the high byte of the _next_ pixel).

 OK, interesting program. I'll try it tonight.
 
 One more thing, what are you thinking about output image quality ? Is that
 normal with todays calibration or is it another problem ?

Well, i, for one, can see the impurities of the white inside of the
scanner lid. There are only very faint vertical lines, if at all.
Example attached.

 Regards
 Guillaume
 
 Regards
 Guillaume
 Regards,
   Pierre

 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 Yep, I write for (j = 150; j instead of for (i = 150; i.
 Now second set seems good. Result is on :
 http://ggastebois.free.fr/lide90_snoop/20_test1.tar

 Hi,

 i am sorry, i actually wanted 450, but didn't realize until just now. I
 missed that the calibration dump images are really grayscale images,
 although stored in color pnms. 1 pixel in image is 3 pixels for the
 calibration...

 I hope this fixes that part of the calibration.

 Regards,
   Pierre

 Regards
 Guillaume


 
 
 

-- next part --
A non-text attachment was scrubbed...
Name: canon-lide-35-example.jpg
Type: image/jpeg
Size: 6061 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080221/bebc286c/attachment.jpg
 


[sane-devel] Canon LiDE 90

2008-02-20 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Yep, I write for (j = 150; j instead of for (i = 150; i.
 Now second set seems good. Result is on : 
 http://ggastebois.free.fr/lide90_snoop/20_test1.tar
 

Hi,

i am sorry, i actually wanted 450, but didn't realize until just now. I
missed that the calibration dump images are really grayscale images,
although stored in color pnms. 1 pixel in image is 3 pixels for the
calibration...

I hope this fixes that part of the calibration.

Regards,
  Pierre

 Regards
 Guillaume
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 I modified lines 4596 and 4712 and reenable SCAN_FLAG_DISABLE_LAMP flag.
 Result can be found on : http://ggastebois.free.fr/lide90_snoop/19_test1.tar
 Okay, results look good so far:
 [genesys_gl841] gl841_offset_calibration: first set: 191/683,191/482,191/76

 but there must be a little bug in the code:
 [genesys_gl841] gl841_offset_calibration: second set:
 0/-1080773208,8/-1212144018,-1080773236/134721688

 this very much looks like the variables for the second set are getting
 overwritten/not initialized. Please try to find the problem(misplaced
 brackets perhaps? copy+pasto when calculating the second set?), or send
 the source.

 Regards,
   Pierre

 Regards
 Guillaume

 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 OK, I'll try this tonight. What is the best : WITH or WITHOUT
 SCAN_FLAG_DISABLE_LAMP ?
 Not using SCAN_FLAG_DISABLE_LAMP is a bit counter productive when trying
 to get black levels on a white-only calibration area.

 Regards,
   Pierre

 Regards
 Guillaume

 Selon Pierre Willenbrock pierre at pirsoft.dnsalias.org:

 Guillaume Gastebois schrieb:
 Hello,

 I made two tests today :

 test 1 : too bright/too dard = 10/65525 WITH flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test1.tar

 test 2 : too bright/too dard = 10/65525 WITHOUT flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test2.tar

 Not what i expected, although the debug images are looking good.

 Please try to change the first pixel used for minimum calculation to 200
 at about lines 4596 and 4712:
 -  for (i = 0; i  num_pixels; i++)
 +  for (i = 150; i  num_pixels; i++)
   {
if (dev-model-is_cis)
val =


 Regards,
   Pierre



 




[sane-devel] Canon LiDE 90

2008-02-19 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 OK, I'll try this tonight. What is the best : WITH or WITHOUT
 SCAN_FLAG_DISABLE_LAMP ?

Not using SCAN_FLAG_DISABLE_LAMP is a bit counter productive when trying
to get black levels on a white-only calibration area.

Regards,
  Pierre

 
 Regards
 Guillaume
 
 Selon Pierre Willenbrock pierre at pirsoft.dnsalias.org:
 
 Guillaume Gastebois schrieb:
 Hello,

 I made two tests today :

 test 1 : too bright/too dard = 10/65525 WITH flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test1.tar

 test 2 : too bright/too dard = 10/65525 WITHOUT flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test2.tar

 Not what i expected, although the debug images are looking good.

 Please try to change the first pixel used for minimum calculation to 200
 at about lines 4596 and 4712:
 -  for (i = 0; i  num_pixels; i++)
 +  for (i = 150; i  num_pixels; i++)
   {
if (dev-model-is_cis)
val =


 Regards,
   Pierre

 
 
 




[sane-devel] Canon LiDE 90

2008-02-19 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I modified lines 4596 and 4712 and reenable SCAN_FLAG_DISABLE_LAMP flag.
 Result can be found on : http://ggastebois.free.fr/lide90_snoop/19_test1.tar

Okay, results look good so far:
[genesys_gl841] gl841_offset_calibration: first set: 191/683,191/482,191/76

but there must be a little bug in the code:
[genesys_gl841] gl841_offset_calibration: second set:
0/-1080773208,8/-1212144018,-1080773236/134721688

this very much looks like the variables for the second set are getting
overwritten/not initialized. Please try to find the problem(misplaced
brackets perhaps? copy+pasto when calculating the second set?), or send
the source.

Regards,
  Pierre

 Regards
 Guillaume
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 OK, I'll try this tonight. What is the best : WITH or WITHOUT
 SCAN_FLAG_DISABLE_LAMP ?
 Not using SCAN_FLAG_DISABLE_LAMP is a bit counter productive when trying
 to get black levels on a white-only calibration area.

 Regards,
   Pierre

 Regards
 Guillaume

 Selon Pierre Willenbrock pierre at pirsoft.dnsalias.org:

 Guillaume Gastebois schrieb:
 Hello,

 I made two tests today :

 test 1 : too bright/too dard = 10/65525 WITH flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test1.tar

 test 2 : too bright/too dard = 10/65525 WITHOUT flag :
 SCAN_FLAG_DISABLE_LAMP. Result can bee found on :
 http://ggastebois.free.fr/lide90_snoop/18_test2.tar

 Not what i expected, although the debug images are looking good.

 Please try to change the first pixel used for minimum calculation to 200
 at about lines 4596 and 4712:
 -  for (i = 0; i  num_pixels; i++)
 +  for (i = 150; i  num_pixels; i++)
   {
  if (dev-model-is_cis)
  val =


 Regards,
   Pierre




 




[sane-devel] Canon LiDE 90

2008-02-18 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I try both {0x00, 0x3f, 0x03, 0x26}, and {0x00, 0x3f, 0x00, 0x26},
 you can find result under :
 http://ggastebois.free.fr/lide90_snoop/17_test1.tar
 and http://ggastebois.free.fr/lide90_snoop/17_test2.tar

Looks a lot better. The offset*.pnm actually show a black image,
coarse.pnm is gray. That is good.

I suspect you are still running with the change in thresholds?:
@@ -4545,9 +4546,9 @@
  val =
  first_line[i * 2 * channels + 2 * j + 1] * 256 +
  first_line[i * 2 * channels + 2 * j];
- if (val  10)
+ if (val  1000)
  cmin[j]++;
- if (val  65525)
+ if (val  4)
  cmax[j]++;
  }

Please undo that change. Should give you a nice 2-3-step offset
calibration, that actually works(at least i hope so).

Regarding the output format of the AFE, stay with {0x00, 0x3f, 0x03,
0x26} for now. This does not seem to make any difference, but there are
suspicously many 16 bit words with the binary pattern
 .fgh .fgh (that is, the two middle nibbles share the lower 3
bits). We may be sampling the digital image data at the wrong times. As
the most significant byte seems to come through correctly, this does not
need immediate fixing. (On a second thought, this may affect the offset
calibration. See the thesholds. We'll see.)

Regards,
  Pierre



[sane-devel] About the GL646(_HP) and future release of SANE

2008-02-17 Thread Pierre Willenbrock
Vidar S?terb? schrieb:
 Hi,
 
 FYI, I was googling for information on the GL646 (I have a HP Scanjet
 2400) when I came across this datasheet:
 http://www.ic-on-line.cn/IOL_gl646/PdfView/833184.htm
 

Another source for that datasheet is probably
http://www.genesyslogic.com/_en/product_01_1.php?id=44

 Cheers,
 Vidar

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-17 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 You can find the result of this test here :
 
 http://ggastebois.free.fr/lide90_snoop/no_shading_2bright_2dark.tar
 
 The calibration is about 25s long.
 Resulting image is bad (as befor).
 

Please try with bit 4+5 of frontend setup register 1 set to 3:
{0x00, 0x3f, 0x03, 0x26},
...

And, while you are at it, try if you can get setup register 2, bits 0+1
set to 0 to work. that may affect the position of the data, so you may
need to fiddle with gl842 registers 0x52-0x57.

 Regards
 Guillaume

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-15 Thread Pierre Willenbrock
Pierre Willenbrock schrieb:
 Guillaume Gastebois schrieb:
 Hello,

 You can find all of that on : 
 http://ggastebois.free.fr/lide90_snoop/no_shading.tar

 What seems strange in calibration ?

 
 The minimum/maximum values retrieved from the scans do not scale with
 the offset values, but in a rather random manner. The calibration
 expects a linear relationship.
 
 Regards,
   Pierre
 

Hi,

the raw offset calibration data looks horrible. Too bright and noisy.
Please change the too bright/too dark thresholds for
gl841_offset_calibration in genesys_gl841.c like this:

@@ -4545,9 +4546,9 @@
  val =
  first_line[i * 2 * channels + 2 * j + 1] * 256 +
  first_line[i * 2 * channels + 2 * j];
- if (val  10)
+ if (val  1000)
  cmin[j]++;
- if (val  65525)
+ if (val  4)
  cmax[j]++;
  }

Send/Put online the debug files offset*.pnm, and the
gl841_offset_calibration: acceptable offsets:  lines from the debug
output(Or the whole set, whichever is more convenient ;-)).

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-14 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 You can find all of that on : 
 http://ggastebois.free.fr/lide90_snoop/no_shading.tar
 
 What seems strange in calibration ?
 

The minimum/maximum values retrieved from the scans do not scale with
the offset values, but in a rather random manner. The calibration
expects a linear relationship.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-13 Thread Pierre Willenbrock
Pierre Willenbrock schrieb:
 Guillaume Gastebois schrieb:
 Hello,

 I see that reg[2] was like 0x07. So INVOP was still set !!!
 I comment out offset_calibration in genesys_flatbed_calibration, set 
 reg[2] to 0x03, and I get a black image with a gray vertical line in the 
 middle !!!
 I try to reenable offset_calibration and I get : 
 http://ggastebois.free.fr/lide90_snoop/toto_10_0_0_invop_0.jpg
 In the central vertical line we can see a piece of my dinosause not 
 reverted !!! I think this works. And good news : the frontend seems to 
 be (or to be compatible) with a wolfson wm8199.

 If you remember, this gray line is on the vertical of the small black 
 piece (in calibration area). So calibration is better with black area !!

 
 hmm. the shading calibration currently needs some black to work. But
 good news. Now, where did i put that alternative offset_calibration code...
 

obviously, in cvs, while thinking i'd only put the power-mode changes
in.. The needed change is a one liner..

This should compile, but i don't know if it works. The shading
calibration should still be commented out. offset_calibration,
gain_calibration and led_calibration might work.

Regards,
  Pierre
-- next part --
A non-text attachment was scrubbed...
Name: offset-calib.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080213/25da0826/attachment.bin
 


[sane-devel] genesys_gl841.c: infinite loops

2008-02-13 Thread Pierre Willenbrock
Pierre Willenbrock schrieb:
 Stefan Lucke schrieb:
 Hi,
 I guess there are 3 possibilities for infinite loops.
 Attached patch fixes this and adjusts loop threshold
 to given comments..

 
 Thanks for spotting these.
 
 We have never had a problem with those loops, but it is certainly a good
 idea to have the code working as the comments in the code suggest. A
 short test revealed no breakages.
 
 I will commit these corrections after the release.

commited.

 Regards,
   Pierre
 




[sane-devel] Canon LiDE 90

2008-02-13 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 OK, I'll try it tonight.
 How do I cleanly remove shading_calibration ?

The code for the actual calibration is in genesys.c, line 3362:
  /* shading calibration */
to line 3414, before
  /* send gamma tables if needed */

 
 Regards
 Guillaume
 




[sane-devel] Canon LiDE 80 (2nd try)

2008-02-13 Thread Pierre Willenbrock
Stefan Lucke schrieb:
 On Monday 11 February 2008, Pierre Willenbrock wrote:
 Reinhard Biegel schrieb:
 Am Monday, 11. February 2008 schrieb Stefan Lucke:
 
 At that moment, I guess you'll see messages like:
new high speed USB device using ehci_hcd and address nn
 via dmesg.
 Hi,
 Yes, thats right.

 Changing the write to reg 0x6b from 0x0c to 0x08 fixes that. 
 Scanner is producing noisy image now.

 Do I see right that the two bits (0x04 and 0x08 of register 0x6b) affect 
 two 
 pins which are marked as 'reserved' in the datasheet? They are only 
 documented for GL843.
 Register 0x6b is very different between GL841/2 and GL843. But the
 documentation around the pins controlled with 0x6b is a bit lacking.
 
 So we need to write reserved I/O bits, (0x6b) need to write to undefined
 gamma addresses (0x5b/5c - 0x0c00). Thats really magic. Both areas
 are defined for GL843 but not for GL841/2.
 

I just tested that on my scanner. Gamma data written to 0xc000 ended up
in Gamma RAM, 0x. Can someone please play around with the actual
data transmitted and the address? It may be a dummy write. On the other
hand, the firmware may intercept that write(for whatever reasons it
could not use another usb vendor transfer).

If you want to test that yourself, i attached my program. You will
probably need to fiddle with the initialisation code.

Regards,
  Pierre
-- next part --
A non-text attachment was scrubbed...
Name: gl842-memory.tbz2
Type: application/octet-stream
Size: 7331 bytes
Desc: not available
Url : 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20080213/4ae75f51/attachment.obj
 


[sane-devel] Canon LiDE 80 (2nd try)

2008-02-12 Thread Pierre Willenbrock
Gerhard Jaeger schrieb:
 On Tuesday 12 February 2008 03:41:49 Reinhard Biegel wrote:
 On Monday, 11. February 2008, Pierre Willenbrock wrote:
 Did someone post the bcdDevice value of a LiDE 80? GL841 goes up to
 3.0.5, as someone said, and GL842 begins with 3.0.6
 
 that was me. But it's not quite clear. got also some info that
 GK842 starts @ 303
 
 bcdDevice of mine is 0302.
 
 So probably it's a GL841. Any chance to disassemble the device?
 
No need to. i just meant to make sure that it is not a version on the
edge to GL843(if there is such an edge). My Canon LiDE 35 has 0305, and
is said to contain a GL842, according to [1], but the LiDE 50 there is
0303 and GL841. Apart from that the two datasheets show suspiciously few
differences.

Regards,
  Pierre

[1] http://www.sane-project.org/unsupported/canon-lide-50.html



[sane-devel] Canon LiDE 90

2008-02-12 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I modified registers 10-1d with :
 
 {0x04, 0xd3, 0x04, 0xd3, 0x02, 0xa3, 0x20, 0x06, 0x00, 0xff, 0x24, 0x00, 
 0x00, 0x04},
 
 and now the led is really white (red green and blue by moving eyes).
 
 Led calibration seems to be good.
 
 But calibration is always 60s long.

http://ggastebois.free.fr/lide90_snoop/scanimage.log
says you have offset_calibration enabled. that cannot work currently.
offset_calibration fiddles with the Frontend offset parameters and will
make the following calibration steps fail. Comment that out in
genesys_flatbed_calibration for now.

Apart from that, please try to toggle the INVOP bit, that is
bit2(counting from 0) of Setup Register 2. This may fix the inverted
image. Looking at the Block diagram of the WM8199, the calibration may
still need to be changed if INVOP=1, but it is worth a try.

Regards,
  Pierre




[sane-devel] Canon LiDE 90

2008-02-12 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I see that reg[2] was like 0x07. So INVOP was still set !!!
 I comment out offset_calibration in genesys_flatbed_calibration, set 
 reg[2] to 0x03, and I get a black image with a gray vertical line in the 
 middle !!!
 I try to reenable offset_calibration and I get : 
 http://ggastebois.free.fr/lide90_snoop/toto_10_0_0_invop_0.jpg
 In the central vertical line we can see a piece of my dinosause not 
 reverted !!! I think this works. And good news : the frontend seems to 
 be (or to be compatible) with a wolfson wm8199.
 
 If you remember, this gray line is on the vertical of the small black 
 piece (in calibration area). So calibration is better with black area !!
 

hmm. the shading calibration currently needs some black to work. But
good news. Now, where did i put that alternative offset_calibration code...

Regards,
  Pierre



[sane-devel] General technical docs for flatbed scanners

2008-02-11 Thread Pierre Willenbrock
Hi list,

anybody knows if/where to find $subject on the web? Something that
describes some details of motor control, lamp control and analog/digital
postprocessing, as well as the general scanning operating. Just enough
for a developer of a driver for a dumb chip(like the genesys chips).

If noone comes up with anything, i will try to create such a thing and
post it here for comments.

Regards,
  Pierre



[sane-devel] Canon LiDE 80 (2nd try)

2008-02-11 Thread Pierre Willenbrock
Reinhard Biegel schrieb:
 Am Monday, 11. February 2008 schrieb Stefan Lucke:
 ...
 [genesys_gl841] reg[0x6b] = 0x02
 [genesys_gl841] reg[0x6e] = 0x6d
 [genesys_gl841] gl841_bulk_write_register: failed while writing command:
 Invalid argument
 scanimage: open of device genesys:libusb:001:010 failed: Invalid argument
 At that moment, I guess you'll see messages like:
  new high speed USB device using ehci_hcd and address nn
 via dmesg.
 
 Hi,
 Yes, thats right.
 
 Changing the write to reg 0x6b from 0x0c to 0x08 fixes that. 
 Scanner is producing noisy image now.
 
 Do I see right that the two bits (0x04 and 0x08 of register 0x6b) affect two 
 pins which are marked as 'reserved' in the datasheet? They are only 
 documented for GL843.

Register 0x6b is very different between GL841/2 and GL843. But the
documentation around the pins controlled with 0x6b is a bit lacking.

Did someone post the bcdDevice value of a LiDE 80? GL841 goes up to
3.0.5, as someone said, and GL842 begins with 3.0.6

 After scanning I have to replug the scanner, otherwise I get an error message 
 telling me the document feeder is jammed. Curiously, if I set 
 SANE_DEBUG_GENESYS, there comes up another error about a failed bulk_write.

The feeder jammed error happens when the backend thinks your scanning
head is stuck. For example when someone forgot to open the lock. I guess
we need SANE2 for more/better error messages. It is probably not really
stuck, but the sensor input is incorrect.

 
 Also I noticed that the LED isn't continuously illuminated. In one half it's 
 continuous, but in the other there are small gaps (about 1mm) with about 4mm 
 spacing between. In the middle there are a few with bigger spacing.

Sounds like it would normally be backtracking between the lighted areas,
but does not for some reason. Just guessing. The LiDE 80 support is far
from complete.

 
 Which way is your scanner connected ?
 Directly to the computer, no hubs.
 
 Regards,
 Reinhard
 

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-09 Thread Pierre Willenbrock
Hi Guillaume,

Guillaume Gastebois schrieb:
 Hello,
 
 Why calibration is so long (~50/60s) ?

It is probably failing. Should take about 3-5 seconds. Look at the logs,
the calculated averages and calibration are dumped there.

 What are /* Start of white strip in mm (y) */ and /* Start of black mark 
 in mm (x) */ in genesys_devices.c ?

Those are configuration values for calibration steps. I don't know if
any of these are currently used or if the values are hardcoded.

I think the start-of-black-mark is used to detect the beginning of the
document area for some gl646 scanners. The start-of-white-strip was once
used in shading calibration. Currently, the shading calibration is setup
for a calibration area looking like this:

home position
+
!   black area
+
!   white area
+

The border between black area and white area is autodetected per pixel,
as the border is usually not straight.

You scanner seems to offer only a white area, so we will need to do
shading calibration differently. My current idea is this:
* always gather data on a white area
* for black data, reduce the led exposure time to the minimum(0x101,
those registers cannot be set to 0. per byte.).
* for white data, use the normal exposure times
I tried something like this for offset calibration, to see if there is
any difference between white area+0x101 exposure time and black
area+normal exposure time. There was no difference in the final images,
and i think the resulting calibration was the same as well.

 Regarding the log file you said :
 W  ! 0x23 ! 0x050 ! dac value rgb(offset value)
 W  ! 0x2b ! 0x028 ! pga gain rgb
 But on debug, I see that these two registers are never written.

0x23 and 0x2b are merely convenience registers. Writing to 0x23 and 0x2b
is equivalent to a write to each of 0x20-0x22 and 0x28-0x2a. For
cis-sensors, there is only one channel used, so we could get away with
only two registers writes(for the correct channel or 0x23/0x2b), but
this won't work for ccd-sensors.

 Another thing : when scaning in color the leds are blue 

I'd expect a shade of white, perhaps blueish. my scanner does a
magentaish white. You may also see the single colors when quickly moving
your eyes relatively to the scanner.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-07 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I need a little bit more informations befor testing (sorry for my poor 
 knowledge
 in scanner)
 
 Selon Pierre Willenbrock pierre at pirsoft.dnsalias.org:
 
 I don't know why the image colors are reversed, but it may be worth
 trying to flip the sign bits in Genesys_Frontend. If that does nothing,
 we need to handle that in code(or i am missing some setting of the gl841).
 The other thing you have seen is the half-resolution mode, used for
 greater speed when doing lower(i.E. not full) resolutions.

 
 How do you explain yhat with half resolution the image seems to be grayscale 
 and
 without it seems to be lineart ?

If you look closely, you see that the image is not exactly lineart. When
doing half resolution, the sensitivity of the scanner sensor changes,
and thus needs a different afe setup. That should be handled gracefully
by the offset/gain calibration, once those are working.

 Subsidary question : what is the small white (perhaps black) rectangle
 in the middle up off page (for calibration) ?
 That may be a small metal clamp holding the glass or the calibration
 strip. That is the black(i.E. white) part at the very top.

 Under this small rectangle I have a vertical more clear line(same height). Is 
 it
 because I need to tweek calibration area (without this small rectangle) ?
 
 To summarize, it is a good idea to have bit 4 on, bit 5 is the half
 resolution switch. I'd put 0x10 into the 0x6c gpio register.

 As for the calibration area, you will need to change some code:
 * comment out genesys_gl841.c:4220:(line numbers may differ)
   status = gl841_feed(dev, 280);/*feed to white strip. canon lide 35 only.*/
 * the same for genesys_gl841.c:4821:
   status = gl841_feed(dev, 280);/*feed to white strip. canon lide 35 only.*/

 then you can try what happens when you turn on the led_calibration and
 the coarse_gain_calibration. offset_calibration needs a bit more
 changes. i think i am having the code needed lying around somewhere.
 essentially, the offset calibration needs to be done with leds off.
 the shading calibration does need even more changes.

 Where to find led_calibration, coarse_gain_calibration ? How to turn them on ?
 For personnal information : what is shading calibration 

They are called by genesys_flatbed_calibration, i think i requested to
comment them out earlier.

There are three things to calibrate for:
1) the mapping from sensor voltages to numbers, to not lose color space
by clipping lower brightness to 0 or higher brightness to 65535.
ideally, you don't ever see 0 or 65535 from the afe. This is mainly the
job of offset/gain calibration, but the led-exposure is a factor to this.
2) the color intensities relative to each other. We try to get each
colored LED to lead to similar voltages in the sensor during its
exposure. This is calibrated by led_calibration
3) Variations between the sensor cells. each sensor cell has it's own
sensitivity and black voltage, so there needs to be a
per-pixel-correction. This is done by shading_calibration.

Additionally, the shading_calibration is by-color, so this is the place
where we map each color channel to the correct range, as the
led_calibration is not that exact.

 
 Additionally, if you can't get the afe to switch the sign, you need to
 do that in the calibration functions(i.E. 65535-value).

 
 Only in calibration function ?

For now, that should be enough. We are not interested in the actual
output image, yet.

Regards,
  Pierre

 
 Regards
 Guillaume
 
 Regards,
   Pierre

 




[sane-devel] Canon LiDE 90

2008-02-06 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 Hello,

 It's a little bit better with these values.
 In Genesys_Sensor I have :
 regs_0x08_0x0b : {0x00, 0x21, 0x00, 0x00}
 regs_0x10_0x1d : {0x02, 0x8b, 0x02, 0x8b, 0x02, 0x8b, 0x20, 0x06, 0x00,
 0xff, 0x24, 0x00, 0x00, 0x04}
 regs_0x52_0x5e : {0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x0a, 0x71, 0x55,
 0x00, 0x00, 0x20, 0x41}
 looks good so far(very few of these can be found in the log after my
 scripts processed them(bug in my scripts), but then they must be okay
 when you are able to scan)

 In Genesys_Gpo I have :
 {0x02, 0x80}{0x7f, 0xe0}
 i found these differing settings in your log for register 0x6c:
 0x00
 0x02
 0x0a
 0x0e
 0x10
 0x12
 0x18
 0x1a
 0x38
 0x3a
 0x3e
 0x3c

 I tryed all these values :
 02 : revert video image with a lot of vertical lines
 0a : revert video image with a lot of vertical lines and motor doesn't 
 stop at the end of the page
 0e, 3e : don't know home position anymore
 10, 12, 18, 1a : revert video image seems to be in black and white (no 
 grayscale) but no more vertical images
 38, 3a : revert video image in grayscale but take only half of the 
 screen in height.
 3c : motor make noise but don't move
 
 You can find sample at :
 http://ggastebois.free.fr/lide90_snoop/toto_18_0_0.jpg
 http://ggastebois.free.fr/lide90_snoop/toto_38_0_0.jpg
 
 these two image are original (just saved in jpg) with x y offset set to 0.
 
 How can we explain that images are in reverse video and that with 38 and 
 3a the image takes only half the place ?

I don't know why the image colors are reversed, but it may be worth
trying to flip the sign bits in Genesys_Frontend. If that does nothing,
we need to handle that in code(or i am missing some setting of the gl841).
The other thing you have seen is the half-resolution mode, used for
greater speed when doing lower(i.E. not full) resolutions.

 Subsidary question : what is the small white (perhaps black) rectangle 
 in the middle up off page (for calibration) ?

That may be a small metal clamp holding the glass or the calibration
strip. That is the black(i.E. white) part at the very top.

To summarize, it is a good idea to have bit 4 on, bit 5 is the half
resolution switch. I'd put 0x10 into the 0x6c gpio register.

As for the calibration area, you will need to change some code:
* comment out genesys_gl841.c:4220:(line numbers may differ)
  status = gl841_feed(dev, 280);/*feed to white strip. canon lide 35 only.*/
* the same for genesys_gl841.c:4821:
  status = gl841_feed(dev, 280);/*feed to white strip. canon lide 35 only.*/

then you can try what happens when you turn on the led_calibration and
the coarse_gain_calibration. offset_calibration needs a bit more
changes. i think i am having the code needed lying around somewhere.
essentially, the offset calibration needs to be done with leds off.
the shading calibration does need even more changes.

Additionally, if you can't get the afe to switch the sign, you need to
do that in the calibration functions(i.E. 65535-value).

Regards,
  Pierre

 
 Regards
 Guillaume
 
 it may be interesting to find out what the effects of these are.

 and now in Genesys_Frontend :
 {{0x00, 0x2f, 0x07, 0x26}
, {0x00, 0x00, 0x00}
, {0x50, 0x50, 0x50}
, {0x28, 0x28, 0x28}
, {0x0d, 0x00, 0x00}
}
 Looks good.

 Are these value acceptable regarding my log
 (http://ggastebois.free.fr/lide90_snoop/UsbSnoop_a4_200dpi.log) ?

 I very appreciate your help.

 Regards
 Guillaume

 P.S : attached a sample image with my values.
 Regarding the image: is this with x|y_offset == 0? and are the
 horizontal bright lines original?

 Regards,
   Pierre





[sane-devel] genesys_gl841.c: infinite loops

2008-02-06 Thread Pierre Willenbrock
Stefan Lucke schrieb:
 Hi,
 I guess there are 3 possibilities for infinite loops.
 Attached patch fixes this and adjusts loop threshold
 to given comments..
 

Thanks for spotting these.

We have never had a problem with those loops, but it is certainly a good
idea to have the code working as the comments in the code suggest. A
short test revealed no breakages.

I will commit these corrections after the release.

Regards,
  Pierre



[sane-devel] Canon LiDE 80 (2nd try)

2008-02-06 Thread Pierre Willenbrock
Hi Stefan,

(more text inline)

Stefan Lucke schrieb:
 On Tuesday 05 February 2008, Stefan Lucke wrote:
 Hi,

 I've seen there is some progress on lide 90 and I want to step in and
 like to ask if there could be done something for my LiDE 80 too.
 I cloned the canon_lide_60_model entry

 -- scanimage with debug messages : --
 [sanei_debug] Setting debug level of genesys to 255.
 [genesys] SANE Genesys backend version 1.0 build 9 from sane-backends 
 1.0.18-cvs
 [genesys] sane_init: authorize != null
 [genesys] sane_init: little endian machine
 [genesys] sane_init: reading config file `genesys.conf'
 [genesys] sane_init: config file line 1: trying to attach `usb 0x04a9 0x2214'
 ..
 [genesys_gl841] gl841_bulk_write_register (elems = 104)
 [genesys_gl841] reg[0x01] = 0xa0
 [genesys_gl841] reg[0x02] = 0x38
 [genesys_gl841] reg[0x03] = 0x5f
 [genesys_gl841] reg[0x04] = 0x10
 [genesys_gl841] reg[0x05] = 0x40
 [genesys_gl841] reg[0x06] = 0x18

 -- I modified this, debug message is written before ..bulk_write..() . --

 [genesys_gl841] gl841_bulk_write_register: failed while writing command: 
 Invalid argument
 scanimage: open of device genesys:libusb:001:017 failed: Invalid argument
 [genesys] sane_exit: start
 [genesys] sane_exit: exit
 
 Some further info:
 I placed some win98 logfiles at http://lucke.in-berlin.de/lide-80/ .
 
 During my search in the list history, I found a test program in this mail:
 http://lists.alioth.debian.org/pipermail/sane-devel/2006-October/017930.html

I must admit, i totally forgot about that.. lectures where starting at
that time at my university.

 
 Using the following stripped down version of usbsnoop-300dpi_color.c,
 helped to get rid of the sudden disconnect from below.
 -- snip --
 set_write_register(0x6b, 0x0c);
 set_write_register(0x06, 0x10);

first, try if either of the following is enough to get past writing
register 0x06:
set_write_register(0x6b, 0x08);
set_write_register(0x6b, 0x04);

put that write to 0x6b into gl841_init, before the /* Write initial
registers */, and make sure the other places where 0x6b is written
preserve the needed bits. That may get scanimage to o further with a
freshly plugged in scanner.

Regards,
  Pierre

 -- snip --
 
 Both lines are required!
 (Note: disconnect has timestamp earlier than USBDEVFS message).
 
 Even with turned off LED and some motor sound (movement in the wrong
 direction ??), scanimage produced some pnm files.
 
 To be continued, but I really need some help, as I've no idea 
 about scanner hardware.
 
 -- dmesg output (kernel 2.6.23.13): --
 [ 5298.424302] usb 1-7: new high speed USB device using ehci_hcd and address 
 17
 [ 5298.480244] usb 1-7: OK: device descriptor read/64, error 0, mp 64 (0 0)
 [ 5298.491202] usb 1-7: configuration #1 chosen from 1 choice
 [ 5312.035169] usb 1-7: usbfs: USBDEVFS_CONTROL failed cmd scanimage rqt 64 
 rq 4 len 2 ret -71
 [ 5312.035148] usb 1-7: USB disconnect, address 17
 [ 5312.188163] usb 1-7: new high speed USB device using ehci_hcd and address 
 18
 [ 5312.244105] usb 1-7: OK: device descriptor read/64, error 0, mp 64 (0 0)
 [ 5312.255079] usb 1-7: configuration #1 chosen from 1 choice
 




[sane-devel] Canon LiDE 90

2008-02-06 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 It's a little bit better with these values.
 In Genesys_Sensor I have :
 regs_0x08_0x0b : {0x00, 0x21, 0x00, 0x00}
 regs_0x10_0x1d : {0x02, 0x8b, 0x02, 0x8b, 0x02, 0x8b, 0x20, 0x06, 0x00,
 0xff, 0x24, 0x00, 0x00, 0x04}
 regs_0x52_0x5e : {0x02, 0x04, 0x02, 0x04, 0x02, 0x04, 0x0a, 0x71, 0x55,
 0x00, 0x00, 0x20, 0x41}

looks good so far(very few of these can be found in the log after my
scripts processed them(bug in my scripts), but then they must be okay
when you are able to scan)

 In Genesys_Gpo I have :
 {0x02, 0x80}{0x7f, 0xe0}

i found these differing settings in your log for register 0x6c:
0x00
0x02
0x0a
0x0e
0x10
0x12
0x18
0x1a
0x38
0x3a
0x3e
0x3c

it may be interesting to find out what the effects of these are.

 and now in Genesys_Frontend :
 {{0x00, 0x2f, 0x07, 0x26}
, {0x00, 0x00, 0x00}
, {0x50, 0x50, 0x50}
, {0x28, 0x28, 0x28}
, {0x0d, 0x00, 0x00}
}

Looks good.

 
 Are these value acceptable regarding my log
 (http://ggastebois.free.fr/lide90_snoop/UsbSnoop_a4_200dpi.log) ?
 
 I very appreciate your help.
 
 Regards
 Guillaume
 
 P.S : attached a sample image with my values.

Regarding the image: is this with x|y_offset == 0? and are the
horizontal bright lines original?

Regards,
  Pierre

 
 Pierre Willenbrock a ?crit :
 Guillaume Gastebois schrieb:
 OK, but via which register is it programmed. I find nothing in GL842
 datasheet
 for frontend.

 regards
 Guillaume


 the analog frontend is programmed through the serial interface accessed
 by address registers 0x50(FERDA)/0x51(FEWRA) and data registers
 0x46/0x47(FERDDATA)/0x3a/0x3b(FEWRDATA).

 I find this sequence in your log:

 R/W ! addr ! data  ! WM8199 register
 +--+---+-
  W  ! 0x04 ! 0x000 ! reset
  R  ! 0x07 ! 0x041 ! revision number, ==0x41
  W  ! 0x04 ! 0x000 ! reset
  W  ! 0x01 ! 0x02f ! Setup reg 1: mode4==0, pgafs=2, selpd=1, mono=1,
 cds=1, en=1
  W  ! 0x02 ! 0x007 ! Setup reg 2: del=0, rlcdacrng=0, 0=0, vrlcext=0,
 invop=1, muxop=3
  W  ! 0x03 ! 0x026 ! Setup reg 3: chan=0, cdsref=2, rlcv=6
  W  ! 0x06 ! 0x00d ! Setup reg 4: fm=0, intm=0, rlcint=1, fme=1,
 acycnrlc=0, linebyline=1
  W  ! 0x08 ! 0x000 ! Setup reg 5: 0=0, posnneg=0, vdel=0, vsmpdet=0
  W  ! 0x20 ! 0x050 ! dac value red(offset value)
  W  ! 0x21 ! 0x050 ! dac value green(offset value)
  W  ! 0x22 ! 0x050 ! dac value blue(offset value)
  W  ! 0x23 ! 0x050 ! dac value rgb(offset value)
  W  ! 0x28 ! 0x028 ! pga gain red(0x28 is a factor of 0.85)
  W  ! 0x29 ! 0x028 ! pga gain green
  W  ! 0x2a ! 0x028 ! pga gain blue
  W  ! 0x2b ! 0x028 ! pga gain rgb


 all WM81xx(at least where datasheets are available) share a similar
 register layout, with revision 0x41 at address 7. writing to the rgb
 variant of pga gain/dac value results in writes to all the color
 specific registers, so it is not needed.

 So, you have in Genesys_Frontend: reg[1]=0x2f, reg[2]=0x07, reg[3]=0x26,
 reg2[0]=0x0d, reg2[1]=0x00, the rest of reg/reg2 =0, all sign[x]=0,
 offset[x]=0x50, gain[x]=0x28.

 this does not match anything currently in genesys_devices.c. Just add
 one entry to the Wolfson array, #define a DAC_ to 7 in genesys_low.h
 and put that in your Genesys_Model.

 The gain/offset setting should be good for led calibration and will be
 replaced by gain/offset calibration.

 After that, get a scan of the calibration area(the area under the
 housing at the parking position). For this, put 0 into the x_offset and
 y_offset in your Genesys_Model. If this turns out to be similar to the
 calibration area of the lide 50, led/offset/gain-calibration should work
 with only minor changes.

 Regards,
   Pierre


 
 
 




[sane-devel] Canon LiDE 80 (2nd try)

2008-02-06 Thread Pierre Willenbrock
Stefan Lucke schrieb:
 On Wednesday 06 February 2008, Pierre Willenbrock wrote:
 Hi Stefan,

 (more text inline)

 Stefan Lucke schrieb:
 On Tuesday 05 February 2008, Stefan Lucke wrote:
 Hi,

 I've seen there is some progress on lide 90 and I want to step in and
 like to ask if there could be done something for my LiDE 80 too.
 I cloned the canon_lide_60_model entry

 -- scanimage with debug messages : --
 [sanei_debug] Setting debug level of genesys to 255.
 [genesys] SANE Genesys backend version 1.0 build 9 from sane-backends 
 1.0.18-cvs
 [genesys] sane_init: authorize != null
 [genesys] sane_init: little endian machine
 [genesys] sane_init: reading config file `genesys.conf'
 [genesys] sane_init: config file line 1: trying to attach `usb 0x04a9 
 0x2214'
 ..
 [genesys_gl841] gl841_bulk_write_register (elems = 104)
 [genesys_gl841] reg[0x01] = 0xa0
 [genesys_gl841] reg[0x02] = 0x38
 [genesys_gl841] reg[0x03] = 0x5f
 [genesys_gl841] reg[0x04] = 0x10
 [genesys_gl841] reg[0x05] = 0x40
 [genesys_gl841] reg[0x06] = 0x18

 -- I modified this, debug message is written before ..bulk_write..() . --

 [genesys_gl841] gl841_bulk_write_register: failed while writing command: 
 Invalid argument
 scanimage: open of device genesys:libusb:001:017 failed: Invalid argument
 [genesys] sane_exit: start
 [genesys] sane_exit: exit
 Some further info:
 I placed some win98 logfiles at http://lucke.in-berlin.de/lide-80/ .

 During my search in the list history, I found a test program in this mail:
 http://lists.alioth.debian.org/pipermail/sane-devel/2006-October/017930.html
 I must admit, i totally forgot about that.. lectures where starting at
 that time at my university.

 Using the following stripped down version of usbsnoop-300dpi_color.c,
 helped to get rid of the sudden disconnect from below.
 -- snip --
 set_write_register(0x6b, 0x0c);
 set_write_register(0x06, 0x10);
 first, try if either of the following is enough to get past writing
 register 0x06:
 set_write_register(0x6b, 0x08);
 set_write_register(0x6b, 0x04);

 put that write to 0x6b into gl841_init, before the /* Write initial
 registers */, and make sure the other places where 0x6b is written
 preserve the needed bits. That may get scanimage to o further with a
 freshly plugged in scanner.

 
 A: set_write_register(0x6b, 0x08); with and without preserving reg_0x6b:
 There is a small audible motor sound, but no movement.
 Windows driver does a small forward , backward movement of scan head.
 
 [genesys] sanei_genesys_write_register (0x0e, 0x00) completed
 [genesys] sanei_genesys_write_register (0x6b, 0x08) completed
 [genesys_gl841] gl841_bulk_write_register (size = 208)
 [genesys_gl841] reg[0x01] = 0xa0
 [genesys_gl841] reg[0x02] = 0x38
 [genesys_gl841] reg[0x03] = 0x5f
 [genesys_gl841] reg[0x04] = 0x10
 [genesys_gl841] reg[0x05] = 0x40
 [genesys_gl841] reg[0x06] = 0x18
 [genesys_gl841] reg[0x07] = 0x00
 [genesys_gl841] reg[0x08] = 0x00
 ..
 [genesys_gl841] reg[0x6a] = 0x00
 [genesys_gl841] reg[0x6c] = 0x00
 ..
 [genesys] sanei_genesys_write_register (0x0f, 0x01) completed
 [genesys] sanei_genesys_read_register (0x41, 0xd1) completed
 [genesys] sanei_genesys_read_register (0x41, 0xd1) completed
 
 B: set_write_register(0x6b, 0x04); 
   - one time with preserving 0x6b - as A:
   - one time  _bulk_write_ up to reg[0x06]
   - this time:
 [genesys] sanei_genesys_write_register (0x6b, 0x04) completed
 [genesys_gl841] gl841_bulk_write_register (size = 208)
 ..
 [genesys_gl841] reg[0x06] = 0x18
 [genesys_gl841] reg[0x07] = 0x00
 [genesys_gl841] gl841_bulk_write_register: failed while writing command: 
 Invalid argument
 
 
 I'm wondering of the effects of playing with bit 2 and 3 of register 0x6b.
 According to my spec of gl841 vers. 1.7 p 42,43 bit 0 and 1 and for GPO 17  
 18,
 bit 2  3 are reserved ;-) .
 

It may be possible to control gpo19/20 there, which may map to
MT(R)_4/5, similar to how gpo17/18 map to MT(R)_6/7. I don't see how the
gl841/2 determines what function is to control the MT(R)_6/7, another
possible job for bit 2/3.

The behavior regarding these pins seems to be not very well documented
in the public datasheets.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-02-01 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 OK, but via which register is it programmed. I find nothing in GL842 datasheet
 for frontend.
 
 regards
 Guillaume
 

the analog frontend is programmed through the serial interface accessed
by address registers 0x50(FERDA)/0x51(FEWRA) and data registers
0x46/0x47(FERDDATA)/0x3a/0x3b(FEWRDATA).

I find this sequence in your log:

R/W ! addr ! data  ! WM8199 register
+--+---+-
 W  ! 0x04 ! 0x000 ! reset
 R  ! 0x07 ! 0x041 ! revision number, ==0x41
 W  ! 0x04 ! 0x000 ! reset
 W  ! 0x01 ! 0x02f ! Setup reg 1: mode4==0, pgafs=2, selpd=1, mono=1,
cds=1, en=1
 W  ! 0x02 ! 0x007 ! Setup reg 2: del=0, rlcdacrng=0, 0=0, vrlcext=0,
invop=1, muxop=3
 W  ! 0x03 ! 0x026 ! Setup reg 3: chan=0, cdsref=2, rlcv=6
 W  ! 0x06 ! 0x00d ! Setup reg 4: fm=0, intm=0, rlcint=1, fme=1,
acycnrlc=0, linebyline=1
 W  ! 0x08 ! 0x000 ! Setup reg 5: 0=0, posnneg=0, vdel=0, vsmpdet=0
 W  ! 0x20 ! 0x050 ! dac value red(offset value)
 W  ! 0x21 ! 0x050 ! dac value green(offset value)
 W  ! 0x22 ! 0x050 ! dac value blue(offset value)
 W  ! 0x23 ! 0x050 ! dac value rgb(offset value)
 W  ! 0x28 ! 0x028 ! pga gain red(0x28 is a factor of 0.85)
 W  ! 0x29 ! 0x028 ! pga gain green
 W  ! 0x2a ! 0x028 ! pga gain blue
 W  ! 0x2b ! 0x028 ! pga gain rgb


all WM81xx(at least where datasheets are available) share a similar
register layout, with revision 0x41 at address 7. writing to the rgb
variant of pga gain/dac value results in writes to all the color
specific registers, so it is not needed.

So, you have in Genesys_Frontend: reg[1]=0x2f, reg[2]=0x07, reg[3]=0x26,
reg2[0]=0x0d, reg2[1]=0x00, the rest of reg/reg2 =0, all sign[x]=0,
offset[x]=0x50, gain[x]=0x28.

this does not match anything currently in genesys_devices.c. Just add
one entry to the Wolfson array, #define a DAC_ to 7 in genesys_low.h
and put that in your Genesys_Model.

The gain/offset setting should be good for led calibration and will be
replaced by gain/offset calibration.

After that, get a scan of the calibration area(the area under the
housing at the parking position). For this, put 0 into the x_offset and
y_offset in your Genesys_Model. If this turns out to be similar to the
calibration area of the lide 50, led/offset/gain-calibration should work
with only minor changes.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-01-31 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 OK,
 I open my LiDE 90 (very hard not all to destroy...).
 I find these IC's :
 
   GL842 (Genesys well known scanner chip)
   GLT44016P (SO40 RAM)
   BU6574 (TSSOP20 )
   VHC175 (TSSOP16 quad flip flop)
   VHC08 (TSSOP16 quad and)
   LB1940 (TSSOP20 constant current driver)
   LM324 (SO14 quad op amp)
   1733 (TO-263 regularor)
 
 Appart the BU6574 (I dont find what it is) I dont find any analog 
 frontend. Is it possible that this chip is located with leds (seems very 
 hard to open.)
 

I don't know where the analog frontend may be found. There are arguments
for both positions.

The BU6574 has enough pins for the job. Did you look at the back of the
pcb?

In the documentation i found for one cis sensor, the glassy sensor
itself contains just the ccd row and the leds. There may be a small pcb
on the sensor bar, carrying the analog frontend.

But you really don't need to look for the chip and possibly destroy your
scanner on the way.. Let's first try to figure out how it is configured
from an usb log.

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-01-30 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
  But you can ignore led-calibration for now, that is not essential when
  debugging the backend. Just make sure the exposure settings in
  Genesys_Sensor.regs_0x10_0x1d are good, for example from an usb log the
  last register write to 0x10-0x15 before receiving actual scanned data.
  If those stay all zero, the rgb-leds in your scanner are very probably
  not controlled using the rgb-led-control-feature of the gl84x.
  
  You can disable led calibration by commenting out the code in
  genesys_flatbed_calibration. Offset/Gain calibration can be commented
  out when the values in Genesys_Frontend are good, Shading calibration
  can be disabled when you add OPTICAL_FLAG_DISABLE_SHADING to the flags
  for gl841_init_optical_regs_scan. When shading calibration is disabled,
  you get vertical stripes, the others lead to too dark/bright r/g/b 
  channels.
  
  Things that may be missing:
  * leds need to be controlled correctly
  * cis-sensor needs to get the correct clock signals(line toggle+pixel
clock, half-resolution signal is optional for now)
  * the analog frontend registers need to be setup correctly in
Genesys_Frontend
  * the readout position in the data stream from the analog frontend may
need tweaking(registers 0x52,0x53)
  
  When that is done, you should be able to get an image from your
  scanner, although calibration may be lacking.
  
  Regards,
Pierre
 
 OK, i see some image (very far to end result...). But can you explain to 
 me how to know the correct values for genesys_frontend 
 These parameter have big influence on resulting image.
 

genesys_frontend contains the settings for the analog frontend.

the canon lide 35/40/50 seem to be all using the wm8199(afair) or a
compatible chip, so that datasheet may be helpful.

Datasheets for the wolfson analog frontends can be found on their website:
http://www.wolfsonmicro.com/productListings/imaging_sensor_adcs/

gl841_set_fe and the calibration functions are currently setup to handle
a wm8199.

The reg, reg2 and sign entries need to be obtained from an usb log. I
don't know the actual register mapping, but it should be easy to figure
that out from gl841_set_fe.

gain and offset will be calibrated by one of the calibration functions.
The values depend heavily on the LED and Sensor characteristics. For
now, when the LED exposure time is constant, you can get away with
constant values.

There seems to be no way to find the exact analog frontend chip without
looking at the pcb, but that is hopefully not needed.

Simplified, you get the result of this equation from the analog
frontend(The datasheet has the details):

v: proportional to input voltage from sensor
o: offset(not necessarily the value from the register)
g: gain-factor(not necessarily the value from the register)
d: digital output value

d = (o + v) * g

The behaviour of the sensor can be described by this equation:

i: proportional to the light intensity, which is proportional to led
exposure time and shade on your original
v_o: offset voltage
s: sensitivity of sensor(voltage per intensity)

v = v_o + i * s

The offset/gain calibration optimizes offset and gain such that maximum
and minimum v fall in the range between maximum and minimum d, but
trying to maximize the range used in d(this requires at least one led
exposure time to be setup reasonably).

The LED calibration tries to get all LED colors to result in a similar
value into the analog frontend, by adjusting the exposure time(this
requires analog frontend offset/gain values to be setup reasonably).


Sorry for the lengthy mail, but i hope the information is helpful.

Regards,
  Pierre



[sane-devel] calling all GL841 experts

2008-01-18 Thread Pierre Willenbrock
m. allan noah schrieb:
 I know nothing about the GL841, but the HP G4010 might be one (or so
 check-usb-chip thinks).
 
 we now have a user-provided usbsnoop attached to this bug report:
 http://alioth.debian.org/tracker/?func=detailatid=410366aid=305050group_id=30186
 
 Could someone who has seen the protocol for this chip just look and
 try to answer the basic question of is this GL841 or not?

The protocol is different to the protocol of gl646 or gl841, but some
commands are the same. Especially, i see motor-slope-table downloads,
done in the same way as for the supported genesys-chips.

I think this one is a newer genesys chip, maybe the gl843.

Regards,
  Pierre



[sane-devel] Protocol of Canon LiDE 600F

2008-01-18 Thread Pierre Willenbrock
J?rgen Ernst schrieb:
 Hi!
 
 Scanner protocol of Canon LiDE 600F is very high level. With a 
 structural analysis it is possible to see functional blocks of driver 
 code. With my knowledge till now I should be able to program a perl 
 script in a couple of days to do a first low resolution scan.
 
 Can somebody confirm that the protocol of Canon LiDE 70 is similar to 
 Canon LiDE 600F ? Does someone have a log? Haven't seen any out there.

The LiDE 70 is a gl841 based scanner, and those are dumb scanners with
very few firmware. A log of my gl841 based Canon LiDE 35 can be found here:
http://pirsoft-dsl-dropzone.de/usbsnoop.log.bz2

Regards,
  Pierre



[sane-devel] Protocol of Canon LiDE 600F

2008-01-18 Thread Pierre Willenbrock
J?rgen Ernst schrieb:
 Pierre Willenbrock schrieb:
 The LiDE 70 is a gl841 based scanner, and those are dumb scanners with
 very few firmware.
 
 I am wondering. According to 
 http://www.sane-project.org/unsupported/canon-lide-70.html I found that 
 the output of sane-find-scanner didn't identify this scanner as GL841 
 based. How did you find this?
 
 Canon LiDE 600F has only 2 endpoints.
 Canon LiDE 70 has also only 2 endpoints.
 

Sorry, confused it with the LiDE 90, which was the orignal subject of
this thread.

 So I wanted to read a usb log to check if the protocol is the same.
 
 Canon LiDE 35 uses 3 endpoints. So it's different.
 
 A log of my gl841 based Canon LiDE 35 can be found here:
 http://pirsoft-dsl-dropzone.de/usbsnoop.log.bz2
 
 Your log shows many URB_FUNCTION_VENDOR_DEVICE lines.
 Canon LiDE 600F doesn't use any vendor device function.
 As far as I know...
 This means I can't find any in my log.
 
 Canon LiDE 35 has definitely not the same protocol.
 
 If you want to check yourself my logs, have a look at
 http://www.juergen-ernst.de/info_sane.html

Regards,
  Pierre



[sane-devel] Canon LiDE 90

2008-01-14 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Guillaume Gastebois schrieb:
 Hello,

 I tried with : SANE_DEBUG_GENESYS_GL841=255 scanimage
 --device-name=genesys:libusb:001:005  toto.pnm

 Result can be found in attachement.

 It locks on last line and did nothing else.
 It sits in gl841_slow_back_home, genesys_gl841.c:3581-3597. You need to
 get the head to move and figure out if/how the home position switch is
 activated. If the motor or the switch can be deactivated, some GPIO is
 typically responsible for that. The motor and home-switch of my LiDE35
 need to be enabled using GPIO, and default to off. There is no standard
 regarding these settings, so you need to go through your usb logs to
 find a working GPIO-setting-sequence.

 Hope that helps,
  Pierre
 
 In windows snoop I find this init sequence :
 


 \x01\x82  \x80
 \x02\x10  \x38
 \x03\x50  \x40
 \x04\x10  \x10
 \x05\x8c  \x40
 \x06\x18  \x18
  \x07  \x00
 \x08\x00  \x00
 \x09\x21  \x10
 \x0a\x00  \x00
 \x0d\x00  \x01
 \x10\x00  \x07
 \x11\x00  \xff
 \x12\x00  \x0e
 \x13\x00  \x89
 \x14\x00  \x0c
 \x15\x00  \xa5
 \x16\x20  \x00
 \x17\x06  \x01
 \x18\x00  \x00
 \x19\xff  \x50
 \x1a\x24  \x00
 \x1c\x00  \x00
 \x1d\x04  \x01
 \x1e\x10  \x10
 \x1f\x04  \x01
 \x20\x02  \x20
 \x21\x10  \x05
 \x22\x7f  \x20
 \x23\x7f  \x20
 \x24\x10  \x05
 \x25\x00  \x00
 \x26\x00  \x04

 \x27\x00  \x08
 \x28\x00  
 \x29\xff  \xff
 \x2a\x00
 \x2b\x00
 \x2c\x09  \x04
 \x2d\x60  \xb0
 \x2e\x80  \x80
 \x2f\x80  \x80
 \x30\x00  \x00
 \x31\x10  \x7f
 \x32\x15  \x28
 \x33\x0e  \x8a
 \x34\x40  \x7e
 \x35\x00  \x00
 \x36\x2a  \x3b
 \x37\x30  \xc6
 \x38\x2a  \x4f
 \x39\xf8  \xc1
 \x3c\x02 
 \x3d\x00  \x00
 \x3e\x00  \x00
 \x3f\x00  \x01
 \x52\x02  \x03
 \x53\x04  \x05
 \x54\x02  \x02
 \x55\x04  \x05
 \x56\x02  \x02
 \x57\x04  \x05
 \x58\x0a  \x03
 \x59\x71  \x03
 \x5a\x55  \x40

 \x5d\x20
 \x5e\x41  \x02
 \x5f\x40  \x05
 \x60\x00  \x00
 \x61\x00  \x00
 \x62\x00  \x00
 \x63\x00  \x00
 \x64\x00  \x00
 \x65\x00  \x00
 \x66\x00  \xff
 \x67\x80  \x7f
 \x68\x80  \x7f
 \x69\x20  \x05
 \x6a\x20  \x05
   \x6b\x03  \x03
   \x6c\x02  \x82
   \x6d\x80  \x80
   \x6e\x7f  \xef
   \x6f\xe0  \x80
 \x70\x00  \x00
 \x71\x05  \x00
 \x72\x07  \x00
 \x73\x09  \x00
 \x75\x01  \x00
 \x76\xff  \x00
 \x78\x00  \x00
 \x79\x3f  \x00
 \x7b\x00  \x00
 \x7c\x1e  \x00
 \x7d\x11  \x00
 \x7e\x00  \x00
 \x7f\x50  \x00
 
 \x80\x00  \x00
 \x81\x00  \x00
 \x82\x0f  \x00
 \x83\x00  \x00
 \x84\x0e  \x00
 \x85\x00  \x00
 \x86\x0d  \x00
 \x87\x00  \x00
 \x88\x00
 \x89\x00
 
 Is that so different as lide 60 ?

I put a similar result from my scanner next to your result. For the
GPIOs, at least the direction bits are different, so i guess they are
used differently. You may want to write a small test-program for your
scanner, similar to what i did for mine[1], using your usb log. If you
got that to work, you can play around with the gpio pins to figure out
their function. Alternatively, you can take a lot of usb logs and guess
the meaning of the pins.

My scanner(Canon LiDE 35) has these functions, as far as i found out:

pinfunction  direction
GPIO1: SCAN button   in
GPIO2: FILE button   in
GPIO3: E-MAIL button in
GPIO4: COPY button   in
GPIO8: overall power?out
GPIO9: save powerout
GPIO16: Full resolution  out
GPO17: lamp+home sensor? out
GPO18: extra power?  out

You may find some of these. Especially the Full/Half resolution
function should be somewhere.

Regards,
  Pierre

[1] http://pirsoft-dsl-dropzone.de/canon-lide35.tbz2



[sane-devel] Canon LiDE 90

2008-01-08 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I tried with : SANE_DEBUG_GENESYS_GL841=255 scanimage
 --device-name=genesys:libusb:001:005  toto.pnm
 
 Result can be found in attachement.
 
 It locks on last line and did nothing else.

It sits in gl841_slow_back_home, genesys_gl841.c:3581-3597. You need to
get the head to move and figure out if/how the home position switch is
activated. If the motor or the switch can be deactivated, some GPIO is
typically responsible for that. The motor and home-switch of my LiDE35
need to be enabled using GPIO, and default to off. There is no standard
regarding these settings, so you need to go through your usb logs to
find a working GPIO-setting-sequence.

Hope that helps,
  Pierre




[sane-devel] Canon LiDE 90

2008-01-07 Thread Pierre Willenbrock
Guillaume Gastebois schrieb:
 Hello,
 
 I can't make led on and motor move with my LiDE 90.
 
 I modify CVS with replacing all LiDE 60 0x221c with 0x199 pid of
 LiDE 90.
 
 scanimage -L returns my LiDE 90, but SANE_DEBUG_GENESYS=255 scanimage
 --device-name=genesys:libusb:001:005  toto.pnm
 
 gives me a log looping indefinitelly on : [genesys]
 sanei_genesys_read_register (0x41, 0xf4) completed
 
 see my attached file.
 
 Is any genesys specialist to explain me what I did wrong !!! (my scanner
 is working on windows in my office)

You should try to use SANE_DEBUG_GENESYS_GL841=255, too. This will give
you more or less a full trace of the calls happening in the backend.

I _think_ the backend tries to do a head move, but the scanner is
immediately ready again. No idea, why this happens.

Regards,
  Pierre



[sane-devel] Canon LIDE 90

2007-11-27 Thread Pierre Willenbrock
Ralf Haueisen schrieb:
 Hi all.
 
 I am just working to get my Canon LiDE 90 working. I took in the 
 genesys_devices.c the LiDE60 an did some changes. I have a sniffer
 log taken with usbsnoop. Some registers i could firgue out where to
 set them. The image still looks like data is somehow scrambled. There
 are some setting in the file for the DAC. (static
 Genesys_Frontend Wolfson[] ) to which registers do these data belong?
 
 TIA,
 Ralf

The settings in the Genesys_Frontend structs go to the analog frontend
via the serial interface at registers 0x3a/0x3b(FEWRDATA)+0x51(FEWRA),
through sanei_genesys_fe_write_data.

If you are receiving noise data, this may indicate that the byte order
was swapped. You should check that the parallel interface to the
frontend is setup correctly(registers 0x52 to 0x57).

HTH,
  Pierre



  1   2   >