[sane-devel] scsi scan command
jazz_johnson at verizon.net
jazz_johnson at verizon.net
Wed Oct 24 22:25:20 UTC 2007
Ricoh IS450 hs2p backend update:
I found the bug in my set_window() command.
The Manual said that the default value of the double-byte bit-order was
that bits 0-2 were '0' and the remaining bits '1'
which conflicted with the further specification that bits 6-4 were reserved and hence unset.
Changing the bit-order value to 0x0007 fixed the ILLEGAL REQUEST error.
But now I have another ILLEGAL REQUEST error when I try to trigger the scanner to scan.
Where, according to the MANUAL,
"the Transfer Length is the
byte-length of the Window List transferred by the initiator in the
DATA OUTPUT PHASE, and the Window List is a list of WIndow Identifiers
created by the SET WINDOW command.
Only one Window is supported with regard to Scan command. Therefore,
0 or 1 is used for Window Identifier, and 1 or 2 for Transfer Length."
So in my set_window_data comand I have code like:
/* For each window (up to 2 if we're duplexing) */
nwin = ( s->val[OPT_DUPLEX].w == SANE_TRUE )? 2 : 1;
for(i=0; i<nwin; i++){ data = &(wbuf->data[i]);
data->window_id = i;
< set bit-order, x-res, y-res, width, height, ... >
}
Then in my trigger_scan command, based on ibm.c,
I have :
typedef struct {
SANE_Byte opcode; /* 0x1B */
SANE_Byte B1; /* LUN : reserved */
SANE_Byte pc; /* page code */
SANE_Byte B2; /* reserved */
SANE_Byte len /* transfer length */
SANE_Byte control; /* VU : reserved : Flag : Link */
}START_SCAN;
trigger_scan (HS2P_Scanner *s)
{
static START_SCAN cmd;
static SANE_Byte window_id_list[2] = { 0, 1} ;
SANE_Status status;
size_t wl_size = sizeof(window_id_list);
memset (&cmd, 0, sizeof (cmd)); /* CLEAR cmd */
cmd.opcode = HS2P_SCSI_START_SCAN; /* 1BH */
cmd.len = (s->val[OPT_DUPLEX].w == SANE_TRUE)? 2 : 1 ;
status = sanei_scsi_cmd (s->fd, &cmd, sizeof (cmd), &window_id_list[0], &wl_size);
/* I've also tried the following line, but also get ILLEGAL REQUEST
status = sanei_scsi_cmd (s->fd, &cmd, sizeof (cmd), NULL, NULL);
*/
return (status);
}
In the MANUAL description of the SET WINDOW command it says about
bytes 0 and 320 (the Window Identifier bytes):
"Window Identifier is set to 0 or 1 as the scanner supports 2 windows."
THANKS for any help in understanding RICOH English.
Some Error Messages:
[hs2p] sane_start: filling in window data buffer
[hs2p] >> set_window_data: sizeof(*wbuf)=648; window len=640
[hs2p] >> set_window_data: CLEARING wbuf
[hs2p] >> set_window_data: writing Window Descriptor Length =640
[hs2p] << set_window_data
[hs2p] sane_start: sending SET WINDOW DATA
[hs2p] >> set_window
[hs2p] set_window: SET WINDOW COMMAND Transfer Length = 648 (should be 648)
[hs2p] set_window: COPYING 648 bytes from settings to Set Window Command (648)
[hs2p] set_window: SET WINDOW COMMAND Window Descriptor Length = 640 (should be 640)
[hs2p] set_window: calling sanei_scsi_cmd(3,&win,658, NULL, NULL)
[hs2p] << set_window
[hs2p] sane_start: sending GET WINDOW
[hs2p] >> get_window
[hs2p] >> get_window datalen = 648
[hs2p] << get_window, datalen = 648
[hs2p] >> trigger scan
[hs2p] sense_handler: result=0x70, sense=0x5, asc=0x26, ascq=0
[hs2p] sense_handler: ErrorCode 70 ValidData: 0 EOM: 0 ILI: 0 InvalidBytes: 0
[hs2p] sense_handler: sense=70 00 05 00 00 00 00 06 00 00 00 00 26 00 00 00
[hs2p] sense_handler: sense_key=0x5 'ILLEGAL REQUEST - Used such as when illegal parameter exists in data or command'
[hs2p] Looking up ascq=(0x26,0)=0x2600
[hs2p] sense_handler: ascq=(0,0): 0x2600 'Invalid field in parameter list (check field pointer).'
[hs2p] sense_handler : 'ILLEGAL REQUEST'-'Used such as when illegal parameter exists in data or command' 'Invalid field in parameter list (check field pointer).' return:4
[hs2p] << trigger scan
[hs2p] start of scan failed: Invalid argument
[hs2p] >> do_cancel
More information about the sane-devel
mailing list