diff options
author | Vinicius Costa Gomes <vinicius.gomes@openbossa.org> | 2012-01-24 10:57:20 -0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-01-24 16:19:21 +0200 |
commit | 3ad251fe23beec146be2326849b647e8d7d63f68 (patch) | |
tree | 00a6bf9f4c24a12fde7dab68a1e706991a52b14d | |
parent | 51886914ef77f6c7331347a5e023cf8cde65629c (diff) |
test: Add support for passing the CID to btiotest
If we want to test LE connections using btiotest we need to be
able to inform btio the Channel ID that we want to connect to, so
the kernel is able to learn that we want to establish a LE connection.
-rw-r--r-- | test/btiotest.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/btiotest.c b/test/btiotest.c index 91fc1d53..f02711d1 100644 --- a/test/btiotest.c +++ b/test/btiotest.c @@ -225,8 +225,8 @@ static void confirm_cb(GIOChannel *io, gpointer user_data) } static void l2cap_connect(const char *src, const char *dst, uint16_t psm, - gint disconn, gint sec, - gint prio) + uint16_t cid, gint disconn, + gint sec, gint prio) { struct io_data *data; GError *err = NULL; @@ -242,6 +242,7 @@ static void l2cap_connect(const char *src, const char *dst, uint16_t psm, BT_IO_OPT_SOURCE, src, BT_IO_OPT_DEST, dst, BT_IO_OPT_PSM, psm, + BT_IO_OPT_CID, cid, BT_IO_OPT_SEC_LEVEL, sec, BT_IO_OPT_PRIORITY, prio, BT_IO_OPT_INVALID); @@ -251,6 +252,7 @@ static void l2cap_connect(const char *src, const char *dst, uint16_t psm, &err, BT_IO_OPT_DEST, dst, BT_IO_OPT_PSM, psm, + BT_IO_OPT_CID, cid, BT_IO_OPT_SEC_LEVEL, sec, BT_IO_OPT_PRIORITY, prio, BT_IO_OPT_INVALID); @@ -470,6 +472,7 @@ static gint opt_accept = DEFAULT_ACCEPT_TIMEOUT; static gint opt_sec = 0; static gboolean opt_master = FALSE; static gint opt_priority = 0; +static gint opt_cid = 0; static GMainLoop *main_loop; @@ -478,6 +481,8 @@ static GOptionEntry options[] = { "RFCOMM channel" }, { "psm", 'p', 0, G_OPTION_ARG_INT, &opt_psm, "L2CAP PSM" }, + { "cid", 'j', 0, G_OPTION_ARG_INT, &opt_cid, + "L2CAP CID" }, { "sco", 's', 0, G_OPTION_ARG_NONE, &opt_sco, "Use SCO" }, { "defer", 'd', 0, G_OPTION_ARG_NONE, &opt_defer, @@ -522,11 +527,10 @@ int main(int argc, char *argv[]) opt_accept, opt_reject, opt_disconn, opt_defer, opt_sec, opt_priority); - if (opt_psm) { + if (opt_psm || opt_cid) { if (argc > 1) - l2cap_connect(opt_dev, argv[1], opt_psm, - opt_disconn, opt_sec, - opt_priority); + l2cap_connect(opt_dev, argv[1], opt_psm, opt_cid, + opt_disconn, opt_sec, opt_priority); else l2cap_listen(opt_dev, opt_psm, opt_defer, opt_reject, opt_disconn, opt_accept, opt_sec, |