summaryrefslogtreecommitdiff
path: root/audio/gateway.c
Commit message (Collapse)AuthorAgeFilesLines
* audio: Fix missing gateway state check on ConnectMikel Astiz2012-10-021-0/+5
| | | | | If the gateway is already connected (or connecting) when Connect() is called, an error should be returned, exactly as other interfaces do.
* audio: Fix crash on gateway close while connectedMikel Astiz2012-10-021-6/+27
| | | | | | | | | | | | | | | | | | | | | | 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) {
* audio: Fix crash if gateway closed before replyMikel Astiz2012-10-021-8/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* audio: Simplify DBusConnection object handlingAndrzej Kaczmarek2012-09-211-11/+9
| | | | | | | | | 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.
* dbus-common: Remove conn parameter from emit_property_changedAndrzej Kaczmarek2012-09-211-3/+3
| | | | | Valid DBusConnection pointer is available static variable 'connection' so it's it's redundant to pass it as function parameter.
* media: Add gateway_get_state() to internal APIMikel Astiz2012-09-141-0/+7
| | | | Expose the state of the gateway interface in the internal API.
* audio: Handle error in gateway_request_stream()Mikel Astiz2012-09-041-3/+4
| | | | | gateway_request_stream() should check if the call to get_records() has succeeded, and fail otherwise.
* audio: Fix gateway in connecting state foreverMikel Astiz2012-09-041-3/+10
| | | | | | | | 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.
* audio: Remove unused functionMikel Astiz2012-09-041-16/+0
| | | | | gateway_config_stream() is now unnecessary after the removal of the unix socket support in commit 1d9d0527cfb6d96a976ede56bd43a2bc16bb5f21.
* Update code base to use the new BtIO APIJohan Hedberg2012-08-281-2/+2
|
* Remove compatibility check for DBUS_TYPE_UNIX_FDAnderson Lizardo2012-05-311-7/+0
| | | | | | | 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.
* Do not set signature and reply in GDBus tablesLucas De Marchi2012-05-171-6/+6
| | | | | Use GDBUS_* macros, so signature and reply fields are not set in each method/signal.
* Convert GDBus methods to use macro helpersLucas De Marchi2012-05-171-8/+13
| | | | | With these macro helpers we can separate in/out arguments and use their own vector.
* Constify GDBus signal tablesLucas De Marchi2012-05-171-1/+1
| | | | | | | Constify signal tables with the following command: find . -name '*.[ch]' -exec \ sed -i 's/\(GDBusSignalTable .* =\)/const \1/g' {} \;
* Constify GDBus method tablesLucas De Marchi2012-05-171-1/+1
| | | | | | | Constify method tables with the following command: find . -name '*.[ch]' -exec \ sed -i 's/\(GDBusMethodTable .* =\)/const \1/g' {} \;
* build: Remove glib-compat.h supportMarcel Holtmann2012-04-161-1/+0
|
* gateway: Fix D-Bus reply memory leakSyam Sidhardhan2012-04-131-3/+3
| | | | | Re-arrange the code to avoid the D-Bus memory leak. Earlier if rfcomm is not connected, then there was a reply memory leak.
* gateway: Fix D-Bus memory leak in audioSyam Sidhardhan2012-04-131-1/+4
|
* gateway: Fix crash if SCO connection failsFrédéric Dalleau2012-03-081-4/+1
| | | | | | | 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.
* audio: do not disconnect on gateway SCO failureMikel Astiz2012-02-141-1/+1
| | | | | | Failure on BlueZ-initiated SCO requests should not drop the RFCOMM connection to the gateway. Instead, considering the stream as suspended should be enough.
* btio: Fix users to not expect a default security levelVinicius Costa Gomes2012-01-241-0/+2
| | | | | | 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.
* Move SDP client functions from glib-helper.c to sdp-client.cJohan Hedberg2011-10-181-1/+1
|
* Add glib-compat.h to deal with issues in old GLib versionsJohan Hedberg2011-10-181-0/+1
|
* Fix Unref message after it was sentFrédéric Danis2011-10-021-0/+1
|
* Minor style fixFrédéric Dalleau2011-09-241-1/+0
|
* Remove unneeded checks in gateway_is_connectedFrédéric Dalleau2011-09-241-2/+6
|
* Check all states before allowing gw connectionFrédéric Dalleau2011-09-241-0/+10
|
* Fix reference count issue in incoming connectionsFrédéric Dalleau2011-09-221-1/+2
| | | | | | In case of incoming RFCOMM connection, manager calls gateway_connect_rfcomm which already take reference to GIOChannel, hence no need to take another one.
* Set state to "connecting" on connection requestedFrédéric Dalleau2011-09-221-10/+19
| | | | | | | 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.
* Fix state to "playing" on SCO establishmentFrédéric Dalleau2011-09-221-0/+1
|
* Fix asynchronously run request stream cbFrédéric Dalleau2011-09-221-42/+106
| | | | | Cancel pending callback if stream is canceled Asynchronously run gateway_config_stream cb Remove occurences of sco_start_cb
* Fix disconnect SCO at same time than RFCOMMFrédéric Dalleau2011-09-221-6/+1
| | | | If RFCOMM disconnects, SCO should be disconnected too.
* Introduce gateway locking mechanismFrédéric Dalleau2011-08-241-0/+38
|
* Set state to "connecting" when AG connects.Frédéric Dalleau2011-08-241-0/+2
| | | | This state is used by media.c to trigger pulseaudio configuration.
* Fix RFCOMM disconnect on suspend requestFrédéric Dalleau2011-08-241-1/+1
| | | | | When pulseaudio release an audio stream, gateway.c disconnects RFCOMM instead of disconnecting only SCO.
* Add state change callback to HandsfreeGatewayFrédéric Dalleau2011-08-241-0/+61
| | | | Media interface needs to monitor state changes of HandsfreeGateway.
* Minor style fix in audio/gateway.cFrédéric Dalleau2011-08-051-9/+6
|
* Add watch for RFCOMM disconnect to HFP HF roleFrédéric Dalleau2011-08-051-0/+19
|
* audio: add profile version to HandsfreeAgentFrédéric Danis2011-08-041-1/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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=?.
* hfp: gateway_suspend_stream should trigger a state changeDaniel Wagner2011-02-111-0/+1
| | | | | When gateway_suspend_stream is called it should change the gateway state machine from PLAYING to CONNECTED.
* Add btd_error_agent_not_available()Gustavo F. Padovan2010-12-161-2/+1
|
* Remove error_common_reply()Gustavo F. Padovan2010-12-161-8/+10
| | | | | Remove old dbus error report function. This patch doesn't make things really really better, but is a start.
* audio: use btd_error_failed()Gustavo F. Padovan2010-12-141-6/+5
|
* convert errors to btd_error_does_not_exist()Gustavo F. Padovan2010-12-081-3/+1
|
* convert errors to btd_error_not_authorized()Gustavo F. Padovan2010-12-081-2/+1
|
* Add btd_error_not_connected()Gustavo F. Padovan2010-12-071-3/+1
|
* Add btd_error_already_exists()Gustavo F. Padovan2010-12-071-3/+1
|
* Create btd_error_invalid_args()Gustavo F. Padovan2010-12-071-6/+2
| | | | | | 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.
* Remove unused includesJohan Hedberg2010-11-281-3/+0
|
* audio: fix leak on gatewayGustavo F. Padovan2010-06-081-1/+14
|