rom1v/usbaudio

Errors out with Pixel 3 XL on Q preview 4

parkerlreed opened this issue · 19 comments

[parker@stealth x]$ usbaudio 
[INFO] Device: [18d1:4ee7] 8BEY0Y2HC
[INFO] Audio forwarding enabled
[INFO] Waiting for input source...
[ERROR] Could not find matching PulseAudio input source
[parker@stealth x]$ usbaudio 
[ERROR] Could not read device serial
[ERROR] Could not find device
[parker@stealth x]$ usbaudio 
[ERROR] Could not find device

Oddly enough the device is dropping on the USB side

[  339.039646] usb 1-2: new high-speed USB device number 13 using xhci_hcd
[  339.374766] usb 1-2: 2:1: cannot get freq at ep 0x82
[  339.375575] usb 1-2: USB disconnect, device number 13
[  340.246318] usb 1-2: new high-speed USB device number 14 using xhci_hcd
[  344.397835] usb 1-2: 2:1: cannot get freq at ep 0x82
[  344.398618] usb 1-2: USB disconnect, device number 14
[  344.786339] usb 1-2: new high-speed USB device number 15 using xhci_hcd
[  349.414742] usb 1-2: 2:1: cannot get freq at ep 0x82
[  349.415648] usb 1-2: USB disconnect, device number 15
[  349.806364] usb 1-2: new high-speed USB device number 16 using xhci_hcd
[  490.564443] usb 1-2: USB disconnect, device number 16
[  491.532699] usb 1-2: new high-speed USB device number 17 using xhci_hcd
[  491.876469] usb 1-2: 2:1: cannot get freq at ep 0x82
[  491.877341] usb 1-2: USB disconnect, device number 17
[  492.749364] usb 1-2: new high-speed USB device number 18 using xhci_hcd
[  496.901842] usb 1-2: 2:1: cannot get freq at ep 0x82
[  496.903172] usb 1-2: USB disconnect, device number 18

Lemme find a different cable.

Yeah same issue no matter the cable.

rom1v commented

Oddly enough the device is dropping on the USB side

This is expected, enabling audio accessory changes the USB product id, so the USB connection is reset.

What is the reslut of lsusb before and after enabling audio accessory?

Bus 001 Device 009: ID 18d1:2d05 Google Inc. 

I see it trying to load snd-usb-audio this time but it still fails at the freq check

[ 5118.543583] usb 1-2: new high-speed USB device number 7 using xhci_hcd
[ 5123.773550] usb 1-2: USB disconnect, device number 7
[ 5124.740306] usb 1-2: new high-speed USB device number 8 using xhci_hcd
[ 5125.790323] usb 1-2: 2:1: cannot get freq at ep 0x82
[ 5125.790375] usb 1-2: USB disconnect, device number 8
[ 5125.791421] usbcore: registered new interface driver snd-usb-audio
[ 5126.656986] usb 1-2: new high-speed USB device number 9 using xhci_hcd
[ 5130.819325] usb 1-2: 2:1: cannot get freq at ep 0x82
[ 5130.820986] usb 1-2: USB disconnect, device number 9
[ 5131.210383] usb 1-2: new high-speed USB device number 10 using xhci_hcd
[ 5135.812661] usb 1-2: 2:1: cannot get freq at ep 0x82
[ 5135.814445] usb 1-2: USB disconnect, device number 10
[ 5136.203745] usb 1-2: new high-speed USB device number 11 using xhci_hcd

Before is

Bus 001 Device 011: ID 18d1:4ee7 Google Inc. 
rom1v commented
Bus 001 Device 009: ID 18d1:2d05 Google Inc. 

In your /etc/udev/rules.d/51-android.rules (or similar), add a rule:

SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ENV{adb_user}="yes"

Same thing. usbaudio bails, the USB mode switches to and from the audio and drops back to regular.

https://amdpowered.com/simplescreenrecorder-2019-06-20_15.42.47.mp4

