diff options
author | Mikel Astiz <mikel.astiz@bmw-carit.de> | 2012-10-19 17:39:28 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-10-25 13:36:16 +0300 |
commit | 2c31fdb6a464c66e46df02f83bcc3aa71607f914 (patch) | |
tree | 2c483652941bc1de62f498daaafe8c8314b4626d | |
parent | b9c588d5672ca041ff6d80ed957ea6eac123d676 (diff) |
input: Expose internal disconnection API
Expose the same API exposed in D-Bus to disconnect devices.
-rw-r--r-- | profiles/input/device.c | 20 | ||||
-rw-r--r-- | profiles/input/device.h | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/profiles/input/device.c b/profiles/input/device.c index 7df92e29..fbc3d6f9 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -700,6 +700,26 @@ static DBusMessage *local_connect(DBusConnection *conn, DBusMessage *msg, return NULL; } +int input_device_disconnect(struct btd_device *dev, struct btd_profile *profile, + btd_profile_cb cb) +{ + struct input_device *idev; + int err; + + idev = find_device_by_path(devices, device_get_path(dev)); + if (!idev) + return -ENOENT; + + err = connection_disconnect(idev, 0); + if (err < 0) + return err; + + if (cb) + cb(profile, dev, 0); + + return 0; +} + static DBusMessage *local_disconnect(DBusConnection *conn, DBusMessage *msg, void *data) { diff --git a/profiles/input/device.h b/profiles/input/device.h index be1f830b..d68798c9 100644 --- a/profiles/input/device.h +++ b/profiles/input/device.h @@ -38,3 +38,5 @@ int input_device_close_channels(const bdaddr_t *src, const bdaddr_t *dst); int input_device_connect(struct btd_device *dev, struct btd_profile *profile, btd_profile_cb cb); +int input_device_disconnect(struct btd_device *dev, struct btd_profile *profile, + btd_profile_cb cb); |