NetBSD-Bugs archive

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

Re: kern/35275 (RCA Lyra flash device/music player will not mount as umass device)



The following reply was made to PR kern/35275; it has been noted by GNATS.

From: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: kern/35275 (RCA Lyra flash device/music player will not mount as 
umass device)
Date: Thu, 6 Mar 2008 11:19:40 +0100

 --XsQoSWH+UP9D9v3l
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 On Thu, Mar 06, 2008 at 04:50:17AM +0000, dholland%NetBSD.org@localhost wrote:
 > Do you think this fix should be found and pulled up to 3.x?
 > (If not, the PR can be closed...)
 
 Unfortunately I can not remember what commit I was thinking of back then.
 Candidates would be:
 
  sys/dev/scsipi/sd.c rev 1.256, 1.255, 1.253 and especially 1.251
 
 Maybe the latter is enough - it applies straight to netbsd-3. Can someone
 test the patch below (against netbsd-3)?
 
 Martin
 
 --XsQoSWH+UP9D9v3l
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=patch
 
 Index: sd.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/scsipi/sd.c,v
 retrieving revision 1.237.2.3
 diff -u -r1.237.2.3 sd.c
 --- sd.c       29 Dec 2005 15:21:00 -0000      1.237.2.3
 +++ sd.c       6 Mar 2008 10:07:15 -0000
 @@ -1644,7 +1644,7 @@
                u_int8_t resvd;
        } scsipi_sense;
        u_int64_t sectors;
 -      int error;
 +      int error, blksize;
  
        /*
         * scsipi_size (ie "read capacity") and mode sense page 6
 @@ -1653,7 +1653,7 @@
         * XXX probably differs for removable media
         */
        dp->blksize = 512;
 -      if ((sectors = scsipi_size(sd->sc_periph, flags)) == 0)
 +      if ((sectors = scsipi_size(sd->sc_periph, &blksize, flags)) == 0)
                return (SDGP_RESULT_OFFLINE);           /* XXX? */
  
        error = scsipi_mode_sense(sd->sc_periph, SMS_DBD, 6,
 @@ -1665,7 +1665,7 @@
  
        dp->blksize = _2btol(scsipi_sense.lbs);
        if (dp->blksize == 0)
 -              dp->blksize = 512;
 +              dp->blksize = blksize ? blksize : 512;
  
        /*
         * Create a pseudo-geometry.
 @@ -1693,13 +1693,13 @@
  sd_get_capacity(struct sd_softc *sd, struct disk_parms *dp, int flags)
  {
        u_int64_t sectors;
 -      int error;
 +      int error, blksize;
  #if 0
        int i;
        u_int8_t *p;
  #endif
  
 -      dp->disksize = sectors = scsipi_size(sd->sc_periph, flags);
 +      dp->disksize = sectors = scsipi_size(sd->sc_periph, &blksize, flags);
        if (sectors == 0) {
                struct scsipi_read_format_capacities cmd;
                struct {
 @@ -1754,7 +1754,7 @@
                memset(&scsipi_sense, 0, sizeof(scsipi_sense));
                error = sd_mode_sense(sd, 0, &scsipi_sense,
                    sizeof(scsipi_sense.blk_desc), 0, flags | XS_CTL_SILENT, 
&big);
 -              dp->blksize = 512;
 +              dp->blksize = blksize ? blksize : 512;
                if (!error) {
                        if (big) {
                                bdesc = (void *)(&scsipi_sense.header.big + 1);
 @@ -1773,7 +1773,7 @@
                        if (bsize >= 8) {
                                dp->blksize = _3btol(bdesc->blklen);
                                if (dp->blksize == 0)
 -                                      dp->blksize = 512;
 +                                      dp->blksize = blksize ? blksize : 512;
                        }
                }
        }
 
 --XsQoSWH+UP9D9v3l--
 


Home | Main Index | Thread Index | Old Index