Commit graph

397 commits

Author SHA1 Message Date
Dmitry Sharshakov
e2ac16ccbd fix: remove v-battery when device disconnects 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a0ac3ac8dd fix: cancel and free battery register pending call 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
5c9028a94d bluez5-dbus: move battery provider functions, fix ghost batteries 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
48cc5915fb chore: backend-native: remove unused define 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
2683c1ef5e backend-native: report battery status to BlueZ 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a1ed8aec68 chore: bluez5: move spa_bt_monitor to common header file 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
0078b3b73e backend-native: get battery status via HFP 2021-03-12 15:45:41 +00:00
Thibault Saunier
485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
Pauli Virtanen
98bedb3895 bluez5: don't set a2dp codec for source device initial profiles
Source devices don't have the a2dp codec profiles, so don't set a codec
profile as the initial one.
2021-03-10 21:32:01 +02:00
Wim Taymans
c0ab4b1b8d bluez5: fix compiler warning 2021-03-09 12:25:20 +01:00
Pauli Virtanen
808b54bc19 bluez5: sco-io: fallback packet size when read size unknown should be even
Reported write MTU is odd for some adapters, which will misalign CVSD
frames, so round fallback value to even.
2021-03-09 08:03:21 +00:00
Pauli Virtanen
511bafb436 bluez5: release transports on profile change
SCO transports have timer-delayed release, but they need to be released
immediately when changing profiles to close connections before switching
to A2DP.
2021-03-08 23:42:08 +02:00
Pauli Virtanen
a99f3a90ef bluez5: correct EnumRoute availability
Mark bluez5 routes always available in EnumRoute, because there's always
a device connected.

Fixes default-route resetting profiles back, when they are manually
changed.
2021-03-07 01:37:57 +02:00
Pauli Virtanen
e42261c6d2 bluez5: remove per-device codec filtering
This does not work as intended, because we no longer do a codec switch
on device connect.  It should be done in a different way, but since it's
not used for anything right now, can as well remove it.
2021-03-06 15:19:14 +02:00
George Kiagiadakis
9168ec4335 backend-hsphfpd: fix compilation 2021-03-03 18:57:48 +00:00
Pauli Virtanen
4389e44903 bluez5: emit props change events only if values actually changed
This may avoid infinite loops if parameters are being set based on events
sent by parameter changes. It's also what alsa-acp devices do, so bluez5
should follow.
2021-03-02 23:46:27 +02:00
Pauli Virtanen
302282ef59 bluez5: set channel information for hfp/hsp transports
Fixes volume problems.
2021-03-02 22:20:44 +02:00
Huang-Huang Bao
97cc27600a bluez5: add missing function defination 2021-03-02 14:08:14 +00:00
Frédéric Danis
0e2a153bd3 bluez5: Start only one backend at a time for HSP/HFP
This will prevent to run the different backends concurrently.

The native backend will only register to BlueZ if neither oFono nor
hsphfpd are running. If one of them starts, the native backend will be
unregistered and the corresponding backend will register to its daemon.
2021-03-02 09:43:16 +00:00
Wim Taymans
157d423246 bluez5: remove stray route param field
This info is also in the classes field.
2021-03-01 16:55:16 +01:00
Pauli Virtanen
6114ca7c4a bluez5: fix queueing codec switches
Make queueing a codec switch work properly.  When receiving the dbus
reply, it should move to latest one. Others should be discarded.

Previously, it instead hit an assert, if there were more than two
queued.
2021-02-24 21:14:25 +00:00
Pauli Virtanen
a5dc2493df bluez5: route shouldn't list a2dp profiles when not connected 2021-02-19 21:16:27 +02:00
Frédéric Danis
7a5a944704 bluez5: backend-native: Check volume values
The value from +VGM/+VGS AT commands or events should be between 0 than 15.
2021-02-18 18:32:21 +00:00
Wim Taymans
930b411075 bluez5: set the right volumes on the node 2021-02-18 19:25:04 +01:00
Wim Taymans
8c5ca000ef bluez5: volumes need to be distributed to all channels
Otherwise some channels might become silent.

See #741
2021-02-18 17:47:22 +01:00
Wim Taymans
63a3811aa7 fix some warnings 2021-02-18 12:42:06 +01:00
Pauli Virtanen
d75a79babc bluez5: add delay adjustment property + fallback value for a2dp-sink
Not all devices report their A2DP delay. In those cases, use a fallback
value of 150ms by default.

