The Card Reader Bluff. Call It!

You will never believe it! I plugged a SD card into the laptop’s card reader slot and it was not recognized. Yes, yes, I know, something in Linux not working out of the box? Weird, right? Stop being ironical and let’s fix it.

For the impatient:
# modprobe rts5139
(Arch Linux) # echo rts5139 > /etc/modules-load.d/sdcardreader.conf
(Ubuntu) # echo rts5139 >> /etc/modules

How did I get to that solution? If we want to troubleshoot it, we should start by examining if the inserted SD card is listed by any of the disk utilities. Let’s try these two:
# fdisk -l
# blkid

Not in my case, next stop? The wonderful land of logs. Since this looks like a hardware issue we should look at the kernel messages and we have a good go, we can plug/unplug the SD card as many times we like so we are going to use that to our advantage (i.e. reproduce the problem which is not equivalent to throwing water on them). Remove the SD card from the reader, open a terminal as root and launch the command to read the kernel messages:
# dmesg -Lw

Now plug the SD card and optionally turn the monitor 90 degrees and change the font to green (Matrix reference). You should see a lot of messages, in my case I see a lot of errors, that is a good start because it means that the hardware at least is operational, obviously not functional but operational. Why errors are good? Well, think in the alternative, you plug the SD card and nothing happens, that is more difficult to solve for starters it could be a hardware malfunction.

The kernel errors messages lead us to the following rationale: this may be a driver problem because the hardware reacts but the device is not accessed correctly. Let’s try to find the driver for my card reader for that we need to identify the actual hardware device; since card readers usually are connected to the USB systems let’s start by:

# lsusb
Bus 001 Device 002: ID 046d:c52f Logitech, Inc. Wireless Mouse M305
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 003 Device 005: ID 0ac8:c349 Z-Star Microelectronics Corp. 

There it is the RTS5129, let’s hope for the best and,in a leap of faith, just load a driver with such a name:
# modprobe rts5129
modprobe: FATAL: Module rts5129 not found.

Auch!!! That hurt, if this was Assassin’s Creed I will be all smashed on the ground. We don’t let the kernel to FATAL-us, do we? How can we check if there is any reference to RTS5129 in the kernel? If we had the Linux sources we could grep them and see what comes out. However, I don’t have the sources and don’t feel like downloading/installing them therefore I will try two websites:

The first site has a customized Google search which gives 3 hits all referring to a file for RTS5139, which is really close to my model. Try the search for yourself

As you could see (if you had click on the link), those files are not very human-friendly, maybe the second site can provide more meaningful information. LKDDb does not have any kind of search but we’ll use Google for it:

Bingo, LKDDb gives two hits and the first match says in plain lame language that rts5139 driver is for rts5129 as well, shall we try it?
# modprobe rts5139

Victory is mine!!! No errors and the SD card is immediately read. Now we have to load the module at boot, for that, in Arch Linux we have to create a file in /etc/modules-load.d/ with the text "rts139" or in Ubuntu we have to append such a module to /etc/modules:
(Arch Linux) # echo rts5139 > /etc/modules-load.d/sdcardreader.conf
(Ubuntu) # echo rts5139 >> /etc/modules

You could always elaborate a bit more as I did:
$ cat /etc/modules-load.d/sdcardreader.conf
#Load SD Reader RTS5129, which uses driver RTS5139

And the fun is over, now I have a boring fully working laptop… until next time.

About these ads
This entry was posted in Linux and tagged , . Bookmark the permalink.

2 Responses to The Card Reader Bluff. Call It!

  1. Wilf M says:

    How do you install the rts5139 driver?

    • thepadawan42 says:

      It should be already included in your kernel as a module. You can try to locate it:
      (Arch LInux) $ find /usr -name ‘rts5139.ko*’
      (Ubuntu) $ find /lib -name ‘rts5139.ko*’

      If you cannot find it then it could be that it is a builtin module or that the kernel you are using did not include it at all (neither as module neither as built-in). In the later case you will have to compile your own kernel and enable the CONFIG_RTS5139 option (‘m’ for module, ‘y’ for built-in).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s