Setting up RNDIS and ECM in Android on same network interface

306 Views Asked by At

I'm trying to setup USB tethering support on an Android 10 based device using configfs to setup the USB Gadget. Right now I'm trying to setup both RNDIS and CDC ECM so that you can connect to it using both Windows and MacOS. This is what I have so far:

mkdir /config/usb_gadget/g1/functions/rndis.gs4
mkdir /config/usb_gadget/g1/functions/ecm.usb0
write /config/usb_gadget/g1/configs/b.1/strings/0x409/configuration "rndis"
write /config/usb_gadget/g1/configs/b.2/strings/0x409/configuration "ecm"
symlink /config/usb_gadget/g1/functions/rndis.gs4 /config/usb_gadget/g1/configs/b.1/f1
symlink /config/usb_gadget/g1/functions/ecm.usb0 /config/usb_gadget/g1/configs/b.2/f1

This does seem to switch between RNDIS and ECM when plugging it into different computers. However we would like to use the usb0 network interface for both protocols. Currently ecm is getting assigned the usb1 network interface. Does anybody know how to configure it so that both go over usb0?

0

There are 0 best solutions below