Enable Realtek USB 2.0 Card Reader On Ubuntu
- by Joe Jr Yamut
In my first and last attempt months ago, I used the keucr module which is a pretty common SD card reader driver to make my laptop’s built-in reader to work. It failed miserably. I half-heartedly searched a few more times on Google but didn’t find a solution. That time I really had no use of the card reader. Eventually I forgot about this, and as I rarely (or never) use the reader, I never bothered to fix it until now. I still rarely use the card reader but I want everything to work on my Ubuntu Natty.
The main reason I failed in my previous attempt is because I did not bother to identify the device on my machine. The thing is, you have to know the name/version of the specific devices you’re trying to make to work.
The device is RTS5139
My laptop manufacturer (MSI) IDs the device as rts5139, and from their website one can download an updated driver. Unfortunately, there is no driver available for Linux. It is only for Windows. At least I now know the specific device version.
Searching on Google again, I found this interesting thread on the Ubuntu forums – http://ubuntuforums.org/archive/index.php/t-1797202.html.
Running `lsusb` I compared the results with my machine against the thread above
Bus 002 Device 005: ID 0bda:0139 Realtek Semiconductor Corp.
BINGO! It is a match and at this point I was pretty sure I was on to something. As luck would have it, one user claimed that he got the source from Realtek by email (Please read the thread above.), and my heart was already pumping hard from all the excitement. Saved me from having to look for it on Realtek’s website. It looks like I may have found the answer after all. And I did.
The source can be downloaded from http://ubuntuone.com/p/153B/ or you may download it directly here. If you want to make it work right away, just extract the package and follow the steps in README.txt. It is that simple.
Note: I am assuming you already have all the compile tools and kernel headers necessary to build from source.
However, that method is kind of lacking. Once you install (update) another kernel the module will no longer work because it is compiled against a specific kernel. You can re-compile it, or, the solution here is to build the module using DKMS (Dynamic Kernel Support).
Steps to Build With DKMS
1) Download the source package above
2) Extract and copy to /usr/src (This is arbitrary. You can save it anywhere, including in your HOME directory. However, /usr/src is a very likely candidate where you don’t accidentally delete the source code. It is needed in future builds against a new kernel version.)
3) Rename the directory to rts5139-0.0.1 (The 0.0.1 is arbitrary. This is for personal versioning purposes. You will understand why this is important because if you use PACKAGE_VERSION, like below, DKMS will look for a directory with the PACKAGE_NAME + VERSION to find the source.)
4) Using your favorite text editor, create the dkms.conf file. Copy the contents below, and save it to /usr/src/rts5139-0.0.1
PACKAGE_NAME=”rts5139″
PACKAGE_VERSION=”0.0.1″
CLEAN=”make clean”
BUILT_MODULE_NAME[0]=”rts5139″
DEST_MODULE_NAME[0]=”rts5139″
MAKE[0]=”make KERNELDIR=/lib/modules/${kernelver}/build PWD=$dkms_tree/rts5139/0.0.1/build”
DEST_MODULE_LOCATION[0]=”/kernel/drivers/scsi”
AUTOINSTALL=”yes”
5) Time to build the module. Follow the commands below one at a time:
sudo dkms add -m rts5139 -v 0.0.1
sudo dkms build -m rts5139 -v 0.0.1
sudo dkms install -m rts5139 -v 0.0.1
(OOPS! Almost forgot. Load the module with modprobe. You may need to reboot after.)
sudo modprobe rts5139
Issue the command modinfo rts5139 to see information about the module.
Everything should have worked up to this point, as it did with mine. However, yours could be a different case. Cross your fingers that the build is successful. 😛
Try out if your DKMS build is working by installing a kernel. Click on details to see what is happening during the install. See image below.
If you’re the type who updates frequently then chances are you may have updated to the latest kernel version. Don’t worry, you can still use the older kernel versions for testing. These should be readily available from the Ubuntu repositories. I suggest you install the kernel through a terminal so you will see the installation process and if it re-builds the module for that particular version. However the surest way to find out if it is working is to reboot and use that newly installed kernel.
Building with DKMS is one of the best ways to compile from source. This way you are guaranteed that your device will work properly on future kernel updates.
I suggest you read about DKMS at https://help.ubuntu.com/community/DKMS and the manual (man DKMS).
Disclaimer: Source package is not signed. Use at your own risk!
Similar Posts:
- > SuSE Linux Enterprise stock ATI Radeon driver bug? October 18, 2006
- > Printer Driver For Fuji-Xerox DocuCentre-II C3300 March 11, 2013
- > AMD Catalyst Display Driver Now Works On Hybrid Graphics Laptops January 28, 2012
- > getting away with RPM dependecies September 28, 2006
- > Running on PHP-FPM May 19, 2020
In my first and last attempt months ago, I used the keucr module which is a pretty common SD card reader driver to make my laptop’s built-in reader to work. It failed miserably. I half-heartedly searched a few more times on Google but didn’t find a solution. That time I really had no use of…