diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2013-04-15 10:54:52 -0300 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2013-04-15 07:07:23 -0500 |
commit | 12df4fca9440e49b60f2b66352cc2cc6b07fa2b1 (patch) | |
tree | 747b2e402febd03487c50b14ca5eb50619379cff /src/handsfree-audio.c | |
parent | f65070b3779013656d03ed74f8d176489da53537 (diff) | |
download | ofono-12df4fca9440e49b60f2b66352cc2cc6b07fa2b1.tar.gz |
handsfree-audio: Keep track whether defer_setup is enabled
'defer_setup' will be one of the inputs when enabling or disabling
support for wideband speech codecs, we will only enable wideband
speech support if the kernel supports deferred setup.
So, we have to have this information available, in this case it means
a global variable.
Diffstat (limited to 'src/handsfree-audio.c')
-rw-r--r-- | src/handsfree-audio.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c index 7f5b33cb..fc3d15b4 100644 --- a/src/handsfree-audio.c +++ b/src/handsfree-audio.c @@ -66,6 +66,7 @@ static GSList *card_list = 0; static guint sco_watch = 0; static GSList *drivers = 0; static ofono_bool_t has_wideband = FALSE; +static int defer_setup = 1; static void send_new_connection(const char *card, int fd, uint8_t codec) { @@ -159,7 +160,7 @@ static int sco_init(void) { GIOChannel *sco_io; struct sockaddr_sco saddr; - int sk, defer_setup = 1; + int sk; sk = socket(PF_BLUETOOTH, SOCK_SEQPACKET | O_NONBLOCK | SOCK_CLOEXEC, BTPROTO_SCO); @@ -177,9 +178,11 @@ static int sco_init(void) } if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP, - &defer_setup, sizeof(defer_setup)) < 0) + &defer_setup, sizeof(defer_setup)) < 0) { + defer_setup = 0; ofono_warn("Can't enable deferred setup: %s (%d)", strerror(errno), errno); + } if (listen(sk, 5) < 0) { close(sk); |