Android Auto (AOA mode) does not work, broken USB audio

jonsmirl Post time 2018-9-27 11:02:38 | Show all posts  Close [Copy link]
4 7568
View: 7568|Reply: 4

Android Auto (AOA mode) does not work, broken USB audio

 Close [Copy link]

7

threads

40

posts

195

credits

Senior Member

Rank: 2

credits
195
Post time 2018-7-18 04:07:09 | Show all posts |Read mode
Edited by jonsmirl at 2018-7-25 23:32 \n\n
A problem with the USB audio configuration is breaking Android Auto.
Here is a capture of the USB error I encountered....

95154.486707] usb 1-5.1: Product: A1_PRO
[95154.486713] usb 1-5.1: Manufacturer: A-gold
[95154.486718] usb 1-5.1: SerialNumber: 0123456789ABCDEF
[95156.647795] usb 1-5.1: USB disconnect, device number 41
[95157.017964] usb 1-5.1: new high-speed USB device number 42 using xhci_hcd
[95157.122812] usb 1-5.1: New USB device found, idVendor=18d1, idProduct=2d03
[95157.122823] usb 1-5.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[95157.122830] usb 1-5.1: Product: A1_PRO
[95157.122836] usb 1-5.1: Manufacturer: A-gold
[95157.122841] usb 1-5.1: SerialNumber: 0123456789ABCDEF
[95157.124251] usb 1-5.1: 1:1: add audio endpoint 0x81
[95157.160158] usb 1-5.1: 1:1: usb_set_interface failed (-32)
[95157.161030] usb 1-5.1: 1:1: usb_set_interface failed (-32)
[95157.161851] usb 1-5.1: 1:1: usb_set_interface failed (-32)
[95157.163121] usb 1-5.1: 1:1: usb_set_interface failed (-32)
[95157.164489] usb 1-5.1: 1:1: usb_set_interface failed (-32)

It is possible to force the phone into USB audio mode without the external program, but it is more tricky to do so.
1) Have the phone plugged into USB
2) Swipe down and click on "USB charging"
3) Tap on set MIDI mode
4) Open developer options
5) Scroll down to Select USB configuration
5) Pick Audio Source

This audio source only works on Linux (car headends run Linux) and not on Windows.
The necessary driver is missing on Windows. If someone wrote the appropriate driver Windows would work too.

You need to pick MIDI first of this won't work. This configuration is not something you would manually set, plugging the phone into the car headend automatically sets it.

---------------

Alternative way to enable Audio Source mode...
To test this, use this program to enable USB audio out on the phone:
https://github.com/gibsson/linux-adk
This program is just used to force the phone into Android Auto mode for USB audio without needing a car. Ignore the prompt on the phone about running a Demo app.

USB ID of A1 is 0e8d:201c

jonsmirl@ares:~/aosp/linux-adk$ ./linux-adk -d 0e8d:201c
Looking for device 0e8d:201c
Device supports AOA 2.0!
Sending identification to the device
sending manufacturer: Google, Inc.
sending model: DemoKit
sending description: Demo ABS2013
sending version: 2.0
sending url: https://github.com/gibsson
sending serial number: 0000000012345678
asking for audio support
Turning the device in Accessory mode
Found accessory 18d1:2d05
Device should now be recognized as valid ALSA card...
  => arecord -l
Unable to open usb device [0xfffffffd]
^CSIGINT: Closing accessory
----> Ctrl-C to kill the program
Closing USB device
----> now the device is in USB audio output mode ----
jonsmirl@ares:~/aosp/linux-adk$ ls /proc/asound
A1PRO  card0  card1  cards  devices  hwdep  modules  oss  PCH  pcm  seq  timers  version
jonsmirl@ares:~/aosp/linux-adk$ ls /proc/asound -l
total 0
lrwxrwxrwx 1 root root 5 Jul  6 09:18 A1PRO -> card1
dr-xr-xr-x 8 root root 0 Jul  6 09:18 card0
dr-xr-xr-x 3 root root 0 Jul  6 09:18 card1
-r--r--r-- 1 root root 0 Jul  6 09:18 cards
-r--r--r-- 1 root root 0 Jul  6 09:18 devices
-r--r--r-- 1 root root 0 Jul  6 09:18 hwdep
-r--r--r-- 1 root root 0 Jul  6 09:18 modules
dr-xr-xr-x 2 root root 0 Jul  6 09:18 oss
lrwxrwxrwx 1 root root 5 Jul  6 09:18 PCH -> card0
-r--r--r-- 1 root root 0 Jul  6 09:18 pcm
dr-xr-xr-x 2 root root 0 Jul  6 09:18 seq
-r--r--r-- 1 root root 0 Jul  6 09:18 timers
-r--r--r-- 1 root root 0 Jul  6 09:18 version
jonsmirl@ares:~/aosp/linux-adk$ arecord -D hw:1,0 -c 2 -r 44100 -f S16_LE ~/foo.wav
Recording WAVE '/home/jonsmirl/foo.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
arecord: set_params:1363: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE
SUBFORMAT:  STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: (3 4)
BUFFER_TIME: 500000
BUFFER_SIZE: 22050
BUFFER_BYTES: 88200
TICK_TIME: 0

