Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 11/11] android/hid: Handle uhid events
Date: Tue, 5 Nov 2013 10:29:55 +0200	[thread overview]
Message-ID: <20131105082843.GC18874@aemeltch-MOBL1> (raw)
In-Reply-To: <1383603615-9953-12-git-send-email-ravikumar.veeramally@linux.intel.com>

Hi Ravi,

On Tue, Nov 05, 2013 at 12:20:15AM +0200, Ravi kumar Veeramally wrote:
> 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 74de02f..fccaa87 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("unsupported event");
> +}
> +
>  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("Unsupported uHID event: type %d", ev.u.output_ev.type);

Use handle_uhid_event helper? You could add printing event type there.

Best regards 
Andrei Emeltchenko 

> +		break;
> +	default:
> +		warn("unexpected uHID event");
> +	}
>  
>  	return TRUE;
>  
> -- 
> 1.8.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2013-11-05  8:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-04 22:20 [PATCH 00/11] Implemented hid interfaces in daemon and hal Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 01/11] android/hid: Rename function name set_state to notify_state Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 02/11] android/hid: Retrieve BOOT_DEVICE attribute from SDP and cache it Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 03/11] android/hid: Implement hid get protocol in daemon Ravi kumar Veeramally
2013-11-05  8:24   ` Johan Hedberg
2013-11-04 22:20 ` [PATCH 04/11] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 05/11] android/hid: Handle protocol mode notification in hal Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 06/11] android/hid: Implement hid get report in daemon Ravi kumar Veeramally
2013-11-05  8:29   ` Johan Hedberg
2013-11-04 22:20 ` [PATCH 07/11] android/hid: Implement hid set " Ravi kumar Veeramally
2013-11-05  8:31   ` Johan Hedberg
2013-11-04 22:20 ` [PATCH 08/11] android/hid: Handle get report notification in hal Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 09/11] android/hid: Replace header checking magic number with defines Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 10/11] android/hid: Handle invalid parameters in hal Ravi kumar Veeramally
2013-11-04 22:20 ` [PATCH 11/11] android/hid: Handle uhid events Ravi kumar Veeramally
2013-11-05  8:29   ` Andrei Emeltchenko [this message]

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=20131105082843.GC18874@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ravikumar.veeramally@linux.intel.com \
    /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