| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
If the gateway is already connected (or connecting) when Connect() is
called, an error should be returned, exactly as other interfaces do.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RFCOMM and SCO watches need to be removed in gateway_close(), otherwise
the watch callbacks might get called later on, resulting in a second
call to gateway_close().
The issue can be easily reproduced if a device is removed (unpaired) a
device while HFP gateway is connected:
bluetoothd[26579]: audio/gateway.c:path_unregister() Unregistered interface org.bluez.HandsfreeGateway on path /org/bluez/26579/hci0/dev_90_84_0D_B2_C7_04
bluetoothd[26579]: audio/media.c:gateway_state_changed()
bluetoothd[26579]: audio/media.c:gateway_state_changed() Clear endpoint 0x555555822cb0
bluetoothd[26579]: audio/source.c:path_unregister() Unregistered interface org.bluez.AudioSource on path /org/bluez/26579/hci0/dev_90_84_0D_B2_C7_04
bluetoothd[26579]: audio/avdtp.c:avdtp_unref() 0x555555827980: ref=2
bluetoothd[26579]: src/device.c:btd_device_unref() 0x55555581a470: ref=1
bluetoothd[26579]: src/device.c:btd_device_unref() 0x55555581a470: ref=0
bluetoothd[26579]: src/device.c:device_free() 0x55555581a470
Program received signal SIGSEGV, Segmentation fault.
gateway_close (device=0x555555820390) at audio/gateway.c:585
585 if (gw->rfcomm) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Any pending call to the agent needs to be cancelled in gateway_close(),
to make sure newconnection_reply() never gets called.
Otherwise, the audio gateway can be closed (dev->gateway == NULL) before
the reply from the agent has been received, resulting in the following
crash as reproduced while removing (unpairing) a device:
bluetoothd[2219]: src/mgmt.c:mgmt_unpair_device() index 0 addr 38:16:D1:C5:D1:A2
bluetoothd[2219]: audio/gateway.c:path_unregister() Unregistered interface org.bluez.HandsfreeGateway on path /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: audio/media.c:gateway_state_changed()
bluetoothd[2219]: audio/media.c:gateway_state_changed() Clear endpoint 0x555555820640
bluetoothd[2219]: audio/source.c:path_unregister() Unregistered interface org.bluez.AudioSource on path /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: src/device.c:btd_device_unref() 0x555555833e70: ref=1
bluetoothd[2219]: src/adapter.c:adapter_get_device() 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/adapter.c:adapter_create_device() 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/device.c:device_create() Creating device /org/bluez/2219/hci0/dev_38_16_D1_C5_D1_A2
bluetoothd[2219]: src/device.c:device_free() 0x55555581f9c0
bluetoothd[2219]: Unable to get btd_device object for 38:16:D1:C5:D1:A2
bluetoothd[2219]: src/device.c:btd_device_unref() 0x555555833e70: ref=0
bluetoothd[2219]: src/device.c:device_free() 0x555555833e70
bluetoothd[2219]: src/mgmt.c:mgmt_event() cond 1
bluetoothd[2219]: src/mgmt.c:mgmt_event() Received 16 bytes from management socket
bluetoothd[2219]: src/mgmt.c:mgmt_cmd_complete()
bluetoothd[2219]: src/mgmt.c:mgmt_cmd_complete() unpair_device complete
Program received signal SIGSEGV, Segmentation fault.
0x000055555556fa26 in newconnection_reply (call=<optimized out>, data=0x555555824dd0) at audio/gateway.c:285
285 if (!dev->gateway->rfcomm) {
Additionally, this patch makes it unnecessary to check if RFCOMM got
disconnected before newconnection_reply, since RFCOMM disconnection also
triggers gateway_close() and thus the agent's call will be cancelled.
|
|
|
|
|
|
|
|
|
| |
This patch removes redundant references and function parameters for
DBusConnection object and uses btd_get_dbus_connection() call wherever
such object is needed instead.
Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.
|
|
|
|
|
| |
Valid DBusConnection pointer is available static variable 'connection'
so it's it's redundant to pass it as function parameter.
|
|
|
|
| |
Expose the state of the gateway interface in the internal API.
|
|
|
|
|
| |
gateway_request_stream() should check if the call to get_records() has
succeeded, and fail otherwise.
|
|
|
|
|
|
|
|
| |
If bt_search_service() fails the state should be left unchanged.
Otherwise the gateway state is set forever to GATEWAY_STATE_CONNECTING.
This issue can be easily reproduced if a connection attempt is done
very soon after startup.
|
|
|
|
|
| |
gateway_config_stream() is now unnecessary after the removal of the unix
socket support in commit 1d9d0527cfb6d96a976ede56bd43a2bc16bb5f21.
|
| |
|
|
|
|
|
|
|
| |
Since commit c89b589a586e97ad875fbdd1d41f03979157ebb0, D-Bus >= 1.4.0 is
required. This version already contains Unix FD passing support,
therefore code that checks for DBUS_TYPE_UNIX_FD definition is
unnecessary.
|
|
|
|
|
| |
Use GDBUS_* macros, so signature and reply fields are not set in each
method/signal.
|
|
|
|
|
| |
With these macro helpers we can separate in/out arguments and use their
own vector.
|
|
|
|
|
|
|
| |
Constify signal tables with the following command:
find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
|
|
|
|
|
|
|
| |
Constify method tables with the following command:
find . -name '*.[ch]' -exec \
sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
|
| |
|
|
|
|
|
| |
Re-arrange the code to avoid the D-Bus memory leak. Earlier if rfcomm
is not connected, then there was a reply memory leak.
|
| |
|
|
|
|
|
|
|
| |
In some situations, a connect callback is created, but
this callback is not added to media_owner. Thus when the owner
is destroyed and at rfcomm disconnect, the callback is executed
with an invalid pointer.
|
|
|
|
|
|
| |
Failure on BlueZ-initiated SCO requests should not drop the RFCOMM
connection to the gateway. Instead, considering the stream as suspended
should be enough.
|
|
|
|
|
|
| |
The users of btio should not expect that btio will set the security
level to medium if it wasn't specified. Now, all the users specfify
the security level needed.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
In case of incoming RFCOMM connection, manager calls
gateway_connect_rfcomm which already take reference to GIOChannel, hence
no need to take another one.
|
|
|
|
|
|
|
| |
Make sure that state changes to disconnected on errors (authorization
refused, disconnect, sdp) This change will become necessary when
integrating the Audio interface which rely on state change to confirm
that connection has started successfully.
|
| |
|
|
|
|
|
| |
Cancel pending callback if stream is canceled Asynchronously run
gateway_config_stream cb Remove occurences of sco_start_cb
|
|
|
|
| |
If RFCOMM disconnects, SCO should be disconnected too.
|
| |
|
|
|
|
| |
This state is used by media.c to trigger pulseaudio configuration.
|
|
|
|
|
| |
When pulseaudio release an audio stream, gateway.c disconnects
RFCOMM instead of disconnecting only SCO.
|
|
|
|
| |
Media interface needs to monitor state changes of HandsfreeGateway.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some phones with HFP Audio Gateway version previous to 1.5 (e.g.
Samsung SGH-D600 returning 0x0101 as profile version) do not accept an
AT+BRSF with latest features. The Handsfree agent should adapt its
AT+BRSF command depending on the remote version, so add version
information as parameter of NewConnection method.
Here is traces of buggy exchange:
< ACL data: handle 12 flags 0x02 dlen 20
L2CAP(d): cid 0x0046 len 16 [psm 3]
RFCOMM(d): UIH: cr 1 dlci 10 pf 0 ilen 12 fcs 0xb0
0000: 41 54 2b 42 52 53 46 3d 31 31 38 0d AT+BRSF=118.
> ACL data: handle 12 flags 0x02 dlen 18
L2CAP(d): cid 0x0041 len 14 [psm 3]
RFCOMM(d): UIH: cr 0 dlci 10 pf 1 ilen 9 fcs 0x76 credits 1
0000: 0d 0a 45 52 52 4f 52 0d 0a ..ERROR..
< ACL data: handle 12 flags 0x02 dlen 8
L2CAP(d): cid 0x0046 len 4 [psm 3]
RFCOMM(s): DISC: cr 1 dlci 10 pf 1 ilen 0 fcs 0x6d
and after the fix (and corresponding fix in oFono):
< ACL data: handle 12 flags 0x02 dlen 19
L2CAP(d): cid 0x0048 len 15 [psm 3]
RFCOMM(d): UIH: cr 1 dlci 10 pf 0 ilen 11 fcs 0xb0
0000: 41 54 2b 42 52 53 46 3d 32 32 0d AT+BRSF=22.
> ACL data: handle 12 flags 0x02 dlen 28
L2CAP(d): cid 0x0041 len 24 [psm 3]
RFCOMM(d): UIH: cr 0 dlci 10 pf 1 ilen 19 fcs 0x76 credits 1
0000: 0d 0a 2b 42 52 53 46 3a 20 33 33 0d 0a 0d 0a 4f ..+BRSF: 33....O
0010: 4b 0d 0a K..
< ACL data: handle 12 flags 0x02 dlen 18
L2CAP(d): cid 0x0048 len 14 [psm 3]
RFCOMM(d): UIH: cr 1 dlci 10 pf 0 ilen 10 fcs 0xb0
0000: 41 54 2b 43 49 4e 44 3d 3f 0d AT+CIND=?.
|
|
|
|
|
| |
When gateway_suspend_stream is called it should change the
gateway state machine from PLAYING to CONNECTED.
|
| |
|
|
|
|
|
| |
Remove old dbus error report function. This patch doesn't make things
really really better, but is a start.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
DBus error handling in BlueZ is a mess. This is the first patch to unify
all DBus error handling like in ConnMan and oFono. This unifies all
.InvalidArguments errors.
|
| |
|
| |
|