diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-27 18:21:25 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-27 18:21:25 +0200 |
commit | 363da064d395925f46be7793ece5800ec66a82ab (patch) | |
tree | 2235f89cbd772f69938c9280546eda1204ff4f59 /src | |
parent | 041076b043f9d950ea9478cfea956b4cad040dfa (diff) |
Don't call read scan enable if the adapter is powering down
When powering down we explicitly set the scan mode to 0 before calling
the HCI_DEVDOWN ioctl. To avoid HCI command timeouts track this
situation and don't call read scan enable in dbus-hci.c when the command
complete for the write scan enable arrives.
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 10 | ||||
-rw-r--r-- | src/adapter.h | 1 | ||||
-rw-r--r-- | src/dbus-hci.c | 3 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c index 6cf2b99b..52b58c4e 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -121,6 +121,8 @@ struct btd_adapter { gboolean initialized; gboolean already_up; /* adapter was already up on init */ + + gboolean off_requested; /* DEVDOWN ioctl was called */ }; static void adapter_set_pairable_timeout(struct btd_adapter *adapter, @@ -432,6 +434,8 @@ static int set_mode(struct btd_adapter *adapter, uint8_t new_mode) return err; } + adapter->off_requested = TRUE; + goto done; } @@ -1990,6 +1994,7 @@ static int adapter_up(struct btd_adapter *adapter, int dd) ba2str(&adapter->bdaddr, srcaddr); + adapter->off_requested = FALSE; adapter->up = 1; adapter->discov_timeout = get_discoverable_timeout(srcaddr); adapter->pairable_timeout = get_pairable_timeout(srcaddr); @@ -2928,3 +2933,8 @@ gboolean adapter_is_pairable(struct btd_adapter *adapter) { return adapter->pairable; } + +gboolean adapter_powering_down(struct btd_adapter *adapter) +{ + return adapter->off_requested; +} diff --git a/src/adapter.h b/src/adapter.h index 59b00f70..06f558aa 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -139,3 +139,4 @@ const char *adapter_any_get_path(void); const char *btd_adapter_any_request_path(void); void btd_adapter_any_release_path(void); gboolean adapter_is_pairable(struct btd_adapter *adapter); +gboolean adapter_powering_down(struct btd_adapter *adapter); diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 894b4492..65919083 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1097,6 +1097,9 @@ void hcid_dbus_setscan_enable_complete(bdaddr_t *local) return; } + if (adapter_powering_down(adapter)) + return; + dev_id = adapter_get_dev_id(adapter); dd = hci_open_dev(dev_id); |