USB tethering with a Nexus 5 on Linux



Sitting on the ICE to Munich, I'm using my Nexus 5 to open a WiFi Hotspot for my laptop. However, I'd like to use USB tethering instead; my mobile is plugged in to charge anyway, and it would also allow me to buy Telekom WiFi for my phone for a day and use it for my laptop, too. Sadly, it didn't work so easily, and I had to write a small patch for my kernel. First, I followed a tutorial on the Gentoo wiki about USB tethering. This was missing (at least) one option that has to be enabled, namely Host for RNDIS and ActiveSync devices (CONFIG_USB_NET_RNDIS_HOST), which corresponds to the rndis_host module. However, it still didn't work and dmesg gave me bad CDC descriptors. After some additional googling, I found a forum thread where someone had a similiar problem with his Motorola A780. Apparently a lot of hardware doesn't conform to the CDC standard. So I wrote a small patch for drivers/net/usb/cdc_ether.c which adds the Nexus 5 to the blacklist of products that are "egregiously nonconformant with the CDC Ethernet specs". Here it is:
--- drivers/net/usb/cdc_ether.c 2015-01-31 14:42:34.096991217 +0100
+++ drivers/net/usb/cdc_ether.nexus5.c  2015-01-31 14:42:28.114066014 +0100
@@ -682,6 +682,13 @@
        .driver_info = 0,
 },
 
+/* Google / LG Nexus 5 */
+{
+        USB_DEVICE_AND_INTERFACE_INFO(0x18d1, 0x4ee3, USB_CLASS_COMM,
+                USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),
+       .driver_info = 0,
+},
+
 /* WHITELIST!!!
  *
  * CDC Ether uses two interfaces, not necessarily consecutive.
I did this on kernel version 3.17.7 with the Gentoo patchset. However, the modified part is very straightforward, so it will probably apply cleanly to other versions to. Or at least, you can Do It Yourself easily.

2 Replies to “USB tethering with a Nexus 5 on Linux”

Leave a Reply

Your email address will not be published. Required fields are marked *