Subject: kern/6720: erroenous error reported by scsipi_ioctl.c
To: None <gnats-bugs@gnats.netbsd.org>
From: Andreas Wrede <andreas@planix.com>
List: netbsd-bugs
Date: 01/03/1999 02:08:43
>Number:         6720
>Category:       kern
>Synopsis:       missing case in scsipi_ioctl.c:scsipi_user_done
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jan  2 23:20:01 1999
>Last-Modified:
>Originator:     Andreas Wrede
>Organization:
Planix, Inc.
>Release:        <NetBSD-current source date>Dec 27, 1998
>Environment:
	
System: NetBSD woffi.planix.com 1.3I NetBSD 1.3I (WOFFI) #6: Sat Jan 2 20:47:00 EST 1999 root@woffi.planix.com:/local1/netbsd/netbsd-current/src/sys/arch/i386/compile/WOFFI i386


>Description:
	
The XS_SELTIMEOUT error value, when returned from an adapter driver 
is erroneously flagged as 'unknown'.

>How-To-Repeat:
	
Remove scsi scanner support from kernel, so your UMAX scanner gets
recognized as a uk device. Install graphics/sane from the package collection,
run scanimage and observe the error message 'unknown error category from 
host adapter code'.
	
>Fix:
	
I don't know if returning SCCMD_UNKNOWN for XS_SELTIMEOUT is correct.
That's what the default case does and that's what works for me. The patch
below ghets rid of the printf, it does not change function.

*** scsipi_ioctl.c.orig	Wed Nov 18 07:20:41 1998
--- scsipi_ioctl.c	Sat Jan  2 20:46:24 1999
***************
*** 182,187 ****
--- 182,191 ----
  		printf("host adapter code inconsistency\n");
  		screq->retsts = SCCMD_UNKNOWN;
  		break;
+ 	case XS_SELTIMEOUT:
+ 		SC_DEBUG(sc_link, SDEV_DB3, ("seltimeout\n"));
+ 		screq->retsts = SCCMD_UNKNOWN;
+ 		break;
  	case XS_TIMEOUT:
  		SC_DEBUG(sc_link, SDEV_DB3, ("timeout\n"));
  		screq->retsts = SCCMD_TIMEOUT;
***************
*** 192,198 ****
  		break;
  	default:
  		sc_link->sc_print_addr(sc_link);
! 		printf("unknown error category from host adapter code\n");
  		screq->retsts = SCCMD_UNKNOWN;
  		break;
  	}
--- 196,202 ----
  		break;
  	default:
  		sc_link->sc_print_addr(sc_link);
! 		printf("unknown error category %d from host adapter code\n",xs->error);
  		screq->retsts = SCCMD_UNKNOWN;
  		break;
  	}
>Audit-Trail:
>Unformatted: