diff options
author | Alok Barsode <alok.barsode@azingo.com> | 2009-05-06 14:07:57 +0530 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-05-06 12:37:44 +0300 |
commit | 4e71ac8617182584edf8ca57879e33d98879eb5d (patch) | |
tree | cdb660c51865fdc4a6823946ff9388897d0f342a /plugins | |
parent | 87056b024e7e5c1421dafe1c65b4db7f61ba8a6c (diff) | |
download | bluez-4e71ac8617182584edf8ca57879e33d98879eb5d.tar.gz |
Adding stop() functionality to hciops plugin.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/hciops.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/hciops.c b/plugins/hciops.c index ba4b69d4a..2e91129c1 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -439,10 +439,34 @@ done: return err; } +static int hciops_stop(int index) +{ + int dd; + int err = 0; + + dd = hci_open_dev(index); + if (dd < 0) + return -EIO; + + if (ioctl(dd, HCIDEVDOWN, index) == 0) + goto done; /* on success */ + + if (errno != EALREADY) { + err = -errno; + error("Can't stop device hci%d: %s (%d)", + index, strerror(errno), errno); + } + +done: + hci_close_dev(dd); + return err; +} + static struct btd_adapter_ops hci_ops = { .setup = hciops_setup, .cleanup = hciops_cleanup, .start = hciops_start, + .stop = hciops_stop, }; static int hciops_init(void) |