2004 to 2020 Mazda 3 Forum and Mazdaspeed 3 Forums banner

Android Auto Headunit App - Beta

724K views 1K replies 372 participants last post by  jason701802 
#1 · (Edited)
Unofficial Mazda Connect Android Auto Headunit App

This is highly experimental - Use at your own risk and no warranties provided.


UPDATE - I will no longer be able to support this app as I am selling my Mazda. However, @agartner and others should be able to continue the good work that they have been doing.

Please use the chatroom for discussions/support: https://gitter.im/gartnera/headunit





Unofficial port of Android Auto Headunit App to Mazda Connect CMU. The app makes extensive use of jni functions that were originally developed by Mike Reid as part of his Android app.

If you are happy with the result, please donate to Mike Reid (mikereidis AT gmail.com).

CREDITS: Mike Reid, Konsulko, A Gartner, @Siutsch
--------------



INSTALL
----------

Only use with CMU Firmware Version >= V55 . Do not use with V31/33! I suggest that you read through the Index thread to understand what exactly are you doing and for any troubleshooting.


Download the latest zip file from Github Release page AND FOLLOW THE INSTRUCTIONS NOTED ON THE RELEASE PAGE.



VIDEO
-------
https://youtu.be/sJZKQGGUl0w

https://youtu.be/ypxSDt2I_bo



--------

Version 0.8 Change log
----------------------------------
1. Performance improvements via sequential operation and removal of mutex locks - provided by @agartner
2. Changed Video sink to mfw_isink - supposed to be faster and also now opera status (volume) bar can be overlayed if required - need some javascript expertise to make it a floating bar.


Version 0.7 Change log
----------------------------------
1. USB Audio is enabled - to actually use this, you need a separate USB thumb drive in one of the slots, as this is the only way for you to be able to select USB audio in the CMU. Please do not try to use MTP option on your android phone, as it is not going to work.. Also, you need at least one mp3 or any music file in the USB thumb drive (I used http://www.xamuel.com/blank-mp3-files/point1sec.mp3)

2. Since there was a severe case of audio stuttering once for me, I have included an option to disable USB audio and switch back to AUX. You can do this by placing a file called hu_disable_audio_out in the SD CARD (which, of course, means you now need an SD card :)). I haven't actually tested this out as USB Audio worked fine at all times except that one instance.

3. Nexus fix provided by @agartner

4. Debug version of the app - to be run from ssh only - download from here . Copy to /data_persist/dev/bin, chmod 755 and run after executing the following command:

Code:
export LD_LIBRARY_PATH=/data_persist/dev/androidauto/custlib:/jci/lib:/jci/opera/3rdpartylibs/freetype:/usr/lib/imx-mm/audio-codec:/usr/lib/imx-mm/parser:/data_persist/dev/lib:


Version 0.6 Change log
----------------------------------
1. Voice control should not cause app to quit
2. More VIDs added, including a possible fix for Nexus phones with VID 0x18D1


Version 0.5 Change log
----------------------------------
1. Voice control enabled
2. More VIDs added, including a possible fix for Nexus phones with VID 0x18D1
3. Graceful kill when reverse gear engaged - App will restart when reverse gear is disengaged. However, reverse camera is still dark (because same V4L device?) as app isn't killed fast enough.


Version 0.4 Change log
----------------------------------
1. Performance improvement to the gstreamer pipeline - testing shows no issues with Nav now. However, need some feedback to check if it is the same for everyone.
2. Removed auto switch to Bluetooth as it causes problems with the UI. Need to switch manually now.
3. Added a bunch of other Vendor id to Android USB Device VID list
4. Removed aaserver and switched to websocketd.
5. New gstreamer plugin h264parse compiled and added.
6. UI now has USB/Gstreamer debug message window


Version 0.3 Change log
----------------------------------
1. Night Mode - Simple logic for now - 6AM to 6PM is day .. Night afterwards :)
2. First attempt at making libssl/libusb calls thread safe (Voice control will crash otherwise ocassionally).
3. Increased USB send timeouts for better screen refresh.
4. Added LG's Vendor id to Android USB Device VID list


Version 0.2 Change log
----------------------------------
1. Code sync with Mikereidis/Master
2. aaserver - microhttpd server to launch and pass status back to UI - no more messy sh, watch and other hoops.
3. UI integration using Herko ter Horst's method.
4. Exit AA using on screen menu (last screen with speedo icon)
 
See less See more
1
#3 ·
Hi, you have done a great job !!!
I'm just starting to test different tweaks and my goal is to understand how they work and make the best modding on my infotratment.

I will be really glad to prepare an USB installer and test the app.

Can you give me some more information on it ?
1. Does the androidauto.js work as i download or i need to receive the working version from you ?
2. the data_persist folder, should be copied directly in the root of the CMU ?

Thanks if you would like to answer me.

Another question :
Wich software development tool you use to prepare the tweak ?
 
#5 ·
This is highly experimental - Use at your own risk and no warranties provided.

INSTALL
------------

Written with assumption that speedometer app is already installed - i.e. watchdog is disabled, opera.ini has User JavaScript=1 and Allow File XMLHttpRequest=1

