linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] bluetooth/hidhost: Fix using feature event as output event
@ 2013-12-16 14:37 Szymon Janc
  2013-12-16 14:37 ` [PATCH 2/2] android/hidhost: Simplify handle_uhid_output Szymon Janc
  0 siblings, 1 reply; 4+ messages in thread
From: Szymon Janc @ 2013-12-16 14:37 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Rename handle_uhid_event to handle_uhid_output and make it handle only
output events.
---
 android/hidhost.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/android/hidhost.c b/android/hidhost.c
index 8bfdfed..0e0391a 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -153,7 +153,8 @@ static void hid_device_free(struct hid_device *dev)
 	g_free(dev);
 }
 
-static void handle_uhid_event(struct hid_device *dev, struct uhid_event *ev)
+static void handle_uhid_output(struct hid_device *dev,
+						struct uhid_output_req *output)
 {
 	int fd, i;
 	uint8_t *req = NULL;
@@ -162,15 +163,14 @@ static void handle_uhid_event(struct hid_device *dev, struct uhid_event *ev)
 	if (!(dev->ctrl_io))
 		return;
 
-	req_size = 1 + (ev->u.output.size / 2);
+	req_size = 1 + (output->size / 2);
 	req = g_try_malloc0(req_size);
 	if (!req)
 		return;
 
-	req[0] = HID_MSG_SET_REPORT | ev->u.output.rtype;
+	req[0] = HID_MSG_SET_REPORT | output->rtype;
 	for (i = 0; i < (req_size - 1); i++)
-		sscanf((char *) &(ev->u.output.data)[i * 2],
-							"%hhx", &req[1 + i]);
+		sscanf((char *) &(output->data)[i * 2], "%hhx", &req[1 + i]);
 
 	fd = g_io_channel_unix_get_fd(dev->ctrl_io);
 
@@ -224,8 +224,10 @@ static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
 		 * asleep This is optional, though. */
 		break;
 	case UHID_OUTPUT:
+		handle_uhid_output(dev, &ev.u.output);
+		break;
 	case UHID_FEATURE:
-		handle_uhid_event(dev, &ev);
+		/* TODO */
 		break;
 	case UHID_OUTPUT_EV:
 		/* This is only sent by kernels prior to linux-3.11. It
-- 
1.8.3.2


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

end of thread, other threads:[~2013-12-18  8:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-16 14:37 [PATCH 1/2] bluetooth/hidhost: Fix using feature event as output event Szymon Janc
2013-12-16 14:37 ` [PATCH 2/2] android/hidhost: Simplify handle_uhid_output Szymon Janc
2013-12-16 15:19   ` Luiz Augusto von Dentz
2013-12-18  8:03     ` 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).