Epic 4G USB tethering with Ubuntu Oneiric 11.10

It’s been a long time since I had to patch kernel code, to get a popular device to work with Linux.

I was having an issue tethering a Samsung Epic 4G to an Ubuntu 11.10 netbook over the USB cable.
When I plug things to Ubuntu, they just work most of the time. So this was a pleasant surprise.

I plugged an Epic 4G to the USB port and I can see the SCSI driver kicking in, with the command ‘dmesg’:

[13192.597053] scsi 5:0:0:0: Direct-Access     SAMSUNG  SPH-D700 Card         PQ: 0 ANSI: 2

When I enabled USB tethering on Android Gingerbread:

Settings -> Wireless and Network -> Tethering -> USB Tethering

I got these errors in Ubuntu about “bad CDC descriptors” when the USB network drivers try to load:

[13229.820147] usb 1-2: USB disconnect, device number 5
[13230.128108] usb 1-2: new high speed USB device number 6 using ehci_hcd
[13230.592280] usbcore: registered new interface driver cdc_ether
[13230.597004] usb 1-2: bad CDC descriptors
[13230.597081] usbcore: registered new interface driver rndis_host
[13230.607344] usb 1-2: bad CDC descriptors
[13230.607527] usbcore: registered new interface driver rndis_wlan

The Samsung Epic 4G uses RNDIS communication control, in order to provide Ethernet Networking over USB. (Microsoft Proprietary).
I hear this used to work well on Linux, until some devices got their Gingerbread update.

Now look at this bright example of Open Source community:
Some guy named Markus Kolb, submitted a bug report, provided debug and console captures; then wrote a patch as a workaround that fixes the issue.

I followed instructions from this Ubuntu Wiki, that explain how to compile a single module. After that, Ubuntu recognizes and connects me to the Internet with a tethered Epic 4G and Ubuntu using the USB cable.

# Fetch and uncompress the kernel source
sudo apt-get install linux-source patch
cd /usr/src
tar xfvj linux-source-3.0.0.tar.bz2 
# Apply the patch from the bug and compile the modules
cd linux-source-3.0.0/drivers/net/usb
patch cdc_ether.c $HOME/Downloads/Ubuntu_bug_796006.patch
make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules    
# sudo make -C /usr/src/linux-headers-`uname -r` M=`pwd` modules_install
sudo depmod -a
# sudo update-initramfs -u

I could have done modules_install and update-initramfs, so the module is used at boot. However, it seemed faster to just copy the compiled module I need (cdc_ether.ko), and overwrite the old one:

cp cdc_ether.ko /lib/modules/`uname -r`/kernel/net/usb/cdc_ether.ko

I could have used the WiFi hotspot functionality instead, but this was more fun.

This entry was posted in Ubuntu Linux and tagged , . Bookmark the permalink. Trackbacks are closed, but you can post a comment.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*