Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH BlueZ 10/16] android/avrcp: Add handler for GetCapabilities command
Date: Mon, 3 Mar 2014 12:10:27 +0200	[thread overview]
Message-ID: <20140303101025.GC4999@aemeltch-MOBL1> (raw)
In-Reply-To: <1393786109-6554-10-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Sun, Mar 02, 2014 at 08:48:25PM +0200, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> 
> ---
>  android/avrcp-lib.h |  1 +
>  android/avrcp.c     | 42 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
> index 8625425..dda1d28 100644
> --- a/android/avrcp-lib.h
> +++ b/android/avrcp-lib.h
> @@ -51,6 +51,7 @@
>  #define AVRCP_EVENT_TRACK_CHANGED		0x02
>  #define AVRCP_EVENT_TRACK_REACHED_END		0x03
>  #define AVRCP_EVENT_TRACK_REACHED_START		0x04
> +#define AVRCP_EVENT_PLAYBACK_POS_CHANGED	0x05
>  #define AVRCP_EVENT_SETTINGS_CHANGED		0x08
>  #define AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED	0x0a
>  #define AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED	0x0b
> diff --git a/android/avrcp.c b/android/avrcp.c
> index 9d86803..bcaa66c 100644
> --- a/android/avrcp.c
> +++ b/android/avrcp.c
> @@ -26,6 +26,7 @@
>  #endif
>  
>  #include <stdbool.h>
> +#include <errno.h>
>  #include <glib.h>
>  
>  #include "btio/btio.h"
> @@ -339,6 +340,46 @@ static const struct avrcp_passthrough_handler passthrough_handlers[] = {
>  		{ },
>  };
>  
> +static ssize_t handle_get_capabilities(struct avrcp *session,
> +						uint8_t transaction,
> +						uint16_t params_len,
> +						uint8_t *params,
> +						void *user_data)
> +{
> +	uint32_t id = 0x001958;

Don't we have it defined?

Best regards 
Andrei Emeltchenko 

> +
> +	if (params_len != 1)
> +		return -EINVAL;
> +
> +	switch (params[0]) {
> +	case CAP_COMPANY_ID:
> +		params[params_len++] = 1;
> +		hton24(&params[params_len], id);
> +		return params_len + 3;
> +	case CAP_EVENTS_SUPPORTED:
> +		/* Android do not provide this info via HAL so the list most
> +		 * be hardcoded according to what RegisterNotification can
> +		 * actually handle */
> +		params[params_len++] = 6;
> +		params[params_len++] = AVRCP_EVENT_STATUS_CHANGED;
> +		params[params_len++] = AVRCP_EVENT_TRACK_CHANGED;
> +		params[params_len++] = AVRCP_EVENT_TRACK_REACHED_END;
> +		params[params_len++] = AVRCP_EVENT_TRACK_REACHED_START;
> +		params[params_len++] = AVRCP_EVENT_PLAYBACK_POS_CHANGED;
> +		params[params_len++] = AVRCP_EVENT_SETTINGS_CHANGED;
> +		return params_len;
> +	}
> +
> +	return -EINVAL;
> +}
> +
> +static const struct avrcp_control_handler control_handlers[] = {
> +		{ AVRCP_GET_CAPABILITIES,
> +					AVC_CTYPE_STATUS, AVC_CTYPE_STABLE,
> +					handle_get_capabilities },
> +		{ },
> +};
> +
>  static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
>  {
>  	struct avrcp_device *dev;
> @@ -390,6 +431,7 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
>  	avrcp_set_destroy_cb(dev->session, disconnect_cb, dev);
>  	avrcp_set_passthrough_handlers(dev->session, passthrough_handlers,
>  									dev);
> +	avrcp_set_control_handlers(dev->session, control_handlers, dev);
>  
>  	/* FIXME: get the real name of the device */
>  	avrcp_init_uinput(dev->session, "bluetooth", address);
> -- 
> 1.8.5.3
> 
> --
> 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:[~2014-03-03 10:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-02 18:48 [PATCH BlueZ 01/16] android/avrcp-lib: Add avrcp_send function Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 02/16] android/avctp: Make handler return ssize_t Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 03/16] android/avrcp-lib: Rework handler callback parameters Luiz Augusto von Dentz
2014-03-03  9:52   ` Andrei Emeltchenko
2014-03-03 12:41     ` Luiz Augusto von Dentz
2014-03-04  8:05       ` Andrei Emeltchenko
2014-03-02 18:48 ` [PATCH BlueZ 04/16] android/avrcp-lib: Embed response code into handler table Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 05/16] android/avrcp-lib: Fix not passing user data of passthrough callback Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 06/16] android/avrcp-lib: Add pressed status to passthrough handler callback Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 07/16] android/avrcp: Add passthrough handler for fast forward Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 08/16] android/avrcp: Add passthrough handler for rewind Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 09/16] android/avrcp-lib: Make hton24 and ntoh24 public Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 10/16] android/avrcp: Add handler for GetCapabilities command Luiz Augusto von Dentz
2014-03-03 10:10   ` Andrei Emeltchenko [this message]
2014-03-02 18:48 ` [PATCH BlueZ 11/16] android/avrcp: Add handler for GetPlayStatus command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 12/16] android/avrcp: Add handler for GetElementAttributes command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 13/16] android/avrcp: Add handler for RegisterNotification command Luiz Augusto von Dentz
2014-03-02 18:48 ` [PATCH BlueZ 14/16] android/avrcp: Bump version to 1.3 Luiz Augusto von Dentz
2014-03-04 11:47 ` [PATCH BlueZ 01/16] android/avrcp-lib: Add avrcp_send function Luiz Augusto von Dentz

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=20140303101025.GC4999@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@gmail.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