Look at dmesg (see above) and note that arecord fails because it can not set the interface.
This is the same procedure Android Auto uses to play audio, it just doesn't need a car.

Here is the correct output from my Google Pixel (also running Oreo)...
Pixel is working without problem.  It is also USB-C.
Also note that this works correctly on the Nokia-1 which is running Mediatek Oreo on the MT6737.
All of these devices are USB 2.0, Pixel and A1 have USB-C, none are USB 3.0.

[95584.714759] usb 1-2: Product: Pixel
[95584.714765] usb 1-2: Manufacturer: Google
[95584.714771] usb 1-2: SerialNumber: FA68Z0309184
[95586.782233] usb 1-2: USB disconnect, device number 48
[95587.309479] usb 1-2: new high-speed USB device number 49 using xhci_hcd
[95587.458468] usb 1-2: New USB device found, idVendor=18d1, idProduct=2d03
[95587.458478] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[95587.458485] usb 1-2: Product: Pixel
[95587.458490] usb 1-2: Manufacturer: Google
[95587.458496] usb 1-2: SerialNumber: FA68Z0309184
[95587.459886] usb 1-2: 1:1: add audio endpoint 0x82
----> A1 pro failed here
[95587.492151] usb 1-2: setting usb interface 1:1
[95587.495659] usb 1-2: setting usb interface 1:1
[95587.502216] usb 1-2: setting usb interface 1:1
[95587.506349] usb 1-2: Starting data EP @00000000d8f304ed
[95593.402794] usb 1-2: setting usb interface 1:1
[95593.403469] usb 1-2: Starting data EP @00000000d8f304ed
jonsmirl@ares:~/aosp/linux-adk$

The broken code is in kernel/drivers/usb/gadget/function/android,c  



7

threads

40

posts

195

credits

Senior Member

Rank: 2

credits
195
 Author| Post time 2018-7-20 22:11:57 | Show all posts
Is this being worked on? Can we expect a fix in the next update?

7

threads

40

posts

195

credits

Senior Member

Rank: 2

credits
195
 Author| Post time 2018-7-25 23:29:32 | Show all posts
MarcinP replied at 2018-7-25 02:32
Could you please explain a bit more what exactly not working on android auto, how you connected and  ...

Older cars use AOA mode -- Android Open Accessory 2.0 -- for audio.
https://source.android.com/devices/accessories/aoa2

List of some hardware using this mode,,,
https://www.crutchfield.com/S-MD ... ry-app-control.html

You can test this mode using Linux Deskop.  Look in this thread, I posted detailed instructions on how to reproduce the error without needing to buy a car headend unit.

http://community.umidigi.com/for ... 7283&extra=page%3D1

Also, Android docking stations also use AOA 2.0 mode when they have a speaker inside.

This bug seems to be specific to the MT6739 A1, I also have a MT6737 based Noka 1 which uses the same source code base from Mediatek and it works fine in AOA mode.

From the Google developer page...
That app I linked in the other post will send this 'SET_AUDIO_MODE' USB packet to enable audio output.

Audio support
AOAv2 includes support for audio output from an Android device to an accessory via a standard USB audio class interface capable of 2 channel, 16-bit PCM audio with a bit rate of 44100 Khz (additional audio modes may be added in the future).
To enable audio support, the accessory must send a new USB control request:

**SET_AUDIO_MODE**  requestType:    USB_DIR_OUT | USB_TYPE_VENDOR
request:        58
value:           0 for no audio (default),
                     1 for 2 channel, 16-bit PCM at 44100 KHz
index:           0
data              none

This command must be sent before sending the ACCESSORY_START command for entering accessory mode.

7

threads

40

posts

195

credits

Senior Member

Rank: 2

credits
195
 Author| Post time 2018-9-1 04:43:33 | Show all posts
Is this going to be fixed in next update? I checked the other two releases and it is broken in all of them.

We have an OEM application that needs a phone and would like to use the A1, but without a fix we will have to pick a different phone.

7

threads

40

posts

195

credits

Senior Member

Rank: 2

credits
195
 Author| Post time 2018-9-27 11:02:38 | Show all posts
Still broken in the update. I was hoping this would get fixed. We have about 30 different phones, this is the only broken one. Even other Mediatek based phones work. I guess we need to pick another for our OEM application.
You have to log in before you can reply Login | WELCOME TO UMIDIGI COMMUNITY

Points Rules

Quick Reply Top Back to list