Repository navigation
Conversation
NetworkManager destroys its device object and builds a new one at a NEW
object path whenever the adapter is re-probed: a USB dongle replugged, or
its driver reloaded by sonar's WiFi recovery. SdbusNm resolved the device
once in __init__ and kept that proxy, so after any of those, every property
access raised
DbusUnknownMethodError: Object does not exist at path
"/org/freedesktop/NetworkManager/Devices/4"
out of get_networks() and get_ip_address(), and the panel listed no network
at all until KlipperScreen was restarted. Measured on a pad: the panel was
still talking to Devices/5 while wlan0 had become Devices/4.
Resolve the device on use instead. An explicit choice pins the interface
NAME, which survives a re-probe, not the proxy. `wifi` becomes a property
for the same reason: it was a snapshot taken once, before a late dongle
could exist.
__init__ no longer dereferences a device that is not there: starting before
the USB dongle is enumerated left wlan_device None and crashed on
None.state. A panel built without an adapter now asks for a rebuild, so a
dongle showing up later fills it on the next opening instead of keeping a
layout whose network list is not even in the widget tree. That rebuild is
registered under this panel's own name: a panel reaches _cur_panels only
once built, so during __init__ its last entry is still the panel we came
from, and the request landed on the wrong one.
Verified on a pad, in one long-lived process across a real USB rebind of
the dongle, which is what sonar's recovery performs:
before wlan0 = /org/freedesktop/NetworkManager/Devices/4
after wlan0 = /org/freedesktop/NetworkManager/Devices/5
cached proxy FAILED DbusUnknownMethodError (path Devices/4)
resolved wifi=True iface=wlan0 ip=192.168.100.103 networks=5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The failure
On a bench pad the network panel listed nothing and announced no WiFi adapter, while
wlan0was associated and routing fine. Its log:NetworkManager had
wlan0onDevices/4; the panel was still addressingDevices/5.SdbusNmresolved the device once in__init__and kept that proxy, bound to one object path. NetworkManager destroys the device object and builds a new one at a new path whenever the adapter is re-probed — a USB dongle replugged, or its driver reloaded by sonar's WiFi recovery. Nothing revalidated the proxy, so the panel stayed empty for the rest of the session. No systemd ordering can cover this: the replacement happens mid-session.The other half: starting before the USB dongle is enumerated left
wlan_deviceatNoneand__init__dereferenced it.The change
wlan_deviceis resolved on use, never kept. An explicit choice pins the interface name, which survives a re-probe, instead of the proxy.wifibecomes a property for the same reason: it was a snapshot taken once.__init__tolerates no adapter, and a panel built without one asks for a rebuild, so a late dongle fills it on the next opening rather than keeping a layout whose network list is not in the widget tree._cur_panelsonly once built, so during__init__the last entry is still the panel we came from and the request landed on the wrong panel.Measured on a pad
One long-lived process across a real USB rebind of the dongle, which is exactly what sonar's recovery performs:
Same process, dongle taken away and brought back:
A restart of NetworkManager alone does not reproduce it: the device objects come back at the same paths. The index only moves when a device is added while NetworkManager is running, which is what a dongle re-probe does.