Log the ids of attached usb devices, and make wirelessInfo() safe - #118
Conversation
"No compatible wifi adapter found." is a common report, and the one thing needed
to act on it - the adapter's vendor and product id - could not be obtained.
sysfs is not readable by the shell on some devices (Horizon OS for one) and
dumpsys usb does not list host devices there either, so the app is the only
thing in a position to report it.
getAttachedAdapters() now logs every attached device with its ids, manufacturer
and product name, and whether usb_device_filter.xml matched:
usb devices attached: 1
/dev/bus/usb/001/002 0BDA:8812 Realtek 802.11n NIC -> supported
which turns "it does not work" into a line that can be pasted into a filter
entry. Relevant to the standing requests for new adapters (OpenIPC#82, OpenIPC#91, OpenIPC#93, OpenIPC#105).
Also fixes a landmine in the same code path: wirelessInfo() is static and reads
a static WifiManager that only VideoActivity.initializeUI() ever assigns, yet it
is called from WfbLinkManager.refreshAdapters(). Any other caller, or this one
before onCreate has got that far, gets a NullPointerException. It now takes a
Context, fetches the service itself and null checks both the manager and the
WifiInfo; the static field is gone, so it cannot come back through a different
entry point.
PR Summary by QodoLog USB device IDs and make Wi-Fi lookup null-safe
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1. 2357:0115 remains unsupported
|
The problem
"No compatible wifi adapter found." is a common report, and the one piece of information
needed to act on it — the adapter's vendor and product id — cannot be obtained by the person
reporting it.
There is no way around the app for this. On some devices sysfs is not readable by the shell
(Horizon OS for one), and
dumpsys usbdoes not list host devices there either:The app enumerates the devices and matches them against
usb_device_filter.xml, and thenthrows that away.
The change
getAttachedAdapters()logs every attached device with its ids, manufacturer and productname, and whether the filter matched:
or, for something not in the list:
which turns "it does not work" into a line that can go straight into a filter entry.
Relevant to the standing adapter requests: #82, #91, #93, #105.
Also in here
wirelessInfo()is reached from exactly this code path and is a landmine: it isstaticandreads a
static WifiManagerfield that onlyVideoActivity.initializeUI()ever assigns.WfbLinkManager.refreshAdapters()calls it from the "no adapter" branch, so any other hostof
WfbLinkManager— or this one beforeonCreatehas got that far — getsIt now takes a
Context, fetches the service itself and null checks both the manager and theWifiInfo. The static field is gone, so it cannot come back through a different entry point.Note
On master this NPE is latent —
VideoActivityis the only host ofWfbLinkManagerand itdoes assign the field. It is a real crash as soon as anything else hosts it, which is how I
ran into it.
Compile tested for arm64-v8a + armeabi-v7a; the logging verified on a Quest 3.
Part of a series of independent fixes found while building an immersive (OpenXR) mode on a
Quest 3, each standalone and mergeable in any order:
wirelessInfo()safeVideoPlayer/WfbNgLinktake aContext#113 and #116 are now confirmed on hardware (Quest 3, Horizon OS, Android 14).