Commit graph

7549 commits

Author SHA1 Message Date
João Paulo Rechi Vita
28fd9bc319 bluetooth: backend-native: Pass profile id in register_profile*
Passing the profile id to register_profile and register profile reply
makes a clearer debug and will allow easier tracking of the profile
status changes.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
a631d4c07c bluetooth: backend-native: Rename profile to object in register_profile*
This string contains a object path name, not a profile name, so lets
make this accurate.

This commit brings no functional change apart from a small change in the
text of one log message.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
4b55b8a9d0 bluetooth: Keep a list of local adapters' UUIDs
This commit stores the UUID list when an adapter is discovered and
updates it whenever a PropertiesChanged signal notifies it has changed.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
Marijn Suijten
a246bb77c7 bluetooth/native: Accept and report battery HF indicator value
HF indicator 2 (see [assigned-numbers], Hands-Free Profile) is able to
report battery percentage at 1% intervals (in range [0, 100]), contrary
to the `+XAPL` `+IPHONEACCEV` extension which only supports 10%
increments.  This does not guarantee increased granularity however, as
peers may still be limited to imprecise battery measurements internally
or round to coarser percentages.
Supporting both additionally broadens the range of devices for which PA
can report its battery level.

[assigned-numbers]: https://www.bluetooth.com/specifications/assigned-numbers/

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
713e3f0680 bluetooth: Deregister battery provider when profile disconnects
Whenever a device disconnects the device is not removed from BlueZ, only
the profiles that had an active connection are disconnected. Since we
were providing this battery level based on AT commands received through
HSP/HFP these services should be responsible for deregistering it again.

Deregister the interface to signal BlueZ (And UPower in return) that the
battery level won't be accurate/updated anymore.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
f7955eeb48 bluetooth: Register as BlueZ experimental BatteryProvider1
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
c667befe9a bluetooth: Provide (HSP/HFP-received) battery level as device property
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
d2c97190ef bt/native: Parse specified number of arguments in IPHONEACCEV
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
e6157c8b1f bt/native: Answer AT command with ERROR if unhandled
The peer will wait some time and eventually time out the connection if
no reply is sent back. When sending `ERROR` the peer can decide to break
the RFCOMM connection immediately or continue when a command is not
critical.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
4cbac23894 bluetooth/native: Signal support for dock status in XAPL reply
The previous commit parses both battery level and dock status (if only
for printing to logs). Make sure bit `2` is set in the `+XAPL=` reply to
signify support for reading this, too.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Sebastian Reichel
7a84a24652 bluetooth: backend-native: add battery level reporting
Devices for Apple's iOS uses a few extra HFP AT commands to
inform the iPhone about the headphone's battery status.
Apple documented the AT commands in the following document:

https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf

The patch has been tested with a Bose QC35, which results
in the following communication:

D: [pulseaudio] backend-native.c: RFCOMM << AT+VGS=14
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+XAPL=009E-400C-0129,3
D: [pulseaudio] backend-native.c: RFCOMM >> +XAPL=iPhone,2
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+XEVENT=Bose SoundLink,158
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+IPHONEACCEV=2,1,4,2,0
N: [pulseaudio] backend-native.c: Battery Level: 50%
N: [pulseaudio] backend-native.c: Dock Status: undocked
D: [pulseaudio] backend-native.c: RFCOMM >> OK

[Marijn: Adapt for recent HSP/HFP code changes]

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
66e2672360 bt/bluez5-device: Update link to assigned Baseband numbers
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Evan Miller
bea3fa7d21 Fix a strict-prototypes warning
Some older compilers complain about the empty arg list in
pa_memfd_is_locally_supported.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/603>
2021-07-14 15:07:46 +00:00
Laurent Bigonville
0efc38e95f iochannel: Fix FTBFS on Debian kfreebsd
Fixes: #1233
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/605>
2021-07-13 10:49:01 +02:00
Igor V. Kovalenko
5febac482d alsa-ucm: fix persistent port names with alsa-lib >= 1.2.5
Alsa UCM device string can contain private configuration prefix required to make
correct device open call. Private prefix is dynamically generated by UCM manager
depending on internal state. Since pulseaudio sink/source port names currently
contain device string, these may change between runs breaking volume database
and module arguments referring to sink/source.

Fix this by skipping UCM private prefix available via `_alibpref` key while
creating UCM mapping name. Mapping object will still contain unmodified
device string for device open call.

See also https://github.com/alsa-project/alsa-ucm-conf/issues/104

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/598>
2021-07-12 13:49:21 +03:00
Tanu Kaskinen
13fd21a9c9 stream-restore: make version check stricter when dropping old entries
If we increment ENTRY_VERSION in the future, the old code would drop
entries with version 2, but we only want to drop entries with version 1.

This issue was spotted by Igor Kovalenko:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/298#note_983365

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/604>
2021-07-09 12:32:27 +03:00
Igor V. Kovalenko
0555d4f5a5 module-gsettings: Handle I/O hangup
When child `gsettings-helper` terminates prematurely, unconditionally reading
from child pipe fails in a busy loop until child process is reaped.

