NetBSD-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 Mon, 13 Aug 2012 13:02:33 -0700
Jeff_W <jgw%tx0.org@localhost> wrote:
> Yes, that patch seems to have fixed things for my no-name "SDHC card
> reader 150x" on NetBSD-5.0.2/i36:

Great -- could you please try the appended patch instead? It tries
to fix the reason of the error instead of ignoring it later.
(The patch is for NetBSD-5.1.2 but I hope it applies too.)

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
--- umass_scsipi.c.orig 2012-08-17 12:33:34.000000000 +0000
+++ umass_scsipi.c      2012-08-17 12:33:49.000000000 +0000
@@ -390,7 +390,7 @@ umass_scsipi_cb(struct umass_softc *sc, 
        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;
@@ -418,16 +418,20 @@ umass_scsipi_cb(struct umass_softc *sc, 
                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,
                                          umass_scsipi_sense_cb, xs);
                return;


Home | Main Index | Thread Index | Old Index