I've been following this discussion a bit and took a look at the
sense_handler code and then took a look a the Linux SCSI Programmers
HOWTO and then the SCSI-2 ansi spec.
The code:
if ( get_RS_error_code(result) != 0x70 )
{
DBG(DBG_proc, "invalid sense key => handled as DEVICE BUSY!\n");
return SANE_STATUS_DEVICE_BUSY; /* sense key invalid */
}
perhaps is being a bit too restrictive. According to the SCSI spec,
it seems that 0x71 is a valid value as well. 0x70 is a current error
and 0x71 is a deferred error. Perhaps this is the value that Simon
is getting? It would be real helpful if we could dump out the sense
buffer :)
I've also seen similar code written as:
if ( result[0] & 0x80 )
{
/* sense buffer invalid */
return SANE_STATUS_GOOD;
}
That code is checking the "valid bit" talked about in the SCSI spec
snippet I've included below. Then it returns the _GOOD status if
it is not set (maybe this is too liberal??)
I hope that this is helpful. I must admit that I find scsi error
handling quite confusing myself. I'd like to see how this one gets
resolved.
Thanks,
Tom Martone
>From the SCSI-2 spec...
Table 7-35: Error Codes 70h and 71h Sense Data Format
==============================================================================
Bit| 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
Byte | | | | | | | | |
==============================================================================
0 | Valid | Error Code (70h or 71h) |
-----|-----------------------------------------------------------------------|
1 | Segment Number |
-----|-----------------------------------------------------------------------|
2 |Filemark| EOM | ILI |Reserved| Sense Key |
-----|-----------------------------------------------------------------------|
3 | (MSB) |
- - -|- - Information - -|
6 | (LSB) |
-----|-----------------------------------------------------------------------|
7 | Additional Sense Length (n-7) |
-----|-----------------------------------------------------------------------|
8 | (MSB) |
- - -|- - Command-Specific Information - -|
11 | (LSB) |
-----|-----------------------------------------------------------------------|
12 | Additional Sense Code |
-----|-----------------------------------------------------------------------|
13 | Additional Sense Code Qualifier |
-----|-----------------------------------------------------------------------|
14 | Field Replaceable Unit Code |
-----|-----------------------------------------------------------------------|
15 to| SKSV | |
- - -|---------- - Sense-Key Specific - -|
17 | |
-----|-----------------------------------------------------------------------|
18 to| |
- - -|- - Additional Sense Bytes - -|
n | |
==============================================================================
A valid bit of zero indicates that the information field is not as defined
in this standard. A valid bit of one indicates the information field contains
valid information as defined in this standard. Targets shall implement the
valid bit.
The sense data format for error codes 70h (current errors) and 71h (deferred
errors) are defined in Table 7-35. Error code values of 72h to 7Eh are
reserved. Error code 7Fh is for a vendor-specific sense data format. Targets
shall implement error code 70h; implementation of error code 71h is optional.
Error code values of 00h to 6Fh are not defined by this standard and their use
is not recommended.
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com