Skip to content

About

R36s Script: USB Network Mode - networking over the USB OTG port (g_ether gadget)

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

ArkOS USB Network Mode

Use your ArkOS handheld over a plain USB cable — no WiFi dongle, no soldering, no extra hardware.

Turns the OTG port into a network interface so you can:

  • copy ROMs and saves (web browser, Samba or SFTP)
  • get an SSH shell on the device
  • optionally give the handheld internet through your PC

Known to work on R36S and clones running ArkOS / ArkOS4Clone. It may or may not work on yours — the tool tells you.


Check compatibility first

On the handheld: Options → USB Network Mode → option 1

Not every clone can do this. The board has to route the USB-C data lines to the SoC in device mode, and plenty of them do not — even when the firmware, the kernel modules and the device tree all look correct.

Option 1 checks the four requirements separately, because failing any one of them looks identical from the outside ("nothing happens when I plug the cable in"):

# Requirement If it fails
1 Kernel gadget modules (g_ether, libcomposite) different firmware may fix it
2 A UDC in /sys/class/udc fatal — the port is not wired as a device
3 dr_mode in the device tree fixable with a patched DTB
4 Link detection (UDC state) fatal if a known-good data cable still shows nothing

It ends with a plain verdict: SUPPORTED, SHOULD WORK, BUT... or NOT SUPPORTED. It only reads — it changes nothing.

Why this check exists

An R35S with the same firmware, the same modules present and dr_mode="otg" still fails. Steps 1–3 pass; the USB-C data lines simply never reach the SoC in device mode, so no host ever appears. Without a check like this you would spend hours swapping cables and reflashing for a problem that has no software fix.

Note that extcon is not a reliable signal: on an RK3326 clone the gadget can be fully enumerated and serving SSH while extcon still reports USB=0 across the board. The UDC state is the authority.


Install

With a card reader — this is the way to do it the first time, and the only one that works from Windows. Power the handheld off, take the card out and plug it into a PC.

The card has three partitions. Windows shows you two of them: the small BOOT one and the big ROMs one — labelled EASYROMS on ArkOS and dArkOSen. Open it and drop USB Network Mode.sh into its tools/ folder (custom/ also works if your firmware has one). That is all — the partition is exFAT and gets mounted with fmask=0000, so the file is already executable and there is nothing to chmod.

Do not go looking for /opt/system from Windows: that path lives on the Linux root partition, which Windows cannot read whatever it is formatted as — ext4 on ArkOS, btrfs on dArkOSen — and you would need extra software to get at it. The tools/ folder you can reach is the same one the handheld shows in its menu.

Over the network — once USB networking works you can skip the card reader and copy straight to the handheld:

scp "USB Network Mode.sh" ark@10.44.44.1:/roms/tools/

Either way it shows up in the Options menu. No reboot needed.

option 1  check compatibility     <- run this first
option 2  universal   (the handheld hands out IPs)
option 3  internet    (the PC shares its connection)
option 4  Remote Services (web + Samba)
option 5  stop everything

On the PC

  • Windows — run setup-windows.bat. It does not change any setting. It is a walkthrough plus a connectivity test; the one thing Windows needs configuring for (internet sharing) is done by hand, and the script tells you where to click.
  • Linux — sudo ./setup-linux.sh. This one does change things: it names the interface arkos0, stops NetworkManager from creating duplicate profiles, adds a firewall workaround for Docker, and creates two network profiles.

What is automatic and what is not

Windows Linux
Install the script on the handheld by hand by hand
USB network driver automatic automatic
Stable interface name automatic † setup-linux.sh †
Avoid duplicate profiles automatic † setup-linux.sh †
Docker firewall workaround not needed setup-linux.sh
Network profiles not needed setup-linux.sh
File mode (universal) nothing to do nothing to do
Internet sharing by hand (ICS, 6 clicks) switch the profile on, by hand

† Both operating systems identify the handheld by its MAC address, so a random one makes them invent a fresh adapter or profile on every reconnect — Ethernet 2, Ethernet 3… on Windows, Wired connection 2, 3… on Linux. The handheld avoids that by advertising a fixed MAC and identity, which is why Windows needs nothing here. Linux needs one extra piece because the kernel also names interfaces after the USB bus path, and that changes with the port you plug into.

The short version: for copying files you configure nothing on either OS. Only internet sharing needs a human, and on Linux the script has already prepared everything so it is one toggle.

Plug the cable into the OTG port, not the charge-only one, and use a data cable. Charge-only cables leave you stuck at "connecting" forever and are by far the most common cause of "it doesn't work".


Which mode do I want?

Use it for PC setup needed
Universal moving files, SSH, using it on someone else's computer none
Internet the handheld itself needs the network (PortMaster, clock) connection sharing

Access

User / password: ark / ark

Universal mode:

Browser    http://10.44.44.1
Windows    \\10.44.44.1
Linux      smb://10.44.44.1
SFTP       sftp://ark@10.44.44.1
SSH        ssh ark@10.44.44.1

Internet mode: the PC assigns the IP — 192.168.137.x on Windows, 10.42.0.x on Linux. The handheld shows it on screen when it connects.


Troubleshooting

Symptom Cause
Stuck at "connecting" charge-only cable — swap it
Nothing shows up on the PC wrong port, use the OTG one
Web page dead but SSH works turn on option 4
Worked once, not any more option 5, then start again
Check reports no link with a good data cable the board does not wire data lines for device mode — nothing to be done in software
A pile of Ethernet 4, Wired connection 5… adapters left over from an earlier attempt with a stock g_ether and its random MAC. Harmless, but delete them so the right one is obvious
Link comes up but no DHCP, address is 169.254.x the PC picked a leftover profile from the case above. Remove it, or on Linux re-run setup-linux.sh

Help build the compatibility list

There is no public list of which handhelds can actually do USB device mode. Vendors do not document it, identical-looking boards behave differently, and the failure looks the same as a bad cable.

If you run option 1, please open a device report with the output — especially if it does not work. A confirmed "no" saves the next person hours of swapping cables and reflashing firmware.

The report is also written to /tmp/usbnet-compat.txt, so you can copy it over SSH instead of retyping it from the screen.

Device Firmware Result
R36S clone (board reports R36S Clone Type5) ArkOS4Clone works, files + internet
R35S AeolusUX MultiPanel never connects — data lines not wired for device mode

Notes

The gadget is loaded with a fixed MAC address and identifies itself as R36S / ArkOS. This matters more than it sounds: with a random MAC, NetworkManager creates a brand new "Wired connection N" profile on every reconnect, and that profile comes up link-local instead of DHCP — which looks exactly like the handheld not responding.

setup-linux.sh also works around Docker: it sets the FORWARD chain policy to DROP, which silently breaks NetworkManager's shared connection. The dispatcher script re-opens it only for the handheld's interface, only while it is up.

Everything runs from RAM. Nothing is installed permanently on the handheld, and option 5 unloads the module and puts the OTG port back to normal.

License

MIT — see LICENSE.

About

R36s Script: USB Network Mode - networking over the USB OTG port (g_ether gadget)

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages