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

Connection Issues #6

Closed
yoriaantje-dev opened this issue Mar 11, 2020 · 23 comments
Closed

Connection Issues #6

yoriaantje-dev opened this issue Mar 11, 2020 · 23 comments

Comments

@yoriaantje-dev
Copy link

Connection Issues

When I run the program from intelligent-auto/bin with the command sudo ./ia when I'm signed in as root in terminal or not, I've got a very spotty connection over USB.

Unfortunally, I've got no clue on how to debug this...

However,

Upon installing and just poking around a little, I've found the kinda OG openauto (the one located in intelligent-auto/openauto) which also had a bin folder, also containing an openauto executable app. Upon running this, I got the option for WiFi (Which unlike USB did sometimes very little but still kinda work for me in Crankshaft) so i decided to give it a shot. And bam, it worked pretty much flawlessly. I didn't yet test it fully (over WiFi) and would prefer to use your UI.

@rsjudka
Copy link
Owner

rsjudka commented Mar 11, 2020

Spotty as in OpenAuto will close by itself randomly and you would have to unplug and plug your phone back in for it to work?

Yeah I purposely left out the wifi capabilities of OpenAuto because I was still deciding how I wanted to handle the connection and settings :p I do plan on adding it in sometime in the near future

@yoriaantje-dev
Copy link
Author

Yes, the first one, sometimes after a little while, sometimes almost instantly. Most of the time, when connecting over USB, I don't even get a connection or a start up of OpenAuto at all, it's just my phone thinking and saying it's connected to my car, but nothing is happening on the RPi end.

I think it might have something to do with those USB Perms you talked about in the readme, but I wouldn't have the slightest clue tbh

@rsjudka
Copy link
Owner

rsjudka commented Mar 11, 2020

do you know if you have music playing when you're trying to connect? When I was doing some debugging, I noticed the only time OpenAuto was dying on me was when I had Spotifty autoplaying music.

@leobel96
Copy link

leobel96 commented Mar 11, 2020

I had the same issue, before:

  • Setting xfce4 as DE
  • Rebooting
  • Running ./ia as root

@yoriaantje-dev
Copy link
Author

yoriaantje-dev commented Mar 11, 2020

Yes, I've changed a few settings on my phone regarding autoplay and general music playback, this has resolved the initial connection issue. It seems to connect perfectly now.

However, it does still (generally after having launched and started playing Spotify) randomly stop working and force me to reconnect the phone. So no changes there.
(Again, not a lot of testing time right now, I'll get back to you this weekend, when I've got more time.)

@yoriaantje-dev
Copy link
Author

yoriaantje-dev commented Mar 11, 2020

@leobel96 thanks for the response and the help:

I had the same issue, before:

  • Setting xfce4 as DE
  • Rebooting
  • Running ./ia as root

And how do I do this? I've got no clue how to setup xcfe4... It's the one (I guess process?) that renders and runs the desktop and stuff right?
I am already running everything as root, I simply put sudo su into the RPi terminal and go from there. Sometimes I put sudo in front of the command, but not always... Don't think it makes a difference right?

@rsjudka
Copy link
Owner

rsjudka commented Mar 11, 2020

However, it does still (generally after having launched and started playing Spotify) randomly stop working and force me to reconnect the phone. So no changes there.

Yeah im really thinking this is the root of the issue, will do some more debugging but its looking more like an audio packet issue so hopefully i can track that down

@leobel96
Copy link

I had the same issue, before:

  • Setting xfce4 as DE
  • Rebooting
  • Running ./ia as root

And how do I do this? I've got no clue how to setup xcfe4... It's the one (I guess process?) that renders and runs the desktop and stuff right?
I am already running everything as root, I simply put sudo su into the RPi terminal and go from there. Sometimes I put sudo in front of the command, but not always... Don't think it makes a difference right?

