[sane-devel] Error in sane_read(...) HP ScanJet 6200C/6250C

Mohit Kumar Mohit Kumar <mohit.kumar@gmail.com>
Fri, 24 Jun 2005 11:41:26 +0530

Hi All,

Sorry for writing so many mails to this group, but I am not able to
scan through my scanner and hence getting delayed.

Now my sane_read has stopped functioning. I mean sometimes it works
sometimes it just hangs and we need to stop the application. I have no
clue what is happening.

Here is the code :
f(gData->m_nBitsPerPixel =3D=3D 1 || gData->m_nBitsPerPixel =3D=3D 8)
=09=09=09=09unsigned char buf8[2*32768];
=09=09=09=09unsigned char* buf8ptr;
=09=09=09=09int len;
=09=09=09=09SANE_Status status =3D sane_read(CSane::handle, (SANE_Byte*)buf=
=09=09=09=09=09return false;
=09=09=09=09gData->m_pBuffer =3D (unsigned char*)malloc(sizeof(char)*len);

And the debugger output:

[hp] start: No request to mirror image vertically
[hp] sanei_hp_optset_scan_type: scantype=3D0
[hp] start: No request to mirror image vertically
[hp] start: 2550 pixels per line, 2550 bytes per line, 3507 lines high
[hp] sanei_hp_scl_startScan: Start scan
[hp] scsi_flush: writing 5 bytes:
[hp]  0x0000  1B 2A 66 30 53                                   .*f0S
[hp] do_read: Start reading data from scanner
[hp] do_read: 8942850 bytes left to read
[hp] do_read: try to read data (32768 bytes)
[hp] start_reader: reader process 1590 started
[hp] scsi_close: closing fd 0
[hp] sane_start will finish with Success
[hp] sane_read called
[hp] sanei_hp_handle_read: trying to read 65536 bytes
Program received signal SIGINT, Interrupt.
0xffffe002 in ?? ()
(gdb) [hp] signal_catcher(sig=3D2): old signal_caught=3D0
[hp] do_read: Error from scsi_read: End of file reached
[hp] process_data_finish called
[hp] do_read: caught signal 2
[hp] hp_handle_startReader: Exiting child (Operation was cancelled)

Any help in this regard would be appreciated because I am not able to
understand why does it work sometimes but not other times.