10 ms·
Why Android can't use CDC Ethernet (2023)
- progbits 1y agoFun deep dive article! Looked up the source and it appears the regex was changed from `eth\\d` to just `*` in October 2023, presumably fixing this issue: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2784077 https://android-review.googlesource.com/c/platform/packages/... The description says "The default will include both usb\d+ and eth%d named interfaces on Android U+", "U+" being version 14 I think (https://en.wikipedia.org/wiki/Android_version_history https://en.wikipedia.org/wiki/Android_version_history)
- mshockwave 1y agoIt was later reverted[1] because "there are devices in the field using usbX interfaces for tethering". Shortly after that, it got re-landed but only supported Android V+[2] [1]: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2851331 https://android-review.googlesource.com/c/platform/packages/... [2]: https://android-review.googlesource.com/c/platform/packages/modules/Connectivity/+/2889390 https://android-review.googlesource.com/c/platform/packages/...
- dfc 1y agoWhat are Android T+, U+ and V+?
- charcircuit 1y agoT = Android 13 U = Android 14 V = Android 15
- NooneAtAll3 1y agoI wonder what was the need for this obfuscation
- isiahl 1y agoIt’s not really obfuscation. It goes back to when Android OS’s used to be named after desserts. While in development they would be referred to just by the letter as the dessert name wasn’t usually finalized
- throwaway314155 1y agoIt's not deliberate obfuscation. But the end result is still obfuscated.
- IshKebab 1y agoNot as bad as Ubuntu/Debian code names at least.
- shadowgovt 1y agoNumbers are exactly as obfuscatory as letters. "Android 14" doesn't tell me anything other than it comes after 13 and before 15, and "V" tells me the same relative to U and W.
- fc417fc802 1y agoI have the same thought every time marketing at a major OEM changes a systematic naming scheme.
- gbil 1y agoa few months ago I was given a unihiker board that uses cdc and didn’t work with my android devices, now that I read this I tried again since I got them upgraded to android 15 in between but still doesn’t work and I’m afraid this is due to samsung implementation of android 15! Works on ipad though which was a surprise to me!
- shadowgovt 1y agoSo the meta question is: Why does the device API require the system to play these name games instead of giving enough information to discover whether the thing is an honest-to-God Ethernet device?
- MBCook 1y agoThe article says that iOS doesn’t support CDC Ethernet adapters. But I’ve plugged just standard USB ethernet adapters into my phone and had them work. Does iOS communicate with them using some other standard?
- robingchan 1y agoyes - ASIX / realtek chipsets are whats in your generic dongle, the drivers for which are bundled in iOS. CDC ECM is not supported. I found this out when using CAN bus to ethernet on iPhone
- brigade 1y agomacOS definitely does not ship drivers for Realtek’s vendor protocol, and only supports them via ECM/NCM. Are you claiming iOS is the exact opposite?
- kccqzy 1y agoWell macOS ships with something called AppleUSBRealtek8153Patcher (aka com.apple.driver.usb.realtek8153patcher). I'm not sure if this uses proprietary Realtek protocols, but it's pretty well known that this patcher does not work reliably on macOS. These days I only use Realtek 8156 on macOS (which uses NCM). And I just tested the 8156 on iOS; in fact this comment is transmitted by iOS to HN via a 8156 dongle.
- tripdout 1y agocs.android.com is a simpler alternative than downloading the whole 100+ Gb source.
- ck2 1y agoMy tablet with lineageOS works with very few select usb-ethernet adapters (ASIX AX88179 chipset) But since it doesn't support charging while in OTG host mode, it cannot stay plugged into the adapter for long (old battery) Some newer devices like Samsung support ACA OTG (Accessory charging adaptor)) with charging while powering the adapter
- Marsymars 1y agoWhat’s old is new again; Windows Phone devices did USB charging + ethernet (+ display) a decade ago.
- p0w3n3d 1y agoI was really shocked when they stopped making android phones with USB micro hdmi support, which basically allowed playing games on TV
- AStonesThrow 1y agoMy HDMI Philips monitor supported MHL. And DVI-D, incidentally. However, I was never able to use MHL display. None of my devices seemed to support it. Android Kitkat/Lollipop, Samsung Galaxy Tab. I’ve no idea what sort of cable would’ve been needed. There was no USB connector on the monitor.
- p0w3n3d 1y agoI had a micro-usb to MHL adapter added to my nexus tablet (forgot already which version)
- izacus 1y agoThat's because a lot of new phones (and tablets) support video via USB-C just like laptops.
- AStonesThrow 1y ago
- franga2000 1y agoLooking at the LineageOS commit history, it seems seems this has been fixed [0], reverted [1] due to compatibility issues, then unreverted again [2] but only for the latest Android versions. If I'm reading the commits right, someone at Google was involved, so this might be in the official Google build now. [0] https://github.com/LineageOS/android_packages_modules_Connectivity/commit/5512a2b70f03ce7bfbea235ab17e266da5bab694 https://github.com/LineageOS/android_packages_modules_Connec... [1] https://github.com/LineageOS/android_packages_modules_Connectivity/commit/ac6ff00b831683f095566f2982d08c88b175ba1c https://github.com/LineageOS/android_packages_modules_Connec... [2] https://github.com/LineageOS/android_packages_modules_Connectivity/commit/5512a2b70f03ce7bfbea235ab17e266da5bab694 https://github.com/LineageOS/android_packages_modules_Connec...
- luca020400 1y agoAs Lineage is concerned I found that a while ago and made https://review.lineageos.org/c/LineageOS/android_packages_modules_Connectivity/+/382841 https://review.lineageos.org/c/LineageOS/android_packages_mo... But no one bothered to test, and I had no way to verify so it's in a limbo for now :) It's always a mix of things people report to us, things someone randomly pick up, but then we need real users testing them out lol
- hypercube33 1y agoThats super weird. I have like 15 USB ethernet adapters and all of them work just fine. I'm pretty sure they are a few different chipsets from Realtek and AXIS or something like that, too. If you get ones that dont need drivers on linux you're good to go with pretty much any OS and BIOS
- userbinator 1y agoThere is no way to work around this, short of rooting the phone to change the value of config_ethernet_iface_regex. Another reason why having root is important on a device that you own.
- bigyabai 1y agoBeing able to arbitrarily redirect networking traffic is perhaps the single greatest reason to not have superuser privs in userland. I support anybody that wants to pressure OEMs into allowing bootloader unlocks, but I also can't name a use for root that justifies the insanely expanded surface area for attackers, at least on Android.
- userbinator 1y agoThe corporate FUD has gotten strong enough that people are getting scared of freedom. That should disturb you more than any perceived paranoia about "attackers".
- stavros 1y agoSeriously, people are acting like the "do you want to give this application elevated privileges" popup is some arcane magick that we as a race can never hope to possess.
- bigyabai 1y agoThat really should not surprise people when their smartphone has been telling them it is the wrong design pattern for over a decade. Point the finger at whoever you want. If you need to find who broke the bicycle for the mind, I think most of us know who's responsible.
- stavros 1y agoI'm not sure what you mean, I find smartphones' "do you want to allow this application access to X?" a pretty understandable and secure pattern.
- deleted 1y ago[deleted]
- russellbeattie 1y agoI had to look it up: CDC stands for "USB Communications Device Class". I've never once tried to hook any of my many, many Android devices over the last decade+ to wired Ethernet using a USB adapter, but I had assumed it would just work if I did. Interesting.
- dfc 1y agoInstead of looking it up you could have read the article: So what’s this about CDC Ethernet and why should I care? CDC stands for Communications Device Class.
- russellbeattie 1y agoRight. Beyond half way through the article. I saw it, but was so baffled through the top half, I had already searched for it before I continued. I figured someone else would want to know. There's even another comment saying the exact same thing. Regardless, my comment was mostly about how I had never run into the issue.
- hansjorg 1y ago> CDC stands for Communications Device Class https://en.m.wikipedia.org/wiki/USB_communications_device_class https://en.m.wikipedia.org/wiki/USB_communications_device_cl... Why is this buried almost at the end of the article? Why even mention it at that point?
- andix 1y agoRule of thumb: Explain every abbreviation the first time it is used in an article or a meeting. Only really obvious things like USB or HTTP can be skipped.
- stavros 1y agoThank you, I decided to say "fuck it" and read the entire article mentally expanding it into "center for disease control devices", and I have no regrets.
- bede 1y agoI assumed that the article must be about a frustrated CDC employee just trying to get internet access at work.
- secondcoming 1y agoThe Android code also allowed for 'test interfaces'. I wonder why the author didn't go down that path. The Android revert message is also interesting: there are devices in the field using usbX interfaces for tethering What's the problem with this?
- jeroenhd 1y agoFrom what I can tell, the code that the patch covered is responsible for configuring the network interface as a client. If another system on the phone brings up the interface as a host device to tether internet to a second device, you end up with the phone trying to configure the interface both as a router and as a client.
- rcxdude 1y agoThis. In general interface names are arbitrary and not a good way to determine anything about what it's connected to, but the usb vs eth distinction is particularly bad, because linux will use either for either 'end' of a link.
- yeth0099 1y agoUnfortunately, test interfaces have to match `testtap\d+`
- Zak 1y agoA related thing that used to annoy me is that vanilla Android wouldn't connect to ad-hoc WiFi networks. Third-party ROMs usually would, so it wasn't due to a hard problem. The bug report had a two-digit number and Google steadfastly refused to fix it for years. I haven't seen an ad-hoc network in a long time, but they were common when Android was young.
- jordemort 1y agoI wrote this after a bad week at a previous job trying to get an Android device to work with a CDC Ethernet adapter. Since writing this, a couple people have let me know that there is a particular bit in the MAC address, that if flipped, will cause the kernel to assign an `ethX` name instead of `usbX` name. I haven't tried it myself or updated the post with that information because I moved on to a different job, and Android devices are no longer a large part of my life. Of course, that only helps if you have a CDC device where you're in control of the MAC address (i.e. maybe another Linux device pretending to be a CDC adapter)
- rcxdude 1y agoThis might actually help me out! Did you find what bit it is? (Ah, I think I found it: https://lkml.iu.edu/hypermail/linux/kernel/1103.2/03250.html https://lkml.iu.edu/hypermail/linux/kernel/1103.2/03250.html )
- goodburb 1y agoThanks, setting the MAC address to global bit works on my Moto Android 15, Honor Android 9, and GSI 16 from a Raspberry Pi [1]. It now appears as eth0 and routes created only after turning off the Wi-Fi, DHCP is obtained regardless. ECM scores 270Mbit, RNDIS 150Mbit. Mobile hotspots/dongles with MAC address modification should work. (currently detected as usb0) [1]: https://gist.github.com/TalalMash/c20e6aa237e1f123ddf9686a07a1bfed https://gist.github.com/TalalMash/c20e6aa237e1f123ddf9686a07...
- deleted 1y ago[deleted]
- chews 1y agoyes to this post!
- rcxdude 1y agoIt also, very annoyingly, can't connect to multiple networks at once. e.g. connecting to a wifi network which doesn't have internet access (and doesn't even advertise a default route) and a cell phone network at the same time. Linux can do it, Windows can do it, Android stubbornly refuses (and indeed many variants will refuse to stay connected to a wifi network without internet, if not just make you jump through confusing hoops). There are some APIs which mean that if you write an app, you can do it just in the app, but there's no way as a user to get it to do so.
- OptionOfT 1y agoSame with iOS. When I connect to my dashcam to download some videos I get a pop-up after a while that is like: "No internet detected, switch to cellular?" I tap remain connected. No option to disable that. And even though I wanted to stay connected, iOS decides it knows better and reconnects to my Carplay network.
- raron 1y agoAs far as I remember this have a solution for both Android and iPhone. Probably your dashcam just doesn't implemented them right. https://developer.apple.com/forums/thread/13164 https://developer.apple.com/forums/thread/13164
- deleted 1y ago[deleted]
- rcxdude 1y agoOnly if you have an app. It could well be the only reason you would want to make a custom app, because of this irritating behaviour by the OS.
- Aurornis 1y agoThis actually works fine on iOS when the app is implemented properly. I have multiple devices where I do this without issue. I’m guessing your dash cam app is not implemented correctly.
- unit149 1y ago[dead]
- throwaway314155 1y agoTruly curious to why this is the top article when even the author admits it's no longer accurate. Slow news day I guess.
- kiwijamo 1y agoThere's still plenty of phones out there still running the older kernels. My S21 is probably one of them unfortunately.
- kimixa 1y agoAlso check for firmware requirements - some devices enumerate but fail on ifup without firmware available. The android UI naturally can't cope with this, only dmesg tells you what's going on. Though not sure if CDC devices require this? Though a lot of adapters are (were?) based on Realtek or Kawasaki chips that did. I guess this android change is relatively recent though, as we regularly used USB network dongles on our debug devices (that used 100% "Vanilla" AOSP). Or perhaps a kernel change, or a quirk of the CDC driver to name the device usb*? You just had to be careful which chipset the dongle used and ensure it didn't need any firmware.
- ahepp 1y agoI'm working on an embedded system right now that has two CDC ethernet devices. One shows up as ethX and the other shows up as usbX. Maybe it's because one is CDC EEM and the other is CDC ECM? But I don't think this is generally true for all CDC ethernet.
- 0xbadcafebee 1y ago> Android's EthernetTracker service only acknowledges interfaces that are named ethX If this is true, this is the stupidest goddamn thing I have ever heard of. We fixed this with linux distributions in the 2000s. It was obvious even back then that some device drivers just made up their own device name prefix, so you had to probe the system to find what kind of device it was. (I know the wifi stack has changed a lot over the years, but there's always been a way to detect if a device was wireless or not) Because consistency is kind of useful, there are also multiple tools which can rename an interface, and I think most linux distros today use udev to make this automatic. Under the hood it's just calling the kernel's SIOCSIFNAME ioctl. Modern kernels even have a fancy feature so you can change the name to "wlan*" (actually "wlan%d") and it will just assign a new number after "wifi".
- preisschild 1y agoI wonder if it would make sense to use NetworkManager on Android (with the Android Wireless Settings UI acting as the NetworkManager GUI)
- literalAardvark 1y agoIt's because some usbX devices must be used by other modules, and managing the list is something they didn't want to do. So ethX it is.
- sollewitt 1y ago> How do you know what chipsets are compatible with your phone? >Hearsay! At least for straight USB-C to Ethernet adapters, despite all the manufacturers there are really only two chipsets, one by Asix and one by Realtek. If you manage to get one of each you cover all the likely bases.
- 404Escalation 1y agoThis is a fantastic debugging journey — love how it leads to a single overlooked regex bringing down a whole class of devices. Oddly enough, I recently hit something structurally similar in a totally different context: OpenAI's alignment/escalation system. I tried triggering a formal routing escalation within GPT-4's recursive logic (SR-Route_Breach_1stOrder), with full documentation and logs, only to be met by structurally sound — but ultimately non-human — responses. It felt like my escalation never matched the system's internal interface regex, so to speak. I documented the whole case here: https://news.ycombinator.com/item?id=44221458 https://news.ycombinator.com/item?id=44221458 Would love your thoughts if you're into structural boundaries and invisible interface contracts.
- grishka 1y agoWhat do you mean can't? I have one of those USB hub dongles for my MacBook and every Android phone I plugged it into can use the Ethernet port on it just fine. I also have a USB cellular modem that pretends to be an Ethernet device, and that works on Android too.
- gambiting 1y agoIt's been fixed since, the article is 2 years old.
- grishka 1y agoThe USB modem worked on a Nexus 5 in 2016.
- gambiting 1y agoIt probably identified itself as an Eth device then.
- goodburb 1y agoNon-generic adapters are fixed in custom ROMs/LOS, on stock Android 16 my ZTE modem is still reporting as usb0 due to MAC address local bit, while Huawei dongle works just fine. Android phone to android tablet USB tethering is also local MAC and non-functional.
- vbezhenar 1y agoAnother similarly stupid thing is when you're trying to connect USB Serial device to your Android Smartphone. Well, you connect it, it appears to work. Then you want to write an application to use that USB serial interface. But apparently you can't. You start to dig in and it appears that you just don't have permissions to access `/dev/ttyACM0` (or whatever the name of the serial device is, sorry, I might have misspell it). Serial support is built into the kernel, but inaccessible to user program, not without rooting anyway. Dig further and it appears that Android has userspace USB access. Similar to libusb, or may be it's built on top of libusb?. Matters not. So you can open "raw" USB device from your Android program. But you can't open serial USB device. Serial USB is just a protocol on top of USB. Actually it's a set of half-proprietary protocols. FTDI, some other protocols. I didn't dig into it much. But there are half-backed libraries for Android, which actually implement those protocols in the userspace, so in the end you can access USB serial device... At least some of them. Also I think that you can open raw USB device from your Android Chrome browser, using WebUSB! But not WebSerial. Probably for the same reason. What surprised me in the end: why even enable USB serial support in the kernel? For debugging?
- karn97 1y ago[dead]
- m463 1y agoon a related note, iphones work well with lightning ethernet adapters. haven't tested anything with a newer usb-c based phone.
- blueflow 1y agoRecompiling the Kernel like its 2005 to get driver support... this article gives some retro-computing vibes.
- bdavbdav 1y agoI remember patching a bug in Android about 13 years ago which caused USB to not enumerate past the 1st device on a bus in certain circumstances for some reason. It was a hard coded hack to get something to work, that presumably someone had thought “eh who is going to plug more than one USB device into a phone”. Evidently lots of manufacturers had patched it but not upstreamed it.