Re: [RFC BlueZ 3/5] hog: Use the per handle GATT event notifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux