linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code
@ 2014-07-28 11:39 Luiz Augusto von Dentz
  2014-07-28 11:39 ` [PATCH BlueZ 2/2] android/hog: Fix handling UHID_FEATURE as UHID_OUTPUT Luiz Augusto von Dentz
  2014-07-29  7:44 ` [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Johan Hedberg
  0 siblings, 2 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2014-07-28 11:39 UTC (permalink / raw)
  To: linux-bluetooth

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

The callback register by bt_uhid_register already contains the event type
so there is no need to check for it again.
---
 profiles/input/hog.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index 491f933..df2b30b 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -340,9 +340,6 @@ static void forward_report(struct uhid_event *ev, void *user_data)
 		size = ev->u.output.size;
 	}
 
-	if (ev->type != UHID_OUTPUT)
-		return;
-
 	type = HOG_REPORT_TYPE_OUTPUT;
 
 	l = g_slist_find_custom(hogdev->reports, GUINT_TO_POINTER(type),
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH BlueZ 2/2] android/hog: Fix handling UHID_FEATURE as UHID_OUTPUT
  2014-07-28 11:39 [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Luiz Augusto von Dentz
@ 2014-07-28 11:39 ` Luiz Augusto von Dentz
  2014-07-29  7:44 ` [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2014-07-28 11:39 UTC (permalink / raw)
  To: linux-bluetooth

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

As with input plugin this code contain the same issue handling
UHID_FEATURE events can cause a crash.
---
 android/hog.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/android/hog.c b/android/hog.c
index 9f8c7e5..ef5690c 100644
--- a/android/hog.c
+++ b/android/hog.c
@@ -404,16 +404,7 @@ static void forward_report(struct uhid_event *ev, void *user_data)
 		size = ev->u.output.size;
 	}
 
-	switch (ev->type) {
-	case UHID_OUTPUT:
-		type = HOG_REPORT_TYPE_OUTPUT;
-		break;
-	case UHID_FEATURE:
-		type = HOG_REPORT_TYPE_FEATURE;
-		break;
-	default:
-		return;
-	}
+	type = HOG_REPORT_TYPE_OUTPUT;
 
 	l = g_slist_find_custom(hog->reports, GUINT_TO_POINTER(type),
 							report_type_cmp);
@@ -573,7 +564,6 @@ static void report_map_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
 	}
 
 	bt_uhid_register(hog->uhid, UHID_OUTPUT, forward_report, hog);
-	bt_uhid_register(hog->uhid, UHID_FEATURE, forward_report, hog);
 }
 
 static void info_read_cb(guint8 status, const guint8 *pdu, guint16 plen,
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code
  2014-07-28 11:39 [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Luiz Augusto von Dentz
  2014-07-28 11:39 ` [PATCH BlueZ 2/2] android/hog: Fix handling UHID_FEATURE as UHID_OUTPUT Luiz Augusto von Dentz
@ 2014-07-29  7:44 ` Johan Hedberg
  1 sibling, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2014-07-29  7:44 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth

Hi Luiz,

On Mon, Jul 28, 2014, Luiz Augusto von Dentz wrote:
> The callback register by bt_uhid_register already contains the event type
> so there is no need to check for it again.
> ---
>  profiles/input/hog.c | 3 ---
>  1 file changed, 3 deletions(-)

Both patches have been applied. Thanks.

Johan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-29  7:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 11:39 [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Luiz Augusto von Dentz
2014-07-28 11:39 ` [PATCH BlueZ 2/2] android/hog: Fix handling UHID_FEATURE as UHID_OUTPUT Luiz Augusto von Dentz
2014-07-29  7:44 ` [PATCH BlueZ 1/2] input/hog: Cleanup unnecessary code Johan Hedberg

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).