Fix this by terminating module upon PA_IO_EVENT_HANGUP or PA_IO_EVENT_ERROR.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/600>
2021-07-04 11:14:37 +03:00
Alper Nebi Yasak
7580ef31a1 alsa-ucm: Log about the correct path value when probing volumes
These two log messages are most likely intended for the path that was
just tried, but they are mistakenly printing the name of the port's
current path. Fix them.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/594>
2021-06-30 15:09:14 +00:00
Igor V. Kovalenko
c817dfb5a4 build-sys: meson: Require bluez dependency if bluez5 feature is enabled
Build breaks if bluez5 and bluez5-native-headset are both enabled
but bluez headers are not available.

Fix this by changing `bluez5` to Meson feature requiring `bluez` dependency.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/583>
2021-06-21 10:50:08 +00:00
Igor V. Kovalenko
58052e0e04 build-sys: meson: require GIO dependency for RTP-GStreamer
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/584>
2021-06-21 03:25:32 +03:00
Hui Wang
36fcfeb211 alsa-sink/source: set volume to hw immediately if ucm_port changing
Recently we found an issue of output volume on speaker and headphone,
they should have their own volume but in practice they share one
output volume.

This issue happens on the laptops which use the ucm2 sof-hda-dsp,
originally the speaker has output volume A while the headphone has the
output volume B, suppose the speaker is the active port at the moment
and the output volume is A, users plug a headphone to the jack and the
headphone becomes the active port, in this process, ucm_set_port()
calls _disdev/_enadev which triggers the io_mixer_callback(), in the
meanwhile, the module_device_restore will restore the headphone's
volume to B, it will call set_volume_cb() to set the volume to B, but
this value is not written to hw immediately, during the time of
waiting for the B to be written to the hw, the io_mixer_callback()
calls get_volume_cb(), it reads hw volume and gets the volume A, then
it overrides the output volume to A, this results in the headphone
gets the volume A instead of B.

If a machine doesn't use the ucm, this issue will not happen since the
set_port_cb() will not trigger the io_mixer_callback(). If the ports
don't belong to the same sink/source, this issue also doesn't happen.

BugLink: http://bugs.launchpad.net/bugs/1930188
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/577>
2021-06-16 19:58:24 +03:00
Patrick Gaskin
ce962563eb win32: Add DACLs for directories created by system daemon
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/549>
2021-06-16 09:17:27 +00:00
Patrick Gaskin
4f3ca10d9e daemon: Add support for running as a service on win32
* Minimal implementation of --system on win32.
* Wrap main with a Windows Service on win32 (with a fallback to
  running it directly).
* Update PA_SYSTEM_{RUNTIME,STATE,CONFIG}_PATH and HOME dynamically
  on Windows (overrides the build config, similar to the existing
  config path replacement logic).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/549>
2021-06-16 09:17:27 +00:00
Hui Wang
87b4d68978 alsa-mixer: only use switch to mute Front in the Headphone path
According to the alsa-info.txt in the pipewire issues of 747 and 1206,
the Front Playback Volume is shared by Headphone and Lineout or
Headphone and Speaker, But Headphone, Lineout or Speaker they all have
independent Playback Switch, change to only use switch to mute the
Lineout or Speaker. This could resolve the issues of 747 and 1206.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1206
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/565>
2021-06-16 09:13:58 +00:00
Patrick Gaskin
6222f610e8 win32: Misc Unix socket fixes
* Make pa_parse_address recognize Unix socket addresses with
  Windows-style absolute paths.
* Treat WASEINVAL as a stale socket.
* Make HAVE_AF_UNIX in config templates recognize winsock2.h.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Patrick Gaskin
a01cce726f win32: Fix environment variables set with pa_{unset,set}_env not taking effect
SetEnvironmentVariable is not visible to getenv.

See https://github.com/curl/curl/issues/4774.
See https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getenv-wgetenv.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Patrick Gaskin
ac8e786026 win32: Fix minimum Windows version for inet_{ntop,pton}
https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_ntop#requirements

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Scott Worley
9d27317873 gsettings: Emit glib logs on stderr, not stdout
Having G_MESSAGES_DEBUG=all set in the environment (a normal thing to do
when debugging Gnome troubles) causes gsettings-helper to emit a bunch
of helpful gnome debug logs (which is good), but before this change they
were printed on stdout rather than stderr (which was bad!).  Rather than
going somewhere the user could see, these log messages were being sent
to the pulesaudio server and interpreted as the src/modules/stdin-util.c
protocol.  pulseadio waits to see a '!' message from gsettings-helper
before continuing startup.  With the log messages mixed in messing up
the stdin-util protocol, pulseaudio never saw the '!' message, and so
never completed startup.

