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

Changes for select mode operation #56

Merged
merged 18 commits into from
Feb 29, 2024
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,9 @@ Use one of the following defconfig for the board you intend to use:
- `raspberrypi3a_defconfig` - Raspberry Pi 3A+
- `raspberrypi4_defconfig` - Raspberry Pi 4

### Enviroment variables
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
Can be selected some customs in the file /root/.env
#HEADUNIT_FIRST=1 // if you uncomment '#HEADUNIT_FIRST=1' , then Connect to usb after before connection is available, in other case then Connect to usb after phone connection is available

## Limitations
- Tested with very limited set of headunits and cars. Let me know if it does not work with your headunit.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ RETVAL=0
case "$1" in
start)
printf "Starting $DAEMON: "
export $(grep -v '^#' /root/.env | xargs)
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
start-stop-daemon -S -b -q -m -p "$PIDFILE" -x "/usr/bin/$DAEMON"
RETVAL=$?
[ $RETVAL = 0 ] && echo "OK" || echo "FAIL"
Expand Down
1 change: 1 addition & 0 deletions aa_wireless_dongle/board/common/rootfs_overlay/root/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#AAWG_CONNECTION_WAIT_FOR_ACCESSORY=1
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions aa_wireless_dongle/package/aawg/src/aawgd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ int main(void) {

while (true) {
// Per connection setup and processing
if (const char* env_p = std::getenv("AAWG_CONNECTION_WAIT_FOR_ACCESSORY")) {
UsbManager::instance().enableDefaultAndWaitForAccessroy();
Logger::instance()->info("Waiting for the accessory to connect first\n");
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
}

AAWProxy proxy;
std::optional<std::thread> proxyThread = proxy.startServer(Config::instance()->getWifiInfo().port);

Expand Down
7 changes: 6 additions & 1 deletion aa_wireless_dongle/package/aawg/src/proxyHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,12 @@ void AAWProxy::handleClient(int server_sock) {

Logger::instance()->info("Tcp server accepted connection\n");

UsbManager::instance().enableDefaultAndWaitForAccessroy();
if (const char* env_p = std::getenv("AAWG_CONNECTION_WAIT_FOR_ACCESSORY")) {
// nothing to do
} else {
nisargjhaveri marked this conversation as resolved.
Show resolved Hide resolved
UsbManager::instance().enableDefaultAndWaitForAccessroy();
}


Logger::instance()->info("Opening usb accessory\n");
if ((m_usb_fd = open("/dev/usb_accessory", O_RDWR)) < 0) {
Expand Down
Loading