pyamsoft / tetherfi

TetherFi - Internet sharing without Root
Apache License 2.0
382 stars 30 forks source link

Broadcast Error: Busy - Unable to create Wifi Direct Group #324

Open reforget-id opened 2 weeks ago

reforget-id commented 2 weeks ago

Hi, I tried your app for the first time, but I got an error. From the logs, it seems there is a problem with Wifi direct. It's a pretty old phone with a custom rom, so I don't expect it to work perfectly nor I ever use wifi direct. Tried rebooting the phone twice and use the default settings but nothing worked.

Android : 10 (Ressurection Remix) App version : 20240710-1

[D] (SourceFile:114) All permissions granted 
[D] Toggle Proxy service! 
[D] Attempt update network info with source null 
[W] Cannot get group info without Wifi source 
[W] Cannot get connection info without Wifi source 
[D] Starting Proxy... 
[D] Start Foreground Service! 
[D] Creating service 
[D] Started foreground notification: NotifyId(id=42069): ServerNotificationData(status=NotRunning, clientCount=0, blockCount=0) 
[D] Service scope start() launched! 
[D] Start command received 
[W] start() called but runner Job already exists! 
[D] Launch notification watcher 
[D] Starting runner! 
[D] Await notification cancellation... 
[D] Starting Proxy! 
[D] Stopping runner! 
[D] #################################### 
[D] Acquire WiFi wakelock: com.pyamsoft.tetherfi:PROXY_WIFI_LOCK 
[D] #################################### 
[D] #################################### 
[D] Acquire CPU wakelock: com.pyamsoft.tetherfi:PROXY_WAKE_LOCK 
[D] #################################### 
[D] Starting Wifi Network... 
[D] START NEW NETWORK 
[D] WiDi Status Changed: Starting 
[D] Starting broadcast network 
[D] Creating WifiP2PManager Channel 
[D] Attempt open connection with channel 
[D] Updated foreground notification: NotifyId(id=42069): ServerNotificationData(status=Starting, clientCount=0, blockCount=0) 
[D] Cannot re-use Wi-Fi group connection, make new one 
[D] Creating new wifi p2p group 
[E] Unable to create Wifi Direct Group
java.lang.RuntimeException: Broadcast Error: Busy
    at com.pyamsoft.tetherfi.server.broadcast.wifidirect.WifiDirectNetwork$connectChannel$3$listener$1.onFailure(SourceFile:41)
    at android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler.handleMessage(WifiP2pManager.java:939)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7398)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
 Broadcast Error: Busy
[E] Failed to connect Wi-Fi direct group
java.lang.RuntimeException: Broadcast Error: Busy
    at com.pyamsoft.tetherfi.server.broadcast.wifidirect.WifiDirectNetwork$connectChannel$3$listener$1.onFailure(SourceFile:41)
    at android.net.wifi.p2p.WifiP2pManager$Channel$P2pHandler.handleMessage(WifiP2pManager.java:939)
    at android.os.Handler.dispatchMessage(Handler.java:107)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7398)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)
 Broadcast Error: Busy
[W] Error during broadcast startup, stop network 
[D] Reset last info refresh times 
[W] Stopping network after startup failed 
[D] WiDi Status Changed: HotspotError(throwable=java.lang.RuntimeException: Broadcast Error: Busy) 
[D] Shutdown event received! 
[D] Shutdown event received! 
[D] Stopping Wifi Network... 
[D] STOP NETWORK 
[D] Shutting down network 
[D] Reset last info refresh times 
[D] Updated foreground notification: NotifyId(id=42069): ServerNotificationData(status=HotspotError(throwable=java.lang.RuntimeException: Broadcast Error: Busy), clientCount=0, blockCount=0) 
[D] Stop Foreground Service! 
[D] Shutdown event received! 
[D] Shutdown event received! 
[D] Network was stopped 
[D] #################################### 
[D] Release WIFI wakelock: com.pyamsoft.tetherfi:PROXY_WIFI_LOCK 
[D] #################################### 
[D] #################################### 
[D] Release CPU wakelock: com.pyamsoft.tetherfi:PROXY_WAKE_LOCK 
[D] #################################### 
[D] Destroying service 
[D] Execute prepareStop() before cancelling service scope 
[D] Mark hotspot stopping 
[D] Broadcast stop-request 
[D] Cancel Service Scope 
[D] Proxy Status Changed: Stopping 
[D] Notification scope is done, cancel notification! 
[D] Stop foreground notification 
[D] (SourceFile:154) Done checking for update, newVersion=0 
pyamsoft commented 2 weeks ago

Hi, please don't post links to random files on mediafire. This is an open source project, if a fix exists for an issue, I will incorporate the code in the project. Thanks!

pyamsoft commented 2 weeks ago

Hi,

Unfortunately, the WiFi Direct API on Android doesn't tell me much. Busy, is just a generic error code which could mean almost anything.

Your Location may need to be on for WiFi direct to work on your device, and you may need to have the phone not be connected to a WiFi network when starting the hotspot.

Alternatively it could be the ROM, not familiar with Resurrection Remix, sorry.

reforget-id commented 2 weeks ago

Yeah, It might be that the location service is not working properly. Sometimes I can't pinpoint my current location on the map even though it's enabled. I'll try it again later. Thanks for the help

pyamsoft commented 1 week ago

A tweak has been added for version 45 which will require you to turn on Location before starting the hotspot service.

This may not fix your specific Wi-Fi Direct issue, as Wi-Fi Direct is device specific, but it is a step in the right direction.

Version 45 is in beta in the store and should be released sometime this or next week. Thank you!