[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-07-01 Thread Stef
On 30/06/2013 09:45, Nikolay Shaplov wrote:
 Current git gives two different behavior when I try to scanimage.

 1. It turn off lamp, turn on lamp, move head little bit forward, move it back,
 stop

 2. Just turn off lamp and all

 there is a debug output of both variants.


 // Sorry for being so late, I misread your message, and decided that you will
 make ASIC detect in future and were waiting for test request, wondering why
 does it takes so long. And only now I reread message and understood that all
 already done by now, long time ago... Sorry once again...



 Hello,

 could apply this patch and retest ? Things should be better.

Regards,
 Stef
-- next part --
diff --git a/backend/genesys.c b/backend/genesys.c
index bbb2dce..a0add59 100644
--- a/backend/genesys.c
+++ b/backend/genesys.c
@@ -927,6 +927,7 @@ genesys_send_offset_and_shading (Genesys_Device * dev, 
uint8_t * data,
* tested instead of adding all the others */
   /* many scanners send coefficient for lineart/gray like in color mode */
   if (dev-settings.scan_mode  2
+   dev-model-ccd_type != CCD_PLUSTEK3800
dev-model-ccd_type != CCD_KVSS080
dev-model-ccd_type != CCD_G4050
dev-model-ccd_type != CCD_CS4400F
@@ -2996,6 +2997,7 @@ genesys_send_shading_coefficient (Genesys_Device * dev)
 target_code);
   break;
 case CCD_KVSS080:
+case CCD_PLUSTEK3800:
 case CCD_G4050:
 case CCD_CS4400F:
 case CCD_CS8400F:
@@ -5215,7 +5217,7 @@ calc_parameters (Genesys_Scanner * s)
 ((br_x - tl_x) * resolution) / MM_PER_INCH;
 
   /* we need an even pixels number
-   * TODO invert test logic or generalize behaviour acroos all ASICs */
+   * TODO invert test logic or generalize behaviour across all ASICs */
   if ((s-dev-model-flags  GENESYS_FLAG_SIS_SENSOR)
   || s-dev-model-asic_type == GENESYS_GL847  
   || s-dev-model-asic_type == GENESYS_GL124  
@@ -6904,6 +6906,8 @@ sane_close (SANE_Handle handle)
   /* we need this to avoid ASIC getting stuck
* in bulk writes */
   if(s-dev-model-asic_type==GENESYS_GL847
+   ||s-dev-model-asic_type==GENESYS_GL845
+   ||s-dev-model-asic_type==GENESYS_GL845
||s-dev-model-asic_type==GENESYS_GL843)
 sanei_usb_reset (s-dev-dn);
 


[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-06-30 Thread Nikolay Shaplov
 Since I added preliminary support for GL846 a couple of months
 ago,
  
  you'd rather declare your scanner as a GL846 one like the
  canon_formula101_model.
  
  I've tried... scanimage -L does not list scanner at all in this case
  O_o
  
  Very strange for me... :-(((
  
In order to test a newly compiled version, you can run it with the
  
  attached script (edit it to adapt it for the exact location of sane
  sources on your PC).
  The debugging output (preview.pnm and preview.log) will help the
  development and fixes of the backend part for GL846.
  
  see
  preview.git.as.canonf101.gl846.log
  
  there  are also two files that shows how differently works gl847 in git
  and 1.0.22
  I have starting to add preliminary code to handle the GL845 in the
 genesys backend. I'll commit it in git in about a week. Meanwhile I have
 updated sane-find-scanner to better detect genesys ASICs. I am
 interested by the test of the very latest git code on your scanner. You
 don't have to do 'make install' to try the new sane-find-scanner
 version, just run ./sane-find-scanner from the 'tools' subdirectory.

Current git gives two different behavior when I try to scanimage.

1. It turn off lamp, turn on lamp, move head little bit forward, move it back, 
stop

2. Just turn off lamp and all

there is a debug output of both variants.


// Sorry for being so late, I misread your message, and decided that you will 
make ASIC detect in future and were waiting for test request, wondering why 
does it takes so long. And only now I reread message and understood that all 
already done by now, long time ago... Sorry once again... 



-- next part --
A non-text attachment was scrubbed...
Name: preview-06-30-git-untouched2.log.gz
Type: application/x-gzip
Size: 4830 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130630/39d354a8/attachment.bin
-- next part --
A non-text attachment was scrubbed...
Name: preview-06-30-git-untouched1.log.gz
Type: application/x-gzip
Size: 9401 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130630/39d354a8/attachment-0001.bin


[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-06-30 Thread Stef
On 30/06/2013 09:45, Nikolay Shaplov wrote:
 Since I added preliminary support for GL846 a couple of months
 ago,

 you'd rather declare your scanner as a GL846 one like the
 canon_formula101_model.
 I've tried... scanimage -L does not list scanner at all in this case
 O_o

 Very strange for me... :-(((

In order to test a newly compiled version, you can run it with the

 attached script (edit it to adapt it for the exact location of sane
 sources on your PC).
 The debugging output (preview.pnm and preview.log) will help the
 development and fixes of the backend part for GL846.
 see
 preview.git.as.canonf101.gl846.log

 there  are also two files that shows how differently works gl847 in git
 and 1.0.22
   I have starting to add preliminary code to handle the GL845 in the
 genesys backend. I'll commit it in git in about a week. Meanwhile I have
 updated sane-find-scanner to better detect genesys ASICs. I am
 interested by the test of the very latest git code on your scanner. You
 don't have to do 'make install' to try the new sane-find-scanner
 version, just run ./sane-find-scanner from the 'tools' subdirectory.
 Current git gives two different behavior when I try to scanimage.

 1. It turn off lamp, turn on lamp, move head little bit forward, move it back,
 stop

 2. Just turn off lamp and all

 there is a debug output of both variants.


 // Sorry for being so late, I misread your message, and decided that you will
 make ASIC detect in future and were waiting for test request, wondering why
 does it takes so long. And only now I reread message and understood that all
 already done by now, long time ago... Sorry once again...



 Hello,

 ahem, in fact I realize I forgot to mail that a new version with 
early gl845 support was released. So you didn't miss anything.

 The cause of the problem is:

[genesys] genesys_send_shading_coefficient start
[genesys] genesys_send_shading_coefficient: sensor 26 not supported
[genesys] genesys_start_scan: failed to send shading calibration 
coefficients: Operation not supported
[genesys] sane_genesys_start: Operation not supported

I have still some places to change for this new sensor. Slope table 
traces also look bad. I think I can fix this this week.

Regards,
 Stef




[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-06-03 Thread Stef
On 29/05/2013 20:23, Nikolay Shaplov wrote:
Since I added preliminary support for GL846 a couple of months
ago,

 you'd rather declare your scanner as a GL846 one like the
 canon_formula101_model.
 I've tried... scanimage -L does not list scanner at all in this case O_o

 Very strange for me... :-(((

   In order to test a newly compiled version, you can run it with the

 attached script (edit it to adapt it for the exact location of sane
 sources on your PC).
 The debugging output (preview.pnm and preview.log) will help the
 development and fixes of the backend part for GL846.
 see
 preview.git.as.canonf101.gl846.log

 there  are also two files that shows how differently works gl847 in git and
 1.0.22


 Hello,

 I have starting to add preliminary code to handle the GL845 in the 
genesys backend. I'll commit it in git in about a week. Meanwhile I have 
updated sane-find-scanner to better detect genesys ASICs. I am 
interested by the test of the very latest git code on your scanner. You 
don't have to do 'make install' to try the new sane-find-scanner 
version, just run ./sane-find-scanner from the 'tools' subdirectory.

Regards,
 Stef



[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-13 Thread Nikolay Shaplov
since the ASIC used is a GL845, you should not try forcing it to
  
  GL847. They are really different, and nothing will ever work. If you
  look at the GL845 datasheet, you'll see it is really close to the GL846.
  So close in fact that the same code should be able to run both.
  
  1. I've build git version with setting GL846 chipset to 3600 clone in the
  model description. It gives the same result as I wrote before
  
  2. In 1.0.22 GL847 worked for me well. It stopped working in 1.0.23. So I
  think this is not an chipset issue. (if at least there were no great
  changes in genesys_gl847.c)
 
  What do you mean by worked well? Since chip a GL845, it won't work
 with GL847 code.

It did not fail on scanner detection, it turn off the light and move the 
scanner head... 
In 1.0.23 it fails on initialization...  Were there great changes in 
genesys_gl847.c between 1.0.22 and 1.0.23?

 In order to test a newly compiled version, you can run it with the
 attached script (edit it to adapt it for the exact location of sane
 sources on your PC).
 The debugging output (preview.pnm and preview.log) will help the
 development and fixes of the backend part for GL846.

Ok. Will do it in several days when I am near the scanner again...



[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-12 Thread Nikolay Shaplov
  since the ASIC used is a GL845, you should not try forcing it to
 
 GL847. They are really different, and nothing will ever work. If you
 look at the GL845 datasheet, you'll see it is really close to the GL846.
 So close in fact that the same code should be able to run both.
 

1. I've build git version with setting GL846 chipset to 3600 clone in the 
model description. It gives the same result as I wrote before

2. In 1.0.22 GL847 worked for me well. It stopped working in 1.0.23. So I 
think this is not an chipset issue. (if at least there were no great changes 
in genesys_gl847.c)

  Since I added preliminary support for GL846 a couple of months ago,
 
 you'd rather declare your scanner as a GL846 one like the
 canon_formula101_model.
I've tried... scanimage -L does not list scanner at all in this case O_o

Very strange for me... :-(((

  Since having the ASIC datasheet isn't enough( GPIO, fontend, motors
 
 change from one model to another and are not coverd by this
 documentation), the process to reach full support is to run the
 experimental backend and compare debugging output with USB logs recorder
 under windows, and tweak the code until it works.



[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-12 Thread Stef
On 12/05/2013 10:54, Nikolay Shaplov wrote:
   since the ASIC used is a GL845, you should not try forcing it to

 GL847. They are really different, and nothing will ever work. If you
 look at the GL845 datasheet, you'll see it is really close to the GL846.
 So close in fact that the same code should be able to run both.

 1. I've build git version with setting GL846 chipset to 3600 clone in the
 model description. It gives the same result as I wrote before

 2. In 1.0.22 GL847 worked for me well. It stopped working in 1.0.23. So I
 think this is not an chipset issue. (if at least there were no great changes
 in genesys_gl847.c)

 What do you mean by worked well? Since chip a GL845, it won't work 
with GL847 code.


   Since I added preliminary support for GL846 a couple of months ago,

 you'd rather declare your scanner as a GL846 one like the
 canon_formula101_model.
 I've tried... scanimage -L does not list scanner at all in this case O_o

 Very strange for me... :-(((


 In order to test a newly compiled version, you can run it with the 
attached script (edit it to adapt it for the exact location of sane 
sources on your PC).
The debugging output (preview.pnm and preview.log) will help the 
development and fixes of the backend part for GL846.

Regards,
 Stef
-- next part --
#!/bin/bash
#==
export SANE_DIR=/replace/with/exact/path/sane-backends
export BIN_DIR=$SANE_DIR/frontend
export SO_DIR=$SANE_DIR/backend/.libs
export SANE_DEBUG_GENESYS=255
export SANE_DEBUG_GENESYS_LOW=255
export SANE_DEBUG_GENESYS_GL646=255
export SANE_DEBUG_GENESYS_GL841=255
export SANE_DEBUG_GENESYS_GL843=255
export SANE_DEBUG_GENESYS_GL847=255
export SANE_DEBUG_GENESYS_GL124=255
#export SANE_DEBUG_SANEI_USB=255
#export SANE_DEBUG_SANEI_MAGIC=255
export LD_PRELOAD=$SO_DIR/libsane-genesys.so
$BIN_DIR/scanimage -d genesys --resolution 75 --preview --mode Color 
2preview.log preview.pnm


[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-10 Thread Stef
On 09/05/2013 10:49, Nikolay Shaplov wrote:
 what kind of changes have you done in the genesys backend ? I find
 strange that
 I find this strange too.

 I added
 {0x07b3, 0x1300, plustek_3800_model},
 into
   Genesys_USB_Device_Entry genesys_usb_device_list[]

 and added

 static Genesys_Model plustek_3800_model = {
plustek-opticbook-3800, /* Name */
PLUSTEK,/* Device vendor string */
OpticBook 3800, /* Device model name */
GENESYS_GL847,
NULL,
{/*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75, 0},/* possible 
 y-resolutions */
{16, 8, 0},   /* possible depths in gray mode */
{16, 8, 0},   /* possible depths in color mode */

SANE_FIX (0.42),/*SANE_FIX (0.42), Start of scan area in mm  
 (x) */
SANE_FIX (6.75),/*SANE_FIX (7.9),  Start of scan area in mm 
 (y) */
SANE_FIX (216.0),/*SANE_FIX (216.0),   Size of scan area in mm (x) 
 */
SANE_FIX (297.0),/*SANE_FIX (297.0),   Size of scan area in mm (y) 
 */

SANE_FIX (0.0),   /* Start of white strip in mm (y) */
SANE_FIX (0.0),   /* Start of black mark in mm (x) */

SANE_FIX (0.0),   /* Start of scan area in TA mode in mm (x) */
SANE_FIX (0.0),   /* Start of scan area in TA mode in mm (y) */
SANE_FIX (0.0),   /* Size of scan area in TA mode in mm (x) */
SANE_FIX (0.0),   /* Size of scan area in TA mode in mm (y) */

SANE_FIX (0.0),   /* Start of white strip in TA mode in mm (y) 
 */

SANE_FIX (0.0),   /* Size of scan area after paper sensor stops
 sensing document in mm */
SANE_FIX (0.0),   /* Amount of feeding needed to eject document
 after finishing scanning in mm */
   
0, 24, 48,/* RGB CCD Line-distance correction in pixel 
 */

COLOR_ORDER_RGB,  /* Order of the CCD/CIS colors */

SANE_FALSE,   /* Is this a CIS scanner? */
SANE_FALSE,   /* Is this a sheetfed scanner? */
CCD_PLUSTEK_3600,
DAC_PLUSTEK_3600,
GPO_PLUSTEK_3600,
MOTOR_PLUSTEK_3600,
GENESYS_FLAG_UNTESTED /* not fully working yet */
| GENESYS_FLAG_CUSTOM_GAMMA
| GENESYS_FLAG_SKIP_WARMUP
| GENESYS_FLAG_DARK_CALIBRATION
| GENESYS_FLAG_OFFSET_CALIBRATION
| GENESYS_FLAG_LAZY_INIT
| GENESYS_FLAG_HALF_CCD_MODE,/*
| GENESYS_FLAG_NO_CALIBRATION,*/
GENESYS_HAS_NO_BUTTONS,
7,
200
 };

 It is a clone of  plustek_3600_model with   GENESYS_GL841, replaced with   
 GENESYS_GL847,
 and names changed...

 That's all I did, and same trick makes sane at least try to move scanner's 
 head in 1.0.22


 libusb:002:007 is opened, then libusb:002:006 is tried.
 Oh... I should be more attentive. I did not noticed that.

 How many scanners do you have?
 Actually my notebook has webcam and fingerprint scanner in it.
 the first one is detected by sane as an acceptable input device (but I've 
 never tried to use it this way)

 What does lsusb reports ?
 $ sudo lsusb
 Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
 Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
 Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
 Bus 001 Device 003: ID 0489:e00d Foxconn / Hon Hai Broadcom Bluetooth 2.1 
 Device
 Bus 001 Device 004: ID 1c7a:0801 LighTuning Technology Inc. Fingerprint Reader
 Bus 001 Device 005: ID 04f2:b1c1 Chicony Electronics Co., Ltd
 Bus 002 Device 004: ID 07b3:1300 Plustek, Inc.

 Hello,

 since the ASIC used is a GL845, you should not try forcing it to 
GL847. They are really different, and nothing will ever work. If you 
look at the GL845 datasheet, you'll see it is really close to the GL846. 
So close in fact that the same code should be able to run both.
 Since I added preliminary support for GL846 a couple of months ago, 
you'd rather declare your scanner as a GL846 one like the 
canon_formula101_model.

 Since having the ASIC datasheet isn't enough( GPIO, fontend, motors 
change from one model to another and are not coverd by this 
documentation), the process to reach full support is to run the 
experimental backend and compare debugging output with USB logs recorder 
under windows, and tweak the code until it works.

Regards,
 Stef





[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-09 Thread Nikolay Shaplov
what kind of changes have you done in the genesys backend ? I find 
strange that

I find this strange too.

I added  
{0x07b3, 0x1300, plustek_3800_model},
into 
 Genesys_USB_Device_Entry genesys_usb_device_list[] 

and added 

static Genesys_Model plustek_3800_model = {
  plustek-opticbook-3800, /* Name */
  PLUSTEK,/* Device vendor string */
  OpticBook 3800, /* Device model name */
  GENESYS_GL847,
  NULL,
  {/*2400,*/ 1200, 600, 400, 300, 200, 150, 100, 75, 0},/* possible 
y-resolutions */
  {16, 8, 0},   /* possible depths in gray mode */
  {16, 8, 0},   /* possible depths in color mode */

  SANE_FIX (0.42),/*SANE_FIX (0.42), Start of scan area in mm  (x) 
*/
  SANE_FIX (6.75),/*SANE_FIX (7.9),  Start of scan area in mm (y) */
  SANE_FIX (216.0),/*SANE_FIX (216.0),   Size of scan area in mm (x) */
  SANE_FIX (297.0),/*SANE_FIX (297.0),   Size of scan area in mm (y) */

  SANE_FIX (0.0),   /* Start of white strip in mm (y) */
  SANE_FIX (0.0),   /* Start of black mark in mm (x) */

  SANE_FIX (0.0),   /* Start of scan area in TA mode in mm (x) */
  SANE_FIX (0.0),   /* Start of scan area in TA mode in mm (y) */
  SANE_FIX (0.0),   /* Size of scan area in TA mode in mm (x) */
  SANE_FIX (0.0),   /* Size of scan area in TA mode in mm (y) */

  SANE_FIX (0.0),   /* Start of white strip in TA mode in mm (y) */

  SANE_FIX (0.0),   /* Size of scan area after paper sensor stops
   sensing document in mm */
  SANE_FIX (0.0),   /* Amount of feeding needed to eject document
   after finishing scanning in mm */
 
  0, 24, 48,/* RGB CCD Line-distance correction in pixel */

  COLOR_ORDER_RGB,  /* Order of the CCD/CIS colors */

  SANE_FALSE,   /* Is this a CIS scanner? */
  SANE_FALSE,   /* Is this a sheetfed scanner? */
  CCD_PLUSTEK_3600,
  DAC_PLUSTEK_3600,
  GPO_PLUSTEK_3600,
  MOTOR_PLUSTEK_3600,
  GENESYS_FLAG_UNTESTED /* not fully working yet */
  | GENESYS_FLAG_CUSTOM_GAMMA
  | GENESYS_FLAG_SKIP_WARMUP
  | GENESYS_FLAG_DARK_CALIBRATION
  | GENESYS_FLAG_OFFSET_CALIBRATION
  | GENESYS_FLAG_LAZY_INIT
  | GENESYS_FLAG_HALF_CCD_MODE,/*
  | GENESYS_FLAG_NO_CALIBRATION,*/
  GENESYS_HAS_NO_BUTTONS,
  7,
  200
};

It is a clone of  plustek_3600_model with   GENESYS_GL841, replaced with   
GENESYS_GL847, 
and names changed...

That's all I did, and same trick makes sane at least try to move scanner's head 
in 1.0.22


 libusb:002:007 is opened, then libusb:002:006 is tried.
Oh... I should be more attentive. I did not noticed that.

 How many scanners do you have?
Actually my notebook has webcam and fingerprint scanner in it.
the first one is detected by sane as an acceptable input device (but I've never 
tried to use it this way)

 What does lsusb reports ?

$ sudo lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 003: ID 0489:e00d Foxconn / Hon Hai Broadcom Bluetooth 2.1 Device
Bus 001 Device 004: ID 1c7a:0801 LighTuning Technology Inc. Fingerprint Reader
Bus 001 Device 005: ID 04f2:b1c1 Chicony Electronics Co., Ltd 
Bus 002 Device 004: ID 07b3:1300 Plustek, Inc. 




[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-06 Thread Stef
On 05/05/2013 16:38, Nikolay Shaplov wrote:
 All my previous efforts I did with libsane 1.0.22 that comes with debian.

 I've tried to do the same trick with git version and with 1.0.23 and did not
 managed to do it.

 For some reason sane reports about not being able to open usb device. The more
 strange thing, it that it reports it on different stages of the 
 initialization:

 ===
   sudo SANE_DEBUG_GENESYS=256  scanimage -d genesys:libusb:002:006 -v -v -v -v
 -v 12345


 [sanei_debug] Setting debug level of genesys to 256.
 [genesys] SANE Genesys backend version 1.0 build 2302 from sane-backends
 1.0.23
 [genesys] SANE Genesys backend built with libusb
 [genesys] sane_init: authorize != null
 [genesys] sane_init: little endian machine
 [genesys] probe_genesys_devices start
 [genesys] attach: start: devp != NULL, may_wait = 0
 [genesys] attach: trying to open device `libusb:002:006'
 [genesys] attach: device `libusb:002:006' successfully opened
 [genesys] attach: found PLUSTEK flatbed scanner OpticBook 3800 at
 libusb:002:006
 [genesys] attach completed
 [genesys] probe_genesys_devices completed
 [genesys] sane_genesys_init completed
 [genesys] sane_open: start (devicename = `libusb:002:006')
 [genesys] sane_open: found `plustek-opticbook-3800' in devlist
 [genesys] WARNING: Your scanner is not fully supported or at least
 [genesys]  had only limited testing. Please be careful and
 [genesys]  report any failure/success to
 [genesys]  sane-devel at lists.alioth.debian.org. Please provide as 
 many
 [genesys]  details as possible, e.g. the exact name of your
 [genesys]  scanner and what does (not) work.
 [genesys] init_options start
 [genesys] init_options completed
 scanimage: open of device genesys:libusb:002:006 failed: Invalid argument
 Calling sane_exit
 [genesys] sane_genesys_exit start
 [genesys] sane_genesys_exit completed
 scanimage: finished
 nataraj at lenovo:/.data/home/nataraj/Projects/pulstek/tests$
 nataraj at lenovo:/.data/home/nataraj/Projects/pulstek/tests$ sudo scanimage 
 -L
 device `v4l:/dev/video0' is a Noname Lenovo EasyCamera virtual device
 device `genesys:libusb:002:007' is a PLUSTEK OpticBook 3800 flatbed scanner

 ==
 $ sudo SANE_DEBUG_GENESYS=256  scanimage -d genesys:libusb:002:006 -v -v -v -v
 -v 12345


 [sanei_debug] Setting debug level of genesys to 256.
 [genesys] SANE Genesys backend version 1.0 build 2302 from sane-backends
 1.0.23
 [genesys] SANE Genesys backend built with libusb
 [genesys] sane_init: authorize != null
 [genesys] sane_init: little endian machine
 [genesys] probe_genesys_devices start
 [genesys] attach: start: devp != NULL, may_wait = 0
 [genesys] attach: trying to open device `libusb:002:007'
 [genesys] attach: device `libusb:002:007' successfully opened
 [genesys] attach: found PLUSTEK flatbed scanner OpticBook 3800 at
 libusb:002:007
 [genesys] attach completed
 [genesys] probe_genesys_devices completed
 [genesys] sane_genesys_init completed
 [genesys] sane_open: start (devicename = `libusb:002:006')
 [genesys] sane_open: couldn't find `libusb:002:006' in devlist, trying attach
 [genesys] attach: start: devp != NULL, may_wait = 1
 [genesys] attach: trying to open device `libusb:002:006'
 [genesys] attach: couldn't open device `libusb:002:006': Invalid argument
 scanimage: open of device genesys:libusb:002:006 failed: Invalid argument
 Calling sane_exit
 [genesys] sane_genesys_exit start
 [genesys] sane_genesys_exit completed
 scanimage: finished


 Does anybody know about this issue? It does not seems for me to be chipset
 related...

 Also it manages to open a device once, and then can not... I do not understand
 what is the matter. :-(
 1.0.22 from sources with two debian patch that were already applied in 1.0.23,
 works well...(at least it tries to scan)



 Hello,

 what kind of changes have you done in the genesys backend ? I find 
strange that

libusb:002:007 is opened, then libusb:002:006 is tried. How many scanners do 
you have ? What does lsusb reports ?

Regards,
Stef




[sane-devel] Pulstek OpticBook 3800 - problems with openning device on 1.0.23+

2013-05-05 Thread Nikolay Shaplov
All my previous efforts I did with libsane 1.0.22 that comes with debian.

I've tried to do the same trick with git version and with 1.0.23 and did not 
managed to do it.

For some reason sane reports about not being able to open usb device. The more 
strange thing, it that it reports it on different stages of the initialization:

===
 sudo SANE_DEBUG_GENESYS=256  scanimage -d genesys:libusb:002:006 -v -v -v -v 
-v 12345


[sanei_debug] Setting debug level of genesys to 256.
[genesys] SANE Genesys backend version 1.0 build 2302 from sane-backends 
1.0.23
[genesys] SANE Genesys backend built with libusb
[genesys] sane_init: authorize != null
[genesys] sane_init: little endian machine
[genesys] probe_genesys_devices start
[genesys] attach: start: devp != NULL, may_wait = 0
[genesys] attach: trying to open device `libusb:002:006'
[genesys] attach: device `libusb:002:006' successfully opened
[genesys] attach: found PLUSTEK flatbed scanner OpticBook 3800 at 
libusb:002:006
[genesys] attach completed
[genesys] probe_genesys_devices completed
[genesys] sane_genesys_init completed
[genesys] sane_open: start (devicename = `libusb:002:006')
[genesys] sane_open: found `plustek-opticbook-3800' in devlist
[genesys] WARNING: Your scanner is not fully supported or at least 
[genesys]  had only limited testing. Please be careful and 
[genesys]  report any failure/success to 
[genesys]  sane-devel at lists.alioth.debian.org. Please provide as many
[genesys]  details as possible, e.g. the exact name of your
[genesys]  scanner and what does (not) work.
[genesys] init_options start
[genesys] init_options completed
scanimage: open of device genesys:libusb:002:006 failed: Invalid argument
Calling sane_exit
[genesys] sane_genesys_exit start
[genesys] sane_genesys_exit completed
scanimage: finished
nataraj at lenovo:/.data/home/nataraj/Projects/pulstek/tests$ 
nataraj at lenovo:/.data/home/nataraj/Projects/pulstek/tests$ sudo scanimage -L
device `v4l:/dev/video0' is a Noname Lenovo EasyCamera virtual device
device `genesys:libusb:002:007' is a PLUSTEK OpticBook 3800 flatbed scanner

==
$ sudo SANE_DEBUG_GENESYS=256  scanimage -d genesys:libusb:002:006 -v -v -v -v 
-v 12345


[sanei_debug] Setting debug level of genesys to 256.
[genesys] SANE Genesys backend version 1.0 build 2302 from sane-backends 
1.0.23
[genesys] SANE Genesys backend built with libusb
[genesys] sane_init: authorize != null
[genesys] sane_init: little endian machine
[genesys] probe_genesys_devices start
[genesys] attach: start: devp != NULL, may_wait = 0
[genesys] attach: trying to open device `libusb:002:007'
[genesys] attach: device `libusb:002:007' successfully opened
[genesys] attach: found PLUSTEK flatbed scanner OpticBook 3800 at 
libusb:002:007
[genesys] attach completed
[genesys] probe_genesys_devices completed
[genesys] sane_genesys_init completed
[genesys] sane_open: start (devicename = `libusb:002:006')
[genesys] sane_open: couldn't find `libusb:002:006' in devlist, trying attach
[genesys] attach: start: devp != NULL, may_wait = 1
[genesys] attach: trying to open device `libusb:002:006'
[genesys] attach: couldn't open device `libusb:002:006': Invalid argument
scanimage: open of device genesys:libusb:002:006 failed: Invalid argument
Calling sane_exit
[genesys] sane_genesys_exit start
[genesys] sane_genesys_exit completed
scanimage: finished


Does anybody know about this issue? It does not seems for me to be chipset 
related...

Also it manages to open a device once, and then can not... I do not understand 
what is the matter. :-( 
1.0.22 from sources with two debian patch that were already applied in 1.0.23, 
works well...(at least it tries to scan)





[sane-devel] Pulstek OpticBook 3800

2013-05-05 Thread Nikolay Shaplov

 did you see my email on the list? 
Yes, for technical reasons, previous mail I've sent did not properly get to 
the list, so I resend it without editing it. I wrote that letter before your 
letter, but it get to the list some days later...

 I tried to understand the protocol a
 bit. However, I'm not familiar with USB. If I had time, I guess I would
 try to talk to the GL845 using python (pyusb) in order to understand it
 better. If you stop working on the driver, please let me know; then I'll
 start learning USB.

Eh... I am not a driver developer at all... I will do my best when I have time 
and energy to get it to work, but this might take a long while...

I've created a branch at github 
https://github.com/dhyannataraj/sane-backends-gl845 
in order to work on this problem. But I've met some strange problems (I will 
write about them in another letter) so after the creating of a branch the 
development stopped.

I think we should put your annotated usb sniff in a wiki there, in order to 
have all staff together.




[sane-devel] Pulstek OpticBook 3800

2013-04-26 Thread Nikolay Shaplov

  Hello,
 
  to my knowledge, regarding bdcDevice, we currently have:
 
 GL843 devices bcdDevice 5.00
 GL846 devices bcdDevice 6.01
 GL847 devices bcdDevice 6.03
 GL124 devices bcdDevice 7.01
 
  So the the 6.05 value you have is a hint that your scanner doesn't
 use a supported genesys ASIC, probably a GL848 or GL123. By comparing
 the datasheet of these ASIC, you'll find register that aren't shared,
 and if you find the use of such registers in log, you'll be able to
 identify the ASIc used.
  Or find a 38x26 pins IC, labeled  GLnnn, where nnn will be the
 ASIC version.

It is GL845.

Other ICs are (just not to open it second time)

ESMT \n M12L64164A- \n AZV1P22P5

and 

WM8196SCDS \n 23AAMDD


Also I've found GL845 datasheet at 
http://www.dz863.com/datasheet-827931563-GL845_High-Speed-Usb-2.0-2-in-1-
Scanner-Controller-With-Adf/

So as I can understand I should clone some genesys_gl84?.[ch] and start to 
adapt it to 845 accoding to UsbSnoof log and datasheet. 

What file is better to clone? 843 according to datasheet has registers up to 
0xAE, 841 up to 0x87.  for 847 there is no datasheet.  and 845 uses registers 
up to 0xFF. So I think it is better to start from 847. Am I right? 

 And  then from what point it is better to start? At least I should make the 
head not trying to move out of phisical limits. I do not want it to be 
demaged... I think it is good point...




[sane-devel] Pulstek OpticBook 3800

2013-04-25 Thread ibu ☉ radempa ䷰
On 2013-04-24 07:05, Stef wrote:
 On 23/04/2013 10:23, Nikolay Shaplov wrote:
   the first step is to find the exact ASIC used in your scanner.
 Can
 you post an USB log of a preview done with the windows driver ?
 http://lj.shaplov.ru/2013/UsbSnoop.log.gz
 http://lj.shaplov.ru/2013/UsbSnoop.parsed.log.gz  (parsed with usbsnoop-
 gl847.pl as I found in this mail list)

 This log is sniffed right from the point of when scanner were turned on.

 And also the result of lsusb -v ?
 lsusb.log in attach

 Is there a chance you can IC through the glass when the scanning
 head is
 moving ?
 IC is for microchip? Then there are

 27ANG9K G4 \n ACT 04

 and

 UTC \n 78D  05L \n 01 PGT0

 The first one has about 14 legs, the second one only two.

 There are two chips with first sign  and two chips with second sign
 on the
 board that attached to the head.

   Then adding this scanner will be like you started it, but you'll
 also have to add specific entries for sensor, motor and gpio which
 change from device to device. The needed values will have to be deduced
 from USB logs.
 I've already started to view USB log and found matches with GL646
 spec, but I
 am still not really good with it, and also I still do not understand
 how does
 such simple operations, as writing some bits into LAMPPWM (for
 example) from
 USB log corresponds with the code from genesys_gl847.c


 The code path will had to be modified for the new defines.
   BTW there is no CCD sensor support currently in gl847 code, only
 CIS sensors are handled. That would need to be changed firt.
 What is CCD and CIS? :-)


 Hello,

 to my knowledge, regarding bdcDevice, we currently have:

 GL843 devices bcdDevice 5.00
 GL846 devices bcdDevice 6.01
 GL847 devices bcdDevice 6.03
 GL124 devices bcdDevice 7.01

 So the the 6.05 value you have is a hint that your scanner doesn't
 use a supported genesys ASIC, probably a GL848 or GL123. By comparing
 the datasheet of these ASIC, you'll find register that aren't shared,
 and if you find the use of such registers in log, you'll be able to
 identify the ASIc used.
 Or find a 38x26 pins IC, labeled  GLnnn, where nnn will be the
 ASIC version. 

Hi Nikolay and Stef,

opening an OpticBook 3800 (bottom metal plate and metal shield) I found
a chip with roughly 2x38x26 pins labeled:

GL845
1023H5508401-01G

This is no typo, it really reads GL845. Here is the datasheet for this chip:
http://www.genesyslogic.com/manage/upfile/12416597621.pdf

I would very much appreciate having a working linux driver for OpticBook
3800, since to my knowledge this would be the first (affordable) flatbed
scanner having a book edge and working with linux. Maybe I can
contribute a bit during the next two weeks.

Does anybody on the list know which chip is used in OpticBook 4800? That
device seems roughly twice as fast (and expensive).

Regards,
ibu




[sane-devel] Pulstek OpticBook 3800

2013-04-25 Thread ibu ☉ radempa ䷰
On 2013-04-25 18:53, ibu ? radempa ? wrote:
 On 2013-04-24 07:05, Stef wrote:
 On 23/04/2013 10:23, Nikolay Shaplov wrote:
   the first step is to find the exact ASIC used in your scanner.
 Can
 you post an USB log of a preview done with the windows driver ?
 http://lj.shaplov.ru/2013/UsbSnoop.log.gz
 http://lj.shaplov.ru/2013/UsbSnoop.parsed.log.gz  (parsed with usbsnoop-
 gl847.pl as I found in this mail list)

 This log is sniffed right from the point of when scanner were turned on.

 And also the result of lsusb -v ?
 lsusb.log in attach

 Is there a chance you can IC through the glass when the scanning
 head is
 moving ?
 IC is for microchip? Then there are

 27ANG9K G4 \n ACT 04

 and

 UTC \n 78D  05L \n 01 PGT0

 The first one has about 14 legs, the second one only two.

 There are two chips with first sign  and two chips with second sign
 on the
 board that attached to the head.

   Then adding this scanner will be like you started it, but you'll
 also have to add specific entries for sensor, motor and gpio which
 change from device to device. The needed values will have to be deduced
 from USB logs.
 I've already started to view USB log and found matches with GL646
 spec, but I
 am still not really good with it, and also I still do not understand
 how does
 such simple operations, as writing some bits into LAMPPWM (for
 example) from
 USB log corresponds with the code from genesys_gl847.c


 The code path will had to be modified for the new defines.
   BTW there is no CCD sensor support currently in gl847 code, only
 CIS sensors are handled. That would need to be changed firt.
 What is CCD and CIS? :-)


 Hello,

 to my knowledge, regarding bdcDevice, we currently have:

 GL843 devices bcdDevice 5.00
 GL846 devices bcdDevice 6.01
 GL847 devices bcdDevice 6.03
 GL124 devices bcdDevice 7.01

 So the the 6.05 value you have is a hint that your scanner doesn't
 use a supported genesys ASIC, probably a GL848 or GL123. By comparing
 the datasheet of these ASIC, you'll find register that aren't shared,
 and if you find the use of such registers in log, you'll be able to
 identify the ASIc used.
 Or find a 38x26 pins IC, labeled  GLnnn, where nnn will be the
 ASIC version. 
 Hi Nikolay and Stef,

 opening an OpticBook 3800 (bottom metal plate and metal shield) I found
 a chip with roughly 2x38x26 pins labeled:

 GL845
 1023H5508401-01G

 This is no typo, it really reads GL845. Here is the datasheet for this chip:
 http://www.genesyslogic.com/manage/upfile/12416597621.pdf

 I would very much appreciate having a working linux driver for OpticBook
 3800, since to my knowledge this would be the first (affordable) flatbed
 scanner having a book edge and working with linux. Maybe I can
 contribute a bit during the next two weeks.

 Does anybody on the list know which chip is used in OpticBook 4800? That
 device seems roughly twice as fast (and expensive).

 Regards,
 ibu
I've annotated the init phase from UsbSnoop.parsed.log using the
datasheet to get an idea of what's going on (attached).
-- next part --
unknown8e(33) = 0x00
set_write_register(0x01, 0x22)  # enable shading fucntion, select area-shading
unknown8e(32) = 0x55
set_write_register(0x25, 0x00)  # reset lines count (4 most significant bits), 
LINCNT [19:16]
unknown8e(32) = 0x55
set_write_register(0x68, 0x7f)  # PWM duty cycle selection, default value
unknown8e(32) = 0x55
set_write_register(0x9d, 0x04)  # Do not force the trigger position of motor 
trigger. Select two-pin type control for COM1  COM2 of LCD (GPO2930). Select 
the multiplier of slope table. For Reg 21, 24, 5F, 69, 6A, the real slope steps 
are register values multiplied by 4. Select data writing for LCM.
unknown8e(32) = 0x55
unknown8e(0) = 0x00
read_register(0x41) = 0xdc  # mixed status bits (power, img buf, motor, 
lamp, ...)
set_write_register(0x03, 0x10)
unknown8e(32) = 0x55
read_register(0xa6) = 0x1c  # GPIO[24:17]
set_write_register(0xa6, 0x1c)  # ?
unknown8e(32) = 0x55
read_register(0xa6) = 0x1c  # again?
set_write_register(0xa6, 0x1c)
unknown8e(32) = 0x55
unknown8e(33) = 0x00
unknown8e(0) = 0x00
read_register(0x06) = 0xf0  # scan mode: 16 clocks/pixel; PWRBIT: ...; 
GAIN4: ...; ASIC operation type: normal mode to capture AFE image
set_write_register(0x02, 0x78)  # auto-go-home and motor control (power on, 
forward, ...)
unknown8e(32) = 0x55
set_write_register(0x20, 0x10)  # set buffer condition. When buffer is full, 
scanner will stop and wait for host to read out image data from SDRAM.
unknown8e(32) = 0x55
set_write_register(0x68, 0x7f)  # again, default value
unknown8e(32) = 0x55
set_write_register(0x9d, 0x04)  # again
unknown8e(32) = 0x55
unknown8e(32) = 0x55
unknown8e(32) = 0x55
set_write_register(0x0b, 0x22)  # system clock: 30MHz; auto-refresh SDRAM; 
SDRAM size: 64M bits
unknown8e(32) = 0x55
set_write_register(0xa2, 0x0f)  # SDRAM refresh time: 30us
unknown8e(32) = 0x55
set_write_register(0x0b, 0x2a)  

[sane-devel] Pulstek OpticBook 3800

2013-04-24 Thread Stef
On 23/04/2013 10:23, Nikolay Shaplov wrote:
   the first step is to find the exact ASIC used in your scanner. Can
 you post an USB log of a preview done with the windows driver ?
 http://lj.shaplov.ru/2013/UsbSnoop.log.gz
 http://lj.shaplov.ru/2013/UsbSnoop.parsed.log.gz  (parsed with usbsnoop-
 gl847.pl as I found in this mail list)

 This log is sniffed right from the point of when scanner were turned on.

 And also the result of lsusb -v ?
 lsusb.log in attach

 Is there a chance you can IC through the glass when the scanning head is
 moving ?
 IC is for microchip? Then there are

 27ANG9K G4 \n ACT 04

 and

 UTC \n 78D  05L \n 01 PGT0

 The first one has about 14 legs, the second one only two.

 There are two chips with first sign  and two chips with second sign on the
 board that attached to the head.

   Then adding this scanner will be like you started it, but you'll
 also have to add specific entries for sensor, motor and gpio which
 change from device to device. The needed values will have to be deduced
 from USB logs.
 I've already started to view USB log and found matches with GL646 spec, but I
 am still not really good with it, and also I still do not understand how does
 such simple operations, as writing some bits into LAMPPWM (for example) from
 USB log corresponds with the code from genesys_gl847.c


 The code path will had to be modified for the new defines.
   BTW there is no CCD sensor support currently in gl847 code, only
 CIS sensors are handled. That would need to be changed firt.
 What is CCD and CIS? :-)


 Hello,

 to my knowledge, regarding bdcDevice, we currently have:

GL843 devices bcdDevice 5.00
GL846 devices bcdDevice 6.01
GL847 devices bcdDevice 6.03
GL124 devices bcdDevice 7.01

 So the the 6.05 value you have is a hint that your scanner doesn't 
use a supported genesys ASIC, probably a GL848 or GL123. By comparing 
the datasheet of these ASIC, you'll find register that aren't shared, 
and if you find the use of such registers in log, you'll be able to 
identify the ASIc used.
 Or find a 38x26 pins IC, labeled  GLnnn, where nnn will be the 
ASIC version.

Regards,
 Stef







[sane-devel] Pulstek OpticBook 3800

2013-04-23 Thread Stef
On 18/04/2013 20:39, Nikolay Shaplov wrote:
 Hi!

 I've recently bought Pulstek OpticBook 3800, hoping that it is almost the same
 thing as 3600, and I wont need much configuring with it.

 This hopes died when I did sane-find-scanner, it said

 found USB scanner (vendor=0x07b3 [PLUSTEK INC], product=0x1300 [USB2.0
 SCANNER], chip=GL847) at libusb:001:020

 and 3600 is GL841 :-(

 What did I do:

 I've cloned Genesys_Model plustek_3600_model in backend/genesys_devices.c
 replaced GENESYS_GL841 with GENESYS_GL847, added correct vendor and product id
 for this clone in device list there, built and installed it, and also added
 vendor and product id into /etc/sane.d/genesys.conf

 Result was the following

 scanimage makes the scanner move it's head (not always sane, sometimes it
 tries to move out of device physical limits) and turn the lamp on and off.

 Scanning goes with turned off lamp, and the result file if always filled with
 0x00, even if i put external light source over the scanner.


 This is my limits of what I can do myself without your help.

 I did not found any info about how to turn some debugging output (-v -v -v -v
 -v does not give much information about what sane is trying to do with the
 scanner)
 I did not found any guides about how to debug devices in such cases.

 If you can help me with these question, or even can guide me through the
 debugging process, this would be great.

 As I can understand GL847 chip is supported by SANE and we should do
 calibration and other staff like these...

 What I should do first?

 Hello,

 the first step is to find the exact ASIC used in your scanner. Can 
you post an USB log of a preview done with the windows driver ? And also 
the result of lsusb -v ? Is there a chance you can IC through the glass 
when the scanning head is moving ?
 Then adding this scanner will be like you started it, but you'll 
also have to add specific entries for sensor, motor and gpio which 
change from device to device. The needed values will have to be deduced 
from USB logs. The code path will had to be modified for the new defines.
 BTW there is no CCD sensor support currently in gl847 code, only 
CIS sensors are handled. That would need to be changed firt.

Regards,
 Stef




[sane-devel] Pulstek OpticBook 3800

2013-04-23 Thread Nikolay Shaplov
  the first step is to find the exact ASIC used in your scanner. Can
 you post an USB log of a preview done with the windows driver ? 
http://lj.shaplov.ru/2013/UsbSnoop.log.gz
http://lj.shaplov.ru/2013/UsbSnoop.parsed.log.gz  (parsed with usbsnoop-
gl847.pl as I found in this mail list)

This log is sniffed right from the point of when scanner were turned on.

 And also the result of lsusb -v ?
lsusb.log in attach

 Is there a chance you can IC through the glass when the scanning head is 
 moving ?

IC is for microchip? Then there are 

27ANG9K G4 \n ACT 04

and

UTC \n 78D  05L \n 01 PGT0

The first one has about 14 legs, the second one only two.

There are two chips with first sign  and two chips with second sign on the 
board that attached to the head. 

  Then adding this scanner will be like you started it, but you'll
 also have to add specific entries for sensor, motor and gpio which
 change from device to device. The needed values will have to be deduced
 from USB logs.
I've already started to view USB log and found matches with GL646 spec, but I 
am still not really good with it, and also I still do not understand how does 
such simple operations, as writing some bits into LAMPPWM (for example) from 
USB log corresponds with the code from genesys_gl847.c


 The code path will had to be modified for the new defines.
  BTW there is no CCD sensor support currently in gl847 code, only
 CIS sensors are handled. That would need to be changed firt.
What is CCD and CIS? :-)
-- next part --
A non-text attachment was scrubbed...
Name: lsusb.log
Type: text/x-log
Size: 2758 bytes
Desc: not available
URL: 
http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20130423/da91a294/attachment.bin


[sane-devel] Pulstek OpticBook 3800

2013-04-18 Thread Nikolay Shaplov

Hi!

I've recently bought Pulstek OpticBook 3800, hoping that it is almost the same 
thing as 3600, and I wont need much configuring with it. 

This hopes died when I did sane-find-scanner, it said

found USB scanner (vendor=0x07b3 [PLUSTEK INC], product=0x1300 [USB2.0 
SCANNER], chip=GL847) at libusb:001:020

and 3600 is GL841 :-(

What did I do:

I've cloned Genesys_Model plustek_3600_model in backend/genesys_devices.c
replaced GENESYS_GL841 with GENESYS_GL847, added correct vendor and product id 
for this clone in device list there, built and installed it, and also added 
vendor and product id into /etc/sane.d/genesys.conf 

Result was the following

scanimage makes the scanner move it's head (not always sane, sometimes it 
tries to move out of device physical limits) and turn the lamp on and off.

Scanning goes with turned off lamp, and the result file if always filled with 
0x00, even if i put external light source over the scanner.


This is my limits of what I can do myself without your help.

I did not found any info about how to turn some debugging output (-v -v -v -v 
-v does not give much information about what sane is trying to do with the 
scanner)
I did not found any guides about how to debug devices in such cases.

If you can help me with these question, or even can guide me through the 
debugging process, this would be great.

As I can understand GL847 chip is supported by SANE and we should do 
calibration and other staff like these...

What I should do first?