Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hkfuertes committed May 8, 2024
1 parent 9565add commit f462737
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions aa_wireless_dongle/board/common/rootfs_overlay/etc/aawgd.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
# 1 - Phone first. Waits for the phone bluetooth and wifi to connect first, and then starts the usb connection.
# 2 - Usb first. Waits for the usb to connect first, and then starts the bluetooth and wifi connection with phone.
AAWG_CONNECTION_STRATEGY=0

# Timeout for Waiting for Usb Accesory
AAWG_WAIT_FOR_ACCESORY=10
4 changes: 4 additions & 0 deletions aa_wireless_dongle/package/aawg/src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ WifiInfo Config::getWifiInfo() {
};
}

int32_t Config::getUsbAccesoryTimeout(){
return getenv("AAWG_WAIT_FOR_ACCESORY", 10);
}

ConnectionStrategy Config::getConnectionStrategy() {
if (!connectionStrategy.has_value()) {
const int32_t connectionStrategyEnv = getenv("AAWG_CONNECTION_STRATEGY", 0);
Expand Down
1 change: 1 addition & 0 deletions aa_wireless_dongle/package/aawg/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Config {

WifiInfo getWifiInfo();
ConnectionStrategy getConnectionStrategy();
int32_t getUsbAccesoryTimeout();
private:
Config() = default;

Expand Down
3 changes: 2 additions & 1 deletion aa_wireless_dongle/package/aawg/src/proxyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ void AAWProxy::handleClient(int server_sock) {
BluetoothHandler::instance().stopConnectWithRetry();

if (Config::instance()->getConnectionStrategy() != ConnectionStrategy::USB_FIRST) {
if (!UsbManager::instance().enableDefaultAndWaitForAccessory(std::chrono::seconds(10))) {
const int32_t timeout = Config::instance()->getUsbAccesoryTimeout();
if (!UsbManager::instance().enableDefaultAndWaitForAccessory(std::chrono::seconds(timeout))) {
return;
}
}
Expand Down

0 comments on commit f462737

Please sign in to comment.