aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Xie <mattx@google.com>2011-08-05 16:15:41 -0700
committerMatthew Xie <mattx@google.com>2011-08-05 16:15:41 -0700
commit6b08f121c817cda19431fa472c9640733df05d6f (patch)
tree5eaabc4bb7abe423dccd6466b04c5065823617c4
parent492a85adb19817e840967b052d9dc02e6fb34aac (diff)
downloadbluez-6b08f121c817cda19431fa472c9640733df05d6f.tar.gz
Send hci command to disable scan mode in power down function
Before we power down HCI dev, we should disable Bluetooth chip scan mode so that it saves power. bug 5080232 Change-Id: I28a761ebcb14c0a4215c53ed82e4ff9430a32250
-rw-r--r--plugins/hciops.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c
index 817a180c..ad977295 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -462,8 +462,15 @@ static int hciops_set_pairable(int index, gboolean pairable)
static int hciops_power_off(int index)
{
struct dev_info *dev = &devs[index];
+ uint8_t mode;
- DBG("hci%d", index);
+ DBG("hci%d set scan mode off", index);
+ mode = SCAN_DISABLED;
+ if (hci_send_cmd(dev->sk, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE,
+ 1, &mode) < 0)
+ return -errno;
+
+ DBG("hci%d HCIDEVDOWN", index);
if (ioctl(dev->sk, HCIDEVDOWN, index) < 0 && errno != EALREADY)
return -errno;