Commit graph

49 commits

Author SHA1 Message Date
Huang-Huang Bao
30e4e56852 bluez5: enable HSP HS volume control
It's only enabled for HSP AG previously.
2021-04-21 08:54:10 +00:00
Huang-Huang Bao
f56d08297d bluez5: correct RFCOMM command to set HSP HS volume 2021-04-21 08:54:10 +00:00
Huang-Huang Bao
edee633f96
bluez5: add property to enable hardware volume control 2021-04-17 19:35:46 +08:00
Huang-Huang Bao
387f7e327f
bluez5: add support for HSP/HFP hardware volume control
Only native backend is fulfilled.
2021-04-17 19:07:35 +08:00
Pauli Virtanen
277a9a2577 bluez5: retry initial HFP codec selection after a timeout
In case headset fails to reply with AT+BCS to the codec selection
following AT+CMER, try to retry the codec selection, and if it still
fails, assume the headset is configured for CVSD.
2021-04-11 16:34:33 +00:00
Pauli Virtanen
87e06783d1 bluez5: more cleanup on impl_clear
Remove dbus filters and close the dbus connection.  Closing the
connection lets BlueZ to clean up, so we don't call its unregistration
API.
2021-04-10 23:07:51 +03:00
Pauli Virtanen
87aa18edb1 bluez5: free rfcomm when device is freed
Avoids use-after-free if device gets freed before the corresponding
rfcomm.
2021-04-10 15:47:46 +00:00
Pauli Virtanen
026e3882d2 bluez5: remove battery when RFCOMM connection drops
There won't be further battery level updates when RFCOMM connection is
down, so remove the battery then.

Fix minor things with canceling the provider registration.
2021-04-05 15:04:16 +00:00
Dmitry Sharshakov
e3f344b3fa bluez5/native: send correct AT+CMER HFP HF command
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2021-04-01 19:12:49 +03:00
Pauli Virtanen
f330446291 bluez5: better error/malformed input handling
Safer parsing of AT commands, additional null and error checks.
2021-03-27 14:38:31 +00:00
Huang-Huang Bao
34c9f24d2a bluez5: autoconnect device profiles on startup
Auto-connect all paired & trusted devices on startup.
Since devices that already connected or powering off would reject the connecting requests, it should be fine with this behavior.
Also reconnect remaining profiles if only partial profiles are connected.
2021-03-26 14:15:55 +00:00
Wim Taymans
ee99693f77 bluez5: check for NULL info before accessing it 2021-03-25 17:38:45 +01:00
Huang-Huang Bao
d439b7cdd7 bluez5: retry sco connect if it got aborted by ECONNABORTED
When I enforing HFP codec switching between HFP profiles, it has a chance of being aborted by ECONNABORTED. Seems a retry is sufficient for work around it.
2021-03-22 10:53:16 +00:00
Pauli Virtanen
79e098bdf2 bluez5: implement HFP codec switching
Implement switching HFP codecs in bluez5-devices, currently only for
backend-native.

Codecs are exposed via profiles similarly as for A2DP.

Some hardware appears to not properly reply to the +BCS message. Catch
these cases with a timeout, in which case we fall back to previously
existing transports.
2021-03-20 20:01:52 +00:00
Pauli Virtanen
e18df4e344 bluez5: use callback table in hsp/hfp backends 2021-03-20 20:01:52 +00:00
George Kiagiadakis
f9b39191c4 bluez: backend-native: advertise transport state for incoming connections
Incoming connections only happen when the remote end is an AG.
Advertising the state allows the device to dynamically create nodes
for such connections.
2021-03-19 11:49:41 +00:00
Björn Daase
5913eb098c treewide: fix issues found by codespell 2021-03-16 19:11:25 +00:00
Huang-Huang Bao
374180e211 bluez5: pass per-device settings to codec handler, make 'bluez5.sbc-xq-support' a per-device setting 2021-03-16 10:31:08 +00:00
Huang-Huang Bao
d6be84ddd0
bluez5: close sco socket if bluetooth daemon disappeared
Fixes pipewire/pipewire#853
2021-03-13 19:06:49 +08: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
0078b3b73e backend-native: get battery status via HFP 2021-03-12 15:45:41 +00: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
Pauli Virtanen
302282ef59 bluez5: set channel information for hfp/hsp transports
Fixes volume problems.
2021-03-02 22:20:44 +02: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
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
63a3811aa7 fix some warnings 2021-02-18 12:42:06 +01: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
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
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
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
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
Pauli Virtanen
e860f2bb4e bluez5: basic codec-switching framework 2021-02-02 09:56:29 +00:00
Huang-Huang
b9f2e6a8c4
bluez5: disable HSP AG by default in native backend 2021-02-01 03:39:49 +08:00
Huang-Huang
f6cc45f736 bluez5: allow headset roles selecting 2021-01-31 18:12:07 +00:00
Huang-Huang
b66e67db14
bluez5: unregister HSP dbus object paths when current HSP/HFP registration fails 2021-02-01 00:01:23 +08:00
Frédéric Danis
f464d8c596 bluez5: Fix NULL dereference in backend-native
Fixes: #602
2021-01-22 15:28:21 +00:00
Frédéric Danis
1b10bee6f8 bluez5: Fix double free in backend-native
This occurs when exiting `pipewire-media-session` with a headset connected.

Fixes !395
2021-01-14 15:16:31 +01:00
Frédéric Danis
514836eebe bluez5: Create spa_bt_transport when codec has been negotiated
This waits for codec negotiation completion, i.e. on `SLC` completion if
codec negotiation is not supported or on `AT+BCS` reception if codec
negotiation is supported, before creating the `spa_bt_transport`
2021-01-13 17:35:57 +01:00
Sebastian Apel
8ac5a89583 bluez5: Added mSBC support in bluze5 backend native, including check to make sure the computer's bluetooth adapter
supports the transport modes required for mSBC
2021-01-13 11:20:22 +01:00
Frédéric Danis
7bd86df6df bluez5: Add simple HFP AG support to backend-native 2021-01-12 11:21:55 +01:00
Frédéric Danis
677f122f1d bluez5: Split RFComm from spa_bt_transport
RFComm channel should not be part of the spa_bt_transport as this one may
change during HFP connection.
2021-01-12 11:21:55 +01:00
Frédéric Danis
00cce32514 bluez5: Rename backend-hsp-native to backend-native 2021-01-12 11:21:55 +01:00
Renamed from spa/plugins/bluez5/backend-hsp-native.c (Browse further)