Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_device_connected_to_wifi not matching #4

Open
rektide opened this issue Nov 22, 2023 · 0 comments
Open

is_device_connected_to_wifi not matching #4

rektide opened this issue Nov 22, 2023 · 0 comments

Comments

@rektide
Copy link

rektide commented Nov 22, 2023

Hello. I'm running aow 0.1.5 via chocolatey. I'm trying to connect to a Samsung S22 which runs One UI 5.1/Android 13. But I keep getting an Device FOOBAR is not connected to Wifi message. adb version says:

Android Debug Bridge version 1.0.41
Version 34.0.5-10900879
Installed as C:\ProgramData\chocolatey\lib\scrcpy\tools\scrcpy-win64-v2.2\adb.exe
Running on Windows 10.0.22621

I think the issue traces back to a call to is_device_connected_to_wifi.

If I run the shell command in that function manually (adb -s MY_DEVICE_ID shell dumpsys connectivity), I do get a lot of output. I see some similar matches, but no literal WIFI[] as appears as in the regex linked above (I might be mis-interpretting \[] in the Rust regex!). Here's an example of output that seems quite similar but which does not seem to match the regex.

  NetworkAgentInfo{network{346}  handle{1489464381453}  ni{WIFI CONNECTED extra: } created=2023-11-22T23:04:26.332Z Score(Policies : TRANSPORT_PRIMARY&EVER_EVALUATED&IS_UNMETERED&ACCEPT_UNVALIDATED&EVER_VALIDATED&IS_VALIDATED ; KeepConnected : 0)  created 2927879471 firstValidated 2927880258 lastValidated 2927880258 acceptUnvalidated acceptPartialConnectivity  lp{{InterfaceName: wlan0 LinkAddresses: [ fe80::6666:6666:fe9a:43a9/64,10.11.13.24/6666:6666:296b:aa00:5009:4dff:fe9a:6666/64,2600:6666:6666:aa00:d5f0:1758:da42:ffd6/64,fdfb:6666:6666:0:5009:4dff:fe9a:43a9/64,fdfb:6666:6666:0:ccef:b9a7:4426:342f/64 ] DnsAddresses: [ /fdfb:6666:38da::1,/10.11.12.2 ] Domains: lan MTU: 0 ServerAddress: /10.11.12.2 TcpBufferSizes: 524288,1048576,4194304,524288,1048576,4194304 Routes: [ fe80::/64 -> :: wlan0 mtu 0,::/0 -> fe80::6666:6666:fe8e:4b72 wlan0 mtu 0,2600:4040:296b:aa00::/56 -> fe80::6666:6666:fe8e:4b72 wlan0 mtu 0,fdfb:6666:38da::/48 -> fe80::6666:6666:fe8e:4b72 wlan0 mtu 0,2600:4040:296b:aa00::/64 -> :: wlan0 mtu 0,6666:6666:38da::/64 -> :: wlan0 mtu 0,fdb3:6666:2610:1::/64 -> fe80::6666:6666:2c9d:5423 wlan0 mtu 0,10.11.12.0/22 -> 0.0.0.0 wlan0 mtu 0,0.0.0.0/0 -> 10.11.12.2 wlan0 mtu 0 ]}}  nc{[ Transports: WIFI Capabilities: NOT_METERED&INTERNET&NOT_RESTRICTED&TRUSTED&NOT_VPN&VALIDATED&NOT_ROAMING&FOREGROUND&NOT_CONGESTED&NOT_SUSPENDED&NOT_VCN_MANAGED LinkUpBandwidth>=18393Kbps LinkDnBandwidth>=57601Kbps Specifier: <WifiNetworkAgentSpecifier [WifiConfiguration=, SSID="DameGothel", BSSID=66:66:66:66:66:66, band=2, mMatchLocalOnlySpecifiers=false]> TransportInfo: <SSID: "DameGothel", BSSID: 66:66:66:66:66:66, MAC: 66:66:66:66:66:66, IP: /10.11.13.24, Security type: 4, Supplicant state: COMPLETED, Wi-Fi standard: 5, RSSI: -45, Link speed: 866Mbps, Tx Link speed: 866Mbps, Max Supported Tx Link speed: 866Mbps, Rx Link speed: 866Mbps, Max Supported Rx Link speed: 866Mbps, Frequency: 5200MHz, Net ID: 5, Metered hint: false, score: 60, isUsable: true, CarrierMerged: false, SubscriptionId: -1, IsPrimary: 1, Trusted: true, Restricted: false, Ephemeral: false, OEM paid: false, OEM private: false, OSU AP: false, FQDN: <none>, Provider friendly name: <none>, Requesting package name: <none>"DameGothel"wpa3-saeMLO Information: , AP MLD Address: <none>, AP MLO Link Id: <none>, AP MLO Affiliated links: <none>> SignalStrength: -45 OwnerUid: 1000 AdminUids: [1000] SSID: "DameGothel" UnderlyingNetworks: Null]}  factorySerialNumber=8

Another theory is maybe this is a utf error? is_device_connect_to_wifi calls from_utf8_lossy. I don't know windows very well but I tried > logfile and got a very ugly file in vim with a special character before each ascii character. I'm not sure how else to detect, but I see: file -i .\connect.log reports: .\connect.log: text/plain; charset=utf-16le, which is notably not utf-8. (Thanks windows! 🙄 ) I'm not sure, there might be some obvious Windows workaround here but I don't know it.

If the is_device_connected_to_wifi check weren't failing, I think this script might work. If I try to run the next step, I do see a wlan0 ip addr:

$ adb -s R5CRC3MLEFK shell ip addr show wlan0
37: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 3000
    link/ether 66:66:66:66:66:66brd ff:ff:ff:ff:ff:ff
    inet 10.11.13.24/22 brd 10.11.15.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet6 fdfb:6666:6666:0:6666:6666:4426:342f/64 scope global temporary dynamic
       valid_lft 603513sec preferred_lft 84909sec
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

No branches or pull requests

1 participant