Bug 1216469

Summary: message "pulseaudio[6779]: Failed to load module "module-alsa-card" ..." after connecting Android phone
Product: [openSUSE] openSUSE Distribution Reporter: Ulrich Windl <Ulrich.Windl>
Component: BasesystemAssignee: Takashi Iwai <tiwai>
Status: RESOLVED FEATURE QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: Ulrich.Windl
Version: Leap 15.5   
Target Milestone: ---   
Hardware: IA64   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Ulrich Windl 2023-10-22 18:01:13 UTC
After I had connected my Android 13 phone via USB and enabled file sharing, I noticed the syslog message:
pulseaudio[6779]: Failed to load module "module-alsa-card" (argument: "device_id="2" name="usb-OPPO_CPH2371_VSERIAL-00" card_name="alsa_card.usb-OPPO_CPH2371_VSERIAL-00" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_propertie="module-udev-detect.discovered=1""): initialization failed.

("VSERIAL" is the redacted actual serial number of the phone)
Comment 1 Takashi Iwai 2023-10-24 12:38:46 UTC
Check the USB entry and figure out why pulseaudio thought it an audio device.
Comment 2 Ulrich Windl 2023-10-24 21:08:25 UTC
(In reply to Takashi Iwai from comment #1)
> Check the USB entry and figure out why pulseaudio thought it an audio device.

When the phone connects, it asks which mode to use; I chose "file transfer".
Maybe that makes two different USB connections. Anyway, here is what I see in the journal:

Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: new high-speed USB device number 11 using xhci_hcd
Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: New USB device found, idVendor=22d9, idProduct=2046, bcdDevice= 2.23
Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: Product: CPH2371
Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: Manufacturer: OPPO
Okt 24 22:54:34 i7g4x4a.site kernel: usb 1-9.1: SerialNumber: REDACTED
Okt 24 22:54:34 i7g4x4a.site mtp-probe[8390]: checking bus 1, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.1"
Okt 24 22:54:34 i7g4x4a.site mtp-probe[8390]: bus: 1, device: 11 was not an MTP device
Okt 24 22:54:35 i7g4x4a.site kernel: mc: Linux media interface: v0.10
Okt 24 22:54:35 i7g4x4a.site kernel: usbcore: registered new interface driver snd-usb-audio
Okt 24 22:54:35 i7g4x4a.site mtp-probe[8408]: checking bus 1, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb1/1-9/1-9.1"
Okt 24 22:54:35 i7g4x4a.site mtp-probe[8408]: bus: 1, device: 11 was not an MTP device
Okt 24 22:54:35 i7g4x4a.site systemd[4072]: Reached target Sound Card.
Okt 24 22:54:35 i7g4x4a.site pulseaudio[4313]: Failed to find a working profile.
Okt 24 22:54:35 i7g4x4a.site pulseaudio[4313]: Failed to load module "module-alsa-card" (argument: "device_id="2" name="usb-OPPO_CPH2371_REDACTED-00" card_name="als...

(I guess that's the initial connection)
I see a disconnection shortly after that:
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: USB disconnect, device number 11
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: new high-speed USB device number 12 using xhci_hcd
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: New USB device found, idVendor=22d9, idProduct=2764, bcdDevice= 2.23
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: Product: CPH2371
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: Manufacturer: OPPO
Okt 24 22:54:38 i7g4x4a.site kernel: usb 1-9.1: SerialNumber: REDACTED

The interface descriptor says:
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              5 MTP
      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
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x001c  1x 28 bytes
        bInterval               6

However when I keep the setting "charge only", the interface descriptor is different:
   Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              5 MIDI function
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0009
        bInCollection           1
        baInterfaceNr(0)        1
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         1 Audio
      bInterfaceSubClass      3 MIDI Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      MIDIStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x0025
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               2 External
        bJackID                 1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               1 Embedded
        bJackID                 2
        bNrInputPins            1
        baSourceID( 0)          1
        BaSourcePin( 0)         1
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 6
        bDescriptorType        36
        bDescriptorSubtype      2 (MIDI_IN_JACK)
        bJackType               1 Embedded
        bJackID                 3
        iJack                   0 
      MIDIStreaming Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (MIDI_OUT_JACK)
        bJackType               2 External
        bJackID                 4
        bNrInputPins            1
        baSourceID( 0)          3
        BaSourcePin( 0)         1
        iJack                   0 
      Endpoint Descriptor:
        bLength                 9
        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
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       3
      Endpoint Descriptor:
        bLength                 9
        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
        bRefresh                0
        bSynchAddress           0
        MIDIStreaming Endpoint Descriptor:
          bLength                 5
          bDescriptorType        37
          bDescriptorSubtype      1 (GENERAL)
          bNumEmbMIDIJack         1
          baAssocJackID( 0)       2

Unsure if that's a bug or a feature.
Comment 3 Takashi Iwai 2023-10-25 06:09:25 UTC
It looks like a feature.  The phone seems exposing itself as a virtual USB-audio device only with MIDI device.  Since it's a USB-audio card, PA tries to probe, but couldn't probe the PCM, hence gave up.