|
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
|
|