1. Download from https://github.com/spadival/headunit/blob/WIP/headunit-imx/gst/androidautoV0.10.zip (click on Raw button)

2. Unzip - the content should end up under /data_persist/dev/androidauto and /data_persist/dev/bin/ on the CMU

3. Copy /data_persist/dev/androidauto/androidauto.js to /jci/opera/opera_dir/userjs/

4. Add the following lines to /jci/scripts/stage_wifi.sh

Code:
# Android Auto action watch
watch -n 1 /data_persist/dev/androidauto/huaction.sh &
5. Run the following commands

Code:
chmod 755 /jci/scripts/stage_wifi.sh
chmod 755 /data_persist/dev/bin/headunit
chmod 755 /data_persist/dev/bin/nc
chmod 755 /data_persist/dev/androidauto/huaction.sh
chmod 666 /data_persist/dev/androidauto/headunit*
Appreciate if someone can make a USB install.

OPERATIONS
-------------------

1. Install Android Auto app on your phone
2. Connect the phone to USB and pair the phone bluetooth with the CMU
3. Click on the AA icon under Applications Menu on the CMU
3. A black screen with credits should open up first and input will automatically switch over to Bluetooth Audio
4. Android Auto will then start. If it does not, pull out the USB and start over again (or check the installation.)
5. Only way to stop AA now is to disconnect the USB cable.

WHAT DOES NOT WORK / TO-DO
------------------------------------------------
1. Voice Control
2. Touch drag / multi touch
3. Google Maps night mode
4. Occasional crashes (Hopefully fixed in this version)
5. A better way to stop the app (using the AA onscreen menu item)

androidauto.js is obfuscated to prevent people ripping off and selling the app. If you PM me, I will send a clean version if you are one of the recognized developers and want to improve on it.

If you are happy, please donate to Mike Ried (mikereidis AT gmail.com)

Great job man!!!! can you share some example video?? i can help you making a usb intall script.
 
#15 ·
Hi spadival

This is awesome !!
So, I installed all files on my CMU and installed AndroidAuto on my Xperia...
But Icon on CMU doesnt work...

