Radxa Zero as USB C gadget for iPad Pro

So we have identified the issue on our official image. It is due to amlogic-adbd service is running on boot, occupying the OTG port.

Please check if your distro also has this service running by executing sudo systemctl status amlogic-adbd.service. If the output shows Active: active (running) you need to run sudo systemctl disable amlogic-adbd.service then shutdown, unplug from host PC, and replug. Once you power cycle the device you can try the following script:

# Based on https://www.collabora.com/news-and-blog/blog/2019/02/18/modern-usb-gadget-on-linux-and-how-to-integrate-it-with-systemd-part-1/
sudo -i
modprobe libcomposite
mkdir /sys/kernel/config/usb_gadget/radxa/ # different distro could have a different configfs mounting point: /sys/kernel/config
cd /sys/kernel/config/usb_gadget/radxa/
echo 0x1d6b > ./idVendor
echo 0x104 > ./idProduct
mkdir -p ./strings/0x409
echo "Radxa" > ./strings/0x409/manufacturer
echo "ECM" > ./strings/0x409/product
mkdir -p ./configs/r.1
mkdir -p ./functions/ecm.usb0
ln -s ./functions/ecm.usb0/ ./configs/r.1/
echo ff400000.usb > ./UDC # ls /sys/class/udc to see available UDCs

This should allow your host PC to have a new interface as well.

You will then need to configure the network on both end. You can refer to your distro’s manual for how-to. You will most likely want to config static IP.

Please let me know the result. If everything is good we will also prepare some systemd service to make this more permanent. Currently this script does not persist between boot.


Awesome! My PC and iPad now detect the Ethernet Gadget. :slightly_smiling_face:

Can You explain what Ethernet Gadget is?

It simply is my Radxa Zero which acts like a virtual Ethernet „adapter“

Awesome! I’ll update our Wiki to include this.


I’d like to let you know that a package specifically for enabling this feature is now available on GitHub for testing.

This package allows the USB Ethernet interface to be enabled between boot, and you can configure the interface with /etc/network/interfaces. Here is the setting I used for testing:

auto usb0
iface usb0 inet static

Manually configure the other end with an IP address between and and you should be able to ping each other.

Any feedback is welcome.

Hi Janik, so it works with Radxa same as it should work for RasPi?
Akaik, Radxa board is connected and powered using one usbC cable?
And one more :slight_smile: are you was able to start any “virtual”/remote X window connection with this setup? (VNC, XRDP, etc.)
All the best! Nick

I believe these instructions no longer work with the latest release / image.

I’ve tested with https://github.com/radxa-build/radxa-zero/releases/tag/20220801-0213 using the image Armbian_22.08.0-trunk_Radxa-zero_focal_current_5.10.134_xfce_desktop.img.xz

The latest builds dont even have the amlogic-adbd service running anymore.

@RadxaYuntian would you be kind enough to update the instructions / wiki to work again with latest build?

Thank you.

You are using an unofficial Armbian build. Please try with our Debian or Ubuntu image.

1 Like

I can confirm that with the Official Ubuntu image, things work.

I did the following:

sudo systemctl disable amlogic-adbd.service
# Reboot

sudo apt install -y wget
wget https://github.com/radxa-pkg/radxa-otgutils/releases/download/0.1-2/radxa-otgutils_0.1-2_all.deb
sudo dpkg -i radxa-otgutils_0.1-2_all.deb
# it complains that android-tools-adbd cannot be installed, but that is a harmless error
sudo systemctl enable radxa-usbnet.service

Then, open the file /etc/network/interfaces

sudo emacs /etc/network/interfaces

Add the following content to the file:

auto usb0
iface usb0 inet static

Now, reboot the radxa zero.

The computer that it connects to will see a usbnet interface (tested on Mac and Linux). Have that interface’s ip address to, and enable Internet Sharing (mac).
Then you radxa is sshable at from your usb-connected computer, and also uses internet from your computer.

Which image did you use? I am trying radxa-zero-ubuntu-focal-server-arm64-20220801-0346-mbr.img, but it does not even boot from the SD card.

I tried without success various images before :frowning: (USB Gadget Ethernet support on the zero)

Ok. So there is a mistake in the latest image boot configuration path to the dtb file: it tries to load dtbs/5.10.69-12-amlogic-g98700611d064/amlogic/amlogic/meson-g12a-radxa-zero.dtb instead of dtbs/5.10.69-12-amlogic-g98700611d064/amlogic/meson-g12a-radxa-zero.dtb, so that loading the dtb fails. Nice joke from radxa!

The adbd service is currently only called “adbd” and it didn’t work to just disable it by systemctl, so that I removed the file /etc/init.d/adbd.sh.

Now, it FINALLY works! Hooray!

Hi. I followed the instructions in a Dietpi v8.9 system, with my Radxa Zero, but ended up with this error in the radxa-usbnet service status:

systemd[1]: Starting Enable USB ethernet gadget on selected Radxa single board computers... radxa-usbnet.sh[2383]: /lib/radxa-otgutils/radxa-usbnet.sh: line 73: echo: write error: Device or resource busy systemd[1]: radxa-usbnet.service: Control process exited, code=exited, status=1/FAILURE systemd[1]: radxa-usbnet.service: Failed with result 'exit-code'. systemd[1]: Failed to start Enable USB ethernet gadget on selected Radxa single board computers.

That line in the scripts refers to:

local UDC=$(ls /sys/class/udc/ | head -1) echo $UDC > /sys/kernel/config/usb_gadget/radxa-$MODE/UDC

I’ve also manually configured my /etc/network/interfaces file but the usb0 interface is still in DOWN state.

Any ideas? :frowning:

That looks like adbd is still running and occupying the UDC.

@wanthalf I have not been able to locate the service using systemd:

systemctl status amlogic-adbd.service Unit amlogic-adbd.service could not be found.
systemctl status adbd.service Unit adbd.service could not be found.

Have you tried listing active kernel modules by lsmod? And/or search dmesg for anything that might be relevant to USB? Also, the USB might need to be explicitly configured as “peripheral” by the DTB, so that it does not become a “host”.

I found this when my system is starting up:

[ 5.750471] usbcore: registered new interface driver brcmfmac
[ 5.793344] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac43455-sdio.radxa,zero.txt failed with error -2

[ 6.511010] usb0: HOST MAC f2:e5:df:c4:e9:d7
[ 6.511025] usb0: MAC be:e9:e1:6d:d9:a8
[ 6.514534] dwc2 ff400000.usb: bound driver configfs-gadget
[ 8.110900] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43455-sdio for chip BCM4345/6
[ 8.159683] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Feb 27 2018 03:15:32 version 7.45.154 (r684107 CY) FWID 01-4fbe0b04

My lsmod command:

usb_f_ecm 24576 2
u_ether 28672 1 usb_f_ecm
libcomposite 73728 8 usb_f_ecm

I think that g_ether already creates an USB-ethernet gadget by itself, so that you cannot use configFS anymore to create additional gadgets/devices.

Oh, it is u_ether! OK, now I am lost too.

Hm. New clean installation of the same system, now on the internal MMC, and it does not work again. I still have no idea why it previously suddenly started working on the SD card (and it still does). Neverending story…

Problem solved.

Comparison of the working and non-working installation showed the key difference is dhcpcd.service running on the former one, but not on the latter one. The dhcpcd actually automatically activates and configures the new network device as soon as it appears in the system. If it is not activated on the side of the device, it is not detected by the host either!

For some reason, there seems to be some difference between the images. I do not remember to have activated dhcpcd myself before.