* Re: [PATCH BlueZ] android/test-ipc: Use correct boolean values for glib functions
From: Szymon Janc @ 2014-02-12 19:21 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1392232401-26119-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Anderson,
On Wednesday 12 of February 2014 15:13:21 Anderson Lizardo wrote:
> ---
> android/test-ipc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/android/test-ipc.c b/android/test-ipc.c
> index 3a0729e..2def97b 100644
> --- a/android/test-ipc.c
> +++ b/android/test-ipc.c
> @@ -263,8 +263,8 @@ static void execute_context(struct context *context)
> {
> g_main_loop_run(context->main_loop);
>
> - g_io_channel_shutdown(context->notif_io, true, NULL);
> - g_io_channel_shutdown(context->cmd_io, true, NULL);
> + g_io_channel_shutdown(context->notif_io, TRUE, NULL);
> + g_io_channel_shutdown(context->cmd_io, TRUE, NULL);
> g_io_channel_unref(context->cmd_io);
> g_io_channel_unref(context->notif_io);
Applied, thanks.
--
BR
Szymon Janc
^ permalink raw reply
* [PATCH BlueZ] android/test-ipc: Use correct boolean values for glib functions
From: Anderson Lizardo @ 2014-02-12 19:13 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
---
android/test-ipc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/android/test-ipc.c b/android/test-ipc.c
index 3a0729e..2def97b 100644
--- a/android/test-ipc.c
+++ b/android/test-ipc.c
@@ -263,8 +263,8 @@ static void execute_context(struct context *context)
{
g_main_loop_run(context->main_loop);
- g_io_channel_shutdown(context->notif_io, true, NULL);
- g_io_channel_shutdown(context->cmd_io, true, NULL);
+ g_io_channel_shutdown(context->notif_io, TRUE, NULL);
+ g_io_channel_shutdown(context->cmd_io, TRUE, NULL);
g_io_channel_unref(context->cmd_io);
g_io_channel_unref(context->notif_io);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 3/6] shared: Add support for disconnect handler in HFP
From: Marcel Holtmann @ 2014-02-12 18:47 UTC (permalink / raw)
To: Szymon Janc; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <92817127.UgR6P4lKdQ@leonov>
Hi Szymon,
>>> It is no longer possible to send any data after disconnection.
>>> Extra reference is taken for disconnect watch to allow users to drop
>>> own reference in disconnect callback.
>>
>> I am not sure that is the best way to do it. I get the feeling that we might
>> better have an internal bool that is tracking if we are
>> connected/disconnected. Thoughts?
>
> You mean don't have a public HFP disconnect handler and just fail on write()
> or use bool instead of io pointer for state tracking?
we should still have a disconnect handler. However we should not take these extra reference and have these extra checks for something.
I rather see us tracking the actual state of the IO and not trying to reference count our way into something insane. It is dangerous to have to many indirect reference counts.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 4/6] shared: Add support for shutdown to IO
From: Marcel Holtmann @ 2014-02-12 18:45 UTC (permalink / raw)
To: Szymon Janc; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <4170119.cK3WpejJYp@leonov>
Hi Szymon,
>>> This allows to locally shutdown IO.
>>> ---
>>> src/shared/io-glib.c | 9 +++++++++
>>> src/shared/io-mainloop.c | 9 +++++++++
>>> src/shared/io.h | 2 ++
>>> 3 files changed, 20 insertions(+)
>>>
>>> diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
>>> index a4f982d..8290745 100644
>>> --- a/src/shared/io-glib.c
>>> +++ b/src/shared/io-glib.c
>>>
>>> @@ -320,3 +320,12 @@ done:
>>> return true;
>>>
>>> }
>>> +
>>> +bool io_shutdown(struct io *io)
>>> +{
>>> + if (!io || !io->channel)
>>> + return false;
>>> +
>>> + return g_io_channel_shutdown(io->channel, TRUE, NULL)
>>> + == G_IO_STATUS_NORMAL;
>>> +}
>>> diff --git a/src/shared/io-mainloop.c b/src/shared/io-mainloop.c
>>> index 14ab128..f1e3b3b 100644
>>> --- a/src/shared/io-mainloop.c
>>> +++ b/src/shared/io-mainloop.c
>>> @@ -26,6 +26,7 @@
>>> #endif
>>>
>>> #include <unistd.h>
>>> +#include <sys/socket.h>
>>>
>>> #include "monitor/mainloop.h"
>>> #include "src/shared/util.h"
>>> @@ -294,3 +295,11 @@ bool io_set_disconnect_handler(struct io *io,
>>> io_callback_func_t callback,>
>>> return true;
>>>
>>> }
>>> +
>>> +bool io_shutdown(struct io *io)
>>> +{
>>> + if (!io || io->fd < 0)
>>> + return false;
>>> +
>>> + return shutdown(io->fd, SHUT_RDWR) == 0;
>>> +}
>>
>> I have no problem doing this, but why is this actually needed? Is not
>> closing the socket good enough? Or would be better also add a
>> shutdown_on_unref option?
>
> This is to allow to read from the socket in case there is some data already
> received (FWIW). I also plan to add 'flush' or similar flag to it to allow
> graceful disconnect i.e. make something like this work as expected
>
> hfp_gw_send_result(device.gw, HFP_RESULT_ERROR);
> hfp_gw_disconnect(device.gw);
>
> but this can be added later on if needed and we could go with close() for now
> as you suggested.
then lets just go with io_shutdown() for now. We can change this at any time once we know what other users really need. In the long run I want everything in android/ use the IO framework.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 1/6] shared: Add support for disonnect handler to GLib based IO handling
From: Szymon Janc @ 2014-02-12 18:42 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <D4957F12-AE54-43F2-A9EE-859676DE055E@holtmann.org>
Hi Marcel,
On Tuesday 11 of February 2014 08:57:25 Marcel Holtmann wrote:
> Hi Szymon,
>
> > ---
> > src/shared/io-glib.c | 59
> > +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58
> > insertions(+), 1 deletion(-)
> >
> > diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
> > index 77ba19e..a4f982d 100644
> > --- a/src/shared/io-glib.c
> > +++ b/src/shared/io-glib.c
> > @@ -40,6 +40,10 @@ struct io {
> >
> > io_callback_func_t write_callback;
> > io_destroy_func_t write_destroy;
> > void *write_data;
> >
> > + guint disconnect_watch;
> > + io_callback_func_t disconnect_callback;
> > + io_destroy_func_t disconnect_destroy;
> > + void *disconnect_data;
> > };
> >
> > static struct io *io_ref(struct io *io)
> >
> > @@ -258,8 +262,61 @@ done:
> > return true;
> >
> > }
> >
> > +static void disconnect_watch_destroy(gpointer user_data)
> > +{
> > + struct io *io = user_data;
> > +
> > + if (io->disconnect_destroy)
> > + io->disconnect_destroy(io->disconnect_data);
> > +
> > + io->disconnect_watch = 0;
> > + io->disconnect_callback = NULL;
> > + io->disconnect_destroy = NULL;
> > + io->disconnect_data = NULL;
> > +
> > + io_unref(io);
> > +}
> > +
> > +static gboolean disconnect_callback(GIOChannel *channel, GIOCondition
> > cond, + gpointer user_data)
> > +{
> > + struct io *io = user_data;
> > + bool result;
> > +
> > + if (io->disconnect_callback)
> > + result = io->disconnect_callback(io, io->disconnect_data);
> > + else
> > + result = false;
> > +
> > + return result ? TRUE : FALSE;
> > +}
> > +
> > bool io_set_disconnect_handler(struct io *io, io_callback_func_t callback,
> >
> > void *user_data, io_destroy_func_t destroy)
> >
> > {
> > - return false;
> > + if (!io)
> > + return false;
> > +
> > + if (io->disconnect_watch > 0) {
> > + g_source_remove(io->disconnect_watch);
> > + io->disconnect_watch = 0;
> > + }
> > +
> > + if (!callback)
> > + goto done;
> > +
> > + io->disconnect_watch = g_io_add_watch_full(io->channel,
> > + G_PRIORITY_DEFAULT,
> > + G_IO_HUP | G_IO_ERR | G_IO_NVAL,
>
> If we are using G_IO_HUP here, we should remove it from the other callback
> handling?
We should, will fix that in next version.
> > + disconnect_callback, io_ref(io),
> > + disconnect_watch_destroy);
> > + if (io->disconnect_watch == 0)
> > + return false;
> > +
> > + io->disconnect_destroy = destroy;
> > + io->disconnect_data = user_data;
>
> we normally have an extra empty line here. You might also fix the previous
> patch then.
I'll fix that as well.
> > +done:
> > + io->disconnect_callback = callback;
> > +
> > + return true;
> > }
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH 3/6] shared: Add support for disconnect handler in HFP
From: Szymon Janc @ 2014-02-12 18:40 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <FB263FEA-C682-448B-9DE4-D289CDDBDB5C@holtmann.org>
Hi Marcel,
On Tuesday 11 of February 2014 09:00:27 Marcel Holtmann wrote:
> Hi Szymon,
>
> > It is no longer possible to send any data after disconnection.
> > Extra reference is taken for disconnect watch to allow users to drop
> > own reference in disconnect callback.
>
> I am not sure that is the best way to do it. I get the feeling that we might
> better have an internal bool that is tracking if we are
> connected/disconnected. Thoughts?
You mean don't have a public HFP disconnect handler and just fail on write()
or use bool instead of io pointer for state tracking?
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH 4/6] shared: Add support for shutdown to IO
From: Szymon Janc @ 2014-02-12 18:38 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <301FB290-56A1-404A-9A79-62F360D9DA9A@holtmann.org>
Hi Marcel,
On Tuesday 11 of February 2014 09:02:15 Marcel Holtmann wrote:
> Hi Szymon,
>
> > This allows to locally shutdown IO.
> > ---
> > src/shared/io-glib.c | 9 +++++++++
> > src/shared/io-mainloop.c | 9 +++++++++
> > src/shared/io.h | 2 ++
> > 3 files changed, 20 insertions(+)
> >
> > diff --git a/src/shared/io-glib.c b/src/shared/io-glib.c
> > index a4f982d..8290745 100644
> > --- a/src/shared/io-glib.c
> > +++ b/src/shared/io-glib.c
> >
> > @@ -320,3 +320,12 @@ done:
> > return true;
> >
> > }
> > +
> > +bool io_shutdown(struct io *io)
> > +{
> > + if (!io || !io->channel)
> > + return false;
> > +
> > + return g_io_channel_shutdown(io->channel, TRUE, NULL)
> > + == G_IO_STATUS_NORMAL;
> > +}
> > diff --git a/src/shared/io-mainloop.c b/src/shared/io-mainloop.c
> > index 14ab128..f1e3b3b 100644
> > --- a/src/shared/io-mainloop.c
> > +++ b/src/shared/io-mainloop.c
> > @@ -26,6 +26,7 @@
> > #endif
> >
> > #include <unistd.h>
> > +#include <sys/socket.h>
> >
> > #include "monitor/mainloop.h"
> > #include "src/shared/util.h"
> > @@ -294,3 +295,11 @@ bool io_set_disconnect_handler(struct io *io,
> > io_callback_func_t callback,>
> > return true;
> >
> > }
> > +
> > +bool io_shutdown(struct io *io)
> > +{
> > + if (!io || io->fd < 0)
> > + return false;
> > +
> > + return shutdown(io->fd, SHUT_RDWR) == 0;
> > +}
>
> I have no problem doing this, but why is this actually needed? Is not
> closing the socket good enough? Or would be better also add a
> shutdown_on_unref option?
This is to allow to read from the socket in case there is some data already
received (FWIW). I also plan to add 'flush' or similar flag to it to allow
graceful disconnect i.e. make something like this work as expected
hfp_gw_send_result(device.gw, HFP_RESULT_ERROR);
hfp_gw_disconnect(device.gw);
but this can be added later on if needed and we could go with close() for now
as you suggested.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH BlueZ 1/9] android/hal-ipc-api: Add Get Play Status Response
From: Szymon Janc @ 2014-02-12 18:29 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Wednesday 12 of February 2014 16:48:06 Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
>
> ---
> android/hal-ipc-api.txt | 30 +++++++++++++++++++++++++++++-
> android/hal-msg.h | 16 ++++++++++++++++
> 2 files changed, 45 insertions(+), 1 deletion(-)
>
> diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
> index ad5d192..01c2e81 100644
> --- a/android/hal-ipc-api.txt
> +++ b/android/hal-ipc-api.txt
> @@ -1174,7 +1174,35 @@ Bluetooth Remote Control HAL (ID 8)
> Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
>
> Opcode 0x00 - Error response
> - Opcode 0x01 - Get Play Status command/response
> +
> + Response parameters: Status (1 octet)
> +
> + Valid status values: 0x01 = Fail
> + 0x02 = Not ready
> + 0x03 = No memory
> + 0x04 = Busy
> + 0x05 = Done (already completed)
> + 0x06 = Unsupported
> + 0x07 = Parameter invalid
> + 0x08 = Unhandled
> + 0x09 = Authentication failure
> + 0x0a = Remote device down
> +
> + Opcode 0x01 - Get Play Status Response command/response
> +
> + Command parameters: Status (1 octet)
> + Duration (4 octets)
> + Position (4 octets)
> +
> + In case of an error, the error response will be returned.
> +
> + Valid status values: 0x00 = Stopped
> + 0x01 = Playing
> + 0x02 = Paused
> + 0x03 = Fwd seek
> + 0x04 = Rev seek
> + 0xff = Error
> +
> Opcode 0x02 - List Player Application Attributes command/response
> Opcode 0x03 - List Player Application Values command/response
> Opcode 0x04 - Get Player Application Values command/response
> diff --git a/android/hal-msg.h b/android/hal-msg.h
> index 6ef00f9..82cd3f5 100644
> --- a/android/hal-msg.h
> +++ b/android/hal-msg.h
> @@ -783,3 +783,19 @@ struct hal_ev_handsfree_unknown_at {
> } __attribute__((packed));
>
> #define HAL_EV_HANDSFREE_HSP_KEY_PRESS 0x90
> +
> +/* AVRCP HAL API */
> +
> +#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
> +#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
> +#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
> +#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
> +#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
> +#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
> +
> +#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
> +struct hal_cmd_avrcp_get_play_status {
> + uint8_t status;
> + uint32_t duration;
> + uint32_t position;
> +} __attribute__((packed));
All patches in this set have been applied, thanks.
--
BR
Szymon Janc
^ permalink raw reply
* [PATCH BlueZ 9/9] android/hal-ipc-api: Add Register Notification Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 19 ++++++++++++++++++-
android/hal-msg.h | 18 ++++++++++++++++++
2 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index b977957..c1609c9 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1281,7 +1281,24 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid status values: Same as in Get Play Status Response
- Opcode 0x09 - Register Notification command/response
+ Opcode 0x09 - Register Notification Response command/response
+
+ Command parameters: Event (1 octet)
+ Type (1 octet)
+ Data length (1 octet)
+ Data (variable)
+
+ In case of an error, the error response will be returned.
+
+ Valid event values: 0x01 = Status Changed
+ 0x02 = Track Changed
+ 0x03 = Track Reached End
+ 0x04 = Track Reached Start
+ 0x05 = Position Changed
+ 0x08 = Setting Changed
+
+ Valid type values : 0x00 = Interim
+ 0x01 = Changed
Opcode 0x81 - Get Play Status notification
Opcode 0x82 - List Player Application Attributes notification
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 42b08cd..ca1f6b5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -863,3 +863,21 @@ struct hal_cmd_avrcp_get_element_attrs_text {
struct hal_cmd_avrcp_set_player_attrs_value {
uint8_t status;
} __attribute__((packed));
+
+#define HAL_AVRCP_EVENT_STATUS_CHANGED 0x01
+#define HAL_AVRCP_EVENT_TRACK_CHANGED 0x02
+#define HAL_AVRCP_EVENT_TRACK_REACHED_END 0x03
+#define HAL_AVRCP_EVENT_TRACK_REACHED_START 0x04
+#define HAL_AVRCP_EVENT_POSITION_CHANGED 0x05
+#define HAL_AVRCP_EVENT_SETTING_CHANGED 0x08
+
+#define HAL_AVRCP_EVENT_TYPE_INTERIM 0x00
+#define HAL_AVRCP_EVENT_TYPE_CHANGED 0x01
+
+#define HAL_OP_AVRCP_REGISTER_NOTIFICATION 0x09
+struct hal_cmd_avrcp_register_notification {
+ uint8_t event;
+ uint8_t type;
+ uint8_t len;
+ uint8_t data[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 8/9] android/hal-ipc-api: Add Set Player Attributes Value Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 8 ++++++++
android/hal-msg.h | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 7c90928..b977957 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1273,6 +1273,14 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
0x06 = Genre
0x06 = Duration
+ Opcode 0x08 - Set Player Attributes Value Response command/response
+
+ Command parameters: Status (1 octet)
+
+ In case of an error, the error response will be returned.
+
+ Valid status values: Same as in Get Play Status Response
+
Opcode 0x09 - Register Notification command/response
Opcode 0x81 - Get Play Status notification
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 9f3c2a1..42b08cd 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -858,3 +858,8 @@ struct hal_cmd_avrcp_get_element_attrs_text {
uint8_t number;
struct hal_avrcp_player_setting_text values[0];
} __attribute__((packed));
+
+#define HAL_OP_AVRCP_SET_PLAYER_ATTRS_VALUE 0x08
+struct hal_cmd_avrcp_set_player_attrs_value {
+ uint8_t status;
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 7/9] android/hal-ipc-api: Add Get Element Attributes Text Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 19 +++++++++++++++++--
android/hal-msg.h | 14 ++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index c8f5557..7c90928 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1256,8 +1256,23 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
In case of an error, the error response will be returned.
- Opcode 0x07 - Get Element Attributes Text command/response
- Opcode 0x08 - Set Player Attributes Value command/response
+ Opcode 0x07 - Get Element Attributes Text Response command/response
+
+ Command parameters: Number of elements (1 octet)
+ Element # (1 octet)
+ Element # text (255 octets)
+ ...
+
+ In case of an error, the error response will be returned.
+
+ Valid elements: 0x01 = Title
+ 0x02 = Artist
+ 0x03 = Album
+ 0x04 = Track Number
+ 0x05 = Number of Tracks
+ 0x06 = Genre
+ 0x06 = Duration
+
Opcode 0x09 - Register Notification command/response
Opcode 0x81 - Get Play Status notification
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 280c28c..9f3c2a1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -844,3 +844,17 @@ struct hal_cmd_avrcp_get_player_values_text {
uint8_t number;
struct hal_avrcp_player_setting_text values[0];
} __attribute__((packed));
+
+#define HAL_AVRCP_MEDIA_ATTR_TITLE 0x01
+#define HAL_AVRCP_MEDIA_ATTR_ARTIST 0x02
+#define HAL_AVRCP_MEDIA_ATTR_ALBUM 0x03
+#define HAL_AVRCP_MEDIA_ATTR_TRACK_NUM 0x04
+#define HAL_AVRCP_MEDIA_ATTR_NUM_TRACKS 0x05
+#define HAL_AVRCP_MEDIA_ATTR_GENRE 0x06
+#define HAL_AVRCP_MEDIA_ATTR_DURATION 0x07
+
+#define HAL_OP_AVRCP_GET_ELEMENT_ATTRS_TEXT 0x07
+struct hal_cmd_avrcp_get_element_attrs_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text values[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 6/9] android/hal-ipc-api: Add Get Player Values Text Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 10 +++++++++-
android/hal-msg.h | 6 ++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 496851c..c8f5557 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1247,7 +1247,15 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attributes: Same as in List Player Attributes
- Opcode 0x06 - Get Player Application Values Text command/response
+ Opcode 0x06 - Get Player Values Text Response command/response
+
+ Command parameters: Number of values (1 octet)
+ Value # (1 octet)
+ Value # text (255 octets)
+ ...
+
+ In case of an error, the error response will be returned.
+
Opcode 0x07 - Get Element Attributes Text command/response
Opcode 0x08 - Set Player Attributes Value command/response
Opcode 0x09 - Register Notification command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 2891a3a..280c28c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -838,3 +838,9 @@ struct hal_cmd_avrcp_get_player_attrs_text {
uint8_t number;
struct hal_avrcp_player_setting_text attrs[0];
} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_VALUES_TEXT 0x06
+struct hal_cmd_avrcp_get_player_values_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text values[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 5/9] android/hal-ipc-api: Add Get Player Attributes Text Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 13 ++++++++++++-
android/hal-msg.h | 11 +++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 27060d5..496851c 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1235,7 +1235,18 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Valid attributes: Same as in List Player Attributes
- Opcode 0x05 - Get Player Application Attributes Text command/response
+ Opcode 0x05 - Get Player Attributes Text Response command/response
+
+ Command parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ Attribute # text length (1 octet)
+ Attribute # text (variable)
+ ...
+
+ In case of an error, the error response will be returned.
+
+ Valid attributes: Same as in List Player Attributes
+
Opcode 0x06 - Get Player Application Values Text command/response
Opcode 0x07 - Get Element Attributes Text command/response
Opcode 0x08 - Set Player Attributes Value command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 753f5a3..2891a3a 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -827,3 +827,14 @@ struct hal_cmd_avrcp_get_player_attrs {
uint8_t number;
struct hal_avrcp_player_attr_value attrs[0];
} __attribute__((packed));
+
+struct hal_avrcp_player_setting_text {
+ uint8_t id;
+ uint8_t text[255];
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_ATTRS_TEXT 0x05
+struct hal_cmd_avrcp_get_player_attrs_text {
+ uint8_t number;
+ struct hal_avrcp_player_setting_text attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 4/9] android/hal-ipc-api: Add Get Player Attributes Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 12 +++++++++++-
android/hal-msg.h | 11 +++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 2e4ecbe..27060d5 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1224,7 +1224,17 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
In case of an error, the error response will be returned.
- Opcode 0x04 - Get Player Application Values command/response
+ Opcode 0x04 - Get Player Values Response command/response
+
+ Command parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ Value # (1 octet)
+ ...
+
+ In case of an error, the error response will be returned.
+
+ Valid attributes: Same as in List Player Attributes
+
Opcode 0x05 - Get Player Application Attributes Text command/response
Opcode 0x06 - Get Player Application Values Text command/response
Opcode 0x07 - Get Element Attributes Text command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 2dcdafc..753f5a3 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -816,3 +816,14 @@ struct hal_cmd_avrcp_list_player_values {
uint8_t number;
uint8_t values[0];
} __attribute__((packed));
+
+struct hal_avrcp_player_attr_value {
+ uint8_t attr;
+ uint8_t value;
+} __attribute__((packed));
+
+#define HAL_OP_AVRCP_GET_PLAYER_ATTRS 0x04
+struct hal_cmd_avrcp_get_player_attrs {
+ uint8_t number;
+ struct hal_avrcp_player_attr_value attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 3/9] android/hal-ipc-api: Add List Player Values Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 9 ++++++++-
android/hal-msg.h | 6 ++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index ae58fda..2e4ecbe 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1216,7 +1216,14 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
0x03 = Shuffle
0x04 = Scan
- Opcode 0x03 - List Player Application Values command/response
+ Opcode 0x03 - List Player Values Response command/response
+
+ Command parameters: Number of values (1 octet)
+ Value # (1 octet)
+ ...
+
+ In case of an error, the error response will be returned.
+
Opcode 0x04 - Get Player Application Values command/response
Opcode 0x05 - Get Player Application Attributes Text command/response
Opcode 0x06 - Get Player Application Values Text command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 4a438d1..2dcdafc 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -810,3 +810,9 @@ struct hal_cmd_avrcp_list_player_attrs {
uint8_t number;
uint8_t attrs[0];
} __attribute__((packed));
+
+#define HAL_OP_AVRCP_LIST_PLAYER_VALUES 0x03
+struct hal_cmd_avrcp_list_player_values {
+ uint8_t number;
+ uint8_t values[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 2/9] android/hal-ipc-api: Add List Player Attributes Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392216494-30885-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 14 +++++++++++++-
android/hal-msg.h | 11 +++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 01c2e81..ae58fda 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1203,7 +1203,19 @@ Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
0x04 = Rev seek
0xff = Error
- Opcode 0x02 - List Player Application Attributes command/response
+ Opcode 0x02 - List Player Attributes Response command/response
+
+ Command parameters: Number of attributes (1 octet)
+ Attribute # (1 octet)
+ ...
+
+ In case of an error, the error response will be returned.
+
+ Valid attributes: 0x01 = Equalizer
+ 0x02 = Repead
+ 0x03 = Shuffle
+ 0x04 = Scan
+
Opcode 0x03 - List Player Application Values command/response
Opcode 0x04 - Get Player Application Values command/response
Opcode 0x05 - Get Player Application Attributes Text command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 82cd3f5..4a438d1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -799,3 +799,14 @@ struct hal_cmd_avrcp_get_play_status {
uint32_t duration;
uint32_t position;
} __attribute__((packed));
+
+#define HAL_AVRCP_PLAYER_ATTR_EQUALIZER 0x01
+#define HAL_AVRCP_PLAYER_ATTR_REPEAT 0x02
+#define HAL_AVRCP_PLAYER_ATTR_SHUFFLE 0x03
+#define HAL_AVRCP_PLAYER_ATTR_SCAN 0x04
+
+#define HAL_OP_AVRCP_LIST_PLAYER_ATTRS 0x02
+struct hal_cmd_avrcp_list_player_attrs {
+ uint8_t number;
+ uint8_t attrs[0];
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* [PATCH BlueZ 1/9] android/hal-ipc-api: Add Get Play Status Response
From: Luiz Augusto von Dentz @ 2014-02-12 14:48 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-ipc-api.txt | 30 +++++++++++++++++++++++++++++-
android/hal-msg.h | 16 ++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index ad5d192..01c2e81 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1174,7 +1174,35 @@ Bluetooth Remote Control HAL (ID 8)
Android HAL name: "avrcp" (BT_PROFILE_AV_RC_ID)
Opcode 0x00 - Error response
- Opcode 0x01 - Get Play Status command/response
+
+ Response parameters: Status (1 octet)
+
+ Valid status values: 0x01 = Fail
+ 0x02 = Not ready
+ 0x03 = No memory
+ 0x04 = Busy
+ 0x05 = Done (already completed)
+ 0x06 = Unsupported
+ 0x07 = Parameter invalid
+ 0x08 = Unhandled
+ 0x09 = Authentication failure
+ 0x0a = Remote device down
+
+ Opcode 0x01 - Get Play Status Response command/response
+
+ Command parameters: Status (1 octet)
+ Duration (4 octets)
+ Position (4 octets)
+
+ In case of an error, the error response will be returned.
+
+ Valid status values: 0x00 = Stopped
+ 0x01 = Playing
+ 0x02 = Paused
+ 0x03 = Fwd seek
+ 0x04 = Rev seek
+ 0xff = Error
+
Opcode 0x02 - List Player Application Attributes command/response
Opcode 0x03 - List Player Application Values command/response
Opcode 0x04 - Get Player Application Values command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 6ef00f9..82cd3f5 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -783,3 +783,19 @@ struct hal_ev_handsfree_unknown_at {
} __attribute__((packed));
#define HAL_EV_HANDSFREE_HSP_KEY_PRESS 0x90
+
+/* AVRCP HAL API */
+
+#define HAL_AVRCP_PLAY_STATUS_STOPPED 0x00
+#define HAL_AVRCP_PLAY_STATUS_PLAYING 0x01
+#define HAL_AVRCP_PLAY_STATUS_PAUSED 0x02
+#define HAL_AVRCP_PLAY_STATUS_FWD_SEEK 0x03
+#define HAL_AVRCP_PLAY_STATUS_REV_SEEK 0x04
+#define HAL_AVRCP_PLAY_STATUS_ERROR 0xff
+
+#define HAL_OP_AVRCP_GET_PLAY_STATUS 0x01
+struct hal_cmd_avrcp_get_play_status {
+ uint8_t status;
+ uint32_t duration;
+ uint32_t position;
+} __attribute__((packed));
--
1.8.5.3
^ permalink raw reply related
* Re: [PATCH] android/socket: Fix wrong memory access
From: Szymon Janc @ 2014-02-12 14:24 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1392214396-2576-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
On Wednesday 12 of February 2014 16:13:16 Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> This fixes accessing proto[2] in the code.
> ---
> android/socket.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/socket.c b/android/socket.c
> index c62ca61..1551e9b 100644
> --- a/android/socket.c
> +++ b/android/socket.c
> @@ -190,7 +190,7 @@ static sdp_record_t *create_rfcomm_record(uint8_t chan,
> uuid_t *uuid, {
> sdp_list_t *svclass_id;
> sdp_list_t *seq, *proto_seq, *pbg_seq;
> - sdp_list_t *proto[2];
> + sdp_list_t *proto[3];
> uuid_t l2cap_uuid, rfcomm_uuid, obex_uuid, pbg_uuid;
> sdp_data_t *channel;
> sdp_record_t *record;
Pushed, thanks.
--
BR
Szymon Janc
^ permalink raw reply
* [PATCH] android: Fix memory leak: uuid free
From: Andrei Emeltchenko @ 2014-02-12 14:22 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Free uuid before exiting.
---
android/bluetooth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/android/bluetooth.c b/android/bluetooth.c
index 5de3401..b818e88 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -1557,6 +1557,8 @@ int bt_adapter_add_record(sdp_record_t *rec, uint8_t svc_hint)
sdp_uuid2strn(uuid, uuid_str, sizeof(uuid_str));
DBG("UUID %s already added", uuid_str);
+
+ bt_free(uuid);
return -EALREADY;
}
--
1.8.3.2
^ permalink raw reply related
* [PATCH] android/socket: Fix wrong memory access
From: Andrei Emeltchenko @ 2014-02-12 14:13 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
This fixes accessing proto[2] in the code.
---
android/socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/android/socket.c b/android/socket.c
index c62ca61..1551e9b 100644
--- a/android/socket.c
+++ b/android/socket.c
@@ -190,7 +190,7 @@ static sdp_record_t *create_rfcomm_record(uint8_t chan, uuid_t *uuid,
{
sdp_list_t *svclass_id;
sdp_list_t *seq, *proto_seq, *pbg_seq;
- sdp_list_t *proto[2];
+ sdp_list_t *proto[3];
uuid_t l2cap_uuid, rfcomm_uuid, obex_uuid, pbg_uuid;
sdp_data_t *channel;
sdp_record_t *record;
--
1.8.3.2
^ permalink raw reply related
* [RFCV2] android/avrcp: Decouple AVRCP logic from btio
From: Andrei Emeltchenko @ 2014-02-12 13:13 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <5637916.N4zjDhQ0cI@leonov>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
The patch makes AVRCP to be channel-agnostic so that it might be used in
unit tests. The idea is that all AVRCP logic would come to avrcp-lib and
channel stuff got to avrcp.
---
android/Android.mk | 1 +
android/Makefile.am | 1 +
android/avrcp-lib.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
android/avrcp-lib.h | 29 +++++++++++++++++++++++++
android/avrcp.c | 28 ++++++++++++++++--------
5 files changed, 112 insertions(+), 9 deletions(-)
create mode 100644 android/avrcp-lib.c
create mode 100644 android/avrcp-lib.h
diff --git a/android/Android.mk b/android/Android.mk
index 71d678b..fa9a86e 100644
--- a/android/Android.mk
+++ b/android/Android.mk
@@ -39,6 +39,7 @@ LOCAL_SRC_FILES := \
bluez/android/avdtp.c \
bluez/android/a2dp.c \
bluez/android/avctp.c \
+ bluez/android/avrcp-lib.c \
bluez/android/avrcp.c \
bluez/android/pan.c \
bluez/android/handsfree.c \
diff --git a/android/Makefile.am b/android/Makefile.am
index 1913b42..07cc851 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
@@ -36,6 +36,7 @@ android_bluetoothd_SOURCES = android/main.c \
android/avdtp.h android/avdtp.c \
android/a2dp.h android/a2dp.c \
android/avctp.h android/avctp.c \
+ android/avrcp-lib.h android/avrcp-lib.c \
android/avrcp.h android/avrcp.c \
android/socket.h android/socket.c \
android/pan.h android/pan.c \
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
new file mode 100644
index 0000000..080e37a
--- /dev/null
+++ b/android/avrcp-lib.c
@@ -0,0 +1,62 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdbool.h>
+#include <glib.h>
+
+#include "lib/bluetooth.h"
+
+#include "src/log.h"
+
+#include "avctp.h"
+#include "avrcp-lib.h"
+
+void avrcp_free(void *data)
+{
+ struct avrcp *session = data;
+
+ if (session->session)
+ avctp_shutdown(session->session);
+
+ g_free(session);
+}
+
+struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu,
+ uint16_t version)
+{
+ struct avrcp *session;
+
+ session = g_new0(struct avrcp, 1);
+
+ session->session = avctp_new(fd, imtu, omtu, version);
+ if (!session->session) {
+ g_free(session);
+ return NULL;
+ }
+
+ return session;
+}
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
new file mode 100644
index 0000000..f1dbf0d
--- /dev/null
+++ b/android/avrcp-lib.h
@@ -0,0 +1,29 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2014 Intel Corporation. All rights reserved.
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+struct avrcp {
+ struct avctp *session;
+};
+
+struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version);
+void avrcp_free(void *data);
diff --git a/android/avrcp.c b/android/avrcp.c
index b8304f5..3d3e323 100644
--- a/android/avrcp.c
+++ b/android/avrcp.c
@@ -38,6 +38,7 @@
#include "hal-msg.h"
#include "ipc.h"
#include "avctp.h"
+#include "avrcp-lib.h"
#define L2CAP_PSM_AVCTP 0x17
@@ -53,7 +54,7 @@ static GIOChannel *server = NULL;
struct avrcp_device {
bdaddr_t dst;
- struct avctp *session;
+ struct avrcp *session;
GIOChannel *io;
};
@@ -133,7 +134,7 @@ static void avrcp_device_free(void *data)
struct avrcp_device *dev = data;
if (dev->session)
- avctp_shutdown(dev->session);
+ avrcp_free(dev->session);
if (dev->io) {
g_io_channel_shutdown(dev->io, FALSE, NULL);
@@ -168,6 +169,17 @@ static int device_cmp(gconstpointer s, gconstpointer user_data)
return bacmp(&dev->dst, dst);
}
+static struct avrcp_device *avrcp_find(const bdaddr_t *dst)
+{
+ GSList *l;
+
+ l = g_slist_find_custom(devices, dst, device_cmp);
+ if (!l)
+ return NULL;
+
+ return l->data;
+}
+
static void disconnect_cb(void *data)
{
struct avrcp_device *dev = data;
@@ -222,17 +234,17 @@ static void connect_cb(GIOChannel *chan, GError *err, gpointer user_data)
}
fd = g_io_channel_unix_get_fd(chan);
- dev->session = avctp_new(fd, imtu, omtu, 0x0100);
+ dev->session = avrcp_new(fd, imtu, omtu, 0x0100);
if (!dev->session) {
avrcp_device_free(dev);
return;
}
- avctp_set_destroy_cb(dev->session, disconnect_cb, dev);
+ avctp_set_destroy_cb(dev->session->session, disconnect_cb, dev);
/* FIXME: get the real name of the device */
- avctp_init_uinput(dev->session, "bluetooth", address);
+ avctp_init_uinput(dev->session->session, "bluetooth", address);
g_io_channel_set_close_on_unref(chan, FALSE);
@@ -331,12 +343,10 @@ void bt_avrcp_connect(const bdaddr_t *dst)
{
struct avrcp_device *dev;
char addr[18];
- GSList *l;
DBG("");
- l = g_slist_find_custom(devices, dst, device_cmp);
- if (l)
+ if (avrcp_find(dst))
return;
dev = avrcp_device_new(dst);
@@ -363,7 +373,7 @@ void bt_avrcp_disconnect(const bdaddr_t *dst)
dev = l->data;
if (dev->session) {
- avctp_shutdown(dev->session);
+ avrcp_free(dev->session);
return;
}
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH v2] android/README: Update with implementation status summary
From: Szymon Janc @ 2014-02-12 13:00 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392115207-14297-1-git-send-email-szymon.janc@tieto.com>
Hi,
On Tuesday 11 of February 2014 11:40:07 Szymon Janc wrote:
> This will give a better overview of implemented features.
> ---
> android/README | 38 +++++++++++++++++++++++++++++++++-----
> 1 file changed, 33 insertions(+), 5 deletions(-)
>
> diff --git a/android/README b/android/README
> index e3c314f..b987dc9 100644
> --- a/android/README
> +++ b/android/README
> @@ -132,15 +132,43 @@ automatically on HAL library initialization. To
> deinitialize HAL library and stop daemon type 'bluetooth cleanup'. Type
> 'help' for more information. Tab completion is also supported.
>
> +=====================
> +Implementation status
> +=====================
> +
> +Summary of HALs implementation status.
> +
> +complete - implementation is feature complete and Android Framework is
> able + to use it normally
> +partial - implementation is in progress and not all required features
> are + present, Android Framework is able to use some of
> features +initial - only initial implementations is present, Android
> Framework is + able to initialize but most likely not able to
> use it +not started - no implementation, Android Framework is not able to
> initialize it +
> +Profile ID HAL header Status
> +---------------------------------------
> +core bluetooth.h complete
> +a2dp bt_av.h complete
> +gatt bt_gatt.h not started
> + bt_gatt_client.h not started
> + bt_gatt_server.h not started
> +handsfree bt_hf.h initial
> +hidhost bt_hh.h complete
> +health bt_hl.h not started
> +pan bt_pan.h complete
> +avrcp bt_rc.h partial
> +socket bt_sock.h partial
> +
> ===========================
> Implementation shortcomings
> ===========================
>
> -It is possible that some of HAL functionality is missing implementation due
> to -reasons like feature feasibility or necessity for latest Android
> Framework. -This sections provides list of such deficiencies. Note that HAL
> library is -always expected to fully implement HAL API so missing
> implementation might -happen only in daemon.
> +It is possible that some of HAL functionality (although being marked as
> +complete) is missing implementation due to reasons like feature feasibility
> or +necessity for latest Android Framework. This sections provides list of
> such +deficiencies. Note that HAL library is always expected to fully
> implement HAL +API so missing implementation might happen only in daemon.
>
> HAL Bluetooth
> =============
Pushed.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH 00/11] Socket HAL updates
From: Szymon Janc @ 2014-02-12 12:55 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: Andrzej Kaczmarek, linux-bluetooth
In-Reply-To: <20140212095739.GA25950@aemeltch-MOBL1>
Hi Andrei,
On Wednesday 12 of February 2014 11:57:41 Andrei Emeltchenko wrote:
> Hi Andrzej,
>
> On Tue, Feb 11, 2014 at 05:58:10PM +0100, Andrzej Kaczmarek wrote:
> > Hi,
> >
> > Current socket HAL implementation is missing major feature which is
> > ability to register RFCOMM server from application (so use some UUID
> > and assign channel number dynamically). This corresponds to
> > BluetoothAdapter::listenUsing(insecure)RfcommWithServiceRecord APIs
> > in Android.
>
> Support dynamic RFCOMM sockets looks god though I do not know why renaming
> of socket names is really needed.
I find new names a bit easier to understand and this is now applied.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH 00/11] Socket HAL updates
From: Szymon Janc @ 2014-02-12 12:54 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1392137901-3403-1-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
On Tuesday 11 of February 2014 17:58:10 Andrzej Kaczmarek wrote:
> Hi,
>
> Current socket HAL implementation is missing major feature which is
> ability to register RFCOMM server from application (so use some UUID
> and assign channel number dynamically). This corresponds to
> BluetoothAdapter::listenUsing(insecure)RfcommWithServiceRecord APIs
> in Android.
>
> This series of patches adds this feature with other required fixes
> and also some does some minor refactoring.
>
> Andrzej Kaczmarek (11):
> android/bluetooth: Handle 128-bit UUIDs
> android/socket: Refactor socket related symbol names
> android/socket: Improve logging
> android/socket: Simplify SDP records handling
> android/socket: Make servers list as static array
> android/tester: Update test data
> android/socket: Add support for dynamic channel numbers
> android/socket: Register SDP record for application service
> android/socket: Include HF AG in built-in profiles
> android/socket: Update channel numbers
> android/socket: Fix sockets security
>
> android/android-tester.c | 2 +-
> android/bluetooth.c | 61 ++---
> android/hal-msg.h | 3 +
> android/socket.c | 658
> +++++++++++++++++++++++------------------------ 4 files changed, 349
> insertions(+), 375 deletions(-)
All patches in this set are now upstream, thanks a lot.
--
BR
Szymon Janc
^ permalink raw reply
* Re: [PATCH BlueZ 1/7] android: Use 16-bit UUID for SDP search
From: Szymon Janc @ 2014-02-12 12:17 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: Luiz Augusto von Dentz, linux-bluetooth@vger.kernel.org
In-Reply-To: <CAJdJm_P3caDzXXttQUvkoeo3pSaWaiuJ4G0B1gbwfw0uwfDD3A@mail.gmail.com>
Hi Anderson,
On Wednesday 12 of February 2014 07:28:24 Anderson Lizardo wrote:
> Hi Szymon,
>
> On Wed, Feb 12, 2014 at 6:59 AM, Szymon Janc <szymon.janc@tieto.com> wrote:
> >> Applied all except 6/7, I think we should probably return an error if
> >> there is an attempt to register a service out of range, then the
> >> caller can assert so we can have a proper test for it that expect an
> >> error in such case.
> >
> > Well, currently IPC depends on hal-msg.h which defines max allowed service
> > ID and using something bigger is a code bug. We could have make IPC
> > independent of hal-msg.h and just verify registered ID in runtime but
> > that would add extra code for each caller with no profit as IDs are fixed
> > anyway.
>
> Personally, I don't have strong opinions on using assert() versus
> raise(SIGTERM) (which is how runtime error conditions seem to be
> handled). Initially I went with raise(SIGTERM), but then I noticed the
> IDs are statically defined, and there is no way to give a invalid ID
> to ipc_register(), unless due to programming error (for which
> assert() is ideal, due to low overhead and no introduction of dead
> code).
>
> That said, this patch is not critical, but only a check so future
> users of ipc_register() don't reintroduce a similar crash fixed by the
> other commit.
>
> > That test fix is invalid as we actually want to test if IPC handles
> > out-of-
> > bound service ID correctly (when receiving register command).
> > And I'm not sure why this actually was causing any problems since that
> > test is not registering handlers for out-of-bound service ID, just sends
> > ipc message with such ID.
>
> I forgot to clarify this on the commit message: the "out of bound"
> service ID is still passed on the IPC message. What I fixed is the
> service ID field used solely for registering the handlers (i.e. passed
> to ipc_register()). If you check the changed struct, there is another
> field for the IPC headers where there is still the expected (out of
> bound) ID.
>
> In the current format, ipc_register() must not receive an "out of
> bound" ID otherwise memory corruptions occur, which introduces subtle
> bugs (in my case the crash happened in very specific compilation
> parameters and valgrind didn't help because the corrupted structures
> were static).
Yes, I was looking at service ID in wrong line. This seems ok now.
--
BR
Szymon Janc
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox