linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH_v2 1/3] android/hidhost: Handle uhid output and feature events
@ 2013-11-12 15:07 Ravi kumar Veeramally
  2013-11-12 15:07 ` [PATCH_v2 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Ravi kumar Veeramally @ 2013-11-12 15:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ravi kumar Veeramally

Data read on uhid events output and feature has to be send through
SET_REPORT request to HID device.
---
 android/hidhost.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/android/hidhost.c b/android/hidhost.c
index cba80a6..556e5a5 100644
--- a/android/hidhost.c
+++ b/android/hidhost.c
@@ -155,7 +155,30 @@ static void hid_device_free(struct hid_device *dev)
 
 static void handle_uhid_event(struct hid_device *dev, struct uhid_event *ev)
 {
-	DBG("UHID_OUTPUT UHID_FEATURE unsupported");
+	int fd, i;
+	uint8_t *req = NULL;
+	uint8_t req_size = 0;
+
+	if (!(dev->ctrl_io))
+		return;
+
+	req_size = 1 + (ev->u.output.size / 2);
+	req = g_try_malloc0(req_size);
+	if (!req)
+		return;
+
+	req[0] = HID_MSG_SET_REPORT | ev->u.output.rtype;
+	for (i = 0; i < (req_size - 1); i++)
+		sscanf((char *) &(ev->u.output.data)[i * 2],
+							"%hhx", &(req + 1)[i]);
+
+	fd = g_io_channel_unix_get_fd(dev->ctrl_io);
+
+	if (write(fd, req, req_size) < 0)
+		error("error writing set_report: %s (%d)",
+						strerror(errno), errno);
+
+	g_free(req);
 }
 
 static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
-- 
1.8.3.2


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

end of thread, other threads:[~2013-11-13  9:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 15:07 [PATCH_v2 1/3] android/hidhost: Handle uhid output and feature events Ravi kumar Veeramally
2013-11-12 15:07 ` [PATCH_v2 2/3] android/hidhost: Remove deprecated idle opcode from ipc document Ravi kumar Veeramally
2013-11-12 15:07 ` [PATCH_v2 3/3] android/hidhost: Set info request from HAL is not supported Ravi kumar Veeramally
2013-11-13  9:01 ` [PATCH_v2 1/3] android/hidhost: Handle uhid output and feature events Johan Hedberg
2013-11-13  9:17   ` Ravi Kumar Veeramally
2013-11-13  9:27     ` 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).