Bug 420389 - Icon shown by plasma-pa doesn't match Bluetooth device profile.
Summary: Icon shown by plasma-pa doesn't match Bluetooth device profile.
Status: RESOLVED UPSTREAM
Alias: None
Product: plasma-pa
Classification: Unmaintained
Component: applet (other bugs)
Version First Reported In: 5.18.3
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-21 16:58 UTC by tdr
Modified: 2020-12-15 21:34 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Screenshot of icon. (49.37 KB, image/png)
2020-04-21 16:58 UTC, tdr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tdr 2020-04-21 16:58:30 UTC
Created attachment 127754 [details]
Screenshot of icon.

SUMMARY

The icon shown by plasma-pa doesn't match the Bluetooth device profile. For example, if I connect my set of Sony MDR-ZX780DC headphones in A2DP mode, it shows the "headset with mic" icon, rather than the "headphones" icon. This doesn't seem like much, but it is hard to tell at a glance which profile is being used, and I must manually check for input devices when switching between applications.


STEPS TO REPRODUCE
1. Pair and connect a headset that supports both A2DP and HSP/HFP profile.
2. Switch profiles using plasma-pa: right-click on applet, select Configure Audio Volume -> Audio -> Advanced
3. Change the device profile.

OBSERVED RESULT

Icon depicts a headset/input device.

EXPECTED RESULT

Icon depicts the appropriate device based on the profile.

SOFTWARE/OS VERSIONS

Operating System: Kubuntu 19.10
KDE Plasma Version: 5.18.3
KDE Frameworks Version: 5.67.0
Qt Version: 5.12.4
Kernel Version: 5.3.0-46-generic
OS Type: 64-bit
Processors: 4 × AMD Phenom(tm) II X4 955 Processor
Memory: 7.8 GiB of RAM

ADDITIONAL INFORMATION

plasma-pa/eoan,now 4:5.18.3-0ubuntu1~ubuntu19.10~ppa1 amd64 [installed,automatic]
  Plasma 5 Volume controller

Hardware is a Sony MDR-ZX780DC: https://www.sony.com/electronics/support/wireless-headphones-bluetooth-headphones/mdr-zx780dc
Comment 1 Nicolas Fella 2020-11-10 01:17:17 UTC
We choose the icon based on the formfactor that pulseaudio reports.

Could you please run "pactl list sinks" before and after switching the profile and attack the output here?
Comment 2 Bug Janitor Service 2020-11-25 04:33:50 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 3 tdr 2020-11-25 14:26:48 UTC
I will add the requested information within the week.

Thanks for looking at this bug.
Comment 4 Bug Janitor Service 2020-12-10 04:34:35 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 tdr 2020-12-15 14:36:27 UTC
As requested, here's the output. Apologies for the late response, life got in the way.

---------------------------------
--- BEFORE switching profiles ---
---------------------------------

$ pactl list sinks
Sink #0
        State: SUSPENDED
        Name: alsa_output.pci-0000_00_1b.0.analog-stereo
        Description: Built-in Audio Analog Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 7
        Mute: yes
        Volume: front-left: 0 /   0% / -inf dB,   front-right: 0 /   0% / -inf dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.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 = "92HD71B7X Analog"
                alsa.id = "92HD71B7X Analog"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "0"
                alsa.card_name = "HDA Intel"
                alsa.long_card_name = "HDA Intel at 0xf6adc000 irq 29"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1b.0"
                sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "293e"
                device.product.name = "82801I (ICH9 Family) HD Audio Controller"
                device.form_factor = "internal"
                device.string = "front:0"
                device.buffering.buffer_size = "65536"
                device.buffering.fragment_size = "32768"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analog Stereo"
                device.description = "Built-in Audio Analog Stereo"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        Ports:
                analog-output-lineout: Line Out (priority: 9000, not available)
                analog-output-speaker: Speakers (priority: 10000)
                analog-output-headphones: Headphones (priority: 9900, not available)
        Active Port: analog-output-speaker
        Formats:
                pcm

Sink #3
        State: SUSPENDED
        Name: bluez_sink.10_4F_A8_D8_29_9B.a2dp_sink
        Description: MDR-ZX780DC
        Driver: module-bluez5-device.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 26
        Mute: no
        Volume: front-left: 9175 /  14% / -51.23 dB,   front-right: 9175 /  14% / -51.23 dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor Source: bluez_sink.10_4F_A8_D8_29_9B.a2dp_sink.monitor
        Latency: 0 usec, configured 0 usec
        Flags: HARDWARE DECIBEL_VOLUME LATENCY 
        Properties:
                bluetooth.protocol = "a2dp_sink"
                device.description = "MDR-ZX780DC"
                device.string = "10:4F:A8:D8:29:9B"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_10_4F_A8_D8_29_9B"
                bluez.class = "0x240404"
                bluez.alias = "MDR-ZX780DC"
                device.icon_name = "audio-headset-bluetooth"
                device.intended_roles = "phone"
        Ports:
                headset-output: Headset (priority: 0)
        Active Port: headset-output
        Formats:
                pcm
                
