-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Dongle Mode Connection Loop #98
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
I have the same problem after upgrading too :/ |
See, I'm here to actually assist with the development of this project. I answered your question on #97 properly and there is absolutely no reason to be salty with sarcastic comments like this. Nobody here is going to spoon feed you instructions on how to actually set up your development and building environment. |
Same problem, the first connection is normally ok, but after turn off the car and turn on 5 minutes after they enter into loop. I made this changes to get a second test, revert in 6e6a1da commit the 110 line : - disableGadget(accessoryGadgetName); in aa_wireless_dongle/package/aawg/src/usb.cpp and increase in 184 line: struct timeval tv = {
.tv_sec = 10,
.tv_usec = 0,
}; to 30 sec to permit more idle time and reduce the loop in aa_wireless_dongle/package/aawg/src/proxyHandler.cpp |
@Ioniq3 you jinxed me. I only had this issue the first time I set up dongle mode and it never did it again, but this morning when I was leaving for work shortly after you commented, I got in my car and it kept looping again until I unplugged it and plugged it back in. I changed the title to reflect that it isn't just during first time setup. |
First time user. I have the same issue. |
didn't fully test it but after upgrading, I had to associate the bluetooth again (I assume it's the normal behavior), then it started to work properly and loaded quite fast in my Renault (with R link 2). |
Yes, modern cars remain 10 , 15 minutes the power in the accesory line after close the car |
Oh ok, I see. |
I'm having more issues with some disconnect sometimes. Couldn't get log yet. |
@tiliarou Not sure this relates to the issue here. I have had no connections issues other than as described in this issue. Three times now I have had to unplug the dongle and then plug it back in because it got stuck in a loop of connecting and disconnecting when I got in my car. I have never had any random disconnects. |
Not sure as well... But it never happened with the previous version... Never a single "android auto has encountered an error" prior to 0.4 Edit: when I see the log in #98 (comment) |
I test that changes and no longer appers the loop, but I prefer that Nisarg review |
I can't find a way to retrieve logs... How do you get to ssh to the raspberry from android ? Target IP shall be 10.0.0.1, right ? On port 22 ? I get a timeout using juicessh on my phone... |
I only tried SSHing once from my phone but was unsuccessful because I think the Android classifies the network differently knowing that it's an AA network. To pull logs I connect to the dongle's network from my PC and SSH in that way, which is a bit tough to do because I either have to have a laptop with me or be in my driveway so I can connect from my desktop in my house. |
Oh OK I see... No way to build an image that would dump logs to sd card? That way I could get logs properly after driving sessions. But I'm a bit off topic here, sorry |
It could be done, I just haven't had time to make it happen myself and I think @nisargjhaveri has focused more on just fixing things without because honestly the logs are not that incredibly helpful and there is some worry that constantly writing logs to the SD card could cause issues. |
I use daremote from Google play. You have to disconnect the WiFi ssid of Android auto and connect to the wifi, same ssid/name but different connection. |
Finally managed to get logs... It's very difficult since android auto automatically connects to the WiFi which can't SSH.
|
No, this morning made the loop in the first setup, so the problem have to be other issue. |
What are you guys running it on? I am using pi zero w. was thinking if that could have something to do with it? |
Hi everyone, I'm using the 4.0 version for 1 week now, and I'm almost having no issue, just sometimes but if i reconnect my bluetooth or wifi, it started working like a charm, but just 2 or 3 of 10 times that i get in the car.. I'm having some laggy experience in audio or touchscreen using spotify + maps, but that's another issue in discussion. I'll try to downgrade to 2.0 version to test this issues |
My setup is quite similar, Raspberry pi zero 2W + Samsung galaxy S21 ultra. Same issues for me, sometimes it works like a charm, sometimes I have to disable wifi and let it reconnect, sometimes I have to unplug and plug again the raspberry... The point is to have a reliable dongle, so it's still an issue even if it's workable with these problems. |
I am using a Pi 0 W as well. Also, I think my Pi died this morning because it is no longer appears as a BT or Wi-Fi device for me despite lighting up when powered on. Checked the SD card and it appears fine. |
Have u tried giving usb power in the power connector and connecting the otg to the car? Maybe the power of the otg car isn't enough now.. idk, just saying! |
Nah, I've been using it for like 2 months and I can't get it to show up when plugged into a USB port on my work PC either. I'm going to re-flash the SD card and see if something did get messed up there (it's an old SD card and it gets pretty cold in my car at night still). |
Yah, it was my SD card. No idea what happened but reflashing fixed it. |
From the conversation above, I see two issues.
For the connection loop, think we need some more investigation into where it gets stuck. Logs should help in this case. For disconnection also, logs might help, but my hunch is that the 10s timeout in tcp read might be too small and in some cases there might be a genuine delay more than that. We can increase the TCP read timeout as @Ioniq3 suggested above. |
/var/log is currently symlinked to /tmp, you can remove the symlink, and it should start storing the logs in sd card. I haven't tried this yes, but I believe this should just work. For a long term solution, I was thinking about adding/removing this symlink based on some config. But for that to work, we need to read the config much earlier in boot. This needs some more changes. I have some local changes in that direction, but needs some more attention. I'll try to create a PR sometime next week. |
To add more information @nisargjhaveri , When it starts to loop, I try to restart /etc/init.d/S92usb_gaget and S93 and in this new implementation of the dongle mode and TCP restarts from Commits from Mar 12, 2024 and it doesn't work, when in the previous impletentation of the dongle feature it works perfect to avoid the physical reboot of the raspberry. So some of the resources like bluetooth connection or usb now remains blocked when the S92 and S93 stop or restart when in the previous behaviour you can restart the process and it recovers, maybe in the thread restart has the same problem. |
I think the disconnections should probably be moved to their own issue because I've never experienced that (in the entire time I've used this project). The most I have ever experienced is a brief drop in audio quality or a hard stutter for a fraction of second, but I'm sure that's just wireless interference where I'm driving. Also, I don't think there is any normal use case where a 10 second delay could happen once connected. If people are experiencing 10+ second hangs on the connection there is either something wrong with their head units, the Pi, or one of the connections between the device (poor signal to the Pi, bad USB cable to the head unit, weak Bluetooth to the head unit). I do think that 10 seconds may not be enough during the connection process though and that may be part of the reason the issue I've described here with the looping happens seemingly randomly, because sometimes it may just take more than 10 seconds to connect fully. That doesn't explain though why it gets stuck in a loop instead of recovering properly. |
I'm having the same issue since 0.4. Funnily I tested my pi zero 2 w first at my computer with Desktop Head Unit and there it would work just fine. In my car it would connect show aa on my screen and then disconnect until my car would show the device is unrecognized. It only helps to re-plug the device until it would eventually work. Might be that the board computer is much slower then running Desktop Head Unit on my computer, which causes the connection to timeout. |
Understood, I will try to remove the symlink. I found an old fork of the AAwireless repo (I suppose it is before they launched the kickstarter), maybe there are some stuff in the 3 branches that can help : https://github.com/chutchi2/aawireless |
Well, increasing the timeouts does not fix this looping issue, but also I think it has something to do with the phone side as well. I am running my own build with both timeouts increased to 30 seconds and this morning when I got in my car it did the loop thing, I unplugged the dongle and plugged it back in, it started looping again and I disconnected it the dongle again. Finally on the third attempt it worked fine. Two things of note:
|
I believe I managed to log the loop, which ended up in a proper and valid connection by itself (after or connection/disconnection cycle, I never unplugged the pi) |
Yes, I think , as I see in my log, is something related to "buildroot user.info aawgd[264]: Bluetooth device already connected, disconnecting" |
Thanks for some logs @tiliarou. The logs suggests that the phone repeatedly connects via BT to start the Android Auto when the dongle thinks it is already connected. I can see multiple "AA Wireless NewConnection" logs even when TCP is already connected and hasn't timed out. Once TCP times out, we try to force reconnection with the phone and also see the "Bluetooth device already connected, disconnecting". Interestingly this log is seen even on first connection on boot, maybe the phone connected faster even before we tried connecting first? This should not be needed for the first time, but I don't think this should cause any major issues. For investigations, we can try removing the disconnection. For context, it was needed to actually force the phone to reconnect via BT in case the the connection fails for some reason. If we don't disconnect and reconnect BT, the phone never retries once successfully connected. My hunch is that on the phone side, the phone was able to detect some problem in the TCP connection and is retrying, but on the RPi, we're still waiting for the timeout. One way to investigate more might be to kill existing session on "AA Wireless NewConnection" and restart the USB with fresh connection and see if that helps. |
Also, does this loop also occur if you change the connection strategy to phone first? Does it connect more reliably in phone first, or instead of loop there are more failure in phone first with otherwise same setup? |
I have yet to try other modes, I remained with the default mode so far, I will try to change that. |
Yes, for dongle mode we don't need the fake HSP profile. For other modes we do need the fake HSP profile for connection. But in those cases, we disconnect BT as soon as the connection is established to make sure phone audio is routed to the headunit and not the dongle. |
I have tried all modes and it is just dongle mode that is not working. |
Don't know if it is the same issue, but I also had a bootloop when in dongle mode (well, maybe in all modes) that I get a "USB unrecognized" for 5-6 times in a row.
I can try to create a pr to move this number to the .env file, if it helps... |
I had something similar. See here :) |
I just want to add on here; this did "fix" it for me, however now having seemingly random issues and intermittent issues with warm boots. I may have a different issue and if/when I get a chance to grab logs I will open my own. Using dongle-mode however makes my head unit's BT act up telling me to turn off BT and reconnect to the head unit (doesn't actually work), but it appears to work fine while it's saying that (Pi 0w2, Pixel 7 and 2020 Honda Civic). |
I switched to 0.4.0 this morning to try the new connection fixes with dongle mode and immediately had issues.
The very first connection took nearly a full minute before Android Auto started on my head unit, and then it would immediately freeze, time out and restart over and over. I had to unplug the dongle and plug it back in and now it appears to be working fine.
I was unable to get logs since I was driving but I suspect it has something to do with the connection process of dongle mode and the newly introduced timeouts because it seemed to be freezing and timing out on the same interval (probably 10 seconds).
The text was updated successfully, but these errors were encountered: