summaryrefslogtreecommitdiffstats
path: root/audio/pcm_bluetooth.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-01-30 11:44:57 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2008-01-30 11:44:57 +0000
commit9fa2613525721908ec43189794fe99828b8a4f51 (patch)
treee464dd48a5565bab81b230ffbf7a2fd20a03ee1e /audio/pcm_bluetooth.c
parent4b8bfb24c7666cb0b6eb26abe9a7d5072e3f9c4e (diff)
Add autoconnect config option to IPC and alsa
Diffstat (limited to 'audio/pcm_bluetooth.c')
-rw-r--r--audio/pcm_bluetooth.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index a04f18c0..e8a524c8 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -122,6 +122,7 @@ struct bluetooth_alsa_config {
int has_block_length;
uint8_t bitpool; /* A2DP only */
int has_bitpool;
+ int autoconnect;
};
struct bluetooth_data {
@@ -1268,11 +1269,14 @@ static int bluetooth_parse_config(snd_config_t *conf,
struct bluetooth_alsa_config *bt_config)
{
snd_config_iterator_t i, next;
- const char *addr, *pref;
+ const char *addr, *pref, *autoconnect;
const char *mode, *allocation, *rate, *subbands, *blocks, *bitpool;
memset(bt_config, 0, sizeof(struct bluetooth_alsa_config));
+ /* Set defaults */
+ bt_config->autoconnect = 1;
+
snd_config_for_each(i, next, conf) {
snd_config_t *n = snd_config_iterator_entry(i);
const char *id;
@@ -1283,6 +1287,17 @@ static int bluetooth_parse_config(snd_config_t *conf,
if (strcmp(id, "comment") == 0 || strcmp(id, "type") == 0)
continue;
+ if (strcmp(id, "autoconnect") == 0) {
+ if (snd_config_get_string(n, &autoconnect) < 0) {
+ SNDERR("Invalid type for %s", id);
+ return -EINVAL;
+ }
+
+ if (strcmp(autoconnect, "no") == 0)
+ bt_config->autoconnect = 0;
+ continue;
+ }
+
if (strcmp(id, "device") == 0 || strcmp(id, "bdaddr") == 0) {
if (snd_config_get_string(n, &addr) < 0) {
SNDERR("Invalid type for %s", id);
@@ -1514,6 +1529,9 @@ static int bluetooth_init(struct bluetooth_data *data, snd_pcm_stream_t stream,
memset(getcaps_req, 0, BT_AUDIO_IPC_PACKET_SIZE);
getcaps_req->h.msg_type = BT_GETCAPABILITIES_REQ;
+ getcaps_req->flags = 0;
+ if (alsa_conf->autoconnect)
+ getcaps_req->flags |= BT_FLAG_AUTOCONNECT;
strncpy(getcaps_req->device, alsa_conf->device, 18);
if (alsa_conf->has_transport)
getcaps_req->transport = alsa_conf->transport;