diff --git a/tools/iso-tester.c b/tools/iso-tester.c
index 5a8b1fe..b1a2afb 100644
--- a/tools/iso-tester.c
+++ b/tools/iso-tester.c
#include "lib/mgmt.h"
#include "monitor/bt.h"
+#include "emulator/vhci.h"
#include "emulator/bthost.h"
#include "emulator/hciemu.h"
uint8_t client_num;
int step;
bool reconnect;
+ bool suspending;
};
struct iso_client_data {
bool disconnect;
bool ts;
bool mconn;
+ bool suspend;
uint8_t pkt_status;
const uint8_t *base;
size_t base_len;
.expect_err = -ENOSYS
};
+static const struct iso_client_data connect_suspend = {
+ .qos = QOS_16_2_1,
+ .expect_err = -ECONNRESET
+};
+
static const struct iso_client_data connect_cig_f0_invalid = {
.qos = QOS_FULL(0xF0, 0x00, {}, QOS_IO(10000, 10, 40, 0x02, 2)),
.expect_err = -EINVAL
.disconnect = true,
};
+static const struct iso_client_data suspend_16_2_1 = {
+ .qos = QOS_16_2_1,
+ .suspend = true,
+};
+
static const struct iso_client_data reconnect_16_2_1 = {
.qos = QOS_16_2_1,
.expect_err = 0,
continue;
if (isodata->send || isodata->recv || isodata->disconnect ||
- data->accept_reason)
+ isodata->suspend || data->accept_reason)
bthost_set_iso_cb(host, iso_accept_conn, iso_new_conn,
data);
tester_print("Disconnecting...");
}
+static bool hook_set_event_mask(const void *msg, uint16_t len, void *user_data)
+{
+ struct test_data *data = user_data;
+
+ tester_print("Set Event Mask");
+
+ --data->step;
+ if (!data->step)
+ tester_test_passed();
+
+ return true;
+}
+
+static void trigger_force_suspend(void *user_data)
+{
+ struct test_data *data = tester_get_data();
+ struct vhci *vhci = hciemu_get_vhci(data->hciemu);
+ int err;
+
+ /* Make sure suspend is only triggered once */
+ if (data->suspending)
+ return;
+
+ data->suspending = true;
+
+ /* Triggers the suspend */
+ tester_print("Set the system into Suspend via force_suspend");
+ err = vhci_set_force_suspend(vhci, true);
+ if (err) {
+ tester_warn("Unable to enable the force_suspend");
+ return;
+ }
+
+ data->step++;
+
+ hciemu_add_hook(data->hciemu, HCIEMU_HOOK_PRE_CMD,
+ BT_HCI_CMD_SET_EVENT_MASK,
+ hook_set_event_mask, data);
+}
+
static gboolean iso_connect(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
iso_recv(data, io);
else if (isodata->disconnect)
iso_shutdown(data, io);
+ else if (isodata->suspend)
+ trigger_force_suspend(data);
else
tester_test_passed();
}
setup_connect(data, 0, iso_connect_wait_close_cb);
}
+static void test_connect_suspend(const void *test_data)
+{
+ test_connect(test_data);
+ trigger_force_suspend((void *)test_data);
+}
+
static void test_bcast(const void *test_data)
{
struct test_data *data = tester_get_data();
setup_listen(data, 0, iso_accept_cb);
}
+static void test_connect2_suspend(const void *test_data)
+{
+ test_connect2(test_data);
+ trigger_force_suspend((void *)test_data);
+}
+
int main(int argc, char *argv[])
{
tester_init(&argc, &argv);
test_iso("ISO Connect Wait Close - Success", &connect_16_2_1,
setup_powered, test_connect_wait_close);
+ test_iso("ISO Connect Suspend - Success", &connect_suspend,
+ setup_powered,
+ test_connect_suspend);
+
+ test_iso("ISO Connected Suspend - Success", &suspend_16_2_1,
+ setup_powered,
+ test_connect);
+
test_iso2("ISO Connect2 CIG 0x01 - Success", &connect_1_16_2_1,
setup_powered,
test_connect2);
setup_powered,
test_connect2);
+ test_iso2("ISO Connect2 Suspend - Success", &connect_suspend,
+ setup_powered,
+ test_connect2_suspend);
+
+ test_iso2("ISO Connected2 Suspend - Success", &suspend_16_2_1,
+ setup_powered,
+ test_connect2);
+
test_iso("ISO Defer Send - Success", &connect_16_2_1_defer_send,
setup_powered,
test_connect);