Re: 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 Luiz,

------- Original Message -------
Sender : Luiz Augusto von Dentz<luiz.dentz@xxxxxxxxx>
Date : Jan 22, 2015 20:03 (GMT+05:30)
Title : Re: [PATCH 1/2] audio/avrcp: Assign player id during player registration

Hi Sagar,

On Thu, Jan 22, 2015 at 2:56 PM, Sagar Nageshmurthy
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.

I agree. As we have to do a lookup in the list I shall implement reusable ids in the next patch.

--
Sagar

>         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ÿôèº{.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