* [PATCH 2/4] android/avrcp: Implement get player attributes text
From: Andrei Emeltchenko @ 2014-02-27 13:35 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393508113-18628-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
android/avrcp-lib.c | 9 +++++++++
android/avrcp-lib.h | 3 +++
2 files changed, 12 insertions(+)
diff --git a/android/avrcp-lib.c b/android/avrcp-lib.c
index 3db5bda..52074a7 100644
--- a/android/avrcp-lib.c
+++ b/android/avrcp-lib.c
@@ -312,3 +312,12 @@ int avrcp_list_player_attributes(struct avrcp *session, avctp_rsp_cb func,
AVRCP_LIST_PLAYER_ATTRIBUTES, NULL, 0,
func, user_data);
}
+
+int avrcp_get_player_attribute_text(struct avrcp *session, uint8_t *attributes,
+ uint8_t attr_len, avctp_rsp_cb func,
+ void *user_data)
+{
+ return avrcp_send_req(session, AVC_CTYPE_STATUS, AVC_SUBUNIT_PANEL,
+ AVRCP_GET_PLAYER_ATTRIBUTE_TEXT, attributes,
+ attr_len, func, user_data);
+}
diff --git a/android/avrcp-lib.h b/android/avrcp-lib.h
index 7283203..da8c990 100644
--- a/android/avrcp-lib.h
+++ b/android/avrcp-lib.h
@@ -110,3 +110,6 @@ int avrcp_get_capabilities(struct avrcp *session, uint8_t param,
avctp_rsp_cb func, void *user_data);
int avrcp_list_player_attributes(struct avrcp *session, avctp_rsp_cb func,
void *user_data);
+int avrcp_get_player_attribute_text(struct avrcp *session, uint8_t *attributes,
+ uint8_t attr_len, avctp_rsp_cb func,
+ void *user_data);
--
1.8.3.2
^ permalink raw reply related
* [PATCH 3/4] unit/avrcp: Add /TP/PAS/BV-03-C test
From: Andrei Emeltchenko @ 2014-02-27 13:35 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393508113-18628-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Test verifies that the get player application settings attribute text
command issued from the Controller.
---
unit/test-avrcp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index c4faca3..a75165b 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -375,6 +375,10 @@ static void test_client(gconstpointer data)
if (g_str_equal(context->data->test_name, "/TP/PAS/BV-01-C"))
avrcp_list_player_attributes(context->session, NULL, NULL);
+ if (g_str_equal(context->data->test_name, "/TP/PAS/BV-03-C"))
+ avrcp_get_player_attribute_text(context->session, NULL, 0,
+ NULL, NULL);
+
execute_context(context);
}
@@ -484,5 +488,11 @@ int main(int argc, char *argv[])
0x00, 0x19, 0x58, 0x11, 0x00, 0x00,
0x01, 0x00));
+ define_test("/TP/PAS/BV-03-C", test_client,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58,
+ AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
+ 0x00, 0x00, 0x00));
+
return g_test_run();
}
--
1.8.3.2
^ permalink raw reply related
* [PATCH 4/4] unit/avrcp: Add /TP/PAS/BV-04-C test
From: Andrei Emeltchenko @ 2014-02-27 13:35 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393508113-18628-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Test verifies that the Get Player Application Setting Attribute Text
response issued from the Target.
---
unit/test-avrcp.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/unit/test-avrcp.c b/unit/test-avrcp.c
index a75165b..db9cb92 100644
--- a/unit/test-avrcp.c
+++ b/unit/test-avrcp.c
@@ -343,11 +343,25 @@ static uint8_t avrcp_handle_list_attributes(struct avrcp *session,
return AVC_CTYPE_STABLE;
}
+static uint8_t avrcp_handle_get_player_attr_text(struct avrcp *session,
+ uint8_t transaction, uint16_t *params_len,
+ uint8_t *params, void *user_data)
+{
+ DBG("");
+
+ *params_len = 1;
+ params[0] = 0;
+
+ return AVC_CTYPE_STABLE;
+}
+
static const struct avrcp_control_handler control_handlers[] = {
{ AVRCP_GET_CAPABILITIES, AVC_CTYPE_STATUS,
avrcp_handle_get_capabilities },
{ AVRCP_LIST_PLAYER_ATTRIBUTES, AVC_CTYPE_STATUS,
avrcp_handle_list_attributes },
+ { AVRCP_GET_PLAYER_ATTRIBUTE_TEXT, AVC_CTYPE_STATUS,
+ avrcp_handle_get_player_attr_text },
{ },
};
@@ -494,5 +508,15 @@ int main(int argc, char *argv[])
AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
0x00, 0x00, 0x00));
+ define_test("/TP/PAS/BV-04-C", test_server,
+ raw_pdu(0x00, 0x11, 0x0e, 0x01, 0x48, 0x00,
+ 0x00, 0x19, 0x58,
+ AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
+ 0x00, 0x00, 0x00),
+ raw_pdu(0x02, 0x11, 0x0e, 0x0c, 0x48, 0x00,
+ 0x00, 0x19, 0x58,
+ AVRCP_GET_PLAYER_ATTRIBUTE_TEXT,
+ 0x00, 0x00, 0x01, 0x00));
+
return g_test_run();
}
--
1.8.3.2
^ permalink raw reply related
* Re: [PATCH 00/13] Make android-tester callbacks thread safe
From: Szymon Janc @ 2014-02-27 14:10 UTC (permalink / raw)
To: Jakub Tyszkowski; +Cc: linux-bluetooth
In-Reply-To: <1392987473-19994-1-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Friday 21 of February 2014 13:57:40 Jakub Tyszkowski wrote:
>
> This patch set makes all callbacks executions in HAL's notification thread being
> transfered to tester's context. As test-specific callbacks are called by generic
> callbacks, making the later executed in tester's main loop makes all custom
> callbacks (and newly added) automatically executed in the right contex.
>
> This is basically RFCv2 resend as PATCH with two follow-up patches.
>
> Changes in relation to RFCv2:
> * [PATCH 12/13]: Changed daemon termination checks to non-blocking
> * [PATCH 13/13]: Added guard to execute all scheduled callbacks in current
> test's context
>
> Best regards,
>
> Jakub Tyszkowski (13):
> android/tester: Execute device found cbacks in main loop
> android/tester: Execute discovery state cbacks in main loop
> android/tester: Execute device properties cbacks in main loop
> android/tester: Execute adapter props cbacks in main loop
> android/tester: Execute adapter state changed cbacks in main loop
> android/tester: Execute socket cbacks in main loop
> android/tester: Execute hh connection state cbacks in main loop
> android/tester: Execute hh info cbacks in main loop
> android/tester: Execute hh protocol mode cbacks in main loop
> android/tester: Execute hh report cbacks in main loop
> android/tester: Execute hh virtual unplug cbacks in main loop
> android/tester: Non-blocking check for daemon termination
> android/tester: Add guard for late callback calls
>
> android/android-tester.c | 375 ++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 326 insertions(+), 49 deletions(-)
All patches except 12/13 are now applied. Thanks.
For waiting for daemon I pushed fix that is using signalfd instead.
--
Best regards,
Szymon Janc
^ permalink raw reply
* [PATCH] android/hal-gatt-api: Add Client Get Device Type
From: Jakub Tyszkowski @ 2014-02-27 14:43 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jakub Tyszkowski
In-Reply-To: <1393404081-1401-22-git-send-email-jakub.tyszkowski@tieto.com>
---
android/hal-ipc-api.txt | 10 ++++++++++
android/hal-msg.h | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/android/hal-ipc-api.txt b/android/hal-ipc-api.txt
index 2a40fc1..72c2a7a 100644
--- a/android/hal-ipc-api.txt
+++ b/android/hal-ipc-api.txt
@@ -1623,6 +1623,16 @@ Android HAL name: "gatt" (BT_PROFILE_GATT_ID)
In case of an error, the error response will be returned.
Opcode 0x14 - Get Device Type command/response
+
+ Command parameters: Remote address (6 octets)
+ Response parameters: Device Type
+
+ Valid Device Type: 0x01 = BREDR
+ 0x02 = BLE
+ 0x03 = DUAL
+
+ In case of an error, the error response will be returned.
+
Opcode 0x15 - Set Advertising data command/response
Opcode 0x16 - Test Command command/response
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 7980c73..7f4266e 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -668,6 +668,11 @@ struct hal_cmd_gatt_client_read_remote_rssi {
uint8_t bdaddr[6];
} __attribute__((packed));
+#define HAL_OP_GATT_CLIENT_GET_DEVICE_TYPE 0x14
+struct hal_cmd_gatt_client_get_device_type {
+ uint8_t bdaddr[6];
+} __attribute__((packed));
+
/* Notifications and confirmations */
#define HAL_POWER_OFF 0x00
--
1.9.0
^ permalink raw reply related
* [PATCH] Bluetooth: Fix response on confirm_name
From: Lukasz Rymanowski @ 2014-02-27 14:48 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
According to mgmt-api.txt, in case of confirm name command,
cmd_complete should be always use as a response. Not command status
as it is now for failures.
Using command complete on failure is actually better as client might
be interested in device address for which confirm name failed.
Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
---
net/bluetooth/mgmt.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4c4912e..d3611dc 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3627,15 +3627,15 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
if (!hci_discovery_active(hdev)) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_FAILED);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_FAILED, &cp->addr, sizeof(cp->addr));
goto failed;
}
e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr);
if (!e) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_INVALID_PARAMS);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_INVALID_PARAMS, &cp->addr, sizeof(cp->addr));
goto failed;
}
--
1.8.4
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Fix response on confirm_name
From: Marcel Holtmann @ 2014-02-27 14:59 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth
In-Reply-To: <1393512487-25667-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
> According to mgmt-api.txt, in case of confirm name command,
> cmd_complete should be always use as a response. Not command status
> as it is now for failures.
> Using command complete on failure is actually better as client might
> be interested in device address for which confirm name failed.
>
> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
> ---
> net/bluetooth/mgmt.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 4c4912e..d3611dc 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3627,15 +3627,15 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
> hci_dev_lock(hdev);
>
> if (!hci_discovery_active(hdev)) {
> - err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> - MGMT_STATUS_FAILED);
> + err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> + MGMT_STATUS_FAILED, &cp->addr, sizeof(cp->addr));
the indentation is all wrong here.
> goto failed;
> }
>
> e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr);
> if (!e) {
> - err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> - MGMT_STATUS_INVALID_PARAMS);
> + err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> + MGMT_STATUS_INVALID_PARAMS, &cp->addr, sizeof(cp->addr));
And here as well.
> goto failed;
> }
Regards
Marcel
^ permalink raw reply
* [PATCH 1/9] android/tester: Coding style and syntax fix
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
Remove white spaces, break lines over 80 characters, redundand braces
for single statement blocks.
---
android/android-tester.c | 44 ++++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/android/android-tester.c b/android/android-tester.c
index 79c8e47..a94c536 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1154,7 +1154,7 @@ static void remote_device_properties_cb(bt_status_t status,
}
static bt_bdaddr_t enable_done_bdaddr_val = { {0x00} };
-static char enable_done_bdname_val[] = "BlueZ for Android";
+static const char enable_done_bdname_val[] = "BlueZ for Android";
static bt_uuid_t enable_done_uuids_val = {
.uu = { 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00,
0x00, 0x80, 0x5f, 0x9b, 0x34, 0xfb},
@@ -1305,7 +1305,7 @@ static const struct generic_data bluetooth_getprop_bdaddr_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
-static char test_bdname[] = "test_bdname_setget";
+static const char test_bdname[] = "test_bdname_setget";
static struct priority_property getprop_bdname_props[] = {
{
@@ -1563,7 +1563,8 @@ static struct priority_property setprop_scanmode_none_props[] = {
},
};
-static const struct generic_data bluetooth_setprop_scanmode_none_success2_test = {
+static const struct generic_data
+ bluetooth_setprop_scanmode_none_success2_test = {
.expected_hal_cb.adapter_properties_cb = check_count_properties_cb,
.expected_properties_num = 1,
.expected_properties = setprop_scanmode_none_props,
@@ -1601,7 +1602,7 @@ static const struct generic_data bluetooth_discovery_device_found_test = {
.expected_adapter_status = BT_STATUS_NOT_EXPECTED,
};
-static char remote_get_properties_bdname_val[] = "00:AA:01:01:00:00";
+static const char remote_get_properties_bdname_val[] = "00:AA:01:01:00:00";
static uint32_t remote_get_properties_cod_val = 0;
static bt_device_type_t remote_get_properties_tod_val = BT_DEVICE_DEVTYPE_BREDR;
static int32_t remote_get_properties_rssi_val = -60;
@@ -1657,7 +1658,7 @@ static const struct generic_data bt_dev_getprops_success_test = {
.expected_adapter_status = BT_STATUS_NOT_EXPECTED,
};
-static char remote_getprop_bdname_val[] = "00:AA:01:01:00:00";
+static const char remote_getprop_bdname_val[] = "00:AA:01:01:00:00";
static struct priority_property remote_getprop_bdname_props[] = {
{
@@ -1932,7 +1933,7 @@ static const struct generic_data bt_dev_getprop_fname_fail_test = {
.expected_adapter_status = BT_STATUS_FAIL,
};
-static char remote_setprop_fname_val[] = "set_fname_test";
+static const char remote_setprop_fname_val[] = "set_fname_test";
static struct priority_property remote_setprop_fname_props[] = {
{
@@ -1959,7 +1960,7 @@ static const struct generic_data bt_dev_setprop_fname_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
-static char remote_setprop_bdname_val[] = "setprop_bdname_fail";
+static const char remote_setprop_bdname_val[] = "setprop_bdname_fail";
static struct priority_property remote_setprop_bdname_props[] = {
{
@@ -2328,7 +2329,8 @@ static void test_enable(const void *test_data)
init_test_conditions(data);
- bdaddr2android((const bdaddr_t *)bdaddr, &enable_done_bdaddr_val.address);
+ bdaddr2android((const bdaddr_t *)bdaddr,
+ &enable_done_bdaddr_val.address);
adapter_status = data->if_bluetooth->enable();
check_expected_status(adapter_status);
@@ -2343,7 +2345,8 @@ static void test_enable_done(const void *test_data)
init_test_conditions(data);
- bdaddr2android((const bdaddr_t *)bdaddr, &enable_done_bdaddr_val.address);
+ bdaddr2android((const bdaddr_t *)bdaddr,
+ &enable_done_bdaddr_val.address);
adapter_status = data->if_bluetooth->enable();
check_expected_status(adapter_status);
@@ -2405,7 +2408,8 @@ static void test_getprop_bdaddr_success(const void *test_data)
init_test_conditions(data);
- bdaddr2android((const bdaddr_t *)bdaddr, &test_getprop_bdaddr_val.address);
+ bdaddr2android((const bdaddr_t *)bdaddr,
+ &test_getprop_bdaddr_val.address);
adapter_status = data->if_bluetooth->get_adapter_property(prop.type);
check_expected_status(adapter_status);
@@ -3779,7 +3783,6 @@ static void emu_powered_complete(uint16_t opcode, uint8_t status,
bt_status = data->if_hid->connect(&bdaddr);
if (bt_status != BT_STATUS_SUCCESS)
tester_setup_failed();
-
}
static void setup_hidhost_connect(const void *test_data)
@@ -3978,15 +3981,20 @@ int main(int argc, char *argv[])
test_bredrle("Bluetooth Init", NULL, setup_base, test_dummy, teardown);
- test_bredrle("Bluetooth Enable - Success", &bluetooth_enable_success_test,
- setup_base, test_enable, teardown);
+ test_bredrle("Bluetooth Enable - Success",
+ &bluetooth_enable_success_test,
+ setup_base, test_enable,
+ teardown);
test_bredrle("Bluetooth Enable - Success 2",
- &bluetooth_enable_success2_test, setup_enabled_adapter,
- test_enable_done, teardown);
-
- test_bredrle("Bluetooth Disable - Success", &bluetooth_disable_success_test,
- setup_enabled_adapter, test_disable, teardown);
+ &bluetooth_enable_success2_test,
+ setup_enabled_adapter,
+ test_enable_done, teardown);
+
+ test_bredrle("Bluetooth Disable - Success",
+ &bluetooth_disable_success_test,
+ setup_enabled_adapter,
+ test_disable, teardown);
test_bredrle("Bluetooth Set BDNAME - Success",
&bluetooth_setprop_bdname_success_test,
--
1.8.5.2
^ permalink raw reply related
* [PATCH 2/9] android/tester: Add create bond with PIN success test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with PIN success test case.
---
android/android-tester.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 140 insertions(+), 2 deletions(-)
diff --git a/android/android-tester.c b/android/android-tester.c
index a94c536..cb08ec1 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -124,6 +124,8 @@ struct bt_cb_data {
bt_status_t status;
bt_bdaddr_t bdaddr;
+ bt_bdname_t bdname;
+ uint32_t cod;
int num;
bt_property_t *props;
@@ -1019,6 +1021,22 @@ static void remote_setprop_fail_device_found_cb(int num_properties,
check_expected_status(status);
}
+static void bond_device_found_cb(int num_properties, bt_property_t *properties)
+{
+ struct test_data *data = tester_get_data();
+ uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t remote_addr;
+ bt_status_t status;
+
+ bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
+
+ if (data->cb_count == 4) {
+ data->cb_count--;
+ status = data->if_bluetooth->create_bond(&remote_addr);
+ check_expected_status(status);
+ }
+}
+
static gboolean device_found(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -1153,6 +1171,97 @@ static void remote_device_properties_cb(bt_status_t status,
g_idle_add(remote_device_properties, cb_data);
}
+static void bond_test_state_changed_cb(bt_status_t status,
+ bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state)
+{
+ struct test_data *data = tester_get_data();
+
+ switch (state) {
+ case BT_BOND_STATE_NONE:
+ data->cb_count--;
+ check_cb_count();
+ break;
+ case BT_BOND_STATE_BONDING:
+ data->cb_count--;
+ break;
+ case BT_BOND_STATE_BONDED:
+ data->cb_count--;
+ check_cb_count();
+ break;
+ default:
+ break;
+ }
+}
+
+static gboolean bond_state_changed(gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ struct bt_cb_data *cb_data = user_data;
+
+ if (data->test_init_done && test->expected_hal_cb.bond_state_changed_cb)
+ test->expected_hal_cb.bond_state_changed_cb(
+ cb_data->status,
+ &cb_data->bdaddr,
+ cb_data->state);
+
+ g_free(cb_data);
+ return FALSE;
+}
+
+static void bond_state_changed_cb(bt_status_t status,
+ bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state)
+{
+ struct bt_cb_data *cb_data = g_new0(struct bt_cb_data, 1);
+
+ cb_data->status = status;
+ cb_data->bdaddr = *remote_bd_addr;
+ cb_data->state = state;
+
+ g_idle_add(bond_state_changed, cb_data);
+}
+
+static void bond_create_pin_success_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod)
+{
+ struct test_data *data = tester_get_data();
+ const bt_bdaddr_t *bdaddr = remote_bd_addr;
+ bt_pin_code_t pin_code = {
+ .pin = { 0x30, 0x30, 0x30, 0x30 },
+ };
+ uint8_t pin_len = 4;
+
+ data->cb_count--;
+
+ data->if_bluetooth->pin_reply(bdaddr, TRUE, pin_len, &pin_code);
+}
+
+static gboolean pin_request(gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ struct bt_cb_data *cb_data = user_data;
+
+ if (data->test_init_done && test->expected_hal_cb.pin_request_cb)
+ test->expected_hal_cb.pin_request_cb(&cb_data->bdaddr,
+ &cb_data->bdname, cb_data->cod);
+
+ g_free(cb_data);
+ return FALSE;
+}
+
+static void pin_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod)
+{
+ struct bt_cb_data *cb_data = g_new0(struct bt_cb_data, 1);
+
+ cb_data->bdaddr = *remote_bd_addr;
+ cb_data->bdname = *bd_name;
+ cb_data->cod = cod;
+
+ g_idle_add(pin_request, cb_data);
+}
+
static bt_bdaddr_t enable_done_bdaddr_val = { {0x00} };
static const char enable_done_bdname_val[] = "BlueZ for Android";
static bt_uuid_t enable_done_uuids_val = {
@@ -2175,6 +2284,14 @@ static const struct generic_data bt_dev_setprop_disctimeout_fail_test = {
.expected_adapter_status = BT_STATUS_FAIL,
};
+static const struct generic_data bt_bond_create_pin_success_test = {
+ .expected_hal_cb.device_found_cb = bond_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.pin_request_cb = bond_create_pin_success_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -2182,9 +2299,9 @@ static bt_callbacks_t bt_callbacks = {
.remote_device_properties_cb = remote_device_properties_cb,
.device_found_cb = device_found_cb,
.discovery_state_changed_cb = discovery_state_changed_cb,
- .pin_request_cb = NULL,
+ .pin_request_cb = pin_request_cb,
.ssp_request_cb = NULL,
- .bond_state_changed_cb = NULL,
+ .bond_state_changed_cb = bond_state_changed_cb,
.acl_state_changed_cb = NULL,
.thread_evt_cb = NULL,
.dut_mode_recv_cb = NULL,
@@ -2913,6 +3030,22 @@ static void test_dev_setprop_disctimeout_fail(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_create_pin_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ static uint8_t pair_device_pin[] = { 0x30, 0x30, 0x30, 0x30 };
+ const void *pin = pair_device_pin;
+ uint8_t pin_len = 4;
+
+ init_test_conditions(data);
+
+ bthost_set_pin_code(bthost, pin, pin_len);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4251,6 +4384,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_dev_setprop_disctimeout_fail, teardown);
+ test_bredrle("Bluetooth Create Bond PIN - Success",
+ &bt_bond_create_pin_success_test,
+ setup_enabled_adapter,
+ test_bond_create_pin_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 3/9] android/tester: Add create bond with PIN fail test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with PIN fail test case.
---
android/android-tester.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index cb08ec1..4db5722 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1037,6 +1037,21 @@ static void bond_device_found_cb(int num_properties, bt_property_t *properties)
}
}
+static void bond_nostatus_device_found_cb(int num_properties,
+ bt_property_t *properties)
+{
+ struct test_data *data = tester_get_data();
+ uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t remote_addr;
+
+ bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
+
+ if (data->cb_count == 4) {
+ data->cb_count--;
+ data->if_bluetooth->create_bond(&remote_addr);
+ }
+}
+
static gboolean device_found(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -1236,6 +1251,21 @@ static void bond_create_pin_success_request_cb(bt_bdaddr_t *remote_bd_addr,
data->if_bluetooth->pin_reply(bdaddr, TRUE, pin_len, &pin_code);
}
+static void bond_create_pin_fail_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod)
+{
+ struct test_data *data = tester_get_data();
+ const bt_bdaddr_t *bdaddr = remote_bd_addr;
+ bt_pin_code_t pin_code = {
+ .pin = { 0x31, 0x31, 0x31, 0x31 },
+ };
+ uint8_t pin_len = 4;
+
+ data->cb_count--;
+
+ data->if_bluetooth->pin_reply(bdaddr, TRUE, pin_len, &pin_code);
+}
+
static gboolean pin_request(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -2292,6 +2322,14 @@ static const struct generic_data bt_bond_create_pin_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
+static const struct generic_data bt_bond_create_pin_fail_test = {
+ .expected_hal_cb.device_found_cb = bond_nostatus_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.pin_request_cb = bond_create_pin_fail_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = MGMT_STATUS_AUTH_FAILED,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3030,6 +3068,16 @@ static void test_dev_setprop_disctimeout_fail(const void *test_data)
data->if_bluetooth->start_discovery();
}
+
+static void bond_device_auth_fail_callback(uint16_t index, uint16_t length,
+ const void *param,
+ void *user_data)
+{
+ const struct mgmt_ev_auth_failed *ev = param;
+
+ check_expected_status(ev->status);
+}
+
static void test_bond_create_pin_success(const void *test_data)
{
struct test_data *data = tester_get_data();
@@ -3046,6 +3094,26 @@ static void test_bond_create_pin_success(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_create_pin_fail(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ static uint8_t pair_device_pin[] = { 0x30, 0x30, 0x30, 0x30 };
+ const void *pin = pair_device_pin;
+ uint8_t pin_len = 4;
+
+ init_test_conditions(data);
+
+ mgmt_register(data->mgmt, MGMT_EV_AUTH_FAILED, data->mgmt_index,
+ bond_device_auth_fail_callback, data,
+ NULL);
+
+ bthost_set_pin_code(bthost, pin, pin_len);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4389,6 +4457,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_pin_success, teardown);
+ test_bredrle("Bluetooth Create Bond PIN - Bad PIN",
+ &bt_bond_create_pin_fail_test,
+ setup_enabled_adapter,
+ test_bond_create_pin_fail, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 4/9] android/tester: Add create bond with SSP sucess test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with SSP succes test case. Confirm is set as SSP
pairing mode.
---
android/android-tester.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 84 insertions(+), 1 deletion(-)
diff --git a/android/android-tester.c b/android/android-tester.c
index 4db5722..2bb895c 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -127,6 +127,9 @@ struct bt_cb_data {
bt_bdname_t bdname;
uint32_t cod;
+ bt_ssp_variant_t ssp_variant;
+ uint32_t passkey;
+
int num;
bt_property_t *props;
};
@@ -1292,6 +1295,61 @@ static void pin_request_cb(bt_bdaddr_t *remote_bd_addr,
g_idle_add(pin_request, cb_data);
}
+static void bond_create_ssp_request_cb(const bt_bdaddr_t *remote_bd_addr,
+ bt_ssp_variant_t pairing_variant,
+ bool accept, uint32_t pass_key)
+{
+ struct test_data *data = tester_get_data();
+
+ data->if_bluetooth->ssp_reply(remote_bd_addr,
+ BT_SSP_VARIANT_PASSKEY_CONFIRMATION,
+ accept, pass_key);
+
+ data->cb_count--;
+}
+
+static void bond_create_ssp_success_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod,
+ bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key)
+{
+ bool accept = true;
+
+ bond_create_ssp_request_cb(remote_bd_addr, pairing_variant, accept,
+ pass_key);
+}
+
+static gboolean ssp_request(gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct generic_data *test = data->test_data;
+ struct bt_cb_data *cb_data = user_data;
+
+ if (data->test_init_done &&
+ test->expected_hal_cb.ssp_request_cb)
+ test->expected_hal_cb.ssp_request_cb(&cb_data->bdaddr,
+ &cb_data->bdname, cb_data->cod,
+ cb_data->ssp_variant, cb_data->passkey);
+
+ g_free(cb_data);
+ return FALSE;
+}
+
+static void ssp_request_cb(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
+ uint32_t cod, bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key)
+{
+ struct bt_cb_data *cb_data = g_new0(struct bt_cb_data, 1);
+
+ cb_data->bdaddr = *remote_bd_addr;
+ cb_data->bdname = *bd_name;
+ cb_data->cod = cod;
+ cb_data->ssp_variant = pairing_variant;
+ cb_data->passkey = pass_key;
+
+ g_idle_add(ssp_request, cb_data);
+}
+
static bt_bdaddr_t enable_done_bdaddr_val = { {0x00} };
static const char enable_done_bdname_val[] = "BlueZ for Android";
static bt_uuid_t enable_done_uuids_val = {
@@ -2330,6 +2388,14 @@ static const struct generic_data bt_bond_create_pin_fail_test = {
.expected_adapter_status = MGMT_STATUS_AUTH_FAILED,
};
+static const struct generic_data bt_bond_create_ssp_success_test = {
+ .expected_hal_cb.device_found_cb = bond_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.ssp_request_cb = bond_create_ssp_success_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -2338,7 +2404,7 @@ static bt_callbacks_t bt_callbacks = {
.device_found_cb = device_found_cb,
.discovery_state_changed_cb = discovery_state_changed_cb,
.pin_request_cb = pin_request_cb,
- .ssp_request_cb = NULL,
+ .ssp_request_cb = ssp_request_cb,
.bond_state_changed_cb = bond_state_changed_cb,
.acl_state_changed_cb = NULL,
.thread_evt_cb = NULL,
@@ -3114,6 +3180,18 @@ static void test_bond_create_pin_fail(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_create_ssp_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ init_test_conditions(data);
+
+ bthost_write_ssp_mode(bthost, 0x01);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4462,6 +4540,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_pin_fail, teardown);
+ test_bredrle("Bluetooth Create Bond SSP - Success",
+ &bt_bond_create_ssp_success_test,
+ setup_enabled_adapter,
+ test_bond_create_ssp_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 5/9] android/tester: Add create bond with SSP fail test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with SSP fail test case. Confirm is set as SSP
pairing mode.
---
android/android-tester.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index 2bb895c..f82025e 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1319,6 +1319,17 @@ static void bond_create_ssp_success_request_cb(bt_bdaddr_t *remote_bd_addr,
pass_key);
}
+static void bond_create_ssp_fail_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod,
+ bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key)
+{
+ bool accept = false;
+
+ bond_create_ssp_request_cb(remote_bd_addr, pairing_variant, accept,
+ pass_key);
+}
+
static gboolean ssp_request(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -2396,6 +2407,14 @@ static const struct generic_data bt_bond_create_ssp_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
+static const struct generic_data bt_bond_create_ssp_fail_test = {
+ .expected_hal_cb.device_found_cb = bond_nostatus_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.ssp_request_cb = bond_create_ssp_fail_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = MGMT_STATUS_AUTH_FAILED,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3192,6 +3211,22 @@ static void test_bond_create_ssp_success(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_create_ssp_fail(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ init_test_conditions(data);
+
+ mgmt_register(data->mgmt, MGMT_EV_AUTH_FAILED, data->mgmt_index,
+ bond_device_auth_fail_callback, data,
+ NULL);
+
+ bthost_write_ssp_mode(bthost, 0x01);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4545,6 +4580,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_ssp_success, teardown);
+ test_bredrle("Bluetooth Create Bond SSP - Negative reply",
+ &bt_bond_create_ssp_fail_test,
+ setup_enabled_adapter,
+ test_bond_create_ssp_fail, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 6/9] android/tester: Add create bond with no discovery test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with no discovery before create bond as NFC does.
SSP with confirm as authentication mode.
---
android/android-tester.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index f82025e..e27c212 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -2415,6 +2415,13 @@ static const struct generic_data bt_bond_create_ssp_fail_test = {
.expected_adapter_status = MGMT_STATUS_AUTH_FAILED,
};
+static const struct generic_data bt_bond_create_no_disc_success_test = {
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.ssp_request_cb = bond_create_ssp_success_request_cb,
+ .expected_cb_count = 3,
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3227,6 +3234,25 @@ static void test_bond_create_ssp_fail(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_create_no_disc_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t remote_addr;
+ bt_status_t status;
+
+ init_test_conditions(data);
+
+ bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
+
+ bthost_write_ssp_mode(bthost, 0x01);
+
+ status = data->if_bluetooth->create_bond(&remote_addr);
+ check_expected_status(status);
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4585,6 +4611,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_ssp_fail, teardown);
+ test_bredrle("Bluetooth Create Bond - No Discovery",
+ &bt_bond_create_no_disc_success_test,
+ setup_enabled_adapter,
+ test_bond_create_no_disc_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 7/9] android/tester: Add create bond with bad addr fail test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds create bond with bad addr fail test case.
---
android/android-tester.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index e27c212..058d2f2 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -2422,6 +2422,10 @@ static const struct generic_data bt_bond_create_no_disc_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
+static const struct generic_data bt_bond_create_bad_addr_success_test = {
+ .expected_adapter_status = MGMT_STATUS_CONNECT_FAILED,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3253,6 +3257,22 @@ static void test_bond_create_no_disc_success(const void *test_data)
check_expected_status(status);
}
+static void test_bond_create_bad_addr_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ bt_bdaddr_t bad_addr = {
+ .address = { 0x12, 0x34, 0x56, 0x78, 0x90, 0x12 }
+ };
+
+ init_test_conditions(data);
+
+ mgmt_register(data->mgmt, MGMT_EV_CONNECT_FAILED, data->mgmt_index,
+ bond_device_auth_fail_callback, data,
+ NULL);
+
+ data->if_bluetooth->create_bond(&bad_addr);
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4616,6 +4636,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_no_disc_success, teardown);
+ test_bredrle("Bluetooth Create Bond - Bad Address",
+ &bt_bond_create_bad_addr_success_test,
+ setup_enabled_adapter,
+ test_bond_create_bad_addr_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 8/9] android/tester: Add cancel bond success test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds cancel bond success test case. SSP as pairing mode.
---
android/android-tester.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index 058d2f2..e0f006b 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1330,6 +1330,24 @@ static void bond_create_ssp_fail_request_cb(bt_bdaddr_t *remote_bd_addr,
pass_key);
}
+static void bond_cancel_success_ssp_request_cb(bt_bdaddr_t *remote_bd_addr,
+ bt_bdname_t *bd_name, uint32_t cod,
+ bt_ssp_variant_t pairing_variant,
+ uint32_t pass_key)
+{
+ struct test_data *data = tester_get_data();
+ uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t remote_addr;
+ bt_status_t status;
+
+ bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
+
+ data->cb_count--;
+
+ status = data->if_bluetooth->cancel_bond(&remote_addr);
+ check_expected_status(status);
+}
+
static gboolean ssp_request(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -2426,6 +2444,14 @@ static const struct generic_data bt_bond_create_bad_addr_success_test = {
.expected_adapter_status = MGMT_STATUS_CONNECT_FAILED,
};
+static const struct generic_data bt_bond_cancel_success_test = {
+ .expected_hal_cb.device_found_cb = bond_nostatus_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb = bond_test_state_changed_cb,
+ .expected_hal_cb.ssp_request_cb = bond_cancel_success_ssp_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3273,6 +3299,18 @@ static void test_bond_create_bad_addr_success(const void *test_data)
data->if_bluetooth->create_bond(&bad_addr);
}
+static void test_bond_cancel_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ init_test_conditions(data);
+
+ bthost_write_ssp_mode(bthost, 0x01);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4641,6 +4679,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_create_bad_addr_success, teardown);
+ test_bredrle("Bluetooth Cancel Bonding - Success",
+ &bt_bond_cancel_success_test,
+ setup_enabled_adapter,
+ test_bond_cancel_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH 9/9] android/tester: Add remove bond success test case
From: Grzegorz Kolodziejczyk @ 2014-02-27 15:04 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1393513490-18674-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
This adds remove bond success test case. SSP as pairing mode.
---
android/android-tester.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/android/android-tester.c b/android/android-tester.c
index e0f006b..22e17e5 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
@@ -1211,6 +1211,29 @@ static void bond_test_state_changed_cb(bt_status_t status,
}
}
+static void bond_remove_success_state_changed_cb(bt_status_t status,
+ bt_bdaddr_t *remote_bd_addr, bt_bond_state_t state)
+{
+ struct test_data *data = tester_get_data();
+ bt_status_t remove_status;
+ uint8_t *bdaddr = (uint8_t *)hciemu_get_client_bdaddr(data->hciemu);
+ bt_bdaddr_t remote_addr;
+
+ bdaddr2android((const bdaddr_t *)bdaddr, &remote_addr.address);
+
+ if (state == BT_BOND_STATE_BONDED) {
+ data->cb_count--;
+ remove_status = data->if_bluetooth->remove_bond(&remote_addr);
+ check_expected_status(remove_status);
+ return;
+ }
+
+ if (state == BT_BOND_STATE_NONE) {
+ data->cb_count--;
+ check_cb_count();
+ }
+}
+
static gboolean bond_state_changed(gpointer user_data)
{
struct test_data *data = tester_get_data();
@@ -2452,6 +2475,15 @@ static const struct generic_data bt_bond_cancel_success_test = {
.expected_adapter_status = BT_STATUS_SUCCESS,
};
+static const struct generic_data bt_bond_remove_success_test = {
+ .expected_hal_cb.device_found_cb = bond_nostatus_device_found_cb,
+ .expected_hal_cb.bond_state_changed_cb =
+ bond_remove_success_state_changed_cb,
+ .expected_hal_cb.ssp_request_cb = bond_create_ssp_success_request_cb,
+ .expected_cb_count = 4,
+ .expected_adapter_status = BT_STATUS_SUCCESS,
+};
+
static bt_callbacks_t bt_callbacks = {
.size = sizeof(bt_callbacks),
.adapter_state_changed_cb = adapter_state_changed_cb,
@@ -3311,6 +3343,18 @@ static void test_bond_cancel_success(const void *test_data)
data->if_bluetooth->start_discovery();
}
+static void test_bond_remove_success(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ init_test_conditions(data);
+
+ bthost_write_ssp_mode(bthost, 0x01);
+
+ data->if_bluetooth->start_discovery();
+}
+
/* Test Socket HAL */
static gboolean adapter_socket_state_changed(gpointer user_data)
@@ -4684,6 +4728,11 @@ int main(int argc, char *argv[])
setup_enabled_adapter,
test_bond_cancel_success, teardown);
+ test_bredrle("Bluetooth Remove Bond - Success",
+ &bt_bond_remove_success_test,
+ setup_enabled_adapter,
+ test_bond_remove_success, teardown);
+
test_bredrle("Socket Init", NULL, setup_socket_interface,
test_dummy, teardown);
--
1.8.5.2
^ permalink raw reply related
* [PATCH v2] Bluetooth: Fix response on confirm_name
From: Lukasz Rymanowski @ 2014-02-27 15:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
According to mgmt-api.txt, in case of confirm name command,
cmd_complete should be always use as a response. Not command status
as it is now for failures.
Using command complete on failure is actually better as client might
be interested in device address for which confirm name failed.
Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
---
net/bluetooth/mgmt.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4c4912e..8b7a3c4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
if (!hci_discovery_active(hdev)) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_FAILED);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_FAILED, &cp->addr,
+ sizeof(cp->addr));
goto failed;
}
e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr);
if (!e) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_INVALID_PARAMS);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_INVALID_PARAMS, &cp->addr,
+ sizeof(cp->addr));
goto failed;
}
--
1.8.4
^ permalink raw reply related
* [PATCH v3] Bluetooth: Fix response on confirm_name
From: Lukasz Rymanowski @ 2014-02-27 15:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Lukasz Rymanowski
According to mgmt-api.txt, in case of confirm name command,
cmd_complete should be always use as a response. Not command status
as it is now for failures.
Using command complete on failure is actually better as client might
be interested in device address for which confirm name failed.
Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
---
net/bluetooth/mgmt.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4c4912e..78ac7c8 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
if (!hci_discovery_active(hdev)) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_FAILED);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_FAILED, &cp->addr,
+ sizeof(cp->addr));
goto failed;
}
e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr);
if (!e) {
- err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
- MGMT_STATUS_INVALID_PARAMS);
+ err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+ MGMT_STATUS_INVALID_PARAMS, &cp->addr,
+ sizeof(cp->addr));
goto failed;
}
--
1.8.4
^ permalink raw reply related
* Re: [PATCH v2] Bluetooth: Fix response on confirm_name
From: Marcel Holtmann @ 2014-02-27 15:47 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth
In-Reply-To: <1393513976-5497-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
> According to mgmt-api.txt, in case of confirm name command,
> cmd_complete should be always use as a response. Not command status
> as it is now for failures.
> Using command complete on failure is actually better as client might
> be interested in device address for which confirm name failed.
>
> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
> ---
> net/bluetooth/mgmt.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 4c4912e..8b7a3c4 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
> hci_dev_lock(hdev);
>
> if (!hci_discovery_active(hdev)) {
> - err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> - MGMT_STATUS_FAILED);
> + err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> + MGMT_STATUS_FAILED, &cp->addr,
> + sizeof(cp->addr));
you are testing me, right ;)
Regards
Marcel
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Fix response on confirm_name
From: Lukasz Rymanowski @ 2014-02-27 15:52 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <9A316920-E118-4B8B-B494-0B0396887144@holtmann.org>
Hi Marcel,
On 27 February 2014 16:47, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Lukasz,
>
>> According to mgmt-api.txt, in case of confirm name command,
>> cmd_complete should be always use as a response. Not command status
>> as it is now for failures.
>> Using command complete on failure is actually better as client might
>> be interested in device address for which confirm name failed.
>>
>> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
>> ---
>> net/bluetooth/mgmt.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index 4c4912e..8b7a3c4 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
>> hci_dev_lock(hdev);
>>
>> if (!hci_discovery_active(hdev)) {
>> - err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
>> - MGMT_STATUS_FAILED);
>> + err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
>> + MGMT_STATUS_FAILED, &cp->addr,
>> + sizeof(cp->addr));
>
> you are testing me, right ;)
>
Yup, and you are doing just fine :)
btw, v3 is the one.
> Regards
>
> Marcel
>
BR
\Lukasz
^ permalink raw reply
* Re: [PATCH v3] Bluetooth: Fix response on confirm_name
From: Marcel Holtmann @ 2014-02-27 16:42 UTC (permalink / raw)
To: Lukasz Rymanowski; +Cc: linux-bluetooth
In-Reply-To: <1393516048-10507-1-git-send-email-lukasz.rymanowski@tieto.com>
Hi Lukasz,
> According to mgmt-api.txt, in case of confirm name command,
> cmd_complete should be always use as a response. Not command status
> as it is now for failures.
> Using command complete on failure is actually better as client might
> be interested in device address for which confirm name failed.
>
> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
> ---
> net/bluetooth/mgmt.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 0/4] Bluetooth: Fix initiator/responder addresses for SMP
From: Marcel Holtmann @ 2014-02-27 16:51 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <1393502743-9995-1-git-send-email-johan.hedberg@gmail.com>
Hi Johan,
> I'm presenting this patch set as an alternative to the two patches from
> Marcel. The main difference is that we trade some more complexity during
> the connection creation phase with less complexity in looking up the
> values in SMP when the time comes for calling the smp_c1 function.
>
> One source of extra complexity is the attempt to handle the case of
> whitelist initiated connections. Since we do not use those I'm not
> completely sure it's worth to have code for it. If the handling is not
> needed patch 3/4 gets a bit simpler and patch 2/4 can potentially be
> dropped (I added that new function mainly to make 3/4 actually readable
> with this extra whitelist handling logic).
>
> Johan
>
> ----------------------------------------------------------------
> Johan Hedberg (4):
> Bluetooth: Add tracking of advertising address type
> Bluetooth: Add hci_copy_identity_address convenience function
> Bluetooth: Track LE initiator and responder address information
> Bluetooth: Use hdev->init/resp_addr values for smp_c1 function
>
> include/net/bluetooth/hci_core.h | 7 +++
> net/bluetooth/hci_core.c | 35 ++++++++---
> net/bluetooth/hci_event.c | 114 ++++++++++++++++++++++++++++++-----
> net/bluetooth/smp.c | 22 ++-----
> 4 files changed, 136 insertions(+), 42 deletions(-)
I applied patch 1 and patch 2 to bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH 14/17] android/tester: Increase timeout for test failure
From: Lukasz Rymanowski @ 2014-02-27 17:18 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
In-Reply-To: <1393379848-4031-15-git-send-email-lukasz.rymanowski@tieto.com>
Hi,
On 26 February 2014 02:57, Lukasz Rymanowski
<lukasz.rymanowski@tieto.com> wrote:
> Inquiry command is sent with inquiry lenght 10.24 sec. There are
> testcases where that time is needed to end the test, therefore change
> timeout to 12 sec (number choosed based on strong feelings ;))
> ---
> android/android-tester.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/android/android-tester.c b/android/android-tester.c
> index 65516c1..b09834a 100644
> --- a/android/android-tester.c
> +++ b/android/android-tester.c
> @@ -3707,7 +3707,7 @@ static void test_hidhost_get_report(const void *test_data)
> user->test_data = data; \
> tester_add_full(name, data, test_pre_setup, test_setup, \
> test, test_teardown, test_post_teardown, \
> - 3, user, g_free); \
> + 12, user, g_free); \
> } while (0)
>
> int main(int argc, char *argv[])
> --
> 1.8.4
>
Will not need this patch. Will fix it in v2
\Lukasz
^ permalink raw reply
* Re: [PATCHv2 00/23] Add GATT Client Messages
From: Szymon Janc @ 2014-02-27 21:15 UTC (permalink / raw)
To: Jakub Tyszkowski; +Cc: linux-bluetooth
In-Reply-To: <1393404081-1401-1-git-send-email-jakub.tyszkowski@tieto.com>
Hi Jakub,
On Wednesday 26 February 2014 09:40:58 Jakub Tyszkowski wrote:
> This patchset adds GATT's Client part of ipc messages data.
>
> v2 changes:
> * moved msg structs and opcodes up to message opcodes section of hal-msg.h
> * fixed typo and renamed few struct members to better match those in HAL
> hdrs * corrected tlv field types
> * [PATCHES 14-23/23] added opcodes and structs for the rest of Client
> messages
>
> Regards,
> Jakub Tyszkowski (23):
> android/hal-gatt-api: Add missing opcodes in GATT Service
> android/hal-gatt-api: Add Client Register
> android/hal-gatt-api: Add Client Unregister
> android/hal-gatt-api: Add Client Scan
> android/hal-gatt-api: Add Client Connect Remote
> android/hal-gatt-api: Add Client Disconnect Remote
> android/hal-gatt-api: Add Client Listen
> android/hal-gatt-api: Add Client Refresh Remote Cache
> android/hal-gatt-api: Add Client Search Service
> android/hal-gatt-api: Add Client Get Included Service
> android/hal-gatt-api: Add Client Get Characteristic
> android/hal-gatt-api: Add Client Get Descriptor
> android/hal-gatt-api: Add Client Read Characteristic
> android/hal-gatt-api: Add Client Write Characteristic
> android/hal-gatt-api: Add Client Read Descriptor
> android/hal-gatt-api: Add Client Write Descriptor
> android/hal-gatt-api: Add Client Execute Write
> android/hal-gatt-api: Add Client Register for Notification
> android/hal-gatt-api: Add Client Deregister for Notification
> android/hal-gatt-api: Add Client Read Remote RSSI
> android/hal-gatt-api: Add Client Get Device Type
> android/hal-gatt-api: Add Client Set Advertising Data
> android/hal-gatt-api: Add Client Test Command
>
> android/hal-ipc-api.txt | 324
> +++++++++++++++++++++++++++++++++++++++++------- android/hal-msg.h |
> 186 +++++++++++++++++++++++++++
> 2 files changed, 466 insertions(+), 44 deletions(-)
All patches applied, thanks.
--
Szymon K. Janc
szymon.janc@gmail.com
^ permalink raw reply
* Re: [PATCH 00/13] Android HAL GATT Server API Commands
From: Szymon Janc @ 2014-02-27 21:16 UTC (permalink / raw)
To: Grzegorz Kolodziejczyk; +Cc: linux-bluetooth
In-Reply-To: <1393507731-1974-1-git-send-email-grzegorz.kolodziejczyk@tieto.com>
Hi Grzegorz,
On Thursday 27 February 2014 14:28:38 Grzegorz Kolodziejczyk wrote:
> This serie of hal-gatt-api patches updates hal-ipc-api document and
> hal-msg header in parallel. Should be applied on top of GATT client
> patches.
>
> Grzegorz Kolodziejczyk (13):
> android/hal-gatt-api: Add Server Register
> android/hal-gatt-api: Add Server Unregister
> android/hal-gatt-api: Add Server Connect
> android/hal-gatt-api: Add Server Disconnect
> android/hal-gatt-api: Add Server Service
> android/hal-gatt-api: Add Server Included Service
> android/hal-gatt-api: Add Server Characteristic
> android/hal-gatt-api: Add Server Descriptor
> android/hal-gatt-api: Add Server Start Service
> android/hal-gatt-api: Add Server Stop Service
> android/hal-gatt-api: Add Server Delete Service
> android/hal-gatt-api: Add Server Send Indication
> android/hal-gatt-api: Add Server Send Response
>
> android/hal-ipc-api.txt | 119
> ++++++++++++++++++++++++++++++++++++++++++++++++ android/hal-msg.h |
> 93 +++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+)
All patches applied, thanks.
--
Szymon K. Janc
szymon.janc@gmail.com
^ 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