From: Mattias A. <mat...@us...> - 2001-03-30 12:04:45
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added test_process_cmd (unfinished) minor changes The diff of the modified file(s): --- test.c 2001/02/15 16:27:34 1.12 +++ test.c 2001/03/30 12:04:43 1.13 @@ -196,8 +196,10 @@ D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } +#ifdef BT_USERSTACK printk("'Authorization' pending for 5 secs...\n"); sleep(5); +#endif printk("Shutting off authorization pending.\n"); emulate_pending =3D 0; printk("Sending connect rsp with result =3D success back\n"); @@ -301,7 +303,7 @@ if (!l2ca_remote_conf_done(l2cap)){ /* still haven't sent a pos configure response*/ =20 - if (l2ca_config_rsp(l2cap, 0, NULL, 1 /* ok */)){ + if (l2ca_config_rsp(l2cap, 0, NULL, CONF_SUCCESS)){ D_ERR("test_config_ind : Configuration response failed\n"); }=20=20=20=20 } else=20 @@ -402,5 +404,18 @@ =20 return l2cap_send_data(tx_buf, con); } + +void test_process_cmd(unsigned char *cmd, s32 size) +{ + printk("test_process_cmd\n"); + print_data("cmd ", cmd, size); +=20=20 + /* fixme -- things to do */ + + /* init test layer */ + +=20=20 +} + =20 /****************** END OF FILE sdp.c ************************************= ***/ |
From: Mats F. <ma...@us...> - 2001-06-15 12:29:23
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added another l2cap_con object, used for testing The diff of the modified file(s): --- test.c 2001/03/30 12:04:43 1.13 +++ test.c 2001/06/15 12:29:23 1.14 @@ -123,6 +123,7 @@ l2cap_con *testcon; l2cap_con *testcon2; l2cap_con *testcon3; +l2cap_con *test_con; s32 emulate_pending =3D 0; s32 test_assymmetric_mtu =3D 0; s32 dont_send_config_req =3D 0; |
From: Mats F. <ma...@us...> - 2001-06-15 13:38:46
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Removed test_con object The diff of the modified file(s): --- test.c 2001/06/15 12:29:23 1.14 +++ test.c 2001/06/15 13:38:45 1.15 @@ -123,7 +123,6 @@ l2cap_con *testcon; l2cap_con *testcon2; l2cap_con *testcon3; -l2cap_con *test_con; s32 emulate_pending =3D 0; s32 test_assymmetric_mtu =3D 0; s32 dont_send_config_req =3D 0; |
From: Anders J. <and...@us...> - 2001-07-30 13:48:50
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected spelling error The diff of the modified file(s): --- test.c 2001/07/30 10:16:35 1.16 +++ test.c 2001/07/30 13:48:49 1.17 @@ -455,7 +455,7 @@ Make a link in this directory to that file and include it in the build (add it to the Makefile) if you are going to use this feature. */ -#if 0 +#ifdef INCLUDE_UNPLUG_TEST=20 int testcase =3D my_atoi(cmd+2); =20 if (testcase > 0) @@ -468,7 +468,7 @@ /* other stuff */ } #else - printk("test_process_cmd: Not available, see test.c for details\n"); + printk("test_process_cmd: Not available\n"); #endif =20 } |
From: Peter K. <pk...@us...> - 2001-07-31 17:28:07
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Include linux/interrupt.h to make it compile for 2.4.x * Check for __KERNEL__ instead of BTD_USERSTACK. The diff of the modified file(s): --- test.c 2001/07/31 09:04:13 1.18 +++ test.c 2001/07/31 17:28:05 1.19 @@ -45,10 +45,13 @@ =20 #ifdef __KERNEL__ #include <linux/malloc.h> +#include <linux/interrupt.h> + #include <linux/bluetooth/test.h> #include <linux/bluetooth/btcommon.h> #include <linux/bluetooth/btmem.h> #include <linux/bluetooth/l2cap.h> +#include <linux/bluetooth/unplug_test.h> #else #include <string.h> =20 @@ -57,6 +60,7 @@ #include "include/btdebug.h" #include "include/btmem.h" #include "include/l2cap.h" +#include "include/unplug_test.h" #endif =20 /****************** DEBUG CONSTANT AND MACRO SECTION *********************= ***/ @@ -185,13 +189,13 @@ =20 static s32 t_init =3D -1; =20 -#ifndef BTD_USERSTACK +#ifdef __KERNEL__ struct tq_struct test_task; #endif =20 void test_connect_ind(l2cap_con *l2cap)=20 { -#ifndef BTD_USERSTACK +#ifdef __KERNEL__ if (t_init < 0) t_init =3D jiffies; #endif @@ -204,7 +208,7 @@ D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } -#ifdef BTD_USERSTACK +#ifndef __KERNEL__ printk("'Authorization' pending for 5 secs...\n"); sleep(5); #else |
From: Peter K. <pk...@us...> - 2001-07-31 18:35:08
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Fixed a couple of compiler warnings. * Corrected indentation. The diff of the modified file(s): --- test.c 2001/07/31 17:28:05 1.19 +++ test.c 2001/07/31 18:35:07 1.20 @@ -155,7 +155,6 @@ l2cap_register_upper(L2CAP_TEST2_LAYER, &this_layer); l2cap_register_upper(L2CAP_TEST3_LAYER, &this_layer); //l2cap_register_upper(7, &this_layer); -=20 } =20 void test_shutdown(void) @@ -187,15 +186,12 @@ return 0; } =20 -static s32 t_init =3D -1; - -#ifdef __KERNEL__ -struct tq_struct test_task; -#endif - void test_connect_ind(l2cap_con *l2cap)=20 { #ifdef __KERNEL__ + struct tq_struct test_task; + static s32 t_init =3D -1; + if (t_init < 0) t_init =3D jiffies; #endif @@ -223,9 +219,8 @@ mark_bh(IMMEDIATE_BH); #endif } -=09=09 - #endif + printk("Shutting off authorization pending.\n"); emulate_pending =3D 0; printk("Sending connect rsp with result =3D success back\n"); @@ -258,7 +253,6 @@ testcon3 =3D l2cap; // else // testcon =3D l2cap; - } =20 /* only client receives connect pnd */ @@ -283,8 +277,7 @@ D_STATE("test_connect_cfm\n"); PRINTPSM(l2cap); =20=09 - if ( !l2ca_local_conf_done(l2cap) ) - { + if (!l2ca_local_conf_done(l2cap)) { if (dont_send_config_req){ printk("Don't send back config_req...\n"); printk("Now waiting for initator to shutdown link...\n"); @@ -296,12 +289,10 @@ if(l2ca_config_req(l2cap, 1280, NULL, 0x1234, 0)) { D_ERR("test_config_cfm : Configuration request failed\n"); } } else { -=09=09=09 if(l2ca_config_req(l2cap, 0, NULL, 0, 0)){ D_ERR("test_config_cfm : Configuration request failed\n"); } } =20=09=09 - /* store connection */ =20 if (l2cap->psm =3D=3D L2CAP_TEST_LAYER) @@ -317,7 +308,6 @@ } =20 =20 - /* someone wants to configure l2cap... */ void=20 test_config_ind(l2cap_con* l2cap) @@ -336,8 +326,7 @@ printk("test_config_ind : already have sent back a pos response\n"); =20 /* check if we received a pos response on a previous config req */=20 - if (!l2ca_local_conf_done(l2cap)) - { + if (!l2ca_local_conf_done(l2cap)) { u16 tmp_mtu; =20 /* still haven't sent config request yet */ @@ -432,37 +421,35 @@ } =20 /* assumes int at end of string */ -int my_atoi(u8 *str) +int +my_atoi(u8 *str) { int i =3D 0, mult =3D 1; int len =3D strlen(str); int res=3D0; =20=20=20 - for (i=3Dlen-1; i>=3D0; i--) - { + for (i =3D len-1; i >=3D 0; i--) { if ((str[i] <=3D '9') && (str[i] >=3D '0' )) { res +=3D mult*(str[i]-'0'); mult*=3D10; } else=20 return -1; -=09=20=20 }=20=20 + return res; } =20 -void test_process_cmd(unsigned char *cmd, s32 size) +void +test_process_cmd(unsigned char *cmd, s32 size) { #ifdef CONFIG_BLUETOOTH_UNPLUG_TEST=20 int testcase =3D my_atoi(cmd+2); =20 - if (testcase > 0) - { + if (testcase > 0) { print_data("Going to send: ", cmd, size); process_test_cmd(testcase); - } - else - { + } else { /* other stuff */ } #else @@ -470,6 +457,5 @@ #endif =20 } - =20 /****************** END OF FILE sdp.c ************************************= ***/ |
From: Anders J. <and...@us...> - 2001-08-01 10:20:08
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added commands to test_process_cmd.=20 The diff of the modified file(s): --- test.c 2001/07/31 18:35:07 1.20 +++ test.c 2001/08/01 10:20:07 1.21 @@ -444,18 +444,59 @@ test_process_cmd(unsigned char *cmd, s32 size) { #ifdef CONFIG_BLUETOOTH_UNPLUG_TEST=20 - int testcase =3D my_atoi(cmd+2); + int testcase, tmp[10], i; + unsigned char bd[6], char_buf[4]; + char_buf[3] =3D 0; + if(strncmp(cmd, "t ", 2) =3D=3D 0) { + testcase =3D my_atoi(cmd+2); =20 if (testcase > 0) { - print_data("Going to send: ", cmd, size); process_test_cmd(testcase); - } else { - /* other stuff */ } + else { + printk("test_process_cmd: Couldn't parse testcase\n"); + } + } + else if(!strncmp(cmd, "bb_conn ", 8)) { + for (i =3D 0; i < 6; i++) { + bd[i] =3D (unsigned char *)my_atoi(strncpy(&char_buf[0], cmd + 8 + (i*3= ), 3)); + } +=09=09 + printk("Connecting BB to bd : %02X:%02X:%02X:%02X:%02X:%02X\n", + bd[5], bd[4], bd[3], + bd[2], bd[1], bd[0]); +=09=09 + l2cap_create_con(bd); + lp_connect_req(bd); + } + else if(!strncmp(cmd, "bb_disc ", 8)) { + int i =3D my_atoi(&cmd[8]); + lp_disconnect((unsigned short)i); + } + else if(!strncmp(cmd, "lcid_disconnect ", 16)) { + l2cap_con *con =3D NULL; + int i =3D my_atoi(&cmd[16]); + if(con =3D get_lcon(i)) { + l2ca_disconnect_req(con); + } + else { + printk("Didn't find lcid %d\n", i); + } + } + else if(!strncmp(cmd, "test_case_reject ", 17)) { + unsigned short fake_psm =3D 0x4561; + for (i =3D 0; i < 6; i++) { + bd[i] =3D (unsigned char)my_atoi(strncpy(&char_buf[0], cmd + 17 + i*3, = 3)); + }=20=20 + l2ca_connect_req(bd, fake_psm); + } + else { + printk("Unknown test cmd!\n"); + } +=09 #else printk("test_process_cmd: Not available\n"); #endif - } =20 /****************** END OF FILE sdp.c ************************************= ***/ |
From: Peter K. <pk...@us...> - 2001-08-06 10:50:19
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Fixed a compiler warning. The diff of the modified file(s): --- test.c 2001/08/02 16:04:48 1.22 +++ test.c 2001/08/06 10:50:18 1.23 @@ -225,7 +225,7 @@ #else init_timer(&test_timer); test_timer.function =3D test_timeout; - test_timer.data =3D l2cap; + test_timer.data =3D (unsigned long)l2cap; test_timer.expires =3D jiffies + 5*HZ; add_timer(&test_timer); #endif |
From: Peter K. <pk...@us...> - 2001-08-06 11:12:33
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.23 1.24=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made it compile for the user stack. The diff of the modified file(s): --- test.c 2001/08/06 10:50:18 1.23 +++ test.c 2001/08/06 11:12:32 1.24 @@ -185,8 +185,6 @@ return 0; } =20 -static struct timer_list test_timer; - static void test_timeout(unsigned long ptr) { @@ -209,6 +207,10 @@ =20 void test_connect_ind(l2cap_con *l2cap)=20 { +#ifdef __KERNEL__ + static struct timer_list test_timer; +#endif + D_STATE("test_connect_ind : remote cid : %d\n", l2cap->remote_cid); PRINTPSM(l2cap); =20 @@ -220,9 +222,7 @@ } =20 /* start 5 sec timer */=09=09 -#ifndef __KERNEL__ - -#else +#ifdef __KERNEL__ init_timer(&test_timer); test_timer.function =3D test_timeout; test_timer.data =3D (unsigned long)l2cap; |
From: Anders J. <and...@us...> - 2001-08-17 09:20:46
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.24 1.25=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Reset dont_send_config after it is used. The diff of the modified file(s): --- test.c 2001/08/06 11:12:32 1.24 +++ test.c 2001/08/17 09:20:46 1.25 @@ -280,10 +280,17 @@ D_STATE("test_connect_cfm\n"); PRINTPSM(l2cap); =20=09 + if(status) { + D_STATE("Connect failed: Status %d\n", status); + return; + } +=09 + if (!l2ca_local_conf_done(l2cap)) { if (dont_send_config_req) { printk("Don't send back config_req...\n"); printk("Now waiting for initator to shutdown link...\n"); + dont_send_config_req =3D 0; return; } =20 @@ -336,6 +343,7 @@ if (dont_send_config_req) { printk("Don't send back config_req...\n"); printk("Now waiting for initator to shutdown link...\n"); + dont_send_config_req =3D 0; return; } =20=09=09 |
From: Mattias A. <mat...@us...> - 2001-08-27 15:20:42
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * use simple_strtoul instead of my_atoi (kernel mode) * renamed l2cap con object variables * added tx_data command which can send data to any local CID The diff of the modified file(s): --- test.c 2001/08/17 09:20:46 1.25 +++ test.c 2001/08/27 15:20:41 1.26 @@ -133,6 +133,12 @@ s32 use_multiple_conf_params =3D 0; s32 disable_testpsm =3D 0; =20 +u8 testdata[UPTEST_DATA_LEN]; + +#ifdef __KERNEL__ +#define strtoul simple_strtoul +#endif + void test_init(void) { protocol_layer this_layer; @@ -205,18 +211,18 @@ } =20 =20 -void test_connect_ind(l2cap_con *l2cap)=20 +void test_connect_ind(l2cap_con *con)=20 { #ifdef __KERNEL__ static struct timer_list test_timer; #endif =20 - D_STATE("test_connect_ind : remote cid : %d\n", l2cap->remote_cid); - PRINTPSM(l2cap); + D_STATE("test_connect_ind : remote cid : %d\n", con->remote_cid); + PRINTPSM(con); =20 if (emulate_pending) { printk("Sending connect rsp pending and waiting 5 secs\n"); - if (l2ca_connect_rsp(l2cap, RES_PENDING, STAT_AUTHENTPEND)) { + if (l2ca_connect_rsp(con, RES_PENDING, STAT_AUTHENTPEND)) { D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } @@ -225,17 +231,19 @@ #ifdef __KERNEL__ init_timer(&test_timer); test_timer.function =3D test_timeout; - test_timer.data =3D (unsigned long)l2cap; + test_timer.data =3D (unsigned long)con; test_timer.expires =3D jiffies + 5*HZ; add_timer(&test_timer); -#endif return; +#else + sleep(5); +#endif } =20=09 if (disable_testpsm =3D=3D 1) { /* send back psm not supp */ - if (l2ca_connect_rsp(l2cap, RES_PSMNEG, 0)) { + if (l2ca_connect_rsp(con, RES_PSMNEG, 0)) { D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } @@ -245,48 +253,47 @@ } =20 printk("now sending back result success !\n"); - if (l2ca_connect_rsp(l2cap, RES_SUCCESS, STAT_NOINFO)) { + if (l2ca_connect_rsp(con, RES_SUCCESS, STAT_NOINFO)) { D_ERR("test_connect_ind: l2ca_connect_rsp failed\n");=20 return; } =20 /* (temp fix for test interface) store connection */ =20 - 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; + if (con->psm =3D=3D L2CAP_TEST_LAYER) + testcon =3D con; + else if (con->psm =3D=3D L2CAP_TEST2_LAYER) + testcon2 =3D con; + else if (con->psm =3D=3D L2CAP_TEST3_LAYER) + testcon3 =3D con; } =20 /* only client receives connect pnd */ -void test_connect_pnd(l2cap_con *l2cap, s32 status) +void test_connect_pnd(l2cap_con *con, s32 status) { D_STATE("test_connect_pnd : reason %d\n", status);=09 - PRINTPSM(l2cap); + PRINTPSM(con); =20 - 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; + if (con->psm =3D=3D L2CAP_TEST_LAYER) + testcon =3D con; + else if (con->psm =3D=3D L2CAP_TEST2_LAYER) + testcon2 =3D con; + else if (con->psm =3D=3D L2CAP_TEST3_LAYER) + testcon3 =3D con; } =20 /* only client receives connect cfm */ -void test_connect_cfm(l2cap_con *l2cap, s32 status) +void test_connect_cfm(l2cap_con *con, s32 status) { D_STATE("test_connect_cfm\n"); - PRINTPSM(l2cap); + PRINTPSM(con); =20 if(status) { D_STATE("Connect failed: Status %d\n", status); return; } =20=09 - - if (!l2ca_local_conf_done(l2cap)) { + if (!l2ca_local_conf_done(con)) { if (dont_send_config_req) { printk("Don't send back config_req...\n"); printk("Now waiting for initator to shutdown link...\n"); @@ -296,20 +303,20 @@ =20 /* still haven't sent config request yet */ if (use_multiple_conf_params) { - if (l2ca_config_req(l2cap, 1280, NULL, 0x1234, 0)) { + if (l2ca_config_req(con, 1280, NULL, 0x1234, 0)) { D_ERR("test_config_cfm : Configuration request failed\n"); } } else { - if (l2ca_config_req(l2cap, 0, NULL, 0, 0)) { + if (l2ca_config_req(con, 0, NULL, 0, 0)) { D_ERR("test_config_cfm : Configuration request failed\n"); } } =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; + if (con->psm =3D=3D L2CAP_TEST_LAYER) + testcon =3D con; + else if (con->psm =3D=3D L2CAP_TEST2_LAYER) + testcon2 =3D con; + else if (con->psm =3D=3D L2CAP_TEST3_LAYER) + testcon3 =3D con; } else=20=09=20=20=20=20=20=20=20 D_RCV("test_config_cfm : already have sent config request\n"); } @@ -317,28 +324,28 @@ =20 /* someone wants to configure l2cap... */ void=20 -test_config_ind(l2cap_con* l2cap) +test_config_ind(l2cap_con* con) {=20 D_STATE("test_config_ind : remote cid : %d remote_mtu : %d\n",=20 - l2cap->remote_cid, l2cap->remote_mtu); + con->remote_cid, con->remote_mtu); =20=09 /* check if we have sent a pos response yet */ - if (!l2ca_remote_conf_done(l2cap)) { + if (!l2ca_remote_conf_done(con)) { /* still haven't sent a pos configure response*/ =20 - if (l2ca_config_rsp(l2cap, 0, NULL, CONF_SUCCESS)) { + if (l2ca_config_rsp(con, 0, NULL, CONF_SUCCESS)) { D_ERR("test_config_ind : Configuration response failed\n"); }=20=20=20=20 } else=20 printk("test_config_ind : already have sent back a pos response\n"); =20 /* check if we received a pos response on a previous config req */=20 - if (!l2ca_local_conf_done(l2cap)) { + if (!l2ca_local_conf_done(con)) { =20 /* still haven't sent config request yet */ =20 D_RCV("Setting local mtu to %d on con (%d:%d)\n",=20 - l2cap->local_mtu, l2cap->local_cid, l2cap->remote_cid); + con->local_mtu, con->local_cid, con->remote_cid); =20 if (dont_send_config_req) { printk("Don't send back config_req...\n"); @@ -349,11 +356,11 @@ =20=09=09 /* still haven't sent config request yet */ if (use_multiple_conf_params) { - if (l2ca_config_req(l2cap, 1280, NULL, 0x1234, 0)) { + if (l2ca_config_req(con, 1280, NULL, 0x1234, 0)) { D_ERR("test_config_cfm : Configuration request failed\n"); } } else { - if (l2ca_config_req(l2cap, test_inmtu, NULL, 0, 0)) + if (l2ca_config_req(con, test_inmtu, NULL, 0, 0)) D_ERR("test_config_ind : configuration request failed\n"); =20 if (test_inmtu) @@ -367,26 +374,26 @@ D_RCV("already ready with config req\n"); } =20 -void test_config_cfm(l2cap_con *l2cap, s32 status) +void test_config_cfm(l2cap_con *con, s32 status) { - D_STATE("test_config_cfm : remote cid : %d\n", l2cap->remote_cid); + D_STATE("test_config_cfm : remote cid : %d\n", con->remote_cid); =20=09 D_STATE("Now we have an open l2cap channel\n"); =20 /* negotiate upper protocol */ } =20 -void test_disconnect_ind(l2cap_con *l2cap)=20 +void test_disconnect_ind(l2cap_con *con)=20 { D_STATE("test_disconnect_ind : (%d:%d)\n",=20 - l2cap->local_cid, l2cap->remote_cid); + con->local_cid, con->remote_cid); =20 - l2ca_disconnect_rsp(l2cap); + l2ca_disconnect_rsp(con); } =20 -void test_disconnect_cfm(l2cap_con *l2cap) +void test_disconnect_cfm(l2cap_con *con) { - D_STATE("TEST_disconnect_cfm: remote cid : %d\n", l2cap->remote_cid); + D_STATE("TEST_disconnect_cfm: remote cid : %d\n", con->remote_cid); } =20 s32 test_disconnect_req(l2cap_con *con) @@ -398,9 +405,9 @@ return l2ca_disconnect_req(con); } =20 -void test_receive_data(l2cap_con *l2cap, unsigned char* data, u32 len) +void test_receive_data(l2cap_con *con, unsigned char* data, u32 len) { - PRINTPSM(l2cap); + PRINTPSM(con); PRINTPKT("test_receive_data : ", data, len);=20=20 } =20 @@ -428,25 +435,8 @@ return l2cap_send_data(tx_buf, con); } =20 -/* assumes int at end of string */ -int -my_atoi(u8 *str) -{ - int i =3D 0, mult =3D 1; - int len =3D strlen(str); - int res =3D 0; =20=20=20 - for (i =3D len-1; i >=3D 0; i--) { - if ((str[i] <=3D '9') && (str[i] >=3D '0' )) { - res +=3D mult*(str[i]-'0'); - mult *=3D 10; - } - else=20 - return -1; - }=20=20 - - return res; -} +/* FIXME -- add new commands in user application menu !!!! */ =20 void test_process_cmd(unsigned char *cmd, s32 size) @@ -455,8 +445,9 @@ int testcase, tmp[10], i; unsigned char bd[6], char_buf[4]; char_buf[3] =3D 0; + if(strncmp(cmd, "t ", 2) =3D=3D 0) { - testcase =3D my_atoi(cmd+2); + testcase =3D strtoul(cmd+2, NULL, 0); =20 if (testcase > 0) { process_test_cmd(testcase); @@ -466,8 +457,12 @@ } } else if(!strncmp(cmd, "bb_conn ", 8)) { + char *p =3D cmd + 8; +=09=09 for (i =3D 0; i < 6; i++) { - bd[i] =3D (unsigned char *)my_atoi(strncpy(&char_buf[0], cmd + 8 + (i*3= ), 3)); + bd[i] =3D strtoul(p, &p, 0); + printk("bb_conn read [%d] =3D 0x%x\n", i, bd[i]); + p=3Dp+1; } =20=09=09 printk("Connecting BB to bd : %02X:%02X:%02X:%02X:%02X:%02X\n", @@ -478,13 +473,13 @@ lp_connect_req(bd); } else if(!strncmp(cmd, "bb_disc ", 8)) { - int i =3D my_atoi(&cmd[8]); + int i =3D strtoul(cmd+8, NULL, 0); lp_disconnect((unsigned short)i); } else if(!strncmp(cmd, "lcid_disconnect ", 16)) { l2cap_con *con =3D NULL; - int i =3D my_atoi(&cmd[16]); - if(con =3D get_lcon(i)) { + int i =3D strtoul(cmd + 16, NULL, 0); + if((con =3D get_lcon(i))) { l2ca_disconnect_req(con); } else { @@ -493,12 +488,33 @@ } else if(!strncmp(cmd, "test_case_reject ", 17)) { unsigned short fake_psm =3D 0x4561; + char *p =3D cmd + 8; for (i =3D 0; i < 6; i++) { - bd[i] =3D (unsigned char)my_atoi(strncpy(&char_buf[0], cmd + 17 + i*3, = 3)); + bd[i] =3D strtoul(p, &p, 0); + printk("bb_conn read [%d] =3D 0x%x\n", i, bd[i]); + p++; }=20=20 l2ca_connect_req(bd, fake_psm); } - else { + else if(!strncmp(cmd, "tx_data ", 8)) { + int lcid, len; + char *p =3D cmd+8; + l2cap_con *con; + lcid =3D strtoul(p, &p, 0); + len =3D strtoul(p+1, &p, 0); +=09=09 + /* first find connection based on local cid */ + con =3D get_lcon(lcid); + if (!con) { + printk("Found no connection with lcid : %d\n", lcid); + return; + } + + test_send_data(con, testdata, len); + } else if(!strncmp(cmd, "sdptest ", 8)) { + int n =3D strtoul(cmd+8, NULL, 0);=09 + do_sdp_test(n); + } else { printk("Unknown test cmd!\n"); } =20=09 |
From: Anders J. <and...@us...> - 2001-09-10 12:24:11
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.26 1.27=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added test case to disable/enable respons of an incoming disconnect reque= st. The diff of the modified file(s): --- test.c 2001/08/27 15:20:41 1.26 +++ test.c 2001/09/10 12:24:10 1.27 @@ -132,6 +132,7 @@ s32 dont_send_config_req =3D 0; s32 use_multiple_conf_params =3D 0; s32 disable_testpsm =3D 0; +s32 dont_send_disconnect_rsp =3D 0; =20 u8 testdata[UPTEST_DATA_LEN]; =20 @@ -387,9 +388,10 @@ { D_STATE("test_disconnect_ind : (%d:%d)\n",=20 con->local_cid, con->remote_cid); - + if(!dont_send_disconnect_rsp) { l2ca_disconnect_rsp(con); } +} =20 void test_disconnect_cfm(l2cap_con *con) { @@ -445,18 +447,7 @@ int testcase, tmp[10], i; unsigned char bd[6], char_buf[4]; char_buf[3] =3D 0; - - if(strncmp(cmd, "t ", 2) =3D=3D 0) { - testcase =3D strtoul(cmd+2, NULL, 0); - - if (testcase > 0) { - process_test_cmd(testcase); - } - else { - printk("test_process_cmd: Couldn't parse testcase\n"); - } - } - else if(!strncmp(cmd, "bb_conn ", 8)) { + if(!strncmp(cmd, "bb_conn ", 8)) { char *p =3D cmd + 8; =20=09=09 for (i =3D 0; i < 6; i++) { @@ -472,6 +463,16 @@ l2cap_create_con(bd); lp_connect_req(bd); } + else if(strncmp(cmd, "t ", 2) =3D=3D 0) { + testcase =3D strtoul(cmd+2, NULL, 0); + + if (testcase > 0) { + process_test_cmd(testcase); + } + else { + printk("test_process_cmd: Couldn't parse testcase\n"); + } + } else if(!strncmp(cmd, "bb_disc ", 8)) { int i =3D strtoul(cmd+8, NULL, 0); lp_disconnect((unsigned short)i); @@ -514,6 +515,10 @@ } else if(!strncmp(cmd, "sdptest ", 8)) { int n =3D strtoul(cmd+8, NULL, 0);=09 do_sdp_test(n); + } else if(!strcmp(cmd, "test_case_disable_disconnect")) { + dont_send_disconnect_rsp =3D 1; + } else if(!strcmp(cmd, "test_case_enable_disconnect")) { + dont_send_disconnect_rsp =3D 0; } else { printk("Unknown test cmd!\n"); } @@ -523,4 +528,4 @@ #endif } =20 -/****************** END OF FILE sdp.c ************************************= ***/ +/****************** END OF FILE test.c ***********************************= ****/ |
From: Anders J. <and...@us...> - 2001-09-28 14:35:39
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected parsing of bb_conn testcommand. The diff of the modified file(s): --- test.c 2001/09/10 12:24:10 1.27 +++ test.c 2001/09/28 14:35:38 1.28 @@ -450,8 +450,8 @@ if(!strncmp(cmd, "bb_conn ", 8)) { char *p =3D cmd + 8; =20=09=09 - for (i =3D 0; i < 6; i++) { - bd[i] =3D strtoul(p, &p, 0); + for (i =3D 5; i >=3D 0; i--) { + bd[i] =3D strtoul(p, &p, 16); printk("bb_conn read [%d] =3D 0x%x\n", i, bd[i]); p=3Dp+1; } |
From: Willy S. <sag...@us...> - 2002-04-11 14:36:50
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- test.c 1.34 1.35=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added linux version ifdef for malloc.h/slab.h The diff of the modified file(s): --- test.c 7 Mar 2002 21:32:28 -0000 1.34 +++ test.c 11 Apr 2002 11:51:29 -0000 1.35 @@ -44,7 +44,11 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#if LINUX_VERSION_CODE >=3D 0x20200 +#include <linux/slab.h> +#else #include <linux/malloc.h> +#endif #include <linux/interrupt.h> =20 #include <linux/bluetooth/test.h> |
From: Peter K. <pk...@us...> - 2003-01-14 15:19:16
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- test.c 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made it compile with CONFIG_BLUETOOTH_UNPLUG_TEST enabled. The diff of the modified file(s): --- test.c 1 Aug 2002 16:19:29 -0000 1.37 +++ test.c 14 Jan 2003 15:19:03 -0000 1.38 @@ -490,6 +490,7 @@ =20 char_buf[3] =3D 0; if(!strncmp(cmd, "bb_conn ", 8)) { + u8 class_of_dev[3] =3D { 0, 0, 0 }; char *p =3D cmd + 8; =20 for (i =3D 5; i >=3D 0; i--) { @@ -502,7 +503,7 @@ bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]); =20 - l2cap_create_con(bd); + l2cap_create_con(bd, class_of_dev); return lp_connect_req(bd); } else if(strncmp(cmd, "t ", 2) =3D=3D 0) { |