|
From: Mattias A. <mat...@us...> - 2001-08-02 16:05:08
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
test.c 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20
unplug_test.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* fixed some errors for unplug tests
* cleanup
The diff of the modified file(s):
--- test.c 2001/08/01 10:20:07 1.21
+++ test.c 2001/08/02 16:04:48 1.22
@@ -128,7 +128,7 @@
l2cap_con *testcon2;
l2cap_con *testcon3;
s32 emulate_pending =3D 0;
-s32 test_assymmetric_mtu =3D 0;
+s32 test_inmtu =3D 0;
s32 dont_send_config_req =3D 0;
s32 use_multiple_conf_params =3D 0;
s32 disable_testpsm =3D 0;
@@ -154,7 +154,6 @@
l2cap_register_upper(L2CAP_TEST_LAYER, &this_layer);
l2cap_register_upper(L2CAP_TEST2_LAYER, &this_layer);
l2cap_register_upper(L2CAP_TEST3_LAYER, &this_layer);
- //l2cap_register_upper(7, &this_layer);
}
=20
void test_shutdown(void)
@@ -186,44 +185,51 @@
return 0;
}
=20
-void test_connect_ind(l2cap_con *l2cap)=20
+static struct timer_list test_timer;
+
+static void
+test_timeout(unsigned long ptr)
{
-#ifdef __KERNEL__
- struct tq_struct test_task;
- static s32 t_init =3D -1;
+ struct l2cap_con *con =3D (struct l2cap_con *)ptr;
+ printk("Test timeout\n");
=20
- if (t_init < 0)
- t_init =3D jiffies;
-#endif
+ if (emulate_pending) {
+
+ printk("Now sending config rsp non-pending...\n");
+ emulate_pending =3D 0;
+=09=09
+ if (l2ca_connect_rsp(con, RES_SUCCESS, STAT_NOINFO)) {
+ D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20
+ return;
+ }
+ emulate_pending =3D 0;
+ }
+}
+
+
+void test_connect_ind(l2cap_con *l2cap)=20
+{
D_STATE("test_connect_ind : remote cid : %d\n", l2cap->remote_cid);
PRINTPSM(l2cap);
=20
- if (emulate_pending)
- {
+ if (emulate_pending) {
+ printk("Sending connect rsp pending and waiting 5 secs\n");
if (l2ca_connect_rsp(l2cap, RES_PENDING, STAT_AUTHENTPEND)) {
D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20
return;
}
+
+ /* start 5 sec timer */=09=09
#ifndef __KERNEL__
- printk("'Authorization' pending for 5 secs...\n");
- sleep(5);
-#else
- while ((jiffies - t_init) < 5*HZ) {
- test_task.routine =3D (void*)test_connect_ind;
- test_task.data =3D l2cap;
=20=09=09=09
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
- queue_task(&test_task, &tq_scheduler);
#else
- queue_task(&test_task, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-#endif
- }
+ init_timer(&test_timer);
+ test_timer.function =3D test_timeout;
+ test_timer.data =3D l2cap;
+ test_timer.expires =3D jiffies + 5*HZ;
+ add_timer(&test_timer);
#endif
-
- printk("Shutting off authorization pending.\n");
- emulate_pending =3D 0;
- printk("Sending connect rsp with result =3D success back\n");
+ return;
}
=20=09
if (disable_testpsm =3D=3D 1)
@@ -238,6 +244,7 @@
return;
}
=20=09
+ printk("now sending back result success !\n");
if (l2ca_connect_rsp(l2cap, RES_SUCCESS, STAT_NOINFO)) {
D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20
return;
@@ -251,8 +258,6 @@
testcon2 =3D l2cap;
else if (l2cap->psm =3D=3D L2CAP_TEST3_LAYER)
testcon3 =3D l2cap;
-// else
-// testcon =3D l2cap;
}
=20
/* only client receives connect pnd */
@@ -267,8 +272,6 @@
testcon2 =3D l2cap;
else if (l2cap->psm =3D=3D L2CAP_TEST3_LAYER)
testcon3 =3D l2cap;
-// else
-// testcon =3D l2cap;
}
=20
/* only client receives connect cfm */
@@ -294,15 +297,12 @@
}
=20=09=09
/* store connection */
-
if (l2cap->psm =3D=3D L2CAP_TEST_LAYER)
testcon =3D l2cap;
else if (l2cap->psm =3D=3D L2CAP_TEST2_LAYER)
testcon2 =3D l2cap;
else if (l2cap->psm =3D=3D L2CAP_TEST3_LAYER)
testcon3 =3D l2cap;
-// else
-// testcon =3D l2cap;
} else=20=09=20=20=20=20=20=20=20
D_RCV("test_config_cfm : already have sent config request\n");
}
@@ -327,7 +327,6 @@
=20
/* check if we received a pos response on a previous config req */=20
if (!l2ca_local_conf_done(l2cap)) {
- u16 tmp_mtu;
=20
/* still haven't sent config request yet */
=20
@@ -346,13 +345,14 @@
D_ERR("test_config_cfm : Configuration request failed\n");
}
} else {
- if (test_assymmetric_mtu)=20=09
- tmp_mtu =3D 8192;
- else
- tmp_mtu =3D 0; /* use default */
-=09=09=09
- if (l2ca_config_req(l2cap, tmp_mtu, NULL, 0, 0))
+ if (l2ca_config_req(l2cap, test_inmtu, NULL, 0, 0))
D_ERR("test_config_ind : configuration request failed\n");
+
+ if (test_inmtu)
+ {
+ printk("Set back our test_inmtu to default\n");
+ test_inmtu =3D 0;
+ }
}
=20
} else=20
--- unplug_test.c 2001/07/31 19:28:55 1.3
+++ unplug_test.c 2001/08/02 16:04:47 1.4
@@ -35,7 +35,8 @@
* the executable file might be covered by the provisions of the GNU
* General Public License.
*
- * $Id$
+ * $Id: unplug_test.c,v 1.
+3 2001/07/31 19:28:55 pkj Exp $
*
*/
=20
@@ -63,7 +64,6 @@
#include "include/btcommon.h"
#endif
=20
-
extern rfcomm_con rfcomm_con_list[7];
=20
extern rpn_values rpn_val;
@@ -74,7 +74,7 @@
=20
extern l2cap_con *testcon; /* is set in test.c */
extern s32 emulate_pending; /* is set in test.c */
-extern s32 test_assymmetric_mtu;
+extern s32 test_inmtu;
extern s32 dont_send_config_req;
extern s32 use_multiple_conf_params;
extern s32 disable_testpsm;
@@ -287,15 +287,13 @@
=20
=20
/*
- * Test case : Opening of a Connection-Oriented Channel,=20
- * Device B Initiator (L2CAP Test 1)
- * (see btd.c, issue command 'test_conn <bd addr>')
+ * Test case 1 : Opening of a Connection-Oriented Channel,=20
+ *
+ * (see bttest.c, issue command 'test_conn <bd addr> <psm>')
*/
=20
/*
- * Test case : Opening of a Connection-Oriented Channel,=20
- * Device A Initiator (L2CAP Test 2)
- * (see test.c, handled automatically as server)
+ * Test case : Data transfer via Open L2CAP Channel (L2CAP Test 2)
*/
=20
/*
@@ -346,17 +344,17 @@
=20
/*
* Test case : Disconnection of a Connection Oriented Channel
- * Device B Initiator (L2CAP Test 4)
- * (see btd.c, issue command 'test_disc')
+ * Device B Initiator (L2CAP Test 3)
+ * (see btd.c, issue command 'test_disc <local CID>')
*/
=20
=20=20
/*
- * Test case : Disconnection of a Connection-Oriented Channel,=20
- * Device A Initiator (L2CAP Test 5)
- * (see test.c, handled automatically as server)
+ * Test case : Echo
+ * Device A Initiator (L2CAP Test 4)
+ *
*/
-/* test_conn 00:e0:03:78:b0:db */
+/* upt t 241 */
=20
/*
=20
@@ -364,38 +362,48 @@
* Data Transferred (L2CAP Test 5)
*/
=20
+#define OPTION_MTU1 4096
+#define OPTION_MTU2 8192
=20
static void test_2_5_1(void)
{
- /* FIXME - Client sends configure request with MTU 4096 */
- if (l2ca_config_req(testcon, 48, NULL, 0, 0)) {
+ printk("[Client] Sending config req for mtu =3D %d\n", OPTION_MTU1);
+ if (l2ca_config_req(testcon, OPTION_MTU1, NULL, 0, 0)) {
D_ERR("l2ca_connect_cfm : Configuration request failed\n");
}
}
=20
+static void test_2_5_2(void)
+{
+ printk("[Server] Set our in_mtu to :%d\n", OPTION_MTU2);
+ test_inmtu =3D OPTION_MTU2;
+}
+
+
static void test_2_5_3(void)
{
- /* FIXME - Server sends configure request with MTU 16384 */
- if (l2ca_config_req(testcon, 16384, NULL, 0xffff, 0)) {
+ printk("[Client] Sending config req for mtu =3D %d\n", OPTION_MTU2);
+ if (l2ca_config_req(testcon, OPTION_MTU2, NULL, 0xffff, 0)) {
D_ERR("l2ca_connect_cfm : Configuration request failed\n");
}
}
=20
static void test_2_5_4(void)
{
- /* FIXME - Client responds success in configure response */
+ printk("[Server] Set our in_mtu to :%d\n", OPTION_MTU1);
+ test_inmtu =3D OPTION_MTU1;
}
=20
static void test_2_5_5(void)
{
/* Client sends 8192 bytes of data */
- printk("test_2_5_6, client sends 8192 bytes\n");
+ printk("Sends 8192 bytes\n");
test_send_data(testcon, tmpdata, 8192);
}
=20
static void test_2_5_6(void)
{
- printk("test_2_5_6, server sends 4096 bytes\n");
+ printk("Sending 4096 bytes\n");
/* Server sends 4096 bytes of data */
test_send_data(testcon, tmpdata, 4096);
}
@@ -1391,6 +1399,8 @@
case 226: test_2_2_6();
break;
case 251: test_2_5_1();
+ break;
+ case 252: test_2_5_2();
break;
case 253: test_2_5_3();
break;
|