linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 2/2] input: Do not send UHID_DESTROY
Date: Wed, 28 May 2014 14:27:55 +0300	[thread overview]
Message-ID: <1401276475-20978-2-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1401276475-20978-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Accourding to uHID documentation when diconnecting the kernel will take
care of cleaning up any device created:

  "If you close() the fd, the device is automatically unregistered and
   destroyed internally."
---
 profiles/input/device.c | 17 +----------------
 profiles/input/hog.c    | 10 ----------
 2 files changed, 1 insertion(+), 26 deletions(-)

diff --git a/profiles/input/device.c b/profiles/input/device.c
index 785b1e9..a61b2c7 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -108,22 +108,7 @@ static int connection_disconnect(struct input_device *idev, uint32_t flags);
 
 static void input_device_free(struct input_device *idev)
 {
-	if (idev->uhid) {
-		if (idev->uhid_created) {
-			int err;
-			struct uhid_event ev;
-
-			memset(&ev, 0, sizeof(ev));
-			ev.type = UHID_DESTROY;
-			err = bt_uhid_send(idev->uhid, &ev);
-			if (err < 0)
-				error("bt_uhid_send: %s (%d)", strerror(-err),
-									-err);
-		}
-
-		bt_uhid_unref(idev->uhid);
-	}
-
+	bt_uhid_unref(idev->uhid);
 	btd_service_unref(idev->service);
 	btd_device_unref(idev->device);
 	g_free(idev->path);
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 47a4fb1..3753343 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -750,17 +750,7 @@ static struct hog_device *hog_register_device(struct btd_device *device,
 
 static int hog_unregister_device(struct hog_device *hogdev)
 {
-	struct uhid_event ev;
-	int err;
-
 	btd_device_remove_attio_callback(hogdev->device, hogdev->attioid);
-
-	memset(&ev, 0, sizeof(ev));
-	ev.type = UHID_DESTROY;
-	err = bt_uhid_send(hogdev->uhid, &ev);
-	if (err < 0)
-		error("bt_uhid_send: %s (%d)", strerror(-err), -err);
-
 	bt_uhid_unref(hogdev->uhid);
 	hog_free_device(hogdev);
 
-- 
1.9.0


  reply	other threads:[~2014-05-28 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-28 11:27 [PATCH BlueZ 1/2] android/hidhost: Rework uHID code to use bt_uhid Luiz Augusto von Dentz
2014-05-28 11:27 ` Luiz Augusto von Dentz [this message]
2014-05-30  6:25 ` Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1401276475-20978-2-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).