* [PATCH BlueZ 8/8] unit/test-avrcp: Add /TP/MPS/BI-02-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the SetBrowsedPlayer response issued by the TG when an invalid
player is requested.
---
unit/test-avrcp.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 18a8785..128ab00 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -607,13 +607,19 @@ static int set_addressed(struct avrcp *session, uint8_t transaction,
static int set_browsed(struct avrcp *session, uint8_t transaction,
uint16_t id, void *user_data)
{
+ struct context *context = user_data;
const char *folders[1] = { "Filesystem" };
DBG("");
- avrcp_set_browsed_player_rsp(session, transaction,
- AVRCP_STATUS_SUCCESS, 0xabcd, 0, 1,
- folders);
+ if (g_str_equal(context->data->test_name, "/TP/MPS/BI-02-C"))
+ avrcp_set_browsed_player_rsp(session, transaction,
+ AVRCP_STATUS_INVALID_PLAYER_ID,
+ 0, 0, 0, NULL);
+ else
+ avrcp_set_browsed_player_rsp(session, transaction,
+ AVRCP_STATUS_SUCCESS,
+ 0xabcd, 0, 1, folders);
return -EAGAIN;
}
@@ -991,6 +997,13 @@ int main(int argc, char *argv[])
AVRCP_SET_ADDRESSED_PLAYER,
0x00, 0x00, 0x01, 0x11));
+ /* SetBrowsedPlayer - TG */
+ define_test("/TP/MPS/BI-02-C", test_server,
+ brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
+ 0xab, 0xcd),
+ brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x01,
+ 0x11));
+
/*
* Media Content Navigation Commands and Notifications for Content
* Browsing.
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 7/8] unit/test-avrcp: Add /TP/MPS/BI-01-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the SetAddressedPlayer response issued by the TG when an
invalid player is requested.
---
unit/test-avrcp.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index a0cb685..18a8785 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -589,11 +589,17 @@ static int set_volume(struct avrcp *session, uint8_t transaction,
static int set_addressed(struct avrcp *session, uint8_t transaction,
uint16_t id, void *user_data)
{
+ struct context *context = user_data;
+ uint8_t status;
+
DBG("");
+ if (g_str_equal(context->data->test_name, "/TP/MPS/BI-01-C"))
+ status = AVRCP_STATUS_INVALID_PLAYER_ID;
+ else
+ status = AVRCP_STATUS_SUCCESS;
- avrcp_set_addressed_player_rsp(session, transaction,
- AVRCP_STATUS_SUCCESS);
+ avrcp_set_addressed_player_rsp(session, transaction, status);
return -EAGAIN;
}
@@ -975,6 +981,16 @@ int main(int argc, char *argv[])
brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
+ /* SetAddressedPlayer - TG */
+ define_test("/TP/MPS/BI-01-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x00, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_SET_ADDRESSED_PLAYER,
+ 0x00, 0x00, 0x02, 0xab, 0xcd),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_STABLE,
+ 0x48, 0x00, 0x00, 0x19, 0x58,
+ AVRCP_SET_ADDRESSED_PLAYER,
+ 0x00, 0x00, 0x01, 0x11));
+
/*
* Media Content Navigation Commands and Notifications for Content
* Browsing.
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 6/8] unit/test-avrcp: Add /TP/MPS/BV-07-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the AvailablePlayersChanged Notification issued by the TG.
---
unit/test-avrcp.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 72e75c3..a0cb685 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -552,6 +552,10 @@ static int register_notification(struct avrcp *session, uint8_t transaction,
data = settings;
len = sizeof(settings);
break;
+ case AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED:
+ data = NULL;
+ len = 0;
+ break;
case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
player[0] = 0x0001;
player[1] = 0xabcd;
@@ -940,6 +944,19 @@ int main(int argc, char *argv[])
brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
+ /* AvailablePlayersChanged Notification – TG */
+ define_test("/TP/MPS/BV-07-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, 0x0a,
+ 0x00, 0x00, 0x00, 0x00),
+ frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x01, 0x0a),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x01, 0x0a));
+
/* GetFolderItems - CT */
define_test("/TP/MPS/BV-08-C", test_client,
brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 5/8] unit/test-avrcp: Add /TP/MPS/BV-06-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the PlayerFeatureBitmask issued by the TG.
---
unit/test-avrcp.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 7998976..72e75c3 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -727,17 +727,39 @@ static void test_server(gconstpointer data)
execute_context(context);
}
+static void get_folder_items_rsp(struct avrcp *session, int err,
+ uint16_t counter, uint16_t number,
+ uint8_t *params, void *user_data)
+{
+ struct context *context = user_data;
+
+ DBG("");
+
+ g_assert_cmpint(err, ==, 0);
+ g_assert_cmpint(counter, ==, 0xabcd);
+ g_assert_cmpint(number, ==, 0);
+
+ context_quit(context);
+}
+
+static const struct avrcp_control_cfm control_cfm = {
+ .get_folder_items = get_folder_items_rsp,
+};
+
static void test_client(gconstpointer data)
{
struct context *context = create_context(0x0100, data);
+ avrcp_register_player(context->session, NULL, &control_cfm, context);
+
if (g_str_equal(context->data->test_name, "/TP/MPS/BV-01-C"))
avrcp_set_addressed_player(context->session, 0xabcd);
if (g_str_equal(context->data->test_name, "/TP/MPS/BV-03-C"))
avrcp_set_browsed_player(context->session, 0xabcd);
- if (g_str_equal(context->data->test_name, "/TP/MPS/BV-08-C"))
+ if (g_str_equal(context->data->test_name, "/TP/MPS/BV-06-C") ||
+ g_str_equal(context->data->test_name, "/TP/MPS/BV-08-C"))
avrcp_get_folder_items(context->session,
AVRCP_MEDIA_PLAYER_LIST, 0, 2, 0, NULL);
@@ -909,6 +931,16 @@ int main(int argc, char *argv[])
0x01, 0x00, 0xcd, 0xab));
/* GetFolderItems - CT */
+ define_test("/TP/MPS/BV-06-C", test_client,
+ brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
+ 0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
+ 0x00, 0x00, 0x00, 0x00, /* start */
+ 0x00, 0x00, 0x00, 0x02, /* end */
+ 0x00),
+ brs_pdu(0x02, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
+ 0x00, 0x05, 0x04, 0xab, 0xcd, 0x00, 0x00));
+
+ /* GetFolderItems - CT */
define_test("/TP/MPS/BV-08-C", test_client,
brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
0x00, 0x0a, AVRCP_MEDIA_PLAYER_LIST,
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 4/8] unit/test-avrcp: Add /TP/MPS/BV-05-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the AddressedPlayerChanged Notification issued by the TG and the
procedure associated to this.
---
unit/test-avrcp.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 146858b..7998976 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -526,6 +526,7 @@ static int register_notification(struct avrcp *session, uint8_t transaction,
struct context *context = user_data;
uint64_t track;
uint8_t settings[3];
+ uint16_t player[2];
void *data;
size_t len;
@@ -551,6 +552,13 @@ static int register_notification(struct avrcp *session, uint8_t transaction,
data = settings;
len = sizeof(settings);
break;
+ case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
+ player[0] = 0x0001;
+ player[1] = 0xabcd;
+
+ data = player;
+ len = sizeof(player);
+ break;
default:
return -EINVAL;
}
@@ -885,6 +893,21 @@ int main(int argc, char *argv[])
0x46, 0x69, 0x6c, 0x65, 0x73, 0x79,
0x73, 0x74, 0x65, 0x6d));
+ /* AddressedPlayerChanged notification – TG */
+ define_test("/TP/MPS/BV-05-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x03, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, 0x0b,
+ 0x00, 0x00, 0x00, 0x00),
+ frg_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_INTERIM, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, 0x0b,
+ 0x00, 0x01, 0xab, 0xcd),
+ raw_pdu(0x02, 0x11, 0x0e, AVC_CTYPE_CHANGED, 0x48, 0x00,
+ 0x00, 0x19, 0x58, AVRCP_REGISTER_NOTIFICATION,
+ 0x00, 0x00, 0x05, 0x0b,
+ 0x01, 0x00, 0xcd, 0xab));
+
/* GetFolderItems - CT */
define_test("/TP/MPS/BV-08-C", test_client,
brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 3/8] unit/test-avrcp: Add /TP/MPS/BV-04-C test
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Verify the SetBrowsedPlayer response issued by the TG.
---
unit/test-avrcp.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index 92c3420..146858b 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -586,6 +586,20 @@ static int set_addressed(struct avrcp *session, uint8_t transaction,
return -EAGAIN;
}
+static int set_browsed(struct avrcp *session, uint8_t transaction,
+ uint16_t id, void *user_data)
+{
+ const char *folders[1] = { "Filesystem" };
+
+ DBG("");
+
+ avrcp_set_browsed_player_rsp(session, transaction,
+ AVRCP_STATUS_SUCCESS, 0xabcd, 0, 1,
+ folders);
+
+ return -EAGAIN;
+}
+
static int get_folder_items(struct avrcp *session, uint8_t transaction,
uint8_t scope, uint32_t start, uint32_t end,
uint16_t number, uint32_t *attrs,
@@ -683,6 +697,7 @@ static const struct avrcp_control_ind control_ind = {
.register_notification = register_notification,
.set_volume = set_volume,
.set_addressed = set_addressed,
+ .set_browsed = set_browsed,
.get_folder_items = get_folder_items,
.change_path = change_path,
.get_item_attributes = get_item_attributes,
@@ -860,6 +875,16 @@ int main(int argc, char *argv[])
brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
0xab, 0xcd));
+ /* SetBrowsedPlayer - TG */
+ define_test("/TP/MPS/BV-04-C", test_server,
+ brs_pdu(0x00, 0x11, 0x0e, 0x70, 0x00, 0x02,
+ 0xab, 0xcd),
+ brs_pdu(0x02, 0x11, 0x0e, 0x70, 0x00, 0x16,
+ 0x04, 0xab, 0xcd, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x6a, 0x01, 0x00, 0x0a,
+ 0x46, 0x69, 0x6c, 0x65, 0x73, 0x79,
+ 0x73, 0x74, 0x65, 0x6d));
+
/* GetFolderItems - CT */
define_test("/TP/MPS/BV-08-C", test_client,
brs_pdu(0x00, 0x11, 0x0e, AVRCP_GET_FOLDER_ITEMS,
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 2/8] android/avrcp-lib: Fix AddressedPlayerChanged
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1412771509-7996-1-git-send-email-luiz.dentz@gmail.com>
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This adds proper handling for AddressedPlayerChanged in
avrcp_register_notification_rsp.
---
android/avrcp-lib.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 8350497..a487668 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -3243,6 +3243,7 @@ int avrcp_register_notification_rsp(struct avrcp *session, uint8_t transaction,
void *data, size_t len)
{
struct iovec iov[2];
+ uint16_t *player;
if (event > AVRCP_EVENT_LAST)
return -EINVAL;
@@ -3269,6 +3270,14 @@ int avrcp_register_notification_rsp(struct avrcp *session, uint8_t transaction,
put_be32(*(uint32_t *) data, data);
break;
case AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED:
+ if (len != 4)
+ return -EINVAL;
+
+ player = data;
+ put_be16(player[0], &player[0]);
+ put_be16(player[1], &player[1]);
+
+ break;
case AVRCP_EVENT_SETTINGS_CHANGED:
if (len < sizeof(uint8_t))
return -EINVAL;
--
1.9.3
^ permalink raw reply related
* [PATCH BlueZ 1/8] android/avrcp-lib: Add support for SetBrowsedPlayer PDU
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/avrcp-lib.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++
android/avrcp-lib.h | 6 +++++
2 files changed, 83 insertions(+)
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 9a074ae..8350497 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -1243,6 +1243,30 @@ static void avrcp_set_control_handlers(struct avrcp *session,
session->control_data = user_data;
}
+static ssize_t set_browsed(struct avrcp *session, uint8_t transaction,
+ uint16_t params_len, uint8_t *params,
+ void *user_data)
+{
+ struct avrcp_player *player = user_data;
+ struct set_browsed_req *req;
+ uint16_t id;
+
+ DBG("");
+
+ if (!player->ind || !player->ind->set_browsed)
+ return -ENOSYS;
+
+ if (!params || params_len != sizeof(*req))
+ return -EINVAL;
+
+ req = (void *) params;
+
+ id = get_be16(&req->id);
+
+ return player->ind->set_browsed(session, transaction, id,
+ player->user_data);
+}
+
static ssize_t get_folder_items(struct avrcp *session, uint8_t transaction,
uint16_t params_len, uint8_t *params,
void *user_data)
@@ -1449,6 +1473,7 @@ static ssize_t add_to_now_playing(struct avrcp *session, uint8_t transaction,
}
static const struct avrcp_browsing_handler browsing_handlers[] = {
+ { AVRCP_SET_BROWSED_PLAYER, set_browsed },
{ AVRCP_GET_FOLDER_ITEMS, get_folder_items },
{ AVRCP_CHANGE_PATH, change_path },
{ AVRCP_GET_ITEM_ATTRIBUTES, get_item_attributes },
@@ -3295,6 +3320,58 @@ int avrcp_set_addressed_player_rsp(struct avrcp *session, uint8_t transaction,
&iov, 1);
}
+int avrcp_set_browsed_player_rsp(struct avrcp *session, uint8_t transaction,
+ uint8_t status, uint16_t counter,
+ uint32_t items, uint8_t depth,
+ const char **folders)
+{
+ struct iovec iov[UINT8_MAX * 2 + 1];
+ struct set_browsed_rsp rsp;
+ uint16_t len[UINT8_MAX];
+ int i;
+
+ if (status != AVRCP_STATUS_SUCCESS) {
+ iov[0].iov_base = &status;
+ iov[0].iov_len = sizeof(status);
+ return avrcp_send_browsing(session, transaction,
+ AVRCP_SET_BROWSED_PLAYER,
+ iov, 1);
+ }
+
+ rsp.status = status;
+ put_be16(counter, &rsp.counter);
+ put_be32(items, &rsp.items);
+ put_be16(AVRCP_CHARSET_UTF8, &rsp.charset);
+ rsp.depth = depth;
+
+ iov[0].iov_base = &rsp;
+ iov[0].iov_len = sizeof(rsp);
+
+ if (!depth)
+ return avrcp_send_browsing(session, transaction,
+ AVRCP_SET_BROWSED_PLAYER,
+ iov, 1);
+
+ for (i = 0; i < depth; i++) {
+ if (!folders[i])
+ return -EINVAL;
+
+ len[i] = strlen(folders[i]);
+
+ iov[i * 2 + 2].iov_base = (void *) folders[i];
+ iov[i * 2 + 2].iov_len = len[i];
+
+ put_be16(len[i], &len[i]);
+
+ iov[i * 2 + 1].iov_base = &len[i];
+ iov[i * 2 + 1].iov_len = sizeof(len[i]);
+ }
+
+ return avrcp_send_browsing(session, transaction,
+ AVRCP_SET_BROWSED_PLAYER, iov,
+ depth * 2 + 1);
+}
+
int avrcp_get_folder_items_rsp(struct avrcp *session, uint8_t transaction,
uint16_t counter, uint8_t number,
uint8_t *type, uint16_t *len,
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index 2b6eccb..dd82deb 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -161,6 +161,8 @@ struct avrcp_control_ind {
uint8_t volume, void *user_data);
int (*set_addressed) (struct avrcp *session, uint8_t transaction,
uint16_t id, void *user_data);
+ int (*set_browsed) (struct avrcp *session, uint8_t transaction,
+ uint16_t id, void *user_data);
int (*get_folder_items) (struct avrcp *session, uint8_t transaction,
uint8_t scope, uint32_t start,
uint32_t end, uint16_t number,
@@ -319,6 +321,10 @@ int avrcp_set_volume_rsp(struct avrcp *session, uint8_t transaction,
uint8_t volume);
int avrcp_set_addressed_player_rsp(struct avrcp *session, uint8_t transaction,
uint8_t status);
+int avrcp_set_browsed_player_rsp(struct avrcp *session, uint8_t transaction,
+ uint8_t status, uint16_t counter,
+ uint32_t items, uint8_t depth,
+ const char **folders);
int avrcp_get_folder_items_rsp(struct avrcp *session, uint8_t transaction,
uint16_t counter, uint8_t number,
uint8_t *type, uint16_t *len,
--
1.9.3
^ permalink raw reply related
* Re: [PATCH 5/6] obexd/messages: Add prototypes for MASInstance response
From: Luiz Augusto von Dentz @ 2014-10-08 12:31 UTC (permalink / raw)
To: Gowtham Anandha Babu
Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda,
cpgs
In-Reply-To: <001901cfe2f0$c26856c0$47390440$@samsung.com>
Hi,
On Wed, Oct 8, 2014 at 3:09 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Hi,
>
>> -----Original Message-----
>> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
>> Sent: Wednesday, October 08, 2014 4:42 PM
>> To: Gowtham Anandha Babu
>> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin; Bharat Panda;
>> cpgs@samsung.com
>> Subject: Re: [PATCH 5/6] obexd/messages: Add prototypes for MASInstance
>> response
>>
>> Hi,
>>
>> On Tue, Oct 7, 2014 at 7:06 AM, Gowtham Anandha Babu
>> <gowtham.ab@samsung.com> wrote:
>> > ---
>> > obexd/plugins/messages.h | 16 ++++++++++++++++
>> > 1 file changed, 16 insertions(+)
>> >
>> > diff --git a/obexd/plugins/messages.h b/obexd/plugins/messages.h index
>> > 00a16b1..3aaeec1 100644
>> > --- a/obexd/plugins/messages.h
>> > +++ b/obexd/plugins/messages.h
>> > @@ -307,3 +307,19 @@ int messages_set_delete(void *session, const char
>> *handle, uint8_t value,
>> > * session: Backend session.
>> > */
>> > void messages_abort(void *session);
>> > +
>> > +
>> > +
>> > +/* Retrieves MAS Instance Information for the given mas-instance id.
>> > + *
>> > + * session: Backend session.
>> > + * mas_id: MAS Instance id requested by the MCE.
>> > + *
>> > + * Callback shall be called for every mas_instance_id request received
>> from MCE.
>> > + */
>> > +typedef void (*messages_mas_instance_info_cb)(void *session, int err,
>> > + uint16_t size, const char *name, void *user_data);
>> > +
>> > +int messages_get_mas_instance_info(void *session, uint16_t
>> mas_instance_id,
>> > + messages_mas_instance_info_cb callback,
>> > + void *user_data);
>> > --
>> > 1.9.1
>>
>> You can drop using mas here since it is pretty obvious what it is for, also Im
>> not sure we need the size in the callback since we can use strlen there.
>>
>>
>> --
>> Luiz Augusto von Dentz
>
> I agree with you. I will update this comment for the patch[6/6] too. I will include this in v2. Still is there anything to be handled?
Start with the server side, I will be working on the client side to
add support for multiple instances, I have something already it just
need some polishing.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH bluetooth-next] 6lowpan: Use pskb_expand_head in IPHC decompression.
From: Jukka Rissanen @ 2014-10-08 12:12 UTC (permalink / raw)
To: Martin Townsend; +Cc: linux-bluetooth, linux-wpan, marcel, alex.aring
In-Reply-To: <54351AF4.5060907@xsilon.com>
Hi Martin,
On ke, 2014-10-08 at 12:07 +0100, Martin Townsend wrote:
> Hi Jukka,
>
> And there's no oops when kmemleak is activated on a kernel without the patch?
Confirmed. Only with your patch I see the crash. Tried with v2 but I can
also try v3. No other changes in kernel code between working and
non-working kernel.
Cheers,
Jukka
^ permalink raw reply
* RE: [PATCH 5/6] obexd/messages: Add prototypes for MASInstance response
From: Gowtham Anandha Babu @ 2014-10-08 12:09 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz'
Cc: linux-bluetooth, 'Dmitry Kasatkin',
'Bharat Panda', cpgs
In-Reply-To: <CABBYNZK2TpB61PvCs9L8t_LxV50+mifKZo9C67-0U4JzLm6wBw@mail.gmail.com>
Hi,
> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Wednesday, October 08, 2014 4:42 PM
> To: Gowtham Anandha Babu
> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin; Bharat Panda;
> cpgs@samsung.com
> Subject: Re: [PATCH 5/6] obexd/messages: Add prototypes for MASInstance
> response
>
> Hi,
>
> On Tue, Oct 7, 2014 at 7:06 AM, Gowtham Anandha Babu
> <gowtham.ab@samsung.com> wrote:
> > ---
> > obexd/plugins/messages.h | 16 ++++++++++++++++
> > 1 file changed, 16 insertions(+)
> >
> > diff --git a/obexd/plugins/messages.h b/obexd/plugins/messages.h index
> > 00a16b1..3aaeec1 100644
> > --- a/obexd/plugins/messages.h
> > +++ b/obexd/plugins/messages.h
> > @@ -307,3 +307,19 @@ int messages_set_delete(void *session, const char
> *handle, uint8_t value,
> > * session: Backend session.
> > */
> > void messages_abort(void *session);
> > +
> > +
> > +
> > +/* Retrieves MAS Instance Information for the given mas-instance id.
> > + *
> > + * session: Backend session.
> > + * mas_id: MAS Instance id requested by the MCE.
> > + *
> > + * Callback shall be called for every mas_instance_id request received
> from MCE.
> > + */
> > +typedef void (*messages_mas_instance_info_cb)(void *session, int err,
> > + uint16_t size, const char *name, void *user_data);
> > +
> > +int messages_get_mas_instance_info(void *session, uint16_t
> mas_instance_id,
> > + messages_mas_instance_info_cb callback,
> > + void *user_data);
> > --
> > 1.9.1
>
> You can drop using mas here since it is pretty obvious what it is for, also Im
> not sure we need the size in the callback since we can use strlen there.
>
>
> --
> Luiz Augusto von Dentz
I agree with you. I will update this comment for the patch[6/6] too. I will include this in v2. Still is there anything to be handled?
Regards,
Gowtham Anandha Babu
^ permalink raw reply
* RE: [PATCH 0/6] Add support for MAP MASInstance feature
From: Gowtham Anandha Babu @ 2014-10-08 12:08 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz'
Cc: linux-bluetooth, 'Dmitry Kasatkin',
'Bharat Panda', cpgs
In-Reply-To: <CABBYNZ+GQ7ffqVnpTKVBZ02_5bqQoPhjz7Ue+ELpfCKGLZF0kg@mail.gmail.com>
Hi,
> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Wednesday, October 08, 2014 4:09 PM
> To: Gowtham Anandha Babu
> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin; Bharat Panda;
> cpgs@samsung.com
> Subject: Re: [PATCH 0/6] Add support for MAP MASInstance feature
>
> Hi,
>
> On Tue, Oct 7, 2014 at 7:06 AM, Gowtham Anandha Babu
> <gowtham.ab@samsung.com> wrote:
> > This patch-set implements MAP 1.2 MAS Instance feature.
> >
> > The patch 1,2,3 will handle the Client part(MCE). It passes the PTS
> > 5.3 test case:TC_MCE_MMI_BV_01_I.
> >
> > The patch 4,5,6 will handle the Server part(MSE). It passes the PTS
> > 5.3 test case:TC_MSE_MMI_BV_02_I.
> >
> > Gowtham Anandha Babu (6):
> > doc/obex-api: Add description about MASInstance request
> > test/map-client: Add D-Bus API support to make MASInstance request
> > obexd/client/map: Add API Calls for request and handlers for response
> > obexd/mas: Add support for providing MASInstance Info as response
> > obexd/messages: Add prototypes for MASInstance response
> > obexd/message-dummy: Add MAS Instance description to response
> >
> > doc/obex-api.txt | 6 +++
> > obexd/client/map.c | 88
> ++++++++++++++++++++++++++++++++++++++++++
> > obexd/plugins/mas.c | 62 +++++++++++++++++++++++++++++
> > obexd/plugins/messages-dummy.c | 18 +++++++++
> > obexd/plugins/messages.h | 16 ++++++++
> > test/map-client | 9 +++++
> > 6 files changed, 199 insertions(+)
> >
> > --
> > 1.9.1
>
> My plan is to actually do this as the name of the folder for each instance:
>
> <MAS 1 info>/telecom/...
> <MAS 2 info>/telecom/...
>
> If there is no info, due to version or lack of support, then we fallback to
> record description or something like that so we can support multiple
> instances.
>
>
> --
> Luiz Augusto von Dentz
I could not understand the first part of your explanation.
Do we need to create any folders internally and store the MAS info?
Or do we need to append the below info to MAS Info?
<MAS 1 info>/telecom/...
<MAS 2 info>/telecom/...
Let me know if I am wrong.
And then do we need to follow any predefined structure for storing the MAS Instance Info?
I think right now bluez supports single MAS instance. This patch will work for single instance. For supporting multiple MAS instances, we need to discuss upon the how this can be implemented?
Regards,
Gowtham Anandha Babu
^ permalink raw reply
* Re: [PATCH v4 1/3] shared/att.c: Add signed command outgoing and CSRK function
From: Luiz Augusto von Dentz @ 2014-10-08 11:43 UTC (permalink / raw)
To: Gu Chaojie; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1412758479-13214-2-git-send-email-chao.jie.gu@intel.com>
Hi,
On Wed, Oct 8, 2014 at 11:54 AM, Gu Chaojie <chao.jie.gu@intel.com> wrote:
> ---
> src/shared/att-types.h | 3 ++
> src/shared/att.c | 122 ++++++++++++++++++++++++++++++++++++++++++++++--
> src/shared/att.h | 16 +++++++
> 3 files changed, 138 insertions(+), 3 deletions(-)
>
> diff --git a/src/shared/att-types.h b/src/shared/att-types.h
> index b85c969..da8b6ae 100644
> --- a/src/shared/att-types.h
> +++ b/src/shared/att-types.h
> @@ -25,6 +25,9 @@
>
> #define BT_ATT_DEFAULT_LE_MTU 23
>
> +/* Length of signature in write signed packet */
> +#define BT_ATT_SIGNATURE_LEN 12
> +
> /* ATT protocol opcodes */
> #define BT_ATT_OP_ERROR_RSP 0x01
> #define BT_ATT_OP_MTU_REQ 0x02
> diff --git a/src/shared/att.c b/src/shared/att.c
> index de35aef..b4921d9 100644
> --- a/src/shared/att.c
> +++ b/src/shared/att.c
> @@ -36,6 +36,7 @@
> #include "lib/uuid.h"
> #include "src/shared/att.h"
> #include "src/shared/att-types.h"
> +#include "src/shared/crypto.h"
>
> #define ATT_MIN_PDU_LEN 1 /* At least 1 byte for the opcode. */
> #define ATT_OP_CMD_MASK 0x40
> @@ -77,6 +78,16 @@ struct bt_att {
> bt_att_debug_func_t debug_callback;
> bt_att_destroy_func_t debug_destroy;
> void *debug_data;
> +
> + struct bt_crypto *crypto;
> +
> + bool valid_local_csrk;
> + uint8_t local_csrk[16];
> + uint32_t local_sign_cnt;
> +
> + bool valid_remote_csrk;
> + uint8_t remote_csrk[16];
> + uint32_t remote_sign_cnt;
Maybe it is better to have pointers to a structs so you can free the
data once it becomes invalid and it also removes the necessity of
extra flags just to tell if the data is still valid since you can
check if the pointer is not NULL then it must be valid.
> };
>
> enum att_op_type {
> @@ -176,6 +187,8 @@ struct att_send_op {
> bt_att_response_func_t callback;
> bt_att_destroy_func_t destroy;
> void *user_data;
> +
> + struct bt_att *att;
> };
>
> static void destroy_att_send_op(void *data)
> @@ -277,6 +290,10 @@ static bool encode_pdu(struct att_send_op *op, const void *pdu,
> uint16_t length, uint16_t mtu)
> {
> uint16_t pdu_len = 1;
> + struct bt_att *att = op->att;
> +
> + if (op->opcode & ATT_OP_SIGNED_MASK)
> + pdu_len += BT_ATT_SIGNATURE_LEN;
>
> if (length && pdu)
> pdu_len += length;
> @@ -293,17 +310,32 @@ static bool encode_pdu(struct att_send_op *op, const void *pdu,
> if (pdu_len > 1)
> memcpy(op->pdu + 1, pdu, length);
>
> + if (op->opcode & ATT_OP_SIGNED_MASK) {
> + if (bt_crypto_sign_att(att->crypto,
> + att->local_csrk,
> + op->pdu,
> + 1 + length,
> + att->local_sign_cnt,
> + &((uint8_t *) op->pdu)[1 + length]))
> + att->local_sign_cnt++;
> + else
> + return false;
> + }
> +
You can probably bail out early if you check !(op->opcode &
ATT_OP_SIGNED_MASK), also perhaps it is a good idea to start defining
structs for the PDUs to simplify the access.
> return true;
> }
>
> -static struct att_send_op *create_att_send_op(uint8_t opcode, const void *pdu,
> - uint16_t length, uint16_t mtu,
> +static struct att_send_op *create_att_send_op(uint8_t opcode,
> + const void *pdu,
> + uint16_t length,
> + struct bt_att *att,
> bt_att_response_func_t callback,
> void *user_data,
> bt_att_destroy_func_t destroy)
> {
> struct att_send_op *op;
> enum att_op_type op_type;
> + uint16_t mtu = att->mtu;
>
> if (length && !pdu)
> return NULL;
> @@ -334,6 +366,7 @@ static struct att_send_op *create_att_send_op(uint8_t opcode, const void *pdu,
> op->callback = callback;
> op->destroy = destroy;
> op->user_data = user_data;
> + op->att = att;
>
> if (!encode_pdu(op, pdu, length, mtu)) {
> free(op);
> @@ -701,6 +734,10 @@ struct bt_att *bt_att_new(int fd)
>
> att->fd = fd;
>
> + att->local_sign_cnt = 0;
> + att->remote_sign_cnt = 0;
> + att->valid_local_csrk = false;
> + att->valid_remote_csrk = false;
> att->mtu = BT_ATT_DEFAULT_LE_MTU;
> att->buf = malloc(att->mtu);
> if (!att->buf)
> @@ -710,6 +747,10 @@ struct bt_att *bt_att_new(int fd)
> if (!att->io)
> goto fail;
>
> + att->crypto = bt_crypto_new();
> + if (!att->crypto)
> + goto fail;
> +
> att->req_queue = queue_new();
> if (!att->req_queue)
> goto fail;
> @@ -744,6 +785,7 @@ fail:
> queue_destroy(att->write_queue, NULL);
> queue_destroy(att->notify_list, NULL);
> queue_destroy(att->disconn_list, NULL);
> + bt_crypto_unref(att->crypto);
> io_destroy(att->io);
> free(att->buf);
> free(att);
> @@ -934,7 +976,7 @@ unsigned int bt_att_send(struct bt_att *att, uint8_t opcode,
> if (!att || !att->io)
> return 0;
>
> - op = create_att_send_op(opcode, pdu, length, att->mtu, callback,
> + op = create_att_send_op(opcode, pdu, length, att, callback,
> user_data, destroy);
> if (!op)
> return 0;
> @@ -1119,3 +1161,77 @@ bool bt_att_unregister_all(struct bt_att *att)
>
> return true;
> }
> +
> +bool bt_att_set_local_csrk(struct bt_att *att, bool valid_local_csrk,
> + uint8_t key[16])
> +{
> + if (!att)
> + return false;
> +
> + att->valid_local_csrk = valid_local_csrk;
> + memcpy(att->local_csrk, key, 16);
> +
> + return true;
> +}
> +
> +bool bt_att_set_remote_csrk(struct bt_att *att, bool valid_remote_csrk,
> + uint8_t key[16])
> +{
> + if (!att)
> + return false;
> +
> + att->valid_remote_csrk = valid_remote_csrk;
> + memcpy(att->remote_csrk, key, 16);
> +
> + return true;
> +
> +}
> +
> +bool bt_att_get_local_csrk(struct bt_att *att, uint8_t key[16],
> + uint32_t *local_sign_cnt)
> +{
> + if (!att)
> + return false;
> +
> + if (att->valid_local_csrk) {
> + memcpy(key, att->local_csrk, 16);
> + *local_sign_cnt = att->local_sign_cnt;
> + } else {
> + return false;
> + }
> +
> + return true;
> +}
> +
> +bool bt_att_get_remote_csrk(struct bt_att *att, uint8_t key[16],
> + uint32_t *remote_sign_cnt)
> +{
> + if (!att)
> + return false;
> +
> + if (att->valid_remote_csrk) {
> + memcpy(key, att->remote_csrk, 16);
> + *remote_sign_cnt = att->remote_sign_cnt;
> + } else {
> + return false;
> + }
> +
> + return true;
> +}
> +
> +bool bt_att_local_csrk_is_valid(struct bt_att *att)
> +{
> + if (!att)
> + return false;
> +
> + return att->valid_local_csrk;
> +}
> +
> +bool bt_att_remote_csrk_is_valid(struct bt_att *att)
> +{
> + if (!att)
> + return false;
> +
> + return att->valid_remote_csrk;
> +
> +}
> diff --git a/src/shared/att.h b/src/shared/att.h
> index 1063021..306d44c 100644
> --- a/src/shared/att.h
> +++ b/src/shared/att.h
> @@ -76,3 +76,19 @@ unsigned int bt_att_register_disconnect(struct bt_att *att,
> bool bt_att_unregister_disconnect(struct bt_att *att, unsigned int id);
>
> bool bt_att_unregister_all(struct bt_att *att);
> +
> +bool bt_att_set_local_csrk(struct bt_att *att, bool valid_local_csrk,
> + uint8_t key[16]);
> +
> +bool bt_att_set_remote_csrk(struct bt_att *att, bool valid_remote_csrk,
> + uint8_t key[16]);
> +
> +bool bt_att_get_local_csrk(struct bt_att *att, uint8_t key[16],
> + uint32_t *local_sign_cnt);
> +
> +bool bt_att_get_remote_csrk(struct bt_att *att, uint8_t key[16],
> + uint32_t *remote_sign_cnt);
> +
> +bool bt_att_local_csrk_is_valid(struct bt_att *att);
> +
> +bool bt_att_remote_csrk_is_valid(struct bt_att *att);
> --
> 1.7.10.4
>
> --
> 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
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH 5/6] obexd/messages: Add prototypes for MASInstance response
From: Luiz Augusto von Dentz @ 2014-10-08 11:12 UTC (permalink / raw)
To: Gowtham Anandha Babu
Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda,
cpgs
In-Reply-To: <1412654816-14971-6-git-send-email-gowtham.ab@samsung.com>
Hi,
On Tue, Oct 7, 2014 at 7:06 AM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> ---
> obexd/plugins/messages.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/obexd/plugins/messages.h b/obexd/plugins/messages.h
> index 00a16b1..3aaeec1 100644
> --- a/obexd/plugins/messages.h
> +++ b/obexd/plugins/messages.h
> @@ -307,3 +307,19 @@ int messages_set_delete(void *session, const char *handle, uint8_t value,
> * session: Backend session.
> */
> void messages_abort(void *session);
> +
> +
> +
> +/* Retrieves MAS Instance Information for the given mas-instance id.
> + *
> + * session: Backend session.
> + * mas_id: MAS Instance id requested by the MCE.
> + *
> + * Callback shall be called for every mas_instance_id request received from MCE.
> + */
> +typedef void (*messages_mas_instance_info_cb)(void *session, int err,
> + uint16_t size, const char *name, void *user_data);
> +
> +int messages_get_mas_instance_info(void *session, uint16_t mas_instance_id,
> + messages_mas_instance_info_cb callback,
> + void *user_data);
> --
> 1.9.1
You can drop using mas here since it is pretty obvious what it is for,
also Im not sure we need the size in the callback since we can use
strlen there.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH bluetooth-next] 6lowpan: Use pskb_expand_head in IPHC decompression.
From: Martin Townsend @ 2014-10-08 11:07 UTC (permalink / raw)
To: Jukka Rissanen; +Cc: linux-bluetooth, linux-wpan, marcel, alex.aring
In-Reply-To: <1412763863.2705.22.camel@jrissane-mobl.ger.corp.intel.com>
Hi Jukka,
And there's no oops when kmemleak is activated on a kernel without the patch?
- Martin.
On 08/10/14 11:24, Jukka Rissanen wrote:
> Hi Martin,
>
> tried to v2 of the patch and still see oops but not with the locking at
> this time. I had kmemleak activated in my kernel in this run.
>
> On ti, 2014-10-07 at 16:37 +0100, Martin Townsend wrote:
>> I should also mention this has only been compile tested as I currently don't have a way of testing it easily. So I would appreciate any testing on real HW.
>>
>> Jukka, I would be very interested to see if you see that locking error message you were seeing previously.
>>
>> - Martin.
>>
>
> [ 243.774232] kmemleak: Cannot insert 0xf45bde40 into the object search
> tree (overlaps existing)
> [ 243.775060] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
> 3.17.0-rc1-bt6lowpan #1
> [ 243.775060] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
> VirtualBox 12/01/2006
> [ 243.775060] f45bde40 00000000 f600bb74 c18821c1 e716a0c8 f600bba8
> c116abac c1ae324c
> [ 243.775060] f45bde40 00200282 e716a0f4 00000010 00000010 e716a134
> 00000000 f45bde40
> [ 243.775060] f6001c00 f6001c00 f600bbd4 c187f10c 00000020 f600bbd4
> 00200246 f47805c0
> [ 243.775060] Call Trace:
> [ 243.775060] [<c18821c1>] dump_stack+0x4b/0x75
> [ 243.775060] [<c116abac>] create_object+0x22c/0x280
> [ 243.775060] [<c187f10c>] kmemleak_alloc+0x3c/0xb0
> [ 243.775060] [<c115e693>] kmem_cache_alloc+0x1a3/0x290
> [ 243.775060] [<c1761ea0>] ? skb_clone+0x40/0xa0
> [ 243.775060] [<c1761ea0>] skb_clone+0x40/0xa0
> [ 243.775060] [<c179a15b>] netlink_broadcast_filtered+0x25b/0x310
> [ 243.775060] [<c179a23e>] netlink_broadcast+0x2e/0x40
> [ 243.775060] [<c179c68e>] nlmsg_notify+0xbe/0xd0
> [ 243.775060] [<c178064f>] rtnl_notify+0x3f/0x60
> [ 243.775060] [<c1828382>] inet6_rt_notify+0xe2/0x150
> [ 243.775060] [<c182a228>] fib6_add+0x388/0x7c0
> [ 243.775060] [<c1825533>] ip6_ins_rt+0x53/0x70
> [ 243.775060] [<c1825828>] ip6_pol_route.isra.42+0x2d8/0x3e0
> [ 243.775060] [<c1825963>] ip6_pol_route_input+0x33/0x40
> [ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
> [ 243.775060] [<c184aba9>] fib6_rule_action+0x79/0x1a0
> [ 243.775060] [<c178d0a7>] fib_rules_lookup+0x117/0x1a0
> [ 243.775060] [<c178cf90>] ? fib_rules_net_init+0x30/0x30
> [ 243.775060] [<c184aedb>] fib6_rule_lookup+0x3b/0x70
> [ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
> [ 243.775060] [<c1825106>] ip6_route_input_lookup.isra.39+0x46/0x50
> [ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
> [ 243.775060] [<c1825a4d>] ip6_route_input+0x9d/0xb0
> [ 243.775060] [<c18187f7>] ip6_rcv_finish+0x147/0x1d0
> [ 243.775060] [<c18197c6>] ipv6_rcv+0x686/0xa10
> [ 243.775060] [<c17716cb>] ? __netif_receive_skb_core+0x4ab/0x7b0
> [ 243.775060] [<c17716cb>] __netif_receive_skb_core+0x4ab/0x7b0
> [ 243.775060] [<c1771279>] ? __netif_receive_skb_core+0x59/0x7b0
> [ 243.775060] [<c17719eb>] __netif_receive_skb+0x1b/0x70
> [ 243.775060] [<c177300f>] process_backlog+0x9f/0x140
> [ 243.775060] [<c1772e48>] net_rx_action+0x128/0x250
> [ 243.775060] [<c104fd84>] __do_softirq+0xd4/0x300
> [ 243.775060] [<c104fcb0>] ? __local_bh_enable_ip+0xf0/0xf0
> [ 243.775060] [<c10049fc>] do_softirq_own_stack+0x2c/0x40
> [ 243.775060] <IRQ> [<c1050136>] irq_exit+0x86/0xb0
> [ 243.775060] [<c188bd98>] smp_apic_timer_interrupt+0x38/0x50
> [ 243.775060] [<c188b6ce>] apic_timer_interrupt+0x32/0x38
> [ 243.775060] [<c107007b>] ? resched_cpu+0x7b/0x80
> [ 243.775060] [<c10be4ea>] ? tick_nohz_idle_enter+0x4a/0x80
> [ 243.775060] [<c10848d5>] cpu_startup_entry+0x35/0x370
> [ 243.775060] [<c10718bb>] ? preempt_count_add+0x4b/0xa0
> [ 243.775060] [<c187dbd1>] rest_init+0xa1/0xb0
> [ 243.775060] [<c1c93aa1>] start_kernel+0x386/0x38b
> [ 243.775060] [<c1c932ab>] i386_start_kernel+0x79/0x7d
> [ 243.775060] kmemleak: Kernel memory leak detector disabled
> [ 243.775060] kmemleak: Object 0xf45bde40 (size 192):
> [ 243.775060] kmemleak: comm "softirq", pid 0, jiffies 4294911070
> [ 243.775060] kmemleak: min_count = 1
> [ 243.775060] kmemleak: count = 0
> [ 243.775060] kmemleak: flags = 0x1
> [ 243.775060] kmemleak: checksum = 0
> [ 243.775060] kmemleak: backtrace:
> [ 243.775060] [<c187f10c>] kmemleak_alloc+0x3c/0xb0
> [ 243.775060] [<c115e693>] kmem_cache_alloc+0x1a3/0x290
> [ 243.775060] [<c17635e1>] __alloc_skb+0x41/0x1c0
> [ 243.775060] [<c18282f5>] inet6_rt_notify+0x55/0x150
> [ 243.775060] [<c182a228>] fib6_add+0x388/0x7c0
> [ 243.775060] [<c1825533>] ip6_ins_rt+0x53/0x70
> [ 243.775060] [<c1825828>] ip6_pol_route.isra.42+0x2d8/0x3e0
> [ 243.775060] [<c1825963>] ip6_pol_route_input+0x33/0x40
> [ 243.775060] [<c184aba9>] fib6_rule_action+0x79/0x1a0
> [ 243.775060] [<c178d0a7>] fib_rules_lookup+0x117/0x1a0
> [ 243.775060] [<c184aedb>] fib6_rule_lookup+0x3b/0x70
> [ 243.775060] [<c1825106>] ip6_route_input_lookup.isra.39
> +0x46/0x50
> [ 243.775060] [<c1825a4d>] ip6_route_input+0x9d/0xb0
> [ 243.775060] [<c18187f7>] ip6_rcv_finish+0x147/0x1d0
> [ 243.775060] [<c18197c6>] ipv6_rcv+0x686/0xa10
> [ 243.775060] [<c17716cb>] __netif_receive_skb_core+0x4ab/0x7b0
> [ 244.044145] BUG: unable to handle kernel NULL pointer dereference at
> 0000006c
> [ 244.044227] IP: [<c115ffc0>] __kmalloc_track_caller+0xb0/0x2b0
> [ 244.044227] *pde = 00000000
> [ 244.044227] Oops: 0000 [#1] PREEMPT SMP
> [ 244.044227] Modules linked in: bluetooth_6lowpan 6lowpan rfcomm bnep
> ecb btusb bluetooth nfc rfkill snd_intel8x0 parport_pc ohci_pci
> snd_ac97_codec ac97_bus parport
>
>
>
> Cheers,
> Jukka
>
>
^ permalink raw reply
* Re: Query regarding the PTS MAP 1.2 push message test case execution
From: Luiz Augusto von Dentz @ 2014-10-08 10:47 UTC (permalink / raw)
To: Gowtham Anandha Babu
Cc: linux-bluetooth@vger.kernel.org, Bharat Panda, Dmitry Kasatkin,
cpgs
In-Reply-To: <000f01cfe21b$7cdac460$76904d20$@samsung.com>
Hi,
On Tue, Oct 7, 2014 at 1:42 PM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> Hi,
>
> I am currently validating all the test cases of PTS 5.3 for MAP 1.2.
> How to push the message bluez map-client to MSE(server)?
> The approach which I followed is described below:
>
> On MCE(Bluez - map-client):
> 1) Run bluetoothd
> 2) Run obexd
> 3) ./map-client -d <REMOTE_BT_ADDR> -c telecom/msg/outbox/ -p PUSH_MSG
>
> On MSE(PTS tool)
> 1) Running the test-case: TC_MCE_MMU_BV_01_I
> 2) After running the test-case. I am getting the User Action Required
> (Please find this in attached image).
>
> The PUSH_MSG will be the filename of the message which we are pushing to
> MSE(server).
> So, I tried pushing the attached file with the same command as shown above
> by replacing PUSH_MSG with filename of the attached.
> But I am getting "org.bluez.obex.Error.Failed: Unable to open file".
>
> How to push the message? Am I missing something?
First you need to check if obexd has permission to open the file, also
you can try obexctl instead using send command should have the same
result as map-client but it is a bit more up to date in terms of
features.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: btusb_intr_complete returns -EPIPE
From: Oliver Neukum @ 2014-10-08 10:44 UTC (permalink / raw)
To: Naveen Kumar Parna; +Cc: linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <CAG0bkvKugdQSDm+GKRbLGLzrURth5ty9KU-8d3ED-a9sgdDkMg@mail.gmail.com>
On Wed, 2014-10-08 at 15:51 +0530, Naveen Kumar Parna wrote:
> hcidump does not show anything when the stalls happen.
There is nothing in all logs. Do you see the problem
with single devices?
Regards
Oliver
^ permalink raw reply
* Re: [PATCH 0/6] Add support for MAP MASInstance feature
From: Luiz Augusto von Dentz @ 2014-10-08 10:38 UTC (permalink / raw)
To: Gowtham Anandha Babu
Cc: linux-bluetooth@vger.kernel.org, Dmitry Kasatkin, Bharat Panda,
cpgs
In-Reply-To: <1412654816-14971-1-git-send-email-gowtham.ab@samsung.com>
Hi,
On Tue, Oct 7, 2014 at 7:06 AM, Gowtham Anandha Babu
<gowtham.ab@samsung.com> wrote:
> This patch-set implements MAP 1.2 MAS Instance feature.
>
> The patch 1,2,3 will handle the Client part(MCE). It passes
> the PTS 5.3 test case:TC_MCE_MMI_BV_01_I.
>
> The patch 4,5,6 will handle the Server part(MSE). It passes
> the PTS 5.3 test case:TC_MSE_MMI_BV_02_I.
>
> Gowtham Anandha Babu (6):
> doc/obex-api: Add description about MASInstance request
> test/map-client: Add D-Bus API support to make MASInstance request
> obexd/client/map: Add API Calls for request and handlers for response
> obexd/mas: Add support for providing MASInstance Info as response
> obexd/messages: Add prototypes for MASInstance response
> obexd/message-dummy: Add MAS Instance description to response
>
> doc/obex-api.txt | 6 +++
> obexd/client/map.c | 88 ++++++++++++++++++++++++++++++++++++++++++
> obexd/plugins/mas.c | 62 +++++++++++++++++++++++++++++
> obexd/plugins/messages-dummy.c | 18 +++++++++
> obexd/plugins/messages.h | 16 ++++++++
> test/map-client | 9 +++++
> 6 files changed, 199 insertions(+)
>
> --
> 1.9.1
My plan is to actually do this as the name of the folder for each instance:
<MAS 1 info>/telecom/...
<MAS 2 info>/telecom/...
If there is no info, due to version or lack of support, then we
fallback to record description or something like that so we can
support multiple instances.
--
Luiz Augusto von Dentz
^ permalink raw reply
* Re: [PATCH bluetooth-next] 6lowpan: Use pskb_expand_head in IPHC decompression.
From: Jukka Rissanen @ 2014-10-08 10:24 UTC (permalink / raw)
To: Martin Townsend; +Cc: linux-bluetooth, linux-wpan, marcel, alex.aring
In-Reply-To: <543408B2.1070309@xsilon.com>
Hi Martin,
tried to v2 of the patch and still see oops but not with the locking at
this time. I had kmemleak activated in my kernel in this run.
On ti, 2014-10-07 at 16:37 +0100, Martin Townsend wrote:
> I should also mention this has only been compile tested as I currently don't have a way of testing it easily. So I would appreciate any testing on real HW.
>
> Jukka, I would be very interested to see if you see that locking error message you were seeing previously.
>
> - Martin.
>
[ 243.774232] kmemleak: Cannot insert 0xf45bde40 into the object search
tree (overlaps existing)
[ 243.775060] CPU: 0 PID: 0 Comm: swapper/0 Not tainted
3.17.0-rc1-bt6lowpan #1
[ 243.775060] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS
VirtualBox 12/01/2006
[ 243.775060] f45bde40 00000000 f600bb74 c18821c1 e716a0c8 f600bba8
c116abac c1ae324c
[ 243.775060] f45bde40 00200282 e716a0f4 00000010 00000010 e716a134
00000000 f45bde40
[ 243.775060] f6001c00 f6001c00 f600bbd4 c187f10c 00000020 f600bbd4
00200246 f47805c0
[ 243.775060] Call Trace:
[ 243.775060] [<c18821c1>] dump_stack+0x4b/0x75
[ 243.775060] [<c116abac>] create_object+0x22c/0x280
[ 243.775060] [<c187f10c>] kmemleak_alloc+0x3c/0xb0
[ 243.775060] [<c115e693>] kmem_cache_alloc+0x1a3/0x290
[ 243.775060] [<c1761ea0>] ? skb_clone+0x40/0xa0
[ 243.775060] [<c1761ea0>] skb_clone+0x40/0xa0
[ 243.775060] [<c179a15b>] netlink_broadcast_filtered+0x25b/0x310
[ 243.775060] [<c179a23e>] netlink_broadcast+0x2e/0x40
[ 243.775060] [<c179c68e>] nlmsg_notify+0xbe/0xd0
[ 243.775060] [<c178064f>] rtnl_notify+0x3f/0x60
[ 243.775060] [<c1828382>] inet6_rt_notify+0xe2/0x150
[ 243.775060] [<c182a228>] fib6_add+0x388/0x7c0
[ 243.775060] [<c1825533>] ip6_ins_rt+0x53/0x70
[ 243.775060] [<c1825828>] ip6_pol_route.isra.42+0x2d8/0x3e0
[ 243.775060] [<c1825963>] ip6_pol_route_input+0x33/0x40
[ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
[ 243.775060] [<c184aba9>] fib6_rule_action+0x79/0x1a0
[ 243.775060] [<c178d0a7>] fib_rules_lookup+0x117/0x1a0
[ 243.775060] [<c178cf90>] ? fib_rules_net_init+0x30/0x30
[ 243.775060] [<c184aedb>] fib6_rule_lookup+0x3b/0x70
[ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
[ 243.775060] [<c1825106>] ip6_route_input_lookup.isra.39+0x46/0x50
[ 243.775060] [<c1825930>] ? ip6_pol_route.isra.42+0x3e0/0x3e0
[ 243.775060] [<c1825a4d>] ip6_route_input+0x9d/0xb0
[ 243.775060] [<c18187f7>] ip6_rcv_finish+0x147/0x1d0
[ 243.775060] [<c18197c6>] ipv6_rcv+0x686/0xa10
[ 243.775060] [<c17716cb>] ? __netif_receive_skb_core+0x4ab/0x7b0
[ 243.775060] [<c17716cb>] __netif_receive_skb_core+0x4ab/0x7b0
[ 243.775060] [<c1771279>] ? __netif_receive_skb_core+0x59/0x7b0
[ 243.775060] [<c17719eb>] __netif_receive_skb+0x1b/0x70
[ 243.775060] [<c177300f>] process_backlog+0x9f/0x140
[ 243.775060] [<c1772e48>] net_rx_action+0x128/0x250
[ 243.775060] [<c104fd84>] __do_softirq+0xd4/0x300
[ 243.775060] [<c104fcb0>] ? __local_bh_enable_ip+0xf0/0xf0
[ 243.775060] [<c10049fc>] do_softirq_own_stack+0x2c/0x40
[ 243.775060] <IRQ> [<c1050136>] irq_exit+0x86/0xb0
[ 243.775060] [<c188bd98>] smp_apic_timer_interrupt+0x38/0x50
[ 243.775060] [<c188b6ce>] apic_timer_interrupt+0x32/0x38
[ 243.775060] [<c107007b>] ? resched_cpu+0x7b/0x80
[ 243.775060] [<c10be4ea>] ? tick_nohz_idle_enter+0x4a/0x80
[ 243.775060] [<c10848d5>] cpu_startup_entry+0x35/0x370
[ 243.775060] [<c10718bb>] ? preempt_count_add+0x4b/0xa0
[ 243.775060] [<c187dbd1>] rest_init+0xa1/0xb0
[ 243.775060] [<c1c93aa1>] start_kernel+0x386/0x38b
[ 243.775060] [<c1c932ab>] i386_start_kernel+0x79/0x7d
[ 243.775060] kmemleak: Kernel memory leak detector disabled
[ 243.775060] kmemleak: Object 0xf45bde40 (size 192):
[ 243.775060] kmemleak: comm "softirq", pid 0, jiffies 4294911070
[ 243.775060] kmemleak: min_count = 1
[ 243.775060] kmemleak: count = 0
[ 243.775060] kmemleak: flags = 0x1
[ 243.775060] kmemleak: checksum = 0
[ 243.775060] kmemleak: backtrace:
[ 243.775060] [<c187f10c>] kmemleak_alloc+0x3c/0xb0
[ 243.775060] [<c115e693>] kmem_cache_alloc+0x1a3/0x290
[ 243.775060] [<c17635e1>] __alloc_skb+0x41/0x1c0
[ 243.775060] [<c18282f5>] inet6_rt_notify+0x55/0x150
[ 243.775060] [<c182a228>] fib6_add+0x388/0x7c0
[ 243.775060] [<c1825533>] ip6_ins_rt+0x53/0x70
[ 243.775060] [<c1825828>] ip6_pol_route.isra.42+0x2d8/0x3e0
[ 243.775060] [<c1825963>] ip6_pol_route_input+0x33/0x40
[ 243.775060] [<c184aba9>] fib6_rule_action+0x79/0x1a0
[ 243.775060] [<c178d0a7>] fib_rules_lookup+0x117/0x1a0
[ 243.775060] [<c184aedb>] fib6_rule_lookup+0x3b/0x70
[ 243.775060] [<c1825106>] ip6_route_input_lookup.isra.39
+0x46/0x50
[ 243.775060] [<c1825a4d>] ip6_route_input+0x9d/0xb0
[ 243.775060] [<c18187f7>] ip6_rcv_finish+0x147/0x1d0
[ 243.775060] [<c18197c6>] ipv6_rcv+0x686/0xa10
[ 243.775060] [<c17716cb>] __netif_receive_skb_core+0x4ab/0x7b0
[ 244.044145] BUG: unable to handle kernel NULL pointer dereference at
0000006c
[ 244.044227] IP: [<c115ffc0>] __kmalloc_track_caller+0xb0/0x2b0
[ 244.044227] *pde = 00000000
[ 244.044227] Oops: 0000 [#1] PREEMPT SMP
[ 244.044227] Modules linked in: bluetooth_6lowpan 6lowpan rfcomm bnep
ecb btusb bluetooth nfc rfkill snd_intel8x0 parport_pc ohci_pci
snd_ac97_codec ac97_bus parport
Cheers,
Jukka
^ permalink raw reply
* Re: btusb_intr_complete returns -EPIPE
From: Naveen Kumar Parna @ 2014-10-08 10:21 UTC (permalink / raw)
To: Oliver Neukum; +Cc: linux-bluetooth@vger.kernel.org, linux-usb, acho
In-Reply-To: <1412759368.21709.15.camel@linux-0dmf.site>
hcidump does not show anything when the stalls happen.
Here is the hcidump log:
[root@banunxcas29 np03]# hcidump -x -t
HCI sniffer - Bluetooth packet analyzer ver 2.1
device: hci0 snap_len: 1028 filter: 0xffffffffffffffff
Corresponding usbmon log
ffff8801265343c0 2826295762 C Ii:1:021:1 -32:1 0
ffff880126418840 2826297275 S Ii:1:021:1 -115:1 16 <
ffff880126534240 2826298730 C Ii:1:020:1 -32:1 0
ffff880126418840 2826298856 C Ii:1:021:1 -32:1 0
ffff880126418840 2826299789 S Ii:1:020:1 -115:1 16 <
ffff880126418900 2826300154 S Ii:1:021:1 -115:1 16 <
ffff8801266329c0 2837941755 C Ii:1:018:1 -32:1 0
ffff880126632c00 2837941884 C Ii:1:016:1 -32:1 0
ffff880126418b40 2837942862 S Ii:1:016:1 -115:1 16 <
ffff880126418300 2837943184 S Ii:1:018:1 -115:1 16 <
ffff880126418300 2897160790 C Ii:1:018:1 -32:1 0
ffff880126418300 2897162701 S Ii:1:018:1 -115:1 16 <
ffff880126632cc0 2897332778 C Ii:1:019:1 -32:1 0
ffff880126418840 2897332909 C Ii:1:020:1 -32:1 0
ffff880126418900 2897332959 C Ii:1:021:1 -32:1 0
ffff880126418b40 2897333002 C Ii:1:016:1 -32:1 0
ffff880126418300 2897333035 C Ii:1:018:1 -32:1 0
ffff880126418900 2897334155 S Ii:1:021:1 -115:1 16 <
ffff880126418b40 2897334405 S Ii:1:020:1 -115:1 16 <
ffff880126418300 2897334635 S Ii:1:019:1 -115:1 16 <
ffff880126418f00 2897335015 S Ii:1:018:1 -115:1 16 <
ffff880126418840 2897335367 S Ii:1:016:1 -115:1 16 <
Corresponding kernel log:
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.604776] hci7 urb
ffff8801265343c0 status -32 count 0
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.606273] hci7
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.607741] hci6 urb
ffff880126534240 status -32 count 0
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.607862] hci7 urb
ffff880126418840 status -32 count 0
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.608787] hci6
Oct 8 15:29:38 banunxcas29 kernel: [ 3244.609155] hci7
Oct 8 15:29:49 banunxcas29 kernel: [ 3256.251736] hci4 urb
ffff8801266329c0 status -32 count 0
Oct 8 15:29:49 banunxcas29 kernel: [ 3256.251857] hci2 urb
ffff880126632c00 status -32 count 0
Oct 8 15:29:49 banunxcas29 kernel: [ 3256.252828] hci2
Oct 8 15:29:49 banunxcas29 kernel: [ 3256.253153] hci4
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.476287] hci4 urb
ffff880126418300 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.478179] hci4
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.648289] hci5 urb
ffff880126632cc0 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.648411] hci6 urb
ffff880126418840 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.648461] hci7 urb
ffff880126418900 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.648504] hci2 urb
ffff880126418b40 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.648537] hci4 urb
ffff880126418300 status -32 count 0
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.649651] hci7
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.649905] hci6
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.650134] hci5
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.650514] hci4
Oct 8 15:30:49 banunxcas29 kernel: [ 3315.650866] hci2
Thanks,
Naveen
On Wed, Oct 8, 2014 at 2:39 PM, Oliver Neukum <oneukum@suse.de> wrote:
> On Tue, 2014-10-07 at 20:01 +0530, Naveen Kumar Parna wrote:
>> > The new patch clears the halt condition.
>>
>> I mean usb_clear_halt( ) returned zero.
>
> That probably means that the device doesn't just
> produce spurious stalls. Does hcidump show anything
> when the stalls happen?
>
> Regards
> Oliver
>
>
^ permalink raw reply
* [PATCH v3 11/11] unit/test-hfp: Add some robustness tests for HFP HF
From: Lukasz Rymanowski @ 2014-10-08 10:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1412763331-30989-1-git-send-email-lukasz.rymanowski@tieto.com>
This patch adds folowing tests:
/hfp/test_hf_corrupted_1
/hfp/test_hf_corrupted_2
/hfp/test_hf_empty
/hfp/test_hf_unknown
---
unit/test-hfp.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index b57f41d..0a479e2 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -543,6 +543,25 @@ static void test_hf_unsolicited(gconstpointer data)
execute_context(context);
}
+static void test_hf_robustness(gconstpointer data)
+{
+ struct context *context = create_context(data);
+ bool ret;
+
+ context->hfp_hf = hfp_hf_new(context->fd_client);
+ g_assert(context->hfp_hf);
+
+ ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
+ g_assert(ret);
+
+ send_pdu(context);
+
+ hfp_hf_unref(context->hfp_hf);
+ context->hfp_hf = NULL;
+
+ execute_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -651,5 +670,26 @@ int main(int argc, char *argv[])
frg_pdu('\r'), frg_pdu('\n'),
data_end());
+ define_hf_test("/hfp/test_hf_corrupted_1", test_hf_unsolicited,
+ hf_result_handler, NULL,
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
+ frg_pdu('\r', 'X', '\r', '\n'),
+ frg_pdu('+', 'C', 'L', 'C', 'C', ':', '1', '3', '0',
+ '\r', '\n'),
+ data_end());
+
+ define_hf_test("/hfp/test_hf_corrupted_2", test_hf_unsolicited,
+ hf_result_handler, NULL,
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\r', '\n'),
+ data_end());
+
+ define_hf_test("/hfp/test_hf_empty", test_hf_robustness, NULL, NULL,
+ raw_pdu('\r'), data_end());
+
+ define_hf_test("/hfp/test_hf_unknown", test_hf_robustness, NULL, NULL,
+ raw_pdu('\r', '\n', 'B', 'R', '\r', '\n'),
+ data_end());
+
return g_test_run();
}
--
1.8.4
^ permalink raw reply related
* [PATCH v3 10/11] unit/test-hfp: Add tests for unsolicited results for HFP HF
From: Lukasz Rymanowski @ 2014-10-08 10:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1412763331-30989-1-git-send-email-lukasz.rymanowski@tieto.com>
This patch adds three test case:
/hfp/test_unsolicited_1
/hfp/test_unsolicited_2
/hfp/test_unsolicited_3
---
unit/test-hfp.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 162f1d5..b57f41d 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -507,6 +507,42 @@ static void test_hf_send_command(gconstpointer data)
execute_context(context);
}
+static void hf_result_handler(struct hfp_hf_result *result,
+ void *user_data)
+{
+ struct context *context = user_data;
+
+ hfp_hf_disconnect(context->hfp_hf);
+}
+
+static void test_hf_unsolicited(gconstpointer data)
+{
+ struct context *context = create_context(data);
+ bool ret;
+
+ context->hfp_hf = hfp_hf_new(context->fd_client);
+ g_assert(context->hfp_hf);
+
+ ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
+ g_assert(ret);
+
+ if (context->data->hf_result_func) {
+ const struct test_pdu *pdu;
+
+ pdu = &context->data->pdu_list[context->pdu_offset++];
+
+ ret = hfp_hf_register(context->hfp_hf,
+ context->data->hf_result_func,
+ (char *)pdu->data, context,
+ NULL);
+ g_assert(ret);
+ }
+
+ send_pdu(context);
+
+ execute_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -592,5 +628,28 @@ int main(int argc, char *argv[])
raw_pdu('\r', '\n', 'O', 'k', '\r', '\n'),
data_end());
+ define_hf_test("/hfp/test_unsolicited_1", test_hf_unsolicited,
+ hf_result_handler, NULL,
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
+ raw_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', '\r',
+ '\n'),
+ data_end());
+
+ define_hf_test("/hfp/test_unsolicited_2", test_hf_unsolicited,
+ hf_result_handler, NULL,
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
+ raw_pdu('\r', '\n', '+', 'C', 'L', 'C', 'C', ':', '1',
+ '3', '0', '\r', '\n'),
+ data_end());
+
+ define_hf_test("/hfp/test_unsolicited_3", test_hf_unsolicited,
+ hf_result_handler, NULL,
+ raw_pdu('+', 'C', 'L', 'C', 'C', '\0'),
+ frg_pdu('\r'), frg_pdu('\n'), frg_pdu('+'),
+ frg_pdu('C'), frg_pdu('L'), frg_pdu('C'), frg_pdu('C'),
+ frg_pdu(':'), frg_pdu('1'), frg_pdu('3'), frg_pdu('0'),
+ frg_pdu('\r'), frg_pdu('\n'),
+ data_end());
+
return g_test_run();
}
--
1.8.4
^ permalink raw reply related
* [PATCH v3 09/11] unit/test-hfp: Add send command tests for HFP HF
From: Lukasz Rymanowski @ 2014-10-08 10:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1412763331-30989-1-git-send-email-lukasz.rymanowski@tieto.com>
This patch adds following tests:
/hfp/test_send_command_1
/hfp/test_send_command_2
---
unit/test-hfp.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index ad26058..162f1d5 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -462,6 +462,51 @@ static void test_hf_init(gconstpointer data)
execute_context(context);
}
+static void hf_response_with_data(enum hfp_result res,
+ struct hfp_hf_result *resp,
+ void *user_data)
+{
+ struct context *context = user_data;
+
+ g_assert(resp);
+
+ hfp_hf_disconnect(context->hfp_hf);
+}
+
+static void hf_response_cb(enum hfp_result res, struct hfp_hf_result *resp,
+ void *user_data)
+{
+ struct context *context = user_data;
+
+ g_assert(!resp);
+
+ hfp_hf_disconnect(context->hfp_hf);
+}
+
+static void test_hf_send_command(gconstpointer data)
+{
+ struct context *context = create_context(data);
+ const struct test_pdu *pdu;
+ bool ret;
+
+ context->hfp_hf = hfp_hf_new(context->fd_client);
+ g_assert(context->hfp_hf);
+
+ pdu = &context->data->pdu_list[context->pdu_offset++];
+
+ ret = hfp_hf_set_close_on_unref(context->hfp_hf, true);
+ g_assert(ret);
+
+ if (context->data->response_func) {
+ ret = hfp_hf_send_command(context->hfp_hf,
+ context->data->response_func,
+ context, (char *)pdu->data);
+ g_assert(ret);
+ }
+
+ execute_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -532,6 +577,20 @@ int main(int argc, char *argv[])
data_end());
define_hf_test("/hfp/test_init", test_hf_init, NULL, NULL, data_end());
+ define_hf_test("/hfp/test_send_command_1", test_hf_send_command, NULL,
+ hf_response_cb,
+ raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\0'),
+ raw_pdu('\r', '\n', 'O', 'k', '\r', '\n'),
+ data_end());
+
+ define_hf_test("/hfp/test_send_command_2", test_hf_send_command,
+ NULL,
+ hf_response_with_data,
+ raw_pdu('A', 'T', '+', 'B', 'R', 'S', 'F', '\0'),
+ raw_pdu('\r', '\n', '+', 'B', 'R', 'S', 'F', '\r',
+ '\n'),
+ raw_pdu('\r', '\n', 'O', 'k', '\r', '\n'),
+ data_end());
return g_test_run();
}
--
1.8.4
^ permalink raw reply related
* [PATCH v3 08/11] unit/test-hfp: Add init test for HFP HF
From: Lukasz Rymanowski @ 2014-10-08 10:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1412763331-30989-1-git-send-email-lukasz.rymanowski@tieto.com>
This patch adds basic infrastruction for HFP HF test plus
init test.
It also moves send_pdu function in the file so it can be used by
test_hf_handler
---
unit/test-hfp.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 78 insertions(+), 18 deletions(-)
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index 4b3473b..ad26058 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -36,6 +36,7 @@ struct context {
int fd_server;
int fd_client;
struct hfp_gw *hfp;
+ struct hfp_hf *hfp_hf;
const struct test_data *data;
unsigned int pdu_offset;
};
@@ -52,6 +53,8 @@ struct test_data {
char *test_name;
struct test_pdu *pdu_list;
hfp_result_func_t result_func;
+ hfp_response_func_t response_func;
+ hfp_hf_result_func_t hf_result_func;
GIOFunc test_handler;
};
@@ -99,6 +102,22 @@ struct test_data {
data.test_handler = test_handler; \
} while (0)
+#define define_hf_test(name, function, result_func, response_function, \
+ args...)\
+ do { \
+ const struct test_pdu pdus[] = { \
+ args, { } \
+ }; \
+ static struct test_data data; \
+ data.test_name = g_strdup(name); \
+ data.pdu_list = g_malloc(sizeof(pdus)); \
+ data.hf_result_func = result_func; \
+ data.response_func = response_function; \
+ memcpy(data.pdu_list, pdus, sizeof(pdus)); \
+ g_test_add_data_func(name, &data, function); \
+ data.test_handler = test_hf_handler; \
+ } while (0)
+
static void context_quit(struct context *context)
{
g_main_loop_quit(context->main_loop);
@@ -128,6 +147,46 @@ static gboolean test_handler(GIOChannel *channel, GIOCondition cond,
return FALSE;
}
+static gboolean send_pdu(gpointer user_data)
+{
+ struct context *context = user_data;
+ const struct test_pdu *pdu;
+ ssize_t len;
+
+ pdu = &context->data->pdu_list[context->pdu_offset++];
+
+ if (pdu && !pdu->valid)
+ return FALSE;
+
+ len = write(context->fd_server, pdu->data, pdu->size);
+ g_assert_cmpint(len, ==, pdu->size);
+
+ pdu = &context->data->pdu_list[context->pdu_offset];
+ if (pdu->fragmented)
+ g_idle_add(send_pdu, context);
+
+ return FALSE;
+}
+
+static gboolean test_hf_handler(GIOChannel *channel, GIOCondition cond,
+ gpointer user_data)
+{
+ struct context *context = user_data;
+
+ if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL))
+ goto done;
+
+ send_pdu(context);
+
+ return TRUE;
+
+done:
+ context_quit(context);
+ context->watch_id = 0;
+
+ return FALSE;
+}
+
static void cmd_handler(const char *command, void *user_data)
{
struct context *context = user_data;
@@ -203,6 +262,9 @@ static void execute_context(struct context *context)
if (context->hfp)
hfp_gw_unref(context->hfp);
+ if (context->hfp_hf)
+ hfp_hf_unref(context->hfp_hf);
+
g_free(context);
}
@@ -275,24 +337,6 @@ static void test_register(gconstpointer data)
execute_context(context);
}
-static gboolean send_pdu(gpointer user_data)
-{
- struct context *context = user_data;
- const struct test_pdu *pdu;
- ssize_t len;
-
- pdu = &context->data->pdu_list[context->pdu_offset++];
-
- len = write(context->fd_server, pdu->data, pdu->size);
- g_assert_cmpint(len, ==, pdu->size);
-
- pdu = &context->data->pdu_list[context->pdu_offset];
- if (pdu->fragmented)
- g_idle_add(send_pdu, context);
-
- return FALSE;
-}
-
static void test_fragmented(gconstpointer data)
{
struct context *context = create_context(data);
@@ -404,6 +448,20 @@ static void check_string_2(struct hfp_gw_result *result,
hfp_gw_send_result(context->hfp, HFP_RESULT_ERROR);
}
+static void test_hf_init(gconstpointer data)
+{
+ struct context *context = create_context(data);
+
+ context->hfp_hf = hfp_hf_new(context->fd_client);
+ g_assert(context->hfp_hf);
+ g_assert(hfp_hf_set_close_on_unref(context->hfp_hf, true));
+
+ hfp_hf_unref(context->hfp_hf);
+ context->hfp_hf = NULL;
+
+ execute_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -473,5 +531,7 @@ int main(int argc, char *argv[])
raw_pdu('\r'),
data_end());
+ define_hf_test("/hfp/test_init", test_hf_init, NULL, NULL, data_end());
+
return g_test_run();
}
--
1.8.4
^ permalink raw reply related
* [PATCH v3 07/11] unit/test-hfp: Provide test_handler function via struct data
From: Lukasz Rymanowski @ 2014-10-08 10:15 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
In-Reply-To: <1412763331-30989-1-git-send-email-lukasz.rymanowski@tieto.com>
This patch allows us to use user defined test handler depends on needs.
Will use it in following patches which implements tests for HFP HF.
---
unit/test-hfp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/unit/test-hfp.c b/unit/test-hfp.c
index a8801b0..4b3473b 100644
--- a/unit/test-hfp.c
+++ b/unit/test-hfp.c
@@ -52,6 +52,7 @@ struct test_data {
char *test_name;
struct test_pdu *pdu_list;
hfp_result_func_t result_func;
+ GIOFunc test_handler;
};
#define data(args...) ((const unsigned char[]) { args })
@@ -95,6 +96,7 @@ struct test_data {
data.result_func = result_function; \
memcpy(data.pdu_list, pdus, sizeof(pdus)); \
g_test_add_data_func(name, &data, function); \
+ data.test_handler = test_handler; \
} while (0)
static void context_quit(struct context *context)
@@ -158,6 +160,7 @@ static struct context *create_context(gconstpointer data)
struct context *context = g_new0(struct context, 1);
GIOChannel *channel;
int err, sv[2];
+ const struct test_data *d = data;
context->main_loop = g_main_loop_new(NULL, FALSE);
g_assert(context->main_loop);
@@ -173,7 +176,8 @@ static struct context *create_context(gconstpointer data)
context->watch_id = g_io_add_watch(channel,
G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
- test_handler, context);
+ d->test_handler, context);
+
g_assert(context->watch_id > 0);
g_io_channel_unref(channel);
--
1.8.4
^ permalink raw reply related
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