Make the delay adjustable with a SPA_Prop, and expose it as a part of
the route. Implement the corresponding parts in media-session.
2021-02-18 11:33:45 +00:00
Pauli Virtanen
df1dbee687 bluez5: include a2dp codec profiles in route profiles 2021-02-18 11:33:45 +00:00
Frédéric Danis
bdbd0f17c6 bluez5: backend_native: Fix backend_native_new() error path 2021-02-17 14:03:06 +01:00
Frédéric Danis
01b6dbfca6 bluez5: backend_native: Add mSBC support to HFP HF 2021-02-17 10:19:39 +01:00
Frédéric Danis
7a96f3a945 bluez5: backend_native: Fix SCO deferred setup accept
In BT_DEFER_SETUP mode, when a connection is accepted, the listening
socket is unblocked but the effective connection setup happens only on
first receive, allowing to configure the accepted socket.

First read from the accepted socket is non-blocking and returns a zero
length buffer.
2021-02-16 18:30:11 +01:00
Wim Taymans
344eb2baa3 bluez5: handle info == NULL when parsing codecs 2021-02-16 17:58:56 +01:00
Frédéric Danis
23823867b0 bluez5: backend_native: Fix +BRSF parsing for HFP HF 2021-02-16 16:49:04 +00:00
Frédéric Danis
be7caf0e66 bluez5: backend_native: Fix default HFP codec 2021-02-16 16:49:04 +00:00
Frédéric Danis
0b2d3730b6 bluez5: Add HFP HF support 2021-02-15 14:46:18 +00:00
Pauli Virtanen
0dee15d0f6 bluez5: aac: set reasonable default bitrate
Set default bitrate to a reasonable value in caps, and handle unknown or
bogus bitrates from device.
2021-02-13 19:03:13 +00:00
Wim Taymans
2908e11a72 bluez5: add mSBC and CVSD codec name to properties
Fixes #666
2021-02-12 17:20:37 +01:00
Frédéric Danis
a14d6d15b3 bluez5: Use only one SCO listening socket in backend-native
Create SCO listening socket on backend creation for all incoming
connections instead of one per remote device.
2021-02-12 16:10:22 +00:00
Pauli Virtanen
b6108df6f3 bluez5: remove device on disconnect
Do device_remove when device disconnects.

This can occur, as profile check is not run on HFP/HSP profile
disconnect.
2021-02-11 21:55:42 +02:00
Pauli Virtanen
beaec3d003 bluez5: set initial profile based on what's connected at startup
Set initial device profile according to what's connected at startup,
rather than having media-session try to set it to A2DP (and fail, if the
profile was not connected, resulting to startup in null profile).

This avoids making a codec switch at device startup (we'll stay with
what BlueZ autoconnected us to, usually the previously used codec).
2021-02-11 11:13:42 +00:00
Frédéric Danis
add8329374 bluez5: Use str2ba() function
bluez5 SPA is already linked to the BlueZ library so we can use this
helper function and simplify code.
2021-02-10 10:57:52 +00:00
Pauli Virtanen
d57c9bd1bd bluez5: aac: reject MPEG4_AAC_LTP, MPEG4_AAC_SCA in select_config
These modes are not actually supported by the code, so it should not
accept them.
2021-02-10 00:18:29 +02:00
Frédéric Danis
640f34d8e2 bluez: Fix HSP command parser
The HSP command parser should not reply, with 'OK' or 'ERROR', to result
codes from the remote AG.
Split the command parser in AG and HS part.
2021-02-09 18:08:26 +00:00
Frédéric Danis
44d8a0a4c1 bluez5: Expose WBS in HFP AG SDP record
Updates the available values for SDP records and BRSF for both Hands-Free
profile version 1.7.
2021-02-09 16:12:29 +01:00
Wim Taymans
ecd1d3e1d7 Move node.pause-on-idle setting to config files
So that we can configure it.
Add some more docs to the config file
2021-02-08 17:19:47 +01:00
Wim Taymans
cd2a7aebaf a2dp-sink: don't force flush on every buffer
Don't force flush on every buffer but accumulate enough data
first. This avoids sending many small packets when the quantum is
small.

See #680
2021-02-08 10:24:50 +01:00
Wim Taymans
e3d19e5602 a2dp: small cleanups 2021-02-08 10:24:27 +01:00
Wim Taymans
37d8cbd5d6 bluez5: make min buffer size match the latency
We request a latency of at least 512 so make sure we have buffers that
large.

See #680
2021-02-07 20:22:55 +01:00
Wim Taymans
63c5fadcfc a2dp: fix compiler warnings 2021-02-07 19:43:09 +01:00
Huang-Huang
cd78003e66 bluez5: don't create device if there is no connected profile 2021-02-07 18:38:10 +00:00