Commit Graph

390 Commits

Author SHA1 Message Date
Peter Hurley
84f4d71d7d Fix get/set_hfp_active to match name conventions
These two functions are defined exclusively for headsets, so
follow established name conventions.
2011-08-22 11:04:24 +03:00
Peter Hurley
f9dddf3f41 Increase timeout before initiating AVDTP connection
AVDTP_CONNECT_TIMEOUT controls the delay between HSP/HFP
connection establishment and AVDTP signal channel establishment.
The original value of 1 sec. is too short to avoid racing for AVDTP
connection establishment (eg., if the device continues to configure
the HFP service level connection with additional AT cmds).

Some devices have broken AVDTP implementations that just cannot
handle the race conditions that arise if both devices are attempting
stream establishment at the same time. However, these conditions arise
only when the remote device is the ACL initiator (and in practice, the
RFCOMM initiator as well).  This fix bumps out the timeout value only
when the headset has initiated the link.
2011-08-22 10:49:02 +03:00
Luiz Augusto von Dentz
8306448148 Make use of g_slist_free_full on audio plugin 2011-06-30 14:38:59 +03:00
Luiz Augusto von Dentz
9c6e404f93 Mark Headset.Play method deprecated
SCO socket should be connected using either unix socket ipc or Media API
2011-06-30 11:11:02 +03:00
Slawomir Bochenski
f8e0916e2d Remove unnecessary jumps 2011-06-01 14:41:01 +03:00
Szymon Janc
6dc1643c76 Disconnect headset when not able to reply with ERROR command 2011-05-15 01:47:10 +03:00
Szymon Janc
50f0671290 Fix callbacks numbering in connect_cb_new from audio/headset.c 2011-05-15 01:47:10 +03:00
Johan Hedberg
36cd74bfa7 Fix format string warnings 2011-04-27 18:00:08 -07:00
Johan Hedberg
407e977f8d Add format string warnings to printf-style functions 2011-04-27 18:00:02 -07:00
Marcel Holtmann
c6d0464321 Accept Apple specific headset commands 2011-04-27 17:24:11 -07:00
Luiz Augusto von Dentz
c28669fd69 Fix not waiting for POLLERR when disconnecting SCO
To make sure the SCO link is really disconnected we should wait for
POLLERR since POLLHUP does not necessarily means the link is
completely disconnected just that no further data can be sent/received.

Note that this depend on a fix of SCO socket shutdown in kernel to wait
for disconnect confimation to then kill/destroy the socket indicating
the err/reason using POLLERR.
2011-04-19 15:29:42 +03:00
Dmitriy Paliy
304b588b02 Add NO CARRIER response to HFP
HFP is updated by NO CARRIER response accordingly to HFP 1.5 p.68.
2011-04-18 10:48:11 +03:00
Daniel Orstadius
fad9257588 Fix check for valid SCO socket before shutdown
To prevent a crash in the event that there is a request to remove
the audio connection when it has already been disconnected by the
remote.

Set headset state to connected directly if there is no SCO socket.
2011-04-04 19:47:23 -07:00
Luiz Augusto von Dentz
d3f69537a4 Wait SCO socket to HUP before changing state
In situations where application wants to switch profiles e.g HFP to A2DP
it normally needs to wait SCO to be disconnected to resume A2DP due to
resource limitations on headset.

There seems to be an issue in the kernel side which prevent this to work
properly, apparently shutdown does not wait the link to be disconnected,
but it is under investigation.
2011-03-25 11:10:53 +02:00
Dmitriy Paliy
f05cb9d298 Fix bluetoothd exit on badly formated AT+VTS
This fixes bluetoothd exit when AT+VTS command is badly formatted,
e.g. as AT+VTS\xfe\xfe[...]=1

