Skip to content

network: fix Local Play with NetworkManager/iwd - #3276

Open
alexryndin wants to merge 1 commit into
ROCKNIX:nextfrom
alexryndin:fix/local-play-nm-iwd
Open

alexryndin wants to merge 1 commit into
ROCKNIX:nextfrom
alexryndin:fix/local-play-nm-iwd

Conversation

@alexryndin

@alexryndin alexryndin commented Sep 6, 2026

Copy link
Copy Markdown

Summary

  • What is the goal of this PR? (e.g. Bump up an emulator version, implement a new feature. )

Fix Local Play, broken since the NetworkManager migration (beb5d8a):

  • iwd runs with EnableNetworkConfiguration=false, so the [IPv4] block wifictl wrote into the iwd AP profile was silently ignored and the AP never got an address.
  • Switching the interface to AP mode behind NetworkManager cannot work: after nmcli device set managed no iwd's own autoconnect re-associates the station, and NM's iwd backend forces Device.Mode back to station on deactivation paths (reset_mode in nm-device-iwd.c). The result is iwctl ap start-profile failing with "Operation aborted" and NETPLAY_AP never appearing.
  • Clients had no way to obtain an address: iwd no longer configures IPs and the netplay AP runs no DHCP server.

Rework Local Play to be NetworkManager-native (NM: IP + lifecycle, iwd: 802.11):

  • Host (ID 1): NM wifi connection in AP mode (WPA-PSK, NETPLAY_AP) with a static 192.168.80.1/24.
  • Clients (IDs 2-4): NM wifi connection with a static 192.168.80.<id>/24 derived from the local play ID; the SSID must be in the scan cache before connection up, the iwd backend fails activation instantly otherwise.
  • Teardown deletes the netplay connection so NM returns the device to the ordinary networks; the normal path also cleans stale netplay profiles.

Testing

  • How was this tested? (e.g. Built and tested on specific devices, manual testing steps, URLs for CI/CD build artifacts.)
  • Test results: (e.g. Screenshots, logs, performance metrics if applicable.)

Tested on two handhelds running the stock 20260901 image with only wifictl replaced: RG353V (RK3566) as host, RG34XX SP (H700) as client.

  • Host: NETPLAY_AP comes up, 192.168.80.1/24 assigned, real clients (the second handheld and a laptop) associate and ping both ways.
  • Client: keeps its static 192.168.80.2/24, returns to the ordinary network within a second after the host disappears.
  • 5 enable/disable cycles: no stale profiles, station mode and ordinary Wi-Fi restored every time.
  • 10MB file transferred between the two handhelds over the netplay network (scp, checksum verified).

Additional Context


AI Usage

While ROCKNIX doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? YES | PARTIALLY | NO

YES — agent assisted (GLM by z.ai, opencode): root-cause analysis, patch and testing driven by the author

@alexryndin
alexryndin force-pushed the fix/local-play-nm-iwd branch from db6d301 to 5ab938c Compare September 6, 2026 12:21
@spycat88

spycat88 commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Thanks for looking at this, the only issue I have is that you have removed wifi.adhoc.channel, so you have effectively made the setting redundant in ES as it still exists in ES.

@alexryndin

Copy link
Copy Markdown
Author

@spycat88 Thanks, I looked into this more closely.

With the iwd backend, NM's AP activation calls iwd's Start(ssid, psk) / StartOpen(ssid) and never passes 802-11-wireless.channel through. On the iwd side, Start() builds an in-memory AP config without General/Channel, and ap_load_config() then falls back to channel 6 on 2.4GHz, with an upstream TODO next to it to pick the channel via a survey: https://git.kernel.org/pub/scm/network/wireless/iwd.git/tree/src/ap.c?h=3.10#n3685

So restoring wifi.adhoc.channel in wifictl and putting it into the NM connection would be a silent no-op: e.g. ES could show channel 11 while the AP still starts on channel 6.

For consistency I've instead removed the LOCAL NETWORK CHANNEL selector from the frontend (ROCKNIX/emulationstation-next#32, updated) and kept the Local Play ID persistence. If NM/iwd gains real AP channel control later, the option can be restored together with working backend support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants