Re: [PATCH 1/2] audio/avrcp: Assign player id during player registration

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

 



Hi Sagar,

On Thu, Jan 22, 2015 at 2:56 PM, Sagar Nageshmurthy
<s.nageshmurt@xxxxxxxxxxx> wrote:
> ---
>  profiles/audio/avrcp.c |    2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
> index 11de6ee..3826a91 100644
> --- a/profiles/audio/avrcp.c
> +++ b/profiles/audio/avrcp.c
> @@ -3662,6 +3662,7 @@ struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
>         struct avrcp_server *server;
>         struct avrcp_player *player;
>         GSList *l;
> +       static uint16_t id = 0;
>
>         server = find_server(servers, adapter);
>         if (!server)
> @@ -3672,6 +3673,7 @@ struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
>         player->cb = cb;
>         player->user_data = user_data;
>         player->destroy = destroy;
> +       player->id = ++id ? id : 1;

It is still possible that the id is taken, that means you would have
to do a lookup in the list the find out what is the next id available,
also the id itself needs to be adjusted otherwise the very next player
would attempt to register id 1 again.

>         server->players = g_slist_append(server->players, 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
--
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