Verification it done for the numeric value to be larger than 0x23,
that corresponds to the hash '#', and to be lower than 0x44, that
corresponds to 'D', such that the tone is in {0-9, *, #, A, B, C, D}.
2011-02-09 14:00:55 -08:00
Johan Hedberg
f041125427 Update NREC callback code to originally intended v2 state 2011-01-19 22:20:41 +05:30
Luiz Augusto von Dentz
170b5be8f8 Add proper tracking mechanism to NREC
NREC may change during the connections so it has to be tracked in order
to signal changes to applications.
2011-01-19 20:50:29 +05:30
Luiz Augusto von Dentz
4aecf0a27c Fix use of deprecated glib on audio plugin 2011-01-19 13:52:53 +02:00
Luiz Augusto von Dentz
dfb9ee3585 Fix printing D-Bus errors when headset record could not be found
When connection is started via headset_config_stream there is no D-Bus
message to reply to.
2010-12-27 17:06:35 +02:00
Gustavo F. Padovan
fdafb86ff0 Convert more D-Bus errors to btd_error_* 2010-12-16 21:45:43 +02:00
Gustavo F. Padovan
9f7a7d39ac Add btd_error_not_ready() 2010-12-16 21:45:43 +02:00
Luiz Augusto von Dentz
b7d758fee8 Fix sending duplicate speaker/microphone gains to the headset
Current code only prevent duplicate D-Bus signals, so in case headset
changes the volume a client may set the same volume level again which
would be send as new volume level.

To fix this headset_set_gain now return -EALREADY if nothing has changed
so code using it can just ignore the change instead of sending to remote
device.
2010-12-16 16:32:34 +02:00
Gustavo F. Padovan
90ae9ec320 Remove error_common_reply()
Remove old dbus error report function. This patch doesn't make things
really really better, but is a start.
2010-12-16 11:27:43 +02:00
Gustavo F. Padovan
2af3d4bbf9 audio: use btd_error_failed() 2010-12-14 10:31:22 +02:00
Johan Hedberg
848ddcfe70 Fix potential memory leak of ag.number 2010-12-13 14:08:02 +02:00
Johan Hedberg
401be37487 Fix cleaning up HFP state after calling telephony_exit
HFP state variables in telephony.h need to be reset when telephony_exit
is called. This is even more important now that telephony_init/exit get
called simply by toggling the adapter powered state.
2010-12-12 23:06:16 +02:00
Johan Hedberg
1180011b81 Don't strdup the chld string for HFP
The chld string is of type const char * and is referring to a fixed
string in the telephony driver. I.e. there's no need to strdup it.
2010-12-12 23:06:16 +02:00
Johan Hedberg
b0d302d489 Fix HFP response and hold (AT+BTRH) command response
Since no telephony driver supports this command at the moment the
correct behavior is to always return an error. Therefore, a new
"not supported" value is needed for the respective state variable.
2010-12-09 15:14:26 +02:00
Gustavo F. Padovan
0d39f2db3c Add btd_error_already_connected() 2010-12-08 22:54:58 +02:00
Gustavo F. Padovan
27fffa4aad Add btd_error_busy() 2010-12-07 23:11:10 +02:00
Gustavo F. Padovan
cd5f44488f Add btd_error_not_available() 2010-12-07 23:10:30 +02:00
Gustavo F. Padovan
bd3cf4860d Add btd_error_in_progress() 2010-12-07 23:08:58 +02:00
Gustavo F. Padovan
64dc6dbbf3 Add btd_error_not_connected() 2010-12-07 23:08:14 +02:00
Gustavo F. Padovan
696c18c48f Create btd_error_invalid_args()
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.
2010-12-07 22:58:32 +02:00
Johan Hedberg
20ccc578c8 Remove unused includes 2010-11-28 13:41:35 +02:00
Johan Hedberg
cf0e128d6f Set initial HFP/HSP mic and speaker gain values to max instead of min
To avoid the issue of applications thinking that the headset is muted if
it hasn't sent any update for the gain values it's better to initialize
them to the maximum (15) instead of the minimum (0).
2010-10-15 10:53:54 +03:00
Radoslaw Jablonski
1dacc118c8 Fix headset disconnecting via device disconnect
Headsets for proper disconnecting need to disconnect profiles in specified
order(by ex. disconnect a2dp, then sink and hfp at the end). Instead of
adding separate callbacks for disconnecting each profile, now adding only
one callback in audio/device.c for calling audio disconnect functions in
correct order. New disconnect callback works similarly to dev_disconnect
from audio/device.c
2010-09-28 10:41:02 +03:00
Luiz Augusto von Dentz
ad28681367 Introduce headset_get_inband 2010-09-15 15:22:06 +03:00
Dmitriy Paliy
1e335a631b Add fast connectable support to HFP
Audio.conf is updated to support fast connectable mode. Set
FastConnectable to true to enable and to false to disable. Headset
initialization and call indicators are updated respectively. It is
disabled by default.
2010-08-18 13:46:03 +03:00
Luiz Augusto von Dentz
139eb67d43 Add headset_set_gain to eliminate duplicate code 2010-05-27 15:23:03 +03:00
Luiz Augusto von Dentz
c50c5af698 Fix not emitting PropertyChanged for SpeakerGain/MicrophoneGain
Currently only the deprecated SpeakerGainChanged/MicrophoneGainChanged are
being emitted when some application set then locally.
2010-05-27 15:23:03 +03:00
Luiz Augusto von Dentz
23b5af1358 Use DBG instead of debug for more verbose output 2010-05-27 15:23:03 +03:00
Luiz Augusto von Dentz
ee23600edd Fix redundant speaker/microphone gains being sent
Both D-Bus signals and +VG command are being sent without checking if their
values have really changed, this is similar to ignore redundant option used
in telephony indicators so we don't disturb the connections with redundant
information.
2010-05-25 11:21:46 +03:00
Gustavo F. Padovan
8e58667ef0 Move debug() to DBG()
Use the new dynamic debug feature
2010-05-21 18:21:48 +02:00
Gustavo F. Padovan
e891f7df62 Move logging.{c,h} to log.{c,h}
Try to make log stuff more similar to ConnMan and oFono.
2010-05-21 14:40:36 +02:00
Johan Hedberg
23f75004d8 Fix invalid memory access in headset_get_nrec when hs->slc is NULL
headset_get_nrec might get called when there's no SLC and it should
return the default NREC value in that case which is TRUE.
2010-04-02 22:41:53 +03:00
Luiz Augusto Von Dentz
37ba10ff87 Use correct sign for error value 2010-03-22 13:10:37 +02:00
Johan Hedberg
fa2686f9bf Fix SCO connection error propagation 2010-03-22 13:07:23 +02:00
Luiz Augusto Von Dentz
8e01fb1560 Fix using invalid data from previous headset connection
Data from previous connection should be reset once disconnected, to fix
this a new structure is introduced called headset_slc which represents
the Service Level Connection and hold the connection data which is freed
when disconnected.
2010-03-04 16:16:15 -04:00
Peter Zotov
0218ab79ea Add preliminary voice dialling support for HSP 2010-01-15 08:53:44 +02:00