public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@tieto.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ v2 01/12] android/hog: Add bt_hog_send
Date: Mon, 30 Jun 2014 18:56:42 +0200	[thread overview]
Message-ID: <2047237.sJOmoChR6N@uw000953> (raw)
In-Reply-To: <1404137861-9313-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Monday 30 of June 2014 17:17:30 Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> This function can be used to send data using Output Report if one is
> available.
> ---
> v2: Fix patch 02/12 to check if a hog instance exists.
> 
>  android/hog.c | 37 +++++++++++++++++++++++++++++++++++++
>  android/hog.h |  1 +
>  2 files changed, 38 insertions(+)
> 
> diff --git a/android/hog.c b/android/hog.c
> index 7e61790..5d33c63 100644
> --- a/android/hog.c
> +++ b/android/hog.c
> @@ -1009,3 +1009,40 @@ int bt_hog_set_control_point(struct bt_hog *hog, bool suspend)
>  
>  	return 0;
>  }
> +
> +int bt_hog_send(struct bt_hog *hog, void *data, size_t size)
> +{
> +	struct report *report;
> +	GSList *l;
> +
> +	if (!hog)
> +		return -EINVAL;
> +
> +	if (!hog->attrib)
> +		return -ENOTCONN;
> +
> +	l = g_slist_find_custom(hog->reports,
> +				GUINT_TO_POINTER(HOG_REPORT_TYPE_OUTPUT),
> +				report_type_cmp);
> +	if (!l)
> +		return -ENOTSUP;
> +
> +	report = l->data;
> +
> +	DBG("Sending data to handle 0x%X", report->decl->value_handle);
> +
> +	if (report->decl->properties & GATT_CHR_PROP_WRITE)
> +		gatt_write_char(hog->attrib, report->decl->value_handle,
> +				data, size, output_written_cb, hog);
> +	else if (report->decl->properties & GATT_CHR_PROP_WRITE_WITHOUT_RESP)
> +		gatt_write_cmd(hog->attrib, report->decl->value_handle,
> +						data, size, NULL, NULL);
> +
> +	for (l = hog->instances; l; l = l->next) {
> +		struct bt_hog *instance = l->data;
> +
> +		bt_hog_send(instance, data, size);
> +	}
> +
> +	return 0;
> +}
> diff --git a/android/hog.h b/android/hog.h
> index 7cf446b..4ebc83e 100644
> --- a/android/hog.h
> +++ b/android/hog.h
> @@ -33,3 +33,4 @@ bool bt_hog_attach(struct bt_hog *hog, void *gatt);
>  void bt_hog_detach(struct bt_hog *hog);
>  
>  int bt_hog_set_control_point(struct bt_hog *hog, bool suspend);
> +int bt_hog_send(struct bt_hog *hog, void *data, size_t size);
> 


I've applied patches 3-12 and updated PTS tests results. Thanks.

For first two I'm not sure yet, we would need similar code for input
and feature reports to pass PTS tests. I'll try using gattc interface
for those and see how it works out. Then we can decide.

-- 
Best regards, 
Szymon Janc

      parent reply	other threads:[~2014-06-30 16:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 14:17 [PATCH BlueZ v2 01/12] android/hog: Add bt_hog_send Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 02/12] android/hidhost: Use bt_hog_send in bt_hid_send_data Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 03/12] android/hog: Read initial value of Report characteristic Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 04/12] android/hog: Read CCC initial value for Input Report Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 05/12] android/hog: Fix not resetting properly on detach Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 06/12] android/hog: Fix not detaching on free Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 07/12] android/hog: Remove unused code Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 08/12] android/scpp: Fix not unregistering on detach Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 09/12] android/scpp: Fix not detaching on free Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 10/12] android/bas: Enable notification for Battery Level characteristic Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 11/12] android/bas: Read CCC initial value for Battery Level Luiz Augusto von Dentz
2014-06-30 14:17 ` [PATCH BlueZ v2 12/12] android/dis: Detach on free Luiz Augusto von Dentz
2014-06-30 16:56 ` Szymon Janc [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=2047237.sJOmoChR6N@uw000953 \
    --to=szymon.janc@tieto.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.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