Return-Path: From: Jakub Tyszkowski To: linux-bluetooth@vger.kernel.org Cc: Jakub Tyszkowski Subject: [PATCH 4/9] android/tester-ng: Add HIDHost set protocol mode case Date: Fri, 25 Jul 2014 15:13:30 +0200 Message-Id: <1406294015-8172-4-git-send-email-jakub.tyszkowski@tieto.com> In-Reply-To: <1406294015-8172-1-git-send-email-jakub.tyszkowski@tieto.com> References: <1406294015-8172-1-git-send-email-jakub.tyszkowski@tieto.com> Sender: linux-bluetooth-owner@vger.kernel.org List-ID: --- android/tester-hidhost.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/android/tester-hidhost.c b/android/tester-hidhost.c index c2ac0b9..d4640a4 100644 --- a/android/tester-hidhost.c +++ b/android/tester-hidhost.c @@ -357,6 +357,21 @@ static void hidhost_get_protocol_action(void) schedule_action_verification(step); } +static void hidhost_set_protocol_action(void) +{ + struct test_data *data = tester_get_data(); + const uint8_t *hid_addr = hciemu_get_client_bdaddr(data->hciemu); + struct step *step = g_new0(struct step, 1); + bt_bdaddr_t bdaddr; + + bdaddr2android((const bdaddr_t *) hid_addr, &bdaddr); + + step->action_status = data->if_hid->set_protocol(&bdaddr, + BTHH_REPORT_MODE); + + schedule_action_verification(step); +} + static struct test_case test_cases[] = { TEST_CASE_BREDRLE("HidHost Init", ACTION_SUCCESS(dummy_action, NULL), @@ -477,6 +492,38 @@ static struct test_case test_cases[] = { ACTION_SUCCESS(hidhost_get_protocol_action, NULL), CALLBACK_HH_MODE(CB_HH_PROTOCOL_MODE, BTHH_OK, HID_MODE_BREDR), ), + TEST_CASE_BREDRLE("HidHost SetProtocol Success", + ACTION_SUCCESS(bluetooth_enable_action, NULL), + CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), + ACTION_SUCCESS(emu_setup_powered_remote_action, NULL), + ACTION_SUCCESS(emu_set_ssp_mode_action, NULL), + ACTION_SUCCESS(bt_create_bond_action, + &prop_test_remote_ble_bdaddr_req), + CALLBACK_BOND_STATE(BT_BOND_STATE_BONDING, + &prop_emu_remote_bdadr, 1), + CALLBACK_DEVICE_FOUND(prop_emu_remotes_default_set, 1), + CALLBACK_SSP_REQ(BT_SSP_VARIANT_PASSKEY_CONFIRMATION, + prop_emu_remotes_pin_req_set, 2), + ACTION_SUCCESS(bt_ssp_reply_accept_action, + &ssp_confirm_accept_reply), + CALLBACK_BOND_STATE(BT_BOND_STATE_BONDED, + &prop_emu_remote_bdadr, 1), + CALLBACK_DEVICE_PROPS(NULL, 0), + ACTION_SUCCESS(emu_add_l2cap_server_action, + &l2cap_setup_sdp_data), + ACTION_SUCCESS(emu_add_l2cap_server_action, + &l2cap_setup_cc_data), + ACTION_SUCCESS(emu_add_l2cap_server_action, + &l2cap_setup_ic_data), + ACTION_SUCCESS(hidhost_connect_action, NULL), + CALLBACK_STATE(CB_HH_CONNECTION_STATE, + BTHH_CONN_STATE_CONNECTING), + CALLBACK(CB_HH_HID_INFO), + CALLBACK_STATE(CB_HH_CONNECTION_STATE, + BTHH_CONN_STATE_CONNECTED), + ACTION_SUCCESS(hidhost_set_protocol_action, NULL), + CALLBACK_HH_MODE(CB_HH_PROTOCOL_MODE, BTHH_OK, HID_MODE_BREDR), + ), }; struct queue *get_hidhost_tests(void) -- 1.9.1