rom1v commented

Just for info, once you edited your udev rules, you need to reload:

sudo udevadm control --reload-rules

For the error cannot get freq at ep 0x82, I don't know.

What is the result of:

lsusb -vd 18d1:4ee7  # audio forwarding disabled
lsusb -vd 18d1:2d05  # audio forwarding enabled

?

I rebooted after the rules. Video is after that.

Bus 001 Device 017: ID 18d1:4ee7 Google Inc. 
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x18d1 Google Inc.
  idProduct          0x4ee7 
  bcdDevice            4.40
  iManufacturer           1 Google
  iProduct                2 Pixel 3 XL
  iSerial                 3 8BEY0Y2HC
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 
      bInterfaceProtocol      1 
      iInterface              5 ADB Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)
Bus 001 Device 019: ID 18d1:2d05 Google Inc. 
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x18d1 Google Inc.
  idProduct          0x2d05 
  bcdDevice            4.40
  iManufacturer           1 
  iProduct                2 
  iSerial                 3 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x009c
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          4 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol      0 
      iInterface              5 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0028
        bInCollection           2
        baInterfaceNr(0)        1
        baInterfaceNr(1)        2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             3
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          2
        bSourceID               2
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 2
        bSourceID               1
        bControlSize            2
        bmaControls(0)     0x0000
        iFeature                0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            1 Discrete
        tSamFreq[ 0]        44100
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes           13
          Transfer Type            Isochronous
          Synch Type               Synchronous
          Usage Type               Data
        wMaxPacketSize     0x0100  1x 256 bytes
        bInterval               4
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         1 Milliseconds
          wLockDelay         0x0001
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 
      bInterfaceProtocol      1 
      iInterface              5 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0

I have similar problem with my another device: Huawei MediaPad M3
Sorry if I should open a new issue.

Before running usbaudio

lsusb
Bus 001 Device 011: ID 12d1:107e Huawei Technologies Co., Ltd. BTV-DL09

adb devices
List of devices attached
CNT6R17602000558	device

Running usbaudio

usbaudio
[INFO] Device: [12d1:107e] CNT6R17602000558
[INFO] Audio forwarding enabled
[INFO] Waiting for input source...
[ERROR] Could not find matching PulseAudio input source

After running usbaudio

lsusb
Bus 001 Device 012: ID 18d1:2d03 Google Inc. BTV-DL09

adb devices
List of devices attached
CNT6R17602000558	offline

The device's USB mode changed to "Audio Source" after running usbaudio, which is a good sign. However I also noticed that the adb went offline at the same time, which doesn't happen with my other device that work fine.

rom1v commented
Bus 001 Device 019: ID 18d1:2d05 Google Inc. 
Couldn't open device, some information will be missing

It seems there is a permission problem to open your USB device when audio accessory is enabled.

Ignoring anything there, JUST switching to the audio mode, it will automatically drop back to regular with zero intervention. It seems like something device side is not agreeing with this mode.

Hence the freq errors in dmesg

rom1v commented

it will automatically drop back to regular with zero intervention

Does the product id automatically switch back from 2d05 to 4ee7?

Yes. That's what I was pointing out in the dmesg above. All those connects and disconnects are without me touching it.

So it goes into the audio mode 2d05, shows up as a USB audio device but then without doing anything disconnects and reconnects as 4ee7 (back to normal operation)

It's like the audio accessory mode is crapping out. I'm not sure.

Ahh thanks. Did you get a chance to look into the new audio capture API stuff in Q? That may be the best bet for Pixels. I can close this if need be.

Aha

image

https://source.android.com/compatibility/android-cdd.pdf

So yeah you might want to note this probably won't work for anybody past Oreo.

The same issue on my devices RedMi K20 Pro

lsusb -vd 18d1:4ee7  # audio forwarding disabled
lsusb -vd 18d1:2d05  # audio forwarding enabled