When the SCO connection is in use, if you disconnect first and then connect,
the SCO connection will occasionally fail, and the Bluetooth error code is 42
(0x2A in hexadecimal). This is usually because an error occurred when the SCO
connection was initiated, we need to try to reconnect to optimize the handling
of this problem. The log returned by the kernel is as follows:
Bluetooth: sco_connect_cfm: hcon 0000000003328902 bdaddr 40:ef:4c:0c:11:f0 status 42
Bluetooth: sco_sock_connect status is -38
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/622>
When module-combine-sink is used to create virtual surround card it is expected
that each slave channel receives data for exactly one combined sink channel.
Currently this is not the case because module-combine-sink would follow
core->disable_remixing setting. Usually this means that multiple channels of
combined sink are getting remixed into slave channel, and there is no option to
disable this behavior just for combined sink.
Improve this by implementing "remix" modarg for module-combine-sink,
default to original behavior (follow core->disable_remixing setting).
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/627>
Mainloop test uses io callback for PA_IO_EVENT_INPUT on stdin.
With glib enabled PA_IO_EVENT_INPUT translates to glib G_IO_IN event which also
matches descriptor in EOF state. While io callback does not check for EOF after
reading from file descriptor this is causing mainloop-test to repeatedly read 0
bytes once EOF is reached, rearm defer callback and spam test log.
Fix this by disarming io callback when EOF is reached in test run.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/625>
The word variables used in the _pactl and _pacmd functions are
unlocalized. Thus, the variable appears in the user's environment when
tab-completing with pactl or pacmd. This may clobber another variable
of the same name, which is undesirable.
Localize the word variable to fix this issue.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/623>
When packaging a new version for OpenEmbedded, I use the
buildhistory-diff tool to check what changed between the versions. The
version number in the module directory means that I get tons of diff
output due to changes in file paths. There are many removed and added
files and it's hard to see if something else than just the version
number changed.
That motivated me to write this patch. Removing the version number has
the downside that it makes it easier to have version mismatches between
the daemon and the modules, but
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/merge_requests/249
will make the handling of such situations better.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/230>
Currently, module-tunnel uses the default fixed latency of 250ms as fixed
latency.
There is no reason for such a large latency. This patch adds a parameter
latency_msec to the module to set the fixed latency at load time of the
module. The parameter can range from 5 to 500 milliseconds. With this
patch, I was able to run a tunnel sink at 7ms latency without problems.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
Currently module-tunnel uses only a rough estimate of the current stream
latency and reports wrong latencies in certain situations. This leads to
very inexact and unstable latency reports for the virtual sink.
This patch fixes the issue by introducing latency snapshots like they
are used in module-loopback. Because the latency reports are now correct,
the update interval for latency re-calculations can be reduced to 1s.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
Currently the combine-sink uses the trivial resampler by default.
This patch changes the default to the configured resampler.
Also the default update time is changed from 10s to 1s to achieve
faster convergence and higher precision.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
Currently, it takes one adjust time before the smoother is updated after an
unsuspend. Before the first update, the smoother will not be aware of the
slave sink latencies, leading to incorrect latency reports.
This patch moves the first smoother update to one latency time after the
sink was unsuspended, thereby improving initial latency reports. This
only partially resolves the problem because the smoother takes multiple
updates to adapt to the slave sink latencies.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
This patch adds a rate controller similar to the one used in module-loopback
to limit step size and maximum deviation from the base rate. Rate changes
are handled more smoothly by the controller. The patch has not much impact
on the behavior of the module, except that there is less rate hunting.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
Currently module-combine-sink uses only a rough estimate of the current
slave sink latencies to calculate the rate for the various sink inputs.
This leads to very inexact and unstable latency reports for the virtual
sink.
This patch fixes the issue by introducing latency snapshots like they
are used in module-loopback. It also changes the definition of the
target latency to ensure that there is always one sink which uses the
base rate.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
Commit f89d64b98e fixed a crash
when disabling adapters. However, now if any device is removed
ofono card is removed, even if it belongs to different device.
Add a check for the device being unlinked to our callback to fix.
Signed-off-by: Juho Hämäläinen <juho.hamalainen@jolla.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/624>
With USB Alternate Setting 3 size of HCI payload is 72 bytes which is already
larger than mSBC frame size. Largest known size of HCI payload is with USB
Alternate Setting 5 (144 bytes), make it the default SCO socket MTU.
Reserve additional space in bluetooth encoder buffer to cover this case.
Since mSBC encoder and decoder will now work with larger packet sizes, drop
assertions about MTU larger than mSBC frame size.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/617>
While the threading model for combine is different from other filters
(which expect to just piggy-back on the I/O thread of the most
downstream sink), it might still be valuable to set this field to
indicate that this sink input is intended to behave as a filter stream
rather than a conventional stream.
At the very least, routing behaviour and cycle detection should act on
these streams as with any other filter.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/399>
With clang compiler including cpuid.h will produce error if architecture is not
x86-based, and cheching if cpuid.h exists via Meson has_header() is not enough.
Fix this by creating a list of headers checked to be usable via Meson
check_header() function, and move cpuid.h to that list.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/614>
This reverts commit 3ac73598c6.
Systemd v249 has new entries of hwdb for node and unit in IEEE 1394 bus
(hwdb.d/80-ieee1394-unit-function.hwdb). It can obsolete my workaround
added by commit 3ac73598c6 ("udev: use ID_MODEL/ID_VENDOR to give
friendly name for FireWire devices"). The hwdb entry is handy prepared.
When user finds missing entry, it's preferable to file issue or merge
request in systemd project site.
IEEE 1394 bus is enough legacy and it's easy to expect that few developer
can evaluate the change. For reviewers, I describe the original issues and
the integration of hwdb in systemd side.
In systemd, udev rule for sound card (rules.d/78-sound-card.rules) has
below line to assign information in hwdb to instance for sound card.
```
IMPORT{builtin}="hwdb"
```
In the case, the udev hwdb builtin finds information according to
modalias by following nodes in device topology tree toward root. For
sound card associated to unit in node in IEEE 1394 bus, it's inconvenient
since hwdb had no entry for the unit. The instance for node in IEEE 1394
bus doesn't have modalias. As a result, the builtin reaches 1394 OHCI
controller in PCI Express bus which maintains the IEEE 1394 bus, then the
value for ID_VENDOR_FROM_DATABASE and ID_MODEL_FROM_DATABASE properties
from hwdb of pci device (hwdb.d/20-pci-vendor-model.hwdb) for the sound
card.
For example, when two nodes are in IEEE 1394 bus and one of them has
unit instance for audio and music functions, the topology of the bus is
depicted in following diagram:
```
* 1394 OHCI controller (pci*, modalias)
* node A - (pci*/fw0, /dev/fw0)
* node B - (pci*/fw1, /dev/fw1)
* unit B-1 - (pci*/fw1/fw1.0, modalias)
* sound card 0 - (pci*/fw1/fw1.0/sound/card0, card0)
```
In the case, the udev hwdb builtin picks up from hwdb of pci device for
the sound card:
```
$ udevadm test-builtin hwdb /sys/class/sound/card2
Load module index
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Created link configuration context.
ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
ID_PCI_SUBCLASS_FROM_DATABASE=FireWire (IEEE 1394)
ID_PCI_INTERFACE_FROM_DATABASE=OHCI
ID_VENDOR_FROM_DATABASE=Texas Instruments
ID_MODEL_FROM_DATABASE=XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express]
Unload module index
Unloaded link configuration context.
```
The aim of my workaround is to avoid using ID_VENDOR_FROM_DATABASE and
ID_MODEL_FROM_DATABASE for sound card associated to unit in IEEE 1394
bus. Instead, ID_VENDOR and ID_MODEL properties are used.
However, it has another issue. For the properties, the udev rule for
sound card has the other lines for sound card associated to unit in
IEEE 1394 bus, below:
```
SUBSYSTEMS=="firewire", ATTRS{guid}=="?*", \
ENV{ID_BUS}="firewire", ENV{ID_SERIAL}="$attr{guid}", ENV{ID_SERIAL_SHORT}="$attr{guid}", \
ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{model}", \
ENV{ID_VENDOR}="$attr{vendor_name}", ENV{ID_MODEL}="$attr{model_name}"
SUBSYSTEMS=="firewire", GOTO="skip_pci"
```
The values of ID_VENDOR and ID_MODEL properties come from vendor_name and
model_name attributes in parent instance of the sound card, therefore
they come from audio and music units in IEEE 1394 bus. Unfortunately
these attributes are not available always.
All of nodes in IEEE 1394 bus should have configuration ROM in place
according to IEEE 1212 and Linux FireWire subsystem parses the content of
ROM to detect units in the node. At the same time, the subsystem manages
to detect information about vendor and model according to standard layout
defined by 1394 Trading Association[1].
When the content of ROM is against the standard, the subsystem is
discouraged the name detection. In the case, vendor_name and model_name
attributes are not available, and supplemental information should be from
software implementation.
The new hwdb (hwdb.d/80-ieee1394-unit-function.hwdb) added to systemd v249
can solve the above issues. The prepared names for vendor and model in
hwdb are assigned to both node and unit. The udev hwdb builtin can find
the vendor and model names for the unit according to modalias before
arriving at pci-device. Regardless of standard or non-standard
configuration ROM, the hwdb gives prepared names of vendor and model.
This is an example of Mark of the Unicorn (MOTU) Traveler. The search
finishes at instance for unit in IEEE 1394 bus expectedly:
```
$ udevadm test-builtin hwdb /sys/class/sound/card2
Load module index
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Created link configuration context.
ID_MODEL_FROM_DATABASE=Traveler
ID_VENDOR_FROM_DATABASE=MOTU
IEEE1394_UNIT_FUNCTION_AUDIO=1
IEEE1394_UNIT_FUNCTION_MIDI=1
Unload module index
Unloaded link configuration context.
```
[1] Configuration ROM for AV/C Devices 1.0 (Dec. 12, 2000, 1394 Trading
Association, TA Document 1999027)
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/610>
Try to register profile support again after RegisterProfile fails, when
BlueZ indicates no one else is implementing the profiles we are
interested in.
Ideally this would rely on a list of UUIDs supported by the profile
manager instead of the adapter, but BlueZ has no such API.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
Create pa_bluetooth_profile_status_t to represent all stages an external
Bluetooth profile can go through:
0. Inactive: Initial state, no D-Bus object has been registered for
this profile yet.
1. Active: an object implementing the org.bluez.Profile1 interface has
been registered on the system bus.
2. Registering: RegisterProfile has been called.
3. Registered: RegisterProfile succeeded.
This will be useful to handle RegisterProfile failures, as well as
dynamically register and un-register a profile based on the current
active seat.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
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>
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>
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>
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>