NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/37403: USB tape drive Illegal Requests for any use

After finally getting a chance to pick this up again I've found an (ugly) 
solution to this issue.

The problem in the logs here seem to indicate a SCSI error when attempting to 
MODE SELECT. After some investigation into the details of that it eventually 
came to be that the block size was getting set to 0 and thus reported as such 
to the MODE SELECT SCSI command. I'm not sure if this is because the value is 
not between the allowed block size (2 <= blksize <= 16777215) or because the 
blksize is not changanble (the change mask a la PC field is not queried in the 
MODE SENSE) or what. What I do know is that the tape drive seems to start 
working great when this patch is applied:

--- sys/dev/scsipi/st.c.orig    2008-11-19 18:50:27.000000000 -0800
+++ sys/dev/scsipi/st.c 2009-10-19 08:48:50.000000000 -0700
@@ -1024,10 +1024,24 @@
         * We're getting no hints from any direction.  Choose variable-
         * length blocks arbitrarily.
+       /*
        st->flags &= ~ST_FIXEDBLOCKS;
        st->blksize = 0;
        SC_DEBUG(st->sc_periph, SCSIPI_DB3,
            ("Give up and default to variable mode\n"));
+        */
+       /* force block size */
+       if (st->media_blksize > 0)
+               st->flags |= ST_FIXEDBLOCKS;
+       else
+               st->flags &= ~ST_FIXEDBLOCKS;
+       st->blksize = st->media_blksize;
+       SC_DEBUG(st->sc_periph, SCSIPI_DB3,
+               ("Give up and default to media_blksize of %d\n", 
+       goto done;

Which successfully does the MODE SELECT with the right block size (512 in this 
device's case).

Now obviously this isn't good for all devices (as implemented in this patch) - 
just note that it works for this hardware. I'm not sure if this particular 
drive cannot do variable-sized blocks (in which case a drive quirk would work 
okay I think) or this is an artifact of the In-System ISD-300 ATAPI-to-USB SCSI 
over Bulk-Only adapter chip that this is using. I think it is the former 
because the same exact issue come ups when I use the drive over FireWire which 
uses an Oxford 911 IEEE1394 adapter chip (which also does SCSI over SBP-2).

I think the right solution is to do a drive quirk only if the drive is not 
directly SCSI attached? While I couldn't find any definitive docs this is a 
somewhat modern drive (AIT-1) which makes me think variable blocks (0 size) 
shouldn't be a problem.

P.S. As an aside why do ATAPI drives not do an actual MODE SELECT command? The 
function returns an error when it is attempted for ATAPI tape drive.

Home | Main Index | Thread Index | Old Index