From: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [RFC BlueZ 3/5] hog: Use the per handle GATT event notifier
Date: Tue, 9 Oct 2012 14:22:26 -0300 [thread overview]
Message-ID: <20121009172226.GB2148@samus> (raw)
In-Reply-To: <1349742372-18420-4-git-send-email-vinicius.gomes@openbossa.org>
Hi,
On 21:26 Mon 08 Oct, Vinicius Costa Gomes wrote:
> ---
> profiles/input/hog_device.c | 66 ++++++++++++++++++++++++---------------------
> 1 file changed, 36 insertions(+), 30 deletions(-)
>
> diff --git a/profiles/input/hog_device.c b/profiles/input/hog_device.c
> index 52ebd95..34f4a41 100644
> --- a/profiles/input/hog_device.c
> +++ b/profiles/input/hog_device.c
> @@ -154,22 +134,31 @@ static void report_value_cb(const uint8_t *pdu, uint16_t len,
> static void report_ccc_written_cb(guint8 status, const guint8 *pdu,
> guint16 plen, gpointer user_data)
> {
> + struct report *report = user_data;
> + struct hog_device *hogdev = report->hogdev;
> +
> if (status != 0) {
> error("Write report characteristic descriptor failed: %s",
> att_ecode2str(status));
> return;
> }
>
> + report->notifyid = g_attrib_register(hogdev->attrib,
> + ATT_OP_HANDLE_NOTIFY,
> + report->decl->value_handle,
> + report_value_cb, report, NULL);
> +
> DBG("Report characteristic descriptor written: notifications enabled");
> }
>
> static void write_ccc(uint16_t handle, gpointer user_data)
> {
> - struct hog_device *hogdev = user_data;
> + struct report *report = user_data;
> + struct hog_device *hogdev = report->hogdev;
> uint8_t value[] = { 0x01, 0x00 };
>
> gatt_write_char(hogdev->attrib, handle, value, sizeof(value),
> - report_ccc_written_cb, hogdev);
> + report_ccc_written_cb, report);
> }
There's a bug in this patch. So please consider it just as a proof of
concept.
Cheers,
--
Vinicius
next prev parent reply other threads:[~2012-10-09 17:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 0:26 [RFC BlueZ 0/5] gattrib: Registering per-handle event listeners Vinicius Costa Gomes
2012-10-09 0:26 ` [RFC BlueZ 1/5] gattrib: Add support for listening for events for specific handles Vinicius Costa Gomes
2012-10-09 0:26 ` [RFC BlueZ 2/5] scan: Use the per handle GATT event notifier Vinicius Costa Gomes
2012-10-09 0:26 ` [RFC BlueZ 3/5] hog: " Vinicius Costa Gomes
2012-10-09 17:22 ` Vinicius Costa Gomes [this message]
2012-10-09 0:26 ` [RFC BlueZ 4/5] heartrate: " Vinicius Costa Gomes
2012-10-09 0:26 ` [RFC BlueZ 5/5] gas: Add " Vinicius Costa Gomes
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=20121009172226.GB2148@samus \
--to=vinicius.gomes@openbossa.org \
--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