ITADN

Pulseaudio Device IDs are useless for bluetooth devices.

#1227OpenDanielHabenicht 创建于 2026-05-31
bughost - pulseaudio
D
DanielHabenichtcommented
When listing pulseaudio devices with `Device.id()` one would get the following device ids: - pulseaudio:56 - pulseaudio:106 - `+` more for inputs... which is not really useful as the ids seem like they are based on the index, but [pulseaudio indexes are not stable](https://wiki.archlinux.org/title/PulseAudio#:~:text=Note%20that%20the%20%22index%22%20of%20the%20available%20sources%20and%20sinks%20will%20change%20each%20time%20a%20card%20profile%20is%20changed.) and "will change each time a card profile is changed". Meaning that any configuration change or a Bluetooth device reconnecting will get a new device id each time. It would be nice if the device ids would reflect the stable name of pulseaudio, e.g.: - pulseaudio:56 -> `pulseaudio:alsa_output.platform-3f00b840.mailbox.stereo-fallback` - pulseaudio:106 -> `pulseaudio:bluez_output.00_12_6F_F1_FF_61.1` <details> <summary>pactl list sinks Output for reference</summary> ```bash pi@magicmirror:~ $ pactl list sinks Sink #56 State: SUSPENDED Name: alsa_output.platform-3f00b840.mailbox.stereo-fallback Description: Built-in Audio Stereo Driver: PipeWire Sample Specification: s16le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 4294967295 Mute: no Volume: front-left: 26214 / 40% / -23.88 dB, front-right: 26214 / 40% / -23.88 dB balance 0.00 Base Volume: 56210 / 86% / -4.00 dB Monitor Source: alsa_output.platform-3f00b840.mailbox.stereo-fallback.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY Properties: alsa.card = "1" alsa.card_name = "bcm2835 Headphones" alsa.class = "generic" alsa.device = "0" alsa.id = "bcm2835 Headphones" alsa.long_card_name = "bcm2835 Headphones" alsa.mixer_name = "Broadcom Mixer" alsa.name = "bcm2835 Headphones" alsa.resolution_bits = "16" alsa.subclass = "generic-mix" alsa.subdevice = "0" alsa.subdevice_name = "subdevice #0" alsa.sync.id = "00000000:00000000:00000000:00000000" api.alsa.card.longname = "bcm2835 Headphones" api.alsa.card.name = "bcm2835 Headphones" api.alsa.path = "hw:1" api.alsa.pcm.card = "1" api.alsa.pcm.stream = "playback" audio.channels = "2" audio.position = "FL,FR" card.profile.device = "1" device.api = "alsa" device.class = "sound" device.icon_name = "audio-card-analog" device.id = "48" device.profile.description = "Stereo" device.profile.name = "stereo-fallback" device.routes = "1" factory.name = "api.alsa.pcm.sink" media.class = "Audio/Sink" device.description = "Built-in Audio" node.name = "alsa_output.platform-3f00b840.mailbox.stereo-fallback" node.nick = "bcm2835 Headphones" node.pause-on-idle = "false" object.path = "alsa:acp:Headphones:1:playback" port.group = "playback" priority.driver = "1000" priority.session = "1000" factory.id = "19" clock.quantum-limit = "8192" client.id = "47" node.driver = "true" node.loop.name = "data-loop.0" library.name = "audioconvert/libspa-audioconvert" object.id = "56" object.serial = "56" api.acp.auto-port = "false" api.acp.auto-profile = "false" api.alsa.card = "1" api.alsa.split-enable = "true" api.alsa.use-acp = "true" api.dbus.ReserveDevice1 = "Audio1" api.dbus.ReserveDevice1.Priority = "-20" device.bus_path = "platform-3f00b840.mailbox" device.enum.api = "udev" device.form_factor = "internal" device.name = "alsa_card.platform-3f00b840.mailbox" device.nick = "bcm2835 Headphones" device.plugged.usec = "11496359" device.subsystem = "sound" sysfs.path = "/devices/platform/soc/3f00b840.mailbox/bcm2835-audio/sound/card1" spa.object.id = "4" device.string = "1" Ports: analog-output: Analog Output (type: Analog, priority: 9900, availability unknown) Active Port: analog-output Formats: pcm Sink #106 State: SUSPENDED Name: bluez_output.00_12_6F_F1_FF_61.1 Description: Teufel BAMSTER PRO Driver: PipeWire Sample Specification: s24le 2ch 48000Hz Channel Map: front-left,front-right Owner Module: 4294967295 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: bluez_output.00_12_6F_F1_FF_61.1.monitor Latency: 0 usec, configured 0 usec Flags: HARDWARE DECIBEL_VOLUME LATENCY Properties: api.bluez5.address = "00:12:6F:F1:FF:61" api.bluez5.codec = "aptx" api.bluez5.profile = "a2dp-sink" api.bluez5.transport = "" bluez5.loopback = "false" card.profile.device = "1" device.id = "77" device.routes = "1" factory.name = "api.bluez5.a2dp.sink" device.description = "Teufel BAMSTER PRO" node.name = "bluez_output.00_12_6F_F1_FF_61.1" node.pause-on-idle = "false" priority.driver = "1010" priority.session = "1010" spa.object.id = "1" factory.id = "12" clock.quantum-limit = "8192" device.api = "bluez5" media.class = "Audio/Sink" media.name = "Teufel BAMSTER PRO" node.driver = "true" port.group = "stream.0" node.loop.name = "data-loop.0" library.name = "audioconvert/libspa-audioconvert" object.id = "87" object.serial = "106" client.id = "47" api.bluez5.class = "0x240404" api.bluez5.connection = "connected" api.bluez5.device = "" api.bluez5.icon = "audio-headset" api.bluez5.path = "/org/bluez/hci0/dev_00_12_6F_F1_FF_61" bluez5.auto-connect = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]" bluez5.profile = "off" device.alias = "Teufel BAMSTER PRO" device.bus = "bluetooth" device.form_factor = "headset" device.icon_name = "audio-headset-bluetooth" device.name = "bluez_card.00_12_6F_F1_FF_61" device.product.id = "0x8645" device.string = "00:12:6F:F1:FF:61" device.vendor.id = "bluetooth:000a" Ports: headset-output: Headset (type: Headset, priority: 0, available) Active Port: headset-output Formats: pcm ``` </details> Related to: https://github.com/RustAudio/cpal/issues/922
1 条评论