From: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Subject: [PATCH_v2 12/13] android/hid: Handle uhid events
Date: Tue, 5 Nov 2013 13:38:14 +0200 [thread overview]
Message-ID: <1383651495-12434-13-git-send-email-ravikumar.veeramally@linux.intel.com> (raw)
In-Reply-To: <1383651495-12434-1-git-send-email-ravikumar.veeramally@linux.intel.com>
Handling few uhid events and described scenarios. OUTPUT and
FEATURE events are not yet handled.
---
android/hid.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
diff --git a/android/hid.c b/android/hid.c
index d3a74b9..8f3a28a 100644
--- a/android/hid.c
+++ b/android/hid.c
@@ -149,6 +149,11 @@ 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)
+{
+ DBG("UHID_OUTPUT UHID_FEATURE unsupported");
+}
+
static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
@@ -172,7 +177,40 @@ static gboolean uhid_event_cb(GIOChannel *io, GIOCondition cond,
}
DBG("uHID event type %d received", ev.type);
- /* TODO Handle events */
+
+ switch (ev.type) {
+ case UHID_START:
+ case UHID_STOP:
+ /* These are called to start and stop the underlying hardware.
+ * We open the channels before creating the device so the
+ * hardware is always ready. No need to handle these.
+ * The kernel never destroys a device itself! Only an explicit
+ * UHID_DESTROY request can remove a device. */
+
+ break;
+ case UHID_OPEN:
+ case UHID_CLOSE:
+ /* OPEN/CLOSE are sent whenever user-space opens any interface
+ * provided by the kernel HID device. Whenever the open-count
+ * is non-zero we must be ready for I/O. As long as it is zero,
+ * we can decide to drop all I/O and put the device
+ * asleep This is optional, though. */
+ break;
+ case UHID_OUTPUT:
+ case UHID_FEATURE:
+ handle_uhid_event(dev, &ev);
+ break;
+ case UHID_OUTPUT_EV:
+ /* This is only sent by kernels prior to linux-3.11. It
+ * requires us to parse HID-descriptors in user-space to
+ * properly handle it. This is redundant as the kernel
+ * does it already. That's why newer kernels assemble
+ * the output-reports and send it to us via UHID_OUTPUT. */
+ DBG("UHID_OUTPUT_EV unsupported");
+ break;
+ default:
+ warn("unexpected uHID event");
+ }
return TRUE;
--
1.8.1.2
next prev parent reply other threads:[~2013-11-05 11:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 11:38 [PATCH_v2 00/13] Implemented hid interfaces in daemon and hal Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 01/13] android/hid: Add hid event proto mode structure to hal msg headers Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 02/13] android/hid: Implement hid get protocol in daemon Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 03/13] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 04/13] android/hid: Handle protocol mode notification in hal Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 05/13] android/hid: Add hid event get report structure to hal msg headers Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 06/13] android/hid: Implement hid get report in daemon Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 07/13] android/hid: Add missing set report parameters to ipc document Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 08/13] android/hid: Implement hid set report in daemon Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 09/13] android/hid: Handle get report notification in hal Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 10/13] android/hid: Replace header checking magic number with defines Ravi kumar Veeramally
2013-11-05 11:38 ` [PATCH_v2 11/13] android/hid: Handle invalid parameters in hal Ravi kumar Veeramally
2013-11-05 11:38 ` Ravi kumar Veeramally [this message]
2013-11-05 11:38 ` [PATCH_v2 13/13] android/hid: Align hal hid struct variables properly Ravi kumar Veeramally
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=1383651495-12434-13-git-send-email-ravikumar.veeramally@linux.intel.com \
--to=ravikumar.veeramally@linux.intel.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