Ricoh SD-Card Reader and Linux

The linux kernel adds the benefit of making firmware drivers available for a large number of widely-used hardware devices and components. This provides great convenience and ensures portability and sane defaults across the various OS distributions. The open-source nature of the Linux kernel, however, relies on the hardware manufacturers to make the firmware and/or drivers available to the Linux community; a process that can be frustratingly slow at times, depending on the hardware manufacturer. Furthermore, once the driver is included in the kernel, it falls on the various OS distributions to make the kernel or a patch to the kernel available for the users to install.
The functionality of rarely-used hardware like a multimedia card reader (SD-card reader) are often overlooked by users until the day when they try to use the device. Usually, the kernel will load the necessary modules for the device to function properly during the boot-up process. Though, if an SD-card is not present during the configuration of the kernel the module will have to be loaded manually with the modprobe command. This writing should serve as an attempt to outline the necessary steps and required kernel modules to enable a Ricoh 4-in-1 media card reader on a ThinkPad-W520 laptop running Fedora20.
The pertinent kernel modules for the SD-card reader are:
  • mmc_core
  • mmc_block
  • sdhci
  • sdhci_pci
  • sdricoh_cs
If you're not sure about the specific modules or if they are different for a specific sd-card reader, you can look for them in the /usr/lib/modules/KERNELVERSION subfolders:
find /usr/lib/modules/3.10.06-100.fc20 -iname '*mmc*' 
find /usr/lib/modules/3.10.06-100.fc20 -iname '*sdhc*'
find /usr/lib/modules/3.10.06-100.fc20 -iname '*ricoh*'
To check whether the needed kernel modules are already loaded:
lsmod |egrep 'mmc|sdhci|ricoh'
I'm not an expert on this stuff by no means; I still have to figure out the specific modules needed without loading unnecessary and conflicting modules. The following is the dmesg output when a microSDHC+adapter was inserted.
kernel: mmc0: Controller never released inhibit bit(s).
kernel: mmc0: new high speed SDHC card at address e624
kernel: mmcblk0: mmc0:e624 SU32G 29.7 GiB (ro)
kernel:  mmcblk0: p1
kernel: SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts
udisksd[5513]: Mounted /dev/mmcblk0p1 at /run/media/Username/3532-3435 on behalf of uid 1000
kernel: mmc0: Card removed during transfer!
kernel: mmc0: Resetting controller.
kernel: mmcblk0: error -123 sending status command, retrying
kernel: mmcblk0: error -123 sending status command, retrying
kernel: mmcblk0: error -123 sending status command, aborting
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234904) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234905) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234906) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234907) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234908) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234909) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234910) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234911) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234912) failed
kernel: FAT-fs (mmcblk0p1): Directory bread(block 1234913) failed
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 353)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 406)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1425)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1426)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1425)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1426)
kernel: mmc0: Got data interrupt 0x00100000 even though no data operation was in progress.
kernel: mmc0: card e624 removed
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1424)
kernel: FAT-fs (mmcblk0p1): FAT read failed (blocknr 1126)
kernel: FAT-fs (mmcblk0p1): unable to read inode block for updating (i_pos 414429186)
udisksd[5513]: Cleaning up mount point /run/media/Username/3532-3435 (device 179:1 no longer exist)
kernel: mmc0: new high speed SDHC card at address e624
kernel: mmcblk0: mmc0:e624 SU32G 29.7 GiB (ro)
kernel:  mmcblk0: p1
kernel: SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts
udisksd[5513]: Mounted /dev/mmcblk0p1 at /run/media/amel/3532-3435 on behalf of uid 1000


According to an ArchLinux forum post, a problem arises if mmc_block is loaded:
There are two readers, one for SD and one for MMC. The SD reader is capable of reading MMC, however: As soon as the SD reader notices that the MMC reader is present, it passes the card to the MMC reader, which is unsupported by Linux. The MMC disabler driver is meant to prevent that, so that the working reader handles the MMC card, not the unsupported one (confusing, I know). So theoretically, MMC should work, too. However, the MSPro and xD readers do not work, as there are no drivers for them.

Solution

modprobe -r mmc_block
Unloading the mmc_block kernel module results in following dmesg output:
kernel: mmc0: card e624 removed                                                             │
kernel: mmc0: new high speed SDHC card at address e624                                      │
kernel: mmcblk0: mmc0:e624 SU32G 29.7 GiB                                                   │
kernel:  mmcblk0: p1                                                                        │
kernel: SELinux: initialized (dev mmcblk0p1, type vfat), uses genfs_contexts                │
udisksd[5513]: Mounted /dev/mmcblk0p1 at /run/media/Username/3532-3435 on behalf of uid 1000│

Popular posts from this blog

Password Policy in RHEL 7

Centos 7 pulseaudio

wpa_supplicant and wifi in RHEL 7