I have one question. file of androidauto.js is right??
this is my androidauto.js file.... somwthing wrong??
var _0x781c=["\x68\x72\x65\x66","\x2F\x64\x61\x74\x61\x5F\x70\x65\x72\x73\x69\x73\x74\x2F\x64\x65\x76\x2F\x61\x6E\x64\x72\x6F\x69\x64\x61\x75\x74\x6F\x2F\x61\x6E\x64\x72\x6F\x69\x64\x61\x75\x74\x6F\x2E\x63\x73\x73","\x61\x74\x74\x72","\x3C\x6C\x69\x6E\x6B


I cant see this file about js....

and jquery.min.js same... no LF??
/*! jQuery v1.11.2 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d


hmm...

I will thank you for your reply.
 
#16 · (Edited)
Nothing wrong with the js file.. it is obfuscated to prevent people from selling the app.

Have you tried running from the ssh command line ?

Code:
LD_LIBRARY_PATH="/tmp/mnt/data_persist/dev/androidauto/custlib:/jci/lib:/jci/opera/3rdpartylibs/freetype:/usr/lib/imx-mm/audio-codec:/usr/lib/imx-mm/parser:/data_persist/dev/lib:" headunit

If that works, can you try copying the /data_persist/dev/bin/nc to /usr/bin ? I think that may be a problem with the installation.
 
#21 · (Edited)
hi guys, i've tried to install aa, i followed all steps and i can see aa icon on apps menú, but not triggered up any time.

Then i try to connect ssh and launch command that spadival says before and i can see that its running but i'm not able to start aa.
Can you disconnect the phone .. connect it again and just try to run the command again via ssh?
As you can see in your screenshot, it shows the message "Phone switched to accessory mode. Restart to enter AA mode.". But you dont have to restart.. Disconnecting and reconnecting the USB to the phone will work. Also, make sure you have Android Auto app installed on your phone.

Code:
LD_LIBRARY_PATH="/tmp/mnt/data_persist/dev/androidauto/custlib:/jci/lib:/jci/opera/3rdpartylibs/freetype:/usr/lib/imx-mm/audio-codec:/usr/lib/imx-mm/parser:/data_persist/dev/lib:" headunit
 
#23 ·
Phew.. at least it is working via ssh for one person.

I think the problem with the install is nc binary being picked up is the old one.. can you rename /usr/bin/nc to nc.bak and reboot ?

Code:
mv /usr/bin/nc /usr/bin/nc.bak
Of course, make sure you have watchdog turned off.

Instead of deleting /usr/bin/nc and creating a symbolic link to busybox-armv7l from /usr/bin/nc, I just renamed busybox-armv7l to nc and put it under /data_persist/dev/bin. Only problem with this is the PATH env variable must have /usr/bin before /data_persist/dev/bin
 
#31 · (Edited)
Crap! Did you reboot after the change? Also, can you check the permissions again and chmod where necessary?

For the next version, I plan to incorporate an http server like libmicrohttpd directly into the AA code, so that the GUI front end can communicate directly with the AA app.. no more messing around with sh files and watch timers.

Other changes expected for the next version:
---------------------------------------------------
1. Synchronize code base to Mike Reid's Master - Done already and it worked with minimal changes.
2. Menu "Return to A" on the last screen (with the speedo icon) changed to "Return to Mazda". Clicking on this will close AA. No more pulling USB cable :)
3. Voice control - Finished coding.. now to start testing to see if this will work :)

Some more "nice to have" that I am working on
------------------------------------------------------
1. Switch AA to Night mode based on time.
2. Ability to start AA even if the phone is already in Accessory mode.
 
#38 ·
I have nearly completed implementing an microhttpserver to trigger Android Auto and pass any error status back to the js front end. It is a lot cleaner compared to the hit and miss shell script approach.

Also, I have used Herko_ter_Horst's template to integrate into the front end :) Just needs a lot of testing before it can be released.

The only thing I need help is getting this command to work inside a shell script (sh). .. It works fine outside on the command line. But does not trigger inside of sh and gives all sorts of weird messages even when I try all sorts of combinations of quotes - " ' `

Code:
LD_LIBRARY_PATH="/data_persist/dev/androidauto/custlib:/jci/lib:/jci/opera/3rdpartylibs/freetype:/usr/lib/imx-mm/audio-codec:/usr/lib/imx-mm/parser:/data_persist/dev/lib:" headunit &
If anyone can make this work, I can release it faster.
 
#39 ·
Hi spadival.

I did your command.

reply is...

(gst-plugin-scanner:5932): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_mpeg2dec.so': lib_mpeg2_dec_arm11_elinux.so.2.2.0: cannot open shared object file: No such file or directory

(gst-plugin-scanner:5932): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_h264dec.so': lib_H264_dec_arm11_elinux.so.2.6.1: cannot open shared object file: No such file or directory

(gst-plugin-scanner:5932): GStreamer-CRITICAL **: gst_pad_template_new: assertion `caps != NULL' failed

(gst-plugin-scanner:5932): GStreamer-CRITICAL **: gst_element_class_add_pad_template: assertion `GST_IS_PAD_TEMPLATE (templ)' failed

(gst-plugin-scanner:5932): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_mpeg4aspdec.so': lib_MPEG4ASP_dec_arm11_elinux.so.1.2.1: cannot open shared object file: No such file or directory




but my AA is working... but after 30-50s , dead...
some .so cant find ?? in /usr/lib/gstreamer-0.10/ there are files..
 
#41 ·
I did not use & .
So,,,, again here log..

> 2016-02-19 13:43:00.781 LD_LIBRARY_PATH="/tmp/mnt/data_persist/dev/androidauto/custlib:/jci/lib:/jci/opera/3rdpartylibs/freetype:/usr/lib/imx-mm/audio-codec:/usr/lib/imx-mm/parser:/data_persist/dev/lib:" headunit ; echo "WinSCP: this is end-of-file:$?"
! 2016-02-19 13:43:02.095 (gst-plugin-scanner:2442): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_mpeg2dec.so': lib_mpeg2_dec_arm11_elinux.so.2.2.0: cannot open shared object file: No such file or directory
! 2016-02-19 13:43:02.095 (gst-plugin-scanner:2442): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_h264dec.so': lib_H264_dec_arm11_elinux.so.2.6.1: cannot open shared object file: No such file or directory
! 2016-02-19 13:43:02.610 (gst-plugin-scanner:2442): GStreamer-CRITICAL **: gst_pad_template_new: assertion `caps != NULL' failed
! 2016-02-19 13:43:02.610 (gst-plugin-scanner:2442): GStreamer-CRITICAL **: gst_element_class_add_pad_template: assertion `GST_IS_PAD_TEMPLATE (templ)' failed
! 2016-02-19 13:43:02.735 (gst-plugin-scanner:2442): GStreamer-WARNING **: Failed to load plugin '/usr/lib/gstreamer-0.10/libmfw_gst_mpeg4aspdec.so': lib_MPEG4ASP_dec_arm11_elinux.so.1.2.1: cannot open shared object file: No such file or directory
! 2016-02-19 13:43:02.829 MAX resolution 800x480
< 2016-02-19 13:43:02.938 MFW_GST_V4LSINK_PLUGIN 3.0.11 build on Mar 1 2014 00:19:39.
< 2016-02-19 13:43:03.032 MFW_GST_V4LSINK_PLUGIN 3.0.11 build on Mar 1 2014 00:19:39.
< 2016-02-19 13:43:07.620 removed queueSHAI1 : aap start.
< 2016-02-19 13:43:07.620 vpudec versions :)
< 2016-02-19 13:43:07.635  plugin: 3.0.5
< 2016-02-19 13:43:07.651  wrapper: 1.0.28(VPUWRAPPER_ARM_LINUX Build on Nov 19 2015 21:30:18)
< 2016-02-19 13:43:07.667  vpulib: 5.4.10
< 2016-02-19 13:43:07.667  firmware: 2.1.8.34588
 
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top