This simple fix relies on a recent glib > 2.68 (Mar 2021), so builds
against old versions of glib will still have this problem!  We consider
this good enough until some complains otherwise.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1222
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/579>
2021-06-15 11:46:20 -07:00
Igor V. Kovalenko
1a4fb0ff63 alsa-mixer: updated Sennheiser GSX 1200 device ID
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/581>
2021-06-15 09:20:41 +03:00
Johannes Wolf
ba7198d5c8 alsa-profiles: Add NI Komplete Audio 6 profiles
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/564>
2021-06-10 12:54:27 +00:00
Igor V. Kovalenko
e576bd924f card: handle sticky profile flag
New card database entry version 5 for card profile is sticky flag.
New messaging API handlers set-profile-sticky and get-profile-sticky.

When card profile is sticky, always restore it even if it is unavailable,
and prevent switching from it when ports become unavailable.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/568>
2021-06-10 10:30:58 +00:00
Igor V. Kovalenko
79cb1369fc alsa-mixer: check if mapping is NULL before using it
Fix Debian bullseye bug where adding this line makes pulseaudio crash on startup

`load-module module-alsa-sink device=hw:1,0 control=Wave`

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=989103

Fixes: dacfcbb09 ("alsa-ucm: use the proper mixer name for ucm pcm sink/source")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/576>
2021-06-07 12:13:49 +03:00
garrison
6d2a49a6a1 build-sys: meson: check if NEON code can be compiled on arm
When Meson SIMD module returns HAVE_NEON=1 on arm host, do extra compile check
to verify compiler can actually handle NEON code.

Related Meson issue #6361 https://github.com/mesonbuild/meson/issues/6361

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/574>
2021-06-05 15:14:59 +00:00
Igor V. Kovalenko
e0d9231bf4 build-sys: meson: check HAVE_MMX and HAVE_SSE before calling initializers
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/575>
2021-06-05 15:16:37 +03:00
Igor V. Kovalenko
2a5497bac5 json: remove json from public API
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/570>
2021-06-03 21:15:48 +00:00
Felipe Sateler
a12d90e2ed tests: fix json test for large numbers
PRIu64 means print a uint64_t, not an unsigned long. This
is warned by the compiler:

warning: format '%llu' expects argument of type 'long long unsigned int', but argument 2 has type 'long unsigned int'

This causes build failures on some 32-bit archs

https://buildd.debian.org/status/fetch.php?pkg=pulseaudio&arch=i386&ver=14.99.1%2Bdfsg1-2&stamp=1622553415&raw=0

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/571>
2021-06-03 18:41:39 +00:00
Ilja van Sprundel
c096193512 webrtc: Avoid using dynamic strings as format strings
Properly call format functions, dynamic strings shouldn't be passed as
format strings. Instead a format string of "%s" should be used, with the
dynamic string as it's argument.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/563>
2021-06-03 21:26:25 +03:00
Igor V. Kovalenko
411c087095 alsa-mixer: prevent double-free on decibel fixes object key
When decibel fixes object is cloned, there is only a shallow copy of `key`
string member of original object. This may lead to double-free crash reported in
pipewire tracker https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1125

Fix this by doing a deep copy of `key` string to maintain correct ownership.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/569>
2021-06-01 20:34:54 +03:00
Felipe Sateler
3a1affa175 Don't link libpulsecommon with GLib and GTK
This was the behaviour with the autotools build.

Fixes #1210

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/559>
2021-05-31 16:18:08 +00:00
Takashi Sakamoto
4d825dad42 udev: fix match expression to Focusrite Saffire Pro i/o series for ignorance
It seems that in sound context environment variable is not available for
match expression.

This commit utilizes walkthrough to refer to attributes in fw node. The
combination of vendor, model, units is enough to match the node since
the attributes of fw unit doesn't have vendor.

Fix: 37358e42c4 ("alsa: Suppress udev detection of sound card for some units on IEEE 1394 bus")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/566>
2021-05-30 13:22:29 +09:00
Igor V. Kovalenko
e818899e51 alsa-mixer: Add support for usb audio in the Dell dock WD19
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/562>
2021-05-19 21:03:01 +03:00
Sanchayan Maity
94e7cf10f5 bluetooth: aptX: Improve error message for when aptX element is not found
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/561>
2021-05-19 19:25:08 +05:30
Sanchayan Maity
8dbe5f7ad4 bluetooth: ldac: Fix missing check for RTP LDAC payloader element
While at it, improve the error message to include the name of the
element which was not found.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/560>
2021-05-19 18:09:43 +05:30
Jason Nader
9a4280988b Apply 3 suggestion(s) to 1 file(s)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
05d8185552 Apply 1 suggestion(s) to 1 file(s)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
ee6af0be23 Apply 1 suggestion(s) to 1 file(s)
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Klaas van Schelven
29860175c7 pactl: add get-(source|sink)-mute commands
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
bc8d615c1b pactl: add get_source_volume command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
258bc97fb1 pactl: add get_default_source command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00
Jason Nader
75390822b4 pactl: add get-sink-volume command
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/430>
2021-05-17 15:35:07 +00:00