It's pretty easy:

  • sudo apt-get install xfce4 x-window-system xfce4-terminal
  • reboot
  • sudo startxfce4 (It sets XFCE instead of LXDE)
  • run ia as root from the xfce terminal (you find it in start, I don't remember where)

@rsjudka
Copy link
Owner

rsjudka commented Mar 11, 2020

Running sudo probably helps you get around the permissions for setting up the USB device, the "more right" way of doing is setting up some permissions for it. I can try to write something up for that procedure.

@yoriaantje-dev
Copy link
Author

Running sudo probably helps you get around the permissions for setting up the USB device, the "more right" way of doing is setting up some permissions for it. I can try to write something up for that procedure.

@rsjudka I'd love that, if you'd be able to provide me with a script I'll try it as soon as possible!

@leobel96
Copy link

@yoriaantje-dev Have you enabled USB debug on your smartphone from developer settings?

@yoriaantje-dev
Copy link
Author

  • sudo apt-get install xfce4 x-window-system xfce4-terminal
  • reboot
  • sudo startxfce4 (It sets XFCE instead of LXDE)
  • run ia as root from the xfce terminal (you find it in start, I don't remember where)

I'll be running these commands as soon as I can, somewhere Friday afternoon is unfortunately the soonest chance I'll have tho...

@yoriaantje-dev
Copy link
Author

@yoriaantje-dev Have you enabled USB debug on your smartphone from developer settings?

@leobel96 yes, I've gone over all developersettings on my phone to ensure that all USB options are either on, or set up as accepted, or to auto-accept etc. (This I did to hopefully resolve the issues I was already experiencing with Crankshaft, however nothing came out of any changes I made.).

@leobel96
Copy link

@yoriaantje-dev Have you enabled USB debug on your smartphone from developer settings?

@leobel96 yes, I've gone over all developersettings on my phone to ensure that all USB options are either on, or set up as accepted, or to auto-accept etc. (This I did to hopefully resolve the issues I was already experiencing with Crankshaft, however nothing came out of any changes I made.).

So try to install xfce and let me know 😄

@yoriaantje-dev
Copy link
Author

yoriaantje-dev commented Mar 16, 2020

Hi guys, sorry for the delay
Due to the Corona virus situation in my country I had to do some other stuff first, but I've tried all the suggestions now. Below you'll find an overview:

XFCE (@leobel96)

XFCE fixed the initial USB connection issues, however, i now get an error message stating the following:
unable to connect to MTP device, 001,0XX were XX are always different numbers.

After clicking on OK in the message box (It's just a regular RPi Desktop messagebox) it boots up Android Auto. As long as I don't play music it all works semi-well. (@rsjudka)
When I do start Spotify though, it almost immediatly crashes or does some playback and crashes when "leaving" the Spotify app (in Android Auto)

Tried it with just OpenAuto aswell, but no different or better results unfortunally.

My Guess

I've been thinking and doing some research, I've got the OG RPi screen, proper USB 3.0 Cable etc etc., so what could be wrong..?

I've downloaded Android Auto as an APK application, as, in the Netherlands, it's not a supported app in the Google Play Store. I'm thinking this might be the issue? But I'm not sure, and I doubt it's got something to do with all this...
Regardless, felt I should let you guys know.

@yoriaantje-dev
Copy link
Author

Hi to the both off you, I've decided to look into how forking and contributing works on GITHUB and I'm going to try and get down to the source of my problems myself.

@rsjudka, if possible, would you mind providing me with your own research regarding the issue?
@leobel96, if possible, would you mind telling if, by going to root user via XFCE, you have any problems with the USB connection?

I'll try and figure this all out, just to be able to use this project in my own car. Any feedback/help is welcome!

@rsjudka
Copy link
Owner

rsjudka commented Mar 22, 2020

Hey sorry, haven't forgotten about this just was struggling to recreate the issue you've been facing. My setup might be a different than yours because I never have to run as sudo or enable any USB debugging on my phone.

This is what I've done to enable the USB connection for openauto:

echo "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"*\", ATTR{idProduct}==\"*\", MODE=\"0660\", GROUP=\"plugdev\"" | sudo tee /etc/udev/rules.d/openauto.rules

And then reboot the system. This adds a rule to allow for R/W communication between the phone and computer. This method isnt really secure, but it worked for my purposes.

Let me know if this works for you, or any errors you get from doing it this way.

@rsjudka
Copy link
Owner

rsjudka commented Mar 22, 2020

Oh and for the issue you're getting where OpenAuto shuts down, I think someone figured it out! In another issue, someone linked this and it was basically the approach I was planning on taking just haven't gotten to it yet.

If you wanted to go ahead and use that fork it seems promising, and will give us more mileage on the fix to see if itll solve this issue everyone has been dealing with lol

@WardBenjamin
Copy link

https://github.com/opencardev/crankshaft/blob/984c6d20b68323c466731fc1829ad505f9f7dd61/stage3/03-crankshaft-base/files/etc/udev/rules.d/51-android.rules

Here's a copy of the rules that Crankshaft uses. This could be easily adapted for a slightly more secure method than the above catch-all rule.

@yoriaantje-dev
Copy link
Author

Wow, this seems to work now!

I'm going to go ahead and test it more thoroughly, but I think it might have solved the issue. I'm for sure going to add this to wiki (#16 ), and I'd like to suggest you add this to the readme also, as I think this will solve a bunch of peoples problems

@yoriaantje-dev
Copy link
Author

yoriaantje-dev commented Mar 25, 2020

Oh and for the issue you're getting where OpenAuto shuts down, I think someone figured it out! In another issue, someone linked this and it was basically the approach I was planning on taking just haven't gotten to it yet.

I wasn't actually getting this issue, it was just the connection shutting down.
I will look into this fork regardless, if you'd like.

@yoriaantje-dev
Copy link
Author

Nope, it only partially fixed the issue, regardless, I'll close this issue and open a new one.

Now the connection just fails/quits/stops whenever I play any form off audio, whether it's spotify music, or navigation direction (allthough they seem to get through at navigation start-up).

I think I'll open a new issue, more specifically geared to audio playback issues. I will try out audio over bluetooth or whatever, just to try it out and see if it helps.

@rsjudka
Copy link
Owner

rsjudka commented Mar 26, 2020

If you can, try to play around with the OpenAuto settings, maybe you'll get better results with a different audio backend? Another thing you might want to look into is the PulseAudio/Alsa configuration, I remember reading somewhere that the packets are small or something and it causes audio to glitch up.

Then when you open the new issue, we'll have alot more to talk about :p

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

4 participants