Re: Problem: non-SDHC 2GB SD cards are unreadable
From: Arnd Bergmann
Date: Mon Apr 14 2008 - 02:48:56 EST
On Monday 14 April 2008, Alexia Death wrote:
> On Monday 14 April 2008 03:45:32 you wrote:
>
> > My guess is that the problem is the way that the card is presented
> > to the USB mass storage driver by the reader.
> Yes, Ive come to a conclusion that because reader does not do anything about
> the speciality of the 2GB cards they wont be readable because Linux usb
> storage does not know about them either.
>
> > Generally, there is no problem with 2GB SD cards,
> It seems that in case of non-USB card readers, ie the ones built-in to laptops
> the speciality is taken care of by the reader driver...
Did you find any code in there that made you think so? Generally, the mmc
layer doesn't do much about the layout of the cards but merely represents
what is there.
On the contrary, the USB card readers go through a lot of effort to
make the card look like a SCSI device, and many of these implementations
are buggy in some way. SD cards are defined to have 512 byte sectors, while
USB mass storage can theoretically have a different sector size. Of course
any other size than 512 bytes is likely to break some code, which you have
experienced.
Note that Linux has another driver for USB mass storage, the "ub" block
driver which does not go through the SCSI software layer. It would be good
if you could check whether that has the same problem. Also, it might be
interesting to see if another operating system has the same problem
with the combination of your card and reader.
If it works on another OS, it's probably fixable on Linux, but the
effort may be significant.
> > so it would be good if you can try a different card reader with your cards.
> I have no different reader to try but I did try connecting the camera. It
> works.
> [1249166.105850] scsi 6:0:0:0: Direct-Access PENTAX DIGITAL_CAMERA
> 1.20 PQ: 0 ANSI: 0
> [1249166.117440] sd 6:0:0:0: [sdb] 3985409 512-byte hardware sectors (2041 MB)
> [1249166.122416] sd 6:0:0:0: [sdb] Write Protect is off
> [1249166.122431] sd 6:0:0:0: [sdb] Mode Sense: 0a 0a 00 01
> [1249166.122438] sd 6:0:0:0: [sdb] Assuming drive cache: write through
> [1249166.137400] sd 6:0:0:0: [sdb] 3985409 512-byte hardware sectors (2041 MB)
> [1249166.142390] sd 6:0:0:0: [sdb] Write Protect is off
> [1249166.142406] sd 6:0:0:0: [sdb] Mode Sense: 0a 0a 00 01
> [1249166.142412] sd 6:0:0:0: [sdb] Assuming drive cache: write through
> [1249166.142430] sdb: sdb1
> [1249166.176608] sd 6:0:0:0: [sdb] Attached SCSI removable disk
> [1249166.176735] sd 6:0:0:0: Attached scsi generic sg2 type 0
>
> As you can see the camera rewrites the hw sectors description and presents it
> quite differently than the card presents itself. Strangely enough my
> cardreader/photobank itself has no problem copying from these cards but still
> presents the cards to the pc "as is".
The camera is just another implementation of a USB mass storage device on
top of an SD card. My guess remains that this one works correctly, while
your standalone reader has a quirk that prevents it from being used on Linux.
Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/