Current-Users archive

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

Re: possible fix for strange USB sticks / SD card readers



On Fri, 17 Aug 2012 02:33:43 -0400
Matthew Mondor <mm_lists%pulsar-zone.net@localhost> wrote:
> On Mon, 13 Aug 2012 18:02:54 +0200
> Matthias Drochner <M.Drochner%fz-juelich.de@localhost> wrote:
>
> > Can those of you with other non-working USB sticks (or SD card
> > readers which sometimes use similar controller chips) try
> > the patch and report whether it helps?
>
> Since this helps for some devices, it should probably also be
> pulled-up to netbsd-6?

I've found a different fix, which hopefully helps in even more
cases. Could everyone with strange devices, and also with
working devices, try that one? (instead of the old patch)
If it doesn't cause regressions, it would be a better candidate
for pullup.

best regards
Matthias


------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------

Kennen Sie schon unsere app? http://www.fz-juelich.de/app
diff -r 8cadf95c3fe1 sys/dev/usb/umass_scsipi.c
--- a/sys/dev/usb/umass_scsipi.c        Fri Aug 17 13:38:15 2012 +0200
+++ b/sys/dev/usb/umass_scsipi.c        Fri Aug 17 13:40:18 2012 +0200
@@ -398,7 +398,7 @@
        struct umass_scsipi_softc *scbus = (struct umass_scsipi_softc *)sc->bus;
        struct scsipi_xfer *xs = priv;
        struct scsipi_periph *periph = xs->xs_periph;
-       int cmdlen;
+       int cmdlen, senselen;
        int s;
 #ifdef UMASS_DEBUG
        struct timeval tv;
@@ -426,16 +426,20 @@
                scbus->sc_sense_cmd.opcode = SCSI_REQUEST_SENSE;
                scbus->sc_sense_cmd.byte2 = periph->periph_lun <<
                    SCSI_CMD_LUN_SHIFT;
-               scbus->sc_sense_cmd.length = sizeof(xs->sense);
 
                if (sc->sc_cmd == UMASS_CPROTO_UFI ||
                    sc->sc_cmd == UMASS_CPROTO_ATAPI)
                        cmdlen = UFI_COMMAND_LENGTH;    /* XXX */
                else
                        cmdlen = sizeof(scbus->sc_sense_cmd);
+               if (periph->periph_version < 0x05) /* SPC-3 */
+                       senselen = 18;
+               else
+                       senselen = sizeof(xs->sense);
+               scbus->sc_sense_cmd.length = senselen;
                sc->sc_methods->wire_xfer(sc, periph->periph_lun,
                                          &scbus->sc_sense_cmd, cmdlen,
-                                         &xs->sense, sizeof(xs->sense),
+                                         &xs->sense, senselen,
                                          DIR_IN, xs->timeout, 0,
                                          umass_scsipi_sense_cb, xs);
                return;


Home | Main Index | Thread Index | Old Index