---------------------------------
 -- AFTER switching profiles --
---------------------------------

$ pactl list sinks
Sink #0
        State: SUSPENDED
        Name: alsa_output.pci-0000_00_1b.0.analog-stereo
        Description: Built-in Audio Analog Stereo
        Driver: module-alsa-card.c
        Sample Specification: s16le 2ch 44100Hz
        Channel Map: front-left,front-right
        Owner Module: 7
        Mute: yes
        Volume: front-left: 0 /   0% / -inf dB,   front-right: 0 /   0% / -inf dB
                balance 0.00
        Base Volume: 65536 / 100% / 0.00 dB
        Monitor Source: alsa_output.pci-0000_00_1b.0.analog-stereo.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 = "92HD71B7X Analog"
                alsa.id = "92HD71B7X Analog"
                alsa.subdevice = "0"
                alsa.subdevice_name = "subdevice #0"
                alsa.device = "0"
                alsa.card = "0"
                alsa.card_name = "HDA Intel"
                alsa.long_card_name = "HDA Intel at 0xf6adc000 irq 29"
                alsa.driver_name = "snd_hda_intel"
                device.bus_path = "pci-0000:00:1b.0"
                sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
                device.bus = "pci"
                device.vendor.id = "8086"
                device.vendor.name = "Intel Corporation"
                device.product.id = "293e"
                device.product.name = "82801I (ICH9 Family) HD Audio Controller"
                device.form_factor = "internal"
                device.string = "front:0"
                device.buffering.buffer_size = "65536"
                device.buffering.fragment_size = "32768"
                device.access_mode = "mmap+timer"
                device.profile.name = "analog-stereo"
                device.profile.description = "Analog Stereo"
                device.description = "Built-in Audio Analog Stereo"
                module-udev-detect.discovered = "1"
                device.icon_name = "audio-card-pci"
        Ports:
                analog-output-lineout: Line Out (priority: 9000, not available)
                analog-output-speaker: Speakers (priority: 10000)
                analog-output-headphones: Headphones (priority: 9900, not available)
        Active Port: analog-output-speaker
        Formats:
                pcm

Sink #4
        State: IDLE
        Name: bluez_sink.10_4F_A8_D8_29_9B.headset_head_unit
        Description: MDR-ZX780DC
        Driver: module-bluez5-device.c
        Sample Specification: s16le 1ch 8000Hz
        Channel Map: mono
        Owner Module: 26
        Mute: no
        Volume: mono: 65536 / 100%
                balance 0.00
        Base Volume: 65536 / 100%
        Monitor Source: bluez_sink.10_4F_A8_D8_29_9B.headset_head_unit.monitor
        Latency: 27655 usec, configured 28000 usec
        Flags: HARDWARE HW_VOLUME_CTRL LATENCY 
        Properties:
                bluetooth.protocol = "headset_head_unit"
                device.intended_roles = "phone"
                device.description = "MDR-ZX780DC"
                device.string = "10:4F:A8:D8:29:9B"
                device.api = "bluez"
                device.class = "sound"
                device.bus = "bluetooth"
                device.form_factor = "headset"
                bluez.path = "/org/bluez/hci0/dev_10_4F_A8_D8_29_9B"
                bluez.class = "0x240404"
                bluez.alias = "MDR-ZX780DC"
                device.icon_name = "audio-headset-bluetooth"
        Ports:
                headset-output: Headset (priority: 0, available)
        Active Port: headset-output
        Formats:
                pcm
Comment 6 tdr 2020-12-15 14:39:47 UTC
It would appear that

    device.form_factor = "headset"

is the same in both listings, which makes sense.

Perhaps this is a PulseAudio decision and not related to KDE.

I would be happy to re-post this in the appropriate tracker, but I wonder if there is another solution to be found in the use of:

     bluetooth.protocol

to detect the type. Happy to patch if so.
Comment 7 Nate Graham 2020-12-15 16:46:01 UTC
Thanks for the info.
Comment 8 Nate Graham 2020-12-15 21:34:27 UTC
Yes, it would appear that this is the PulseAudio bug. When PulseAudio tells us "headset", we provide the "audio-headset" icon, which includes a microphone. To get the "audio-headphones" icon, we need for PulseAudio to tell us "headphone. Here's the code (abbreviated):

        case "headset":
            return "audio-headset";
        case "headphone":
            return "audio-headphones";

So you would file a bug at https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/ saying that your device is incorrectly detected as a headset instead of a pair of headphones. device.form_factor needs to return "headphones" instead of "headset.