Re: Re: [PATCH 2/2] audio/avrcp: Handle SetAddressedPlayer command

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

 



Hi Luiz,

------- Original Message -------
Sender : Luiz Augusto von Dentz<luiz.dentz@xxxxxxxxx>
Date : Jan 22, 2015 20:17 (GMT+05:30)
Title : Re: [PATCH 2/2] audio/avrcp: Handle SetAddressedPlayer command

Hi Sagar,

On Thu, Jan 22, 2015 at 2:57 PM, Sagar Nageshmurthy
wrote:
> This patch handles the SetAddressedPlayer command for TG role.
> ---
>  profiles/audio/avrcp.c |   41 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>
> diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
> index 3826a91..cea081c 100644
> --- a/profiles/audio/avrcp.c
> +++ b/profiles/audio/avrcp.c
> @@ -103,6 +103,7 @@
>  #define AVRCP_REQUEST_CONTINUING       0x40
>  #define AVRCP_ABORT_CONTINUING         0x41
>  #define AVRCP_SET_ABSOLUTE_VOLUME      0x50
> +#define AVRCP_SET_ADDRESSED_PLAYER     0x60
>  #define AVRCP_SET_BROWSED_PLAYER       0x70
>  #define AVRCP_GET_FOLDER_ITEMS         0x71
>  #define AVRCP_CHANGE_PATH              0x72
> @@ -1610,6 +1611,44 @@ err:
>         return AVC_CTYPE_REJECTED;
>  }
>
> +static uint8_t avrcp_handle_set_addressed_player(struct avrcp *session,
> +                                               struct avrcp_header *pdu,
> +                                                       uint8_t transaction)
> +{
> +       uint16_t player_id;
> +       uint16_t len = ntohs(pdu->params_len);
> +       struct avrcp_server *server = session->server;
> +       GSList *l;
> +
> +       if (len != 2)
> +               goto err;
> +
> +       player_id = bt_get_be16(&pdu->params[0]);
> +
> +       DBG("id = %d", player_id);
> +
> +       for (l = server->players; l; l = l->next) {
> +               struct avrcp_player *player = l->data;
> +
> +               if (player->id == player_id) {
> +                       session->target->player = player;
> +                       pdu->params_len = htons(1);
> +                       pdu->params[0] = AVRCP_STATUS_SUCCESS;
> +                       return AVC_CTYPE_ACCEPTED;
> +               }
> +
> +       }

Split the player lookup in a different function. Futhermore upon
success there are a few event that needs to complete according to the
spec (seeTable 6.43 Completion of notifications on addressed player
changed).

Yes; I thought of handling it with Addressed Player Changed notification
implementation. I shall share the patch for the same.

--
Sagar

> +       pdu->params_len = htons(1);
> +       pdu->params[0] = AVRCP_STATUS_PARAM_NOT_FOUND;

Im not so sure this is the right error, I believe what shall be use is
AVRCP_STATUS_INVALID_PLAYER_ID in this case.

> +       return AVC_CTYPE_REJECTED;
> +err:
> +       pdu->params_len = htons(1);
> +       pdu->params[0] = AVRCP_STATUS_INVALID_PARAM;
> +
> +       return AVC_CTYPE_REJECTED;
> +}
> +
>  static const struct control_pdu_handler control_handlers[] = {
>                 { AVRCP_GET_CAPABILITIES, AVC_CTYPE_STATUS,
>                                         avrcp_handle_get_capabilities },
> @@ -1641,6 +1680,8 @@ static const struct control_pdu_handler control_handlers[] = {
>                                         avrcp_handle_request_continuing },
>                 { AVRCP_ABORT_CONTINUING, AVC_CTYPE_CONTROL,
>                                         avrcp_handle_abort_continuing },
> +               { AVRCP_SET_ADDRESSED_PLAYER, AVC_CTYPE_CONTROL,
> +                                       avrcp_handle_set_addressed_player },
>                 { },
>  };
>
> --
> 1.7.9.5
>
> --
> 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



-- 
Luiz Augusto von Dentzÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±ý¹nzÚ(¶âžØ^n‡r¡ö¦zË?ëh™¨è­Ú&£ûàz¿äz¹Þ—ú+€Ê+zf£¢·hšˆ§~†­†Ûiÿÿï?êÿ‘êçz_è®æj:+v‰¨þ)ߣøm





[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