diff options
author | Andre Guedes <andre.guedes@openbossa.org> | 2012-12-18 11:41:21 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-12-18 17:21:25 +0200 |
commit | bc06a970257730dcccc632839889efe087c30f47 (patch) | |
tree | 50f6497da9914a7c95d20a810c14d1370b726b7d | |
parent | e89886ac6546f059955baf5d1b4f8fb25041c578 (diff) | |
download | bluez-bc06a970257730dcccc632839889efe087c30f47.tar.gz |
hog: Fix removing HoG device bug
We should remove only hog_devices from the given btd_device.
Otherwise, all hog_devices will be removed.
-rw-r--r-- | profiles/input/hog_device.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c index 4f5e99b54..e2a348831 100644 --- a/profiles/input/hog_device.c +++ b/profiles/input/hog_device.c @@ -852,8 +852,14 @@ static int hog_device_probe(struct btd_profile *p, struct btd_device *device, return 0; } -static void remove_device(gpointer hogdev, gpointer b) +static void remove_device(gpointer a, gpointer b) { + struct hog_device *hogdev = a; + struct btd_device *device = b; + + if (hogdev->device != device) + return; + devices = g_slist_remove(devices, hogdev); hog_device_unregister(hogdev); } @@ -864,7 +870,7 @@ static void hog_device_remove(struct btd_profile *p, struct btd_device *device) DBG("path %s", path); - g_slist_foreach(devices, remove_device, NULL); + g_slist_foreach(devices, remove_device, device); } static struct btd_profile hog_profile = { |