canonical / checkbox

Checkbox
https://checkbox.readthedocs.io
GNU General Public License v3.0
30 stars 47 forks source link

Unable to detect the hotplug of headphone on Raspberry Pi 4 #568

Open baconYao opened 1 year ago

baconYao commented 1 year ago

Bug Description

Problem

Job audio/speaker-headphone-plug-detection failed since the Sink from pactl command doesn't change after plugging the 3.5mm jack headset to RPI 4.

What I found

The logic of job audio/speaker-headphone-plug-detection is to compare difference of sinks' value from pactl command.

But the value of 3.5mm jack is existed {('Sink #0', 'analog-output-headphones', 'availability unknown') at the beginning, so, even though I plug the headset, the Sink value is still same as before plugging.

To Reproduce

  1. Install Checkbox Snap
  2. Run checkbox.checkbox-cli run com.canonical.certification::audio/speaker-headphone-plug-detection

Environment

Relevant log output

----------------------------[ Running job 30 / 74 ]-----------------------------
-------------------[ audio/speaker-headphone-plug-detection ]-------------------
ID: com.canonical.certification::audio/speaker-headphone-plug-detection
Category: Audio tests
--------------------------------------------------------------------------------
Description:

PURPOSE:
    Check that system detects speakers or headphones being plugged in
STEPS:
    1. Prepare a pair of headphones or speakers with a standard 3.5mm jack
    2. Locate the speaker / headphone jack on the device under test
    3. Run the test (you have 30 seconds from now on)
    4. Plug headphones or speakers into the appropriate jack
    5. Unplug the device for subsequent tests.
VERIFICATION:
    Verification is automatic, no action is required.
    The test times out after 30 seconds (and fails in that case).

Pick an action
    => press ENTER to continue
  c => add a comment
  s => skip this job
  q => save the session and quit
[csq]: 
Starting with config: {('Sink #1', 'iec958-stereo-output', None), ('Sink #0', 'analog-output-headphones', 'availability unknown')}
You have 30 seconds to plug the item in
Time is up
--------------------------------------------------------------------------------
Outcome: job failed

$ pactl list sinks

Sink #0
    State: SUSPENDED
    Name: alsa_output.platform-bcm2835_audio.stereo-fallback
    Description: Built-in Audio Stereo
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Owner Module: 7
    Mute: no
    Volume: front-left: 32768 /  50% / -18.06 dB,   front-right: 32768 /  50% / -18.06 dB
            balance 0.00
    Base Volume: 56210 /  86% / -4.00 dB
    Monitor Source: alsa_output.platform-bcm2835_audio.stereo-fallback.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
    Properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "bcm2835 Headphones"
        alsa.id = "bcm2835 Headphones"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "bcm2835 Headphones"
        alsa.long_card_name = "bcm2835 Headphones"
        alsa.driver_name = "snd_bcm2835"
        device.bus_path = "platform-bcm2835_audio"
        sysfs.path = "/devices/platform/soc/fe00b840.mailbox/bcm2835_audio/sound/card0"
        device.form_factor = "internal"
        device.string = "hw:0"
        device.buffering.buffer_size = "17632"
        device.buffering.fragment_size = "4416"
        device.access_mode = "mmap"
        device.profile.name = "stereo-fallback"
        device.profile.description = "Stereo"
        device.description = "Built-in Audio Stereo"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card"
    Ports:
        analog-output-headphones: Headphones (type: Headphones, priority: 9900, availability unknown)
    Active Port: analog-output-headphones
    Formats:
        pcm

Sink #1
    State: SUSPENDED
    Name: alsa_output.platform-fef05700.hdmi.iec958-stereo
    Description: Built-in Audio Digital Stereo (IEC958)
    Driver: module-alsa-card.c
    Sample Specification: s16le 2ch 44100Hz
    Channel Map: front-left,front-right
    Owner Module: 9
    Mute: no
    Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
            balance 0.00
    Base Volume: 65536 / 100% / 0.00 dB
    Monitor Source: alsa_output.platform-fef05700.hdmi.iec958-stereo.monitor
    Latency: 0 usec, configured 0 usec
    Flags: HARDWARE DECIBEL_VOLUME LATENCY SET_FORMATS 
    Properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "MAI PCM i2s-hifi-0"
        alsa.id = "MAI PCM i2s-hifi-0"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "2"
        alsa.card_name = "vc4-hdmi-1"
        alsa.long_card_name = "vc4-hdmi-1"
        alsa.driver_name = "vc4"
        device.bus_path = "platform-fef05700.hdmi"
        sysfs.path = "/devices/platform/soc/fef05700.hdmi/sound/card2"
        device.form_factor = "internal"
        device.string = "iec958:2"
        device.buffering.buffer_size = "262144"
        device.buffering.fragment_size = "131072"
        device.access_mode = "mmap+timer"
        device.profile.name = "iec958-stereo"
        device.profile.description = "Digital Stereo (IEC958)"
        device.description = "Built-in Audio Digital Stereo (IEC958)"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card"
    Ports:
        iec958-stereo-output: Digital Output (S/PDIF) (type: SPDIF, priority: 0, availability unknown)
    Active Port: iec958-stereo-output
    Formats:
        pcm


### Additional context

_No response_
baconYao commented 1 year ago

Same problem can be reporded on Baoshan Project (Arm64)

syncronize-issues-to-jira[bot] commented 8 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CHECKBOX-1215.

This message was autogenerated