You are not logged in.

#1 2011-05-14 15:53:48

MadCat_X
Member
Registered: 2009-10-08
Posts: 189

Problem reading files from SD card

Hello folks,

I've just encountered a strange problem reading JPEG (and possibly other, haven't tried yet) files from a SD card I use in my camera. It's a rather old 512 MB one and Windows and the camera read it perfectly fine. When I mount it in Arch, I can see the directory structure and files correctly, but the contents of the files is garbled and useless. I figured it might have something to do with https://bbs.archlinux.org/viewtopic.php?id=118751, but downgrade to 2.6.38.5 didn't help. The card reader I use is built in my Toshiba Qosmio X300 laptop (lspci output below).
Fsck.vfat -a /dev/mmcblk0p1 gives me a lot of errors which seem to be quite random, because they're different each time I run fsck.
I tried reformatting the card both in win and lin, using cfdisk to recreate a partition but it's still a no go. I get (also quite random) errors in dmesg like

FAT: Filesystem error (dev mmcblk0p1)
May 14 16:19:02 Qosmio-X300 kernel: invalid access to FAT (entry 0x0000d5f3)
May 14 16:19:02 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:19:02 Qosmio-X300 kernel: invalid access to FAT (entry 0x0000ceba)
May 14 16:20:25 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:20:25 Qosmio-X300 kernel: FAT: Filesystem has been set read-only
May 14 16:20:25 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:20:25 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:20:25 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:28:28 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:28:28 Qosmio-X300 kernel: invalid access to FAT (entry 0x0023a757)
May 14 16:28:28 Qosmio-X300 kernel: FAT: Filesystem has been set read-only
May 14 16:28:29 Qosmio-X300 kernel: FAT: Filesystem error (dev mmcblk0p1)
May 14 16:28:29 Qosmio-X300 kernel: invalid access to FAT (entry 0x0023a757)

lspci -vvv | grep JMicron

20:00.0 FireWire (IEEE 1394): JMicron Technology Corp. IEEE 1394 Host Controller (prog-if 10 [OHCI])
20:00.1 System peripheral: JMicron Technology Corp. SD/MMC Host Controller
20:00.2 SD Host controller: JMicron Technology Corp. Standard SD Host Controller (prog-if 01)
20:00.3 System peripheral: JMicron Technology Corp. MS Host Controller
20:00.4 System peripheral: JMicron Technology Corp. xD Host Controller

I'm on custom 2.6.38.5 kernel with BFS and BFQ patches.

This is how a JPEG file read from the card looks like (http://img577.imageshack.us/i/dscn2352w.jpg/)

Any ideas?

Offline

#2 2011-05-16 09:38:19

mmvinni
Member
Registered: 2011-05-16
Posts: 2

Re: Problem reading files from SD card

Can you try this patch: http://git.kernel.org/?p=linux/kernel/g … e82b055409

That patch is on its way to 2.6.40, hopefully, and getting it to stable trees would be easier if
it helps for more people than just me.

Offline

#3 2011-05-16 19:28:48

MadCat_X
Member
Registered: 2009-10-08
Posts: 189

Re: Problem reading files from SD card

Thanks a million for this patch. I applied it on 2.6.39-rc7-git10 and everything seems to be just fine. BTW, I remember my card reader working OK with some older kernel versions, is this a regression?

Offline

#4 2011-05-16 20:18:32

mmvinni
Member
Registered: 2011-05-16
Posts: 2

Re: Problem reading files from SD card

I'm glad it helps.
I tried to bisect the problem at some point thinking that 2.6.36 was good and 2.6.36.3 and 2.6.37 were buggy. Needless to say, both runs gave a different result, and the appearance of the bug depends also on the config in use and even then it doesn't happen every time (at least on my laptop).

Offline

Board footer

Powered by FluxBB