diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-24 02:10:02 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-24 02:10:02 +0200 |
commit | 1876483852eae481acd1e060131d011519200ddf (patch) | |
tree | 2e3758532194bb1c6173354ce960fa6c1a55e5bd /plugins | |
parent | 22ee00198a6cb9bb7277ebc8a244763e7f4d1430 (diff) | |
download | bluez-1876483852eae481acd1e060131d011519200ddf.tar.gz bluez-1876483852eae481acd1e060131d011519200ddf.tar.xz bluez-1876483852eae481acd1e060131d011519200ddf.zip |
mgmtops: Move power on after UUID additions
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mgmtops.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/plugins/mgmtops.c b/plugins/mgmtops.c index ff5ee3e7..e9c6f0b1 100644 --- a/plugins/mgmtops.c +++ b/plugins/mgmtops.c @@ -76,6 +76,8 @@ static struct controller_info { gboolean pending_class; uint8_t major; uint8_t minor; + + gboolean pending_powered; } *controllers = NULL; static int mgmt_sock = -1; @@ -953,7 +955,20 @@ static void read_index_list_complete(int sk, void *buf, size_t len) static int mgmt_set_powered(int index, gboolean powered) { - DBG("index %d powered %d", index, powered); + struct controller_info *info = &controllers[index]; + + DBG("index %d powered %d pending_uuid %u", index, powered, + info->pending_uuid); + + if (powered) { + if (info->pending_uuid) { + info->pending_powered = TRUE; + return 0; + } + } else { + info->pending_powered = FALSE; + } + return mgmt_set_mode(index, MGMT_OP_SET_POWERED, powered); } @@ -1242,6 +1257,11 @@ static void mgmt_add_uuid_complete(int sk, uint16_t index, void *buf, mgmt_set_dev_class(index, info->major, info->minor); } + if (info->pending_powered) { + info->pending_powered = FALSE; + mgmt_set_powered(index, 1); + } + return; } |