|
From: Mattias A. <mat...@us...> - 2001-03-21 19:03:10
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
replaced code with functions in bt_xxx files
lots of cleanup
The diff of the modified file(s):
--- bttest.c 2001/03/10 12:49:32 1.2
+++ bttest.c 2001/03/21 19:03:09 1.3
@@ -39,12 +39,6 @@
*
*/
=20
-/*=20
- * FIXME !!!
- * THIS FILE HAS NOT BEEN TESTED AFTER SPLIT UP OF BTD=20
- * AND SHOULD NOT BE USED AS IS
- */
-
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -76,12 +70,10 @@
#include "bt_if.h"
#include "bt_misc.h"
#include "bt_conf.h"
+#include "bt_vendor.h"
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
=20
-#define START_PPP 1
-#define QUIT_BTD 2
-
#define BTD_HISTORY_FILE "/tmp/btd_history"
=20
char* menu[] =3D
@@ -97,9 +89,7 @@
" readbd", /* read module bd address */
" reset", /* reset board */
" role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)",
-#ifdef BT_USERSTACK
" stat ", /* similar to reading the /proc/bt */
-#endif
#ifdef ECS_TEST_FUNCTIONS
" ecs_entertest <handle> (hex)",
" ecs_testctrl <par1,par2,...,par9> (hex)",
@@ -107,7 +97,6 @@
" ecs_testcon <xx:xx:xx:xx:xx:xx> (hex)",=20=20
" enable_dut", /* enable device under test mode */
#endif
- " ppp",
" quit",
#ifdef BT_USERSTACK
"",
@@ -150,27 +139,21 @@
}=20=20=20=20=20=20=20=20=20
}
=20
-void=20
-testmain(void)
+int
+main(void)
{
- int start_ppp =3D 0;
int bt_cfd;=20=20
=20
- if ((bt_cfd =3D open_device(BT_CTRL_TTY, O_RDWR, 0)) < 0)
+ /* First of all check that stack is running */
+ if (!bt_isinitiated())
{
- perror("Could not open BT control TTY\n");
+ printf("Stack not initiated, exit\n");
exit(1);
}
-
-// if (enter_cmd_mode)
- {
- read_history(BTD_HISTORY_FILE);
=20
-#ifdef BT_USERSTACK
- sleep(2); /* temp fix - wait for last command response to be returned =
*/
-#endif
+ bt_cfd =3D bt_openctrl();
=20
- printf("Now entering cmd line mode\n");
+ read_history(BTD_HISTORY_FILE);=20=20
=20
show_menu();
=20=20=20=20=20
@@ -178,62 +161,37 @@
{
int tmp;
char *line =3D (char*) readline("> ");
-
- if (!line)
- {
- start_ppp =3D 0;
- break;
- }
-
add_history(line);
=20=20=20=20=20=20=20
tmp =3D process_cmd(line, bt_cfd);
=20
- if (tmp =3D=3D START_PPP)
- {
- start_ppp =3D 1;
- break;
- }
- else if (tmp =3D=3D QUIT_BTD)
+ if (tmp =3D=3D QUIT_BTD)
{
- start_ppp =3D 0;
break;
}
free(line);
}
write_history(BTD_HISTORY_FILE);
- }=20=20
+ exit(0);
}
=20
int
process_cmd(char *buf, int bt_cfd)
{
- int bd[6];
- unsigned char my_bd_addr[6];
unsigned int tmp[11];
int repeat;
int i, line;
-#ifdef BT_USERSTACK
- unsigned char tmp_bd[6]; /* used for byte swapping */
- int server_channel, profile;
-#endif
=20=20
if (!strncmp(buf, "quit", 4))
{
return QUIT_BTD;
}
- else if (!strncmp(buf, "ppp", 3))
- {
- return START_PPP;
- }
-
- if (sscanf(buf, "rf_conn %x:%x:%x:%x:%x:%x %d %d",
+ else if (sscanf(buf, "rf_conn %x:%x:%x:%x:%x:%x %d %d",
&tmp[0], &tmp[1], &tmp[2],
&tmp[3], &tmp[4], &tmp[5],
&tmp[6], &tmp[7]) =3D=3D 8)
{
- int i;
- unsigned int con_id;
+ unsigned int con_id, i;
unsigned short srv_ch, line;
unsigned char tmp_bd[6];
=20
@@ -268,118 +226,33 @@
}
else if (sscanf(buf, "rf_send %d %d %d", &i, &repeat, &line) =3D=3D 3)
{
-#define MAXSIZE (4096*2)
- struct timeval start_t, stop_t;
- int bytes_tot =3D i*repeat;
- int avg_speed =3D 0; /* bps */
- unsigned int ms;
- char tmp[MAXSIZE];
+ int btfd;
char dev[20];
- int fd;
- int j;
-
sprintf(dev, "/dev/ttyBT%d",line);
-
-#ifndef BT_USERSTACK=20=20=20=20
- printf("Opening %s\n", dev);
- if ((fd =3D open_device(dev, O_RDWR, CLIENT)) < 0)
- {
- perror("open_device");
- return 0;
- }=20=20=20=20
- printf("Done.\n");
-
- bt_waitconnection(fd, line);
-
-#else
- /* FIXME -- currently only uses line 0 */
- if (line !=3D 0) {
- printf("No support for sending data on line %d, use line 0 instead !=
(userstack only)\n", line);
- fd=3D-1;
- return 0;
- }
-#endif
-
- if (i > MAXSIZE)
- {
- printf("Max 8192 bytes per write!\n");
- i =3D MAXSIZE;
- bytes_tot =3D i*repeat; /* update this aswell */
- }
-
- /* fill them with letters... */
- for(j =3D 0; j < i; j++)
- {
- tmp[j] =3D (j % 25) + 65;
+ btfd =3D open(dev, O_RDWR | O_NOCTTY);
+ bt_send(bt_cfd, i, repeat);
+ close(btfd);
}
-=20=20=20=20
- printf("\nNow sending %d %d-bytes packet (%d kB) on line %d\n",=20
- repeat, i, bytes_tot/1000, line);
-
- gettimeofday(&start_t, NULL);
-=20
- while (repeat)
+ else if (sscanf(buf, "setbd %x:%x:%x:%x:%x:%x",
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =
=3D=3D 6)
{
- int n =3D 0;
-#ifndef BT_USERSTACK
- n =3D write(fd, tmp, i);=20=20=20
-#else
- n =3D bt_write_top(tmp, i, line);
-#endif
+ unsigned char tmp_bd[6];
=20=20=20=20=20=20=20
- if (n <=3D0)
+ for (i =3D 0; i < 6; i++)
{
- printf("couldn't write any more data...\n\n");
- bytes_tot =3D bytes_tot-repeat*i;
- break;
- }
-
- repeat--;
- printf("%6d kB left to send... \r",
- ((repeat*i)/1000));
- fflush(stdout);
+ tmp_bd[i] =3D (unsigned char)tmp[i];
}
- gettimeofday(&stop_t, NULL);
- printf("\ndone.\n");
=20
- ms =3D (stop_t.tv_sec-start_t.tv_sec)*1000 +=20
- (stop_t.tv_usec-start_t.tv_usec)/1000;
- if (ms)
- avg_speed =3D ((8*bytes_tot)/ms);
- printf("Average TX rate : %d kbps (%d kB/s)\n", avg_speed, avg_speed/8=
);
-#ifndef BT_USERSTACK
- printf("Closing %s\n", dev);
- close_device(fd);
-#endif
- }
- else if (sscanf(buf, "setbd %x:%x:%x:%x:%x:%x",
- &bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5]) =3D=3D 6)
- {
- bt_set_bd_addr(bt_cfd, &bd[0]);
+ bt_set_bd_addr(bt_cfd, &tmp_bd[0]);
}
else if (strncmp(buf, "readbd", 6) =3D=3D 0)
{
+ unsigned char my_bd_addr[6];=20=20
read_local_bd(bt_cfd, my_bd_addr);
}
- else if (strncmp(buf, "reset", 5) =3D=3D 0)
- {
- /* FIXME */
-#if 0
-
- close_device(bt_cfd);
- close_device(phys_fd);
- bt_cfd =3D -1;
- phys_fd =3D -1;
- reset_hw();
-#ifdef RESTART_ENABLED
- /* must set baud rate to default for hw again... */
- siglongjmp(jmpbuffer, 1);
-#endif
-
-#endif
- }
else if(sscanf(buf, "role_switch %x:%x:%x:%x:%x:%x %d ",
- &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5], &tmp[6]) =3D=3D 7)
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4],=20
+ &tmp[5], &tmp[6])=3D=3D 7)
{
unsigned char tmp_bd[6];
=20
@@ -422,22 +295,16 @@
ericsson_tx_test(&tmp[0]);
}
#endif
-
-/*
- * Non usermode stack functions for the stuff=20
- * below will be added later on
- */
-
-#ifdef BT_USERSTACK
else if (strncmp(buf, "stat", 4) =3D=3D 0)
{
-
- char tmp[4096];
- int len;
- len =3D bt_read_internal(tmp);
- tmp[len] =3D 0;
- printf("%s", tmp);
+ bt_showstatus();
}
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
+/* FIXME !!! -- make this work for both kernel / usermode stack */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
+
+
+#ifdef BT_USERSTACK
else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x",
&bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5]) =3D=3D 6)
{
@@ -575,7 +442,6 @@
printf("> error: command not recognized or wrong syntax\n");
show_menu();
}
-
return 0;
}
=20
|
|
From: Mattias A. <mat...@us...> - 2001-03-26 15:35:47
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
added options to inquiry
added ping
The diff of the modified file(s):
--- bttest.c 2001/03/21 19:03:09 1.3
+++ bttest.c 2001/03/26 15:35:44 1.4
@@ -80,11 +80,12 @@
{
"\nMenu",
"------------------------",
- " inq (inquiry scan)",
+ " inq <max nbr resp> <inq time>",
" rf_conn <xx:xx:xx:xx:xx:xx> <srv ch> <line>",
" rf_send <nbr bytes> <nbr repeats> <line>",=20
" rf_disc <line>",
" rf_wait <line>", /* waits for a connection on that line */
+ " ping <xx:xx:xx:xx:xx:xx>",
" setbd <xx:xx:xx:xx:xx:xx>", /* only ericsson HW */
" readbd", /* read module bd address */
" reset", /* reset board */
@@ -107,7 +108,6 @@
" test_conn <xx:xx:xx:xx:xx:xx> <psm>", /* l2cap test using PSM psm */
" test_disc", /* disconnect all (both) test connections */
" test_case_reject <xx:xx:xx:xx:xx:xx>",=20
- " ping <xx:xx:xx:xx:xx:xx>",
" getinfo <xx:xx:xx:xx:xx:xx> <type>",
" ",
" bb_conn <xx:xx:xx:xx:xx:xx>", /* connect only baseband */
@@ -219,10 +219,9 @@
bt_waitconnection(bt_cfd, line);
printf("Connect on line %d\n", line);
}
- else if (strncmp(buf, "inq", 3) =3D=3D 0)
+ else if (sscanf(buf, "inq %d %d", &tmp[0], &tmp[1]) =3D=3D 2)
{
- /* fixme<2> use real params */
- bt_inquiry(bt_cfd, 10, 10);
+ bt_inquiry(bt_cfd, tmp[0], tmp[1]);
}
else if (sscanf(buf, "rf_send %d %d %d", &i, &repeat, &line) =3D=3D 3)
{
@@ -299,25 +298,29 @@
{
bt_showstatus();
}
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-/* FIXME !!! -- make this work for both kernel / usermode stack */
-/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
-
-
-#ifdef BT_USERSTACK
else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x",
- &bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5]) =3D=3D 6)
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{
+ unsigned char bd[6];
+=20=20=20=20
for (i =3D 0; i < 6; i++)
{
- tmp_bd[i] =3D (unsigned char)bd[i];
+ bd[i] =3D (unsigned char)tmp[i];
}
=20=20
printf("Pinging bd : %02X:%02X:%02X:%02X:%02X:%02X\n",
- tmp_bd[0], tmp_bd[1], tmp_bd[2],
- tmp_bd[3], tmp_bd[4], tmp_bd[5]);
- l2ca_ping(tmp_bd);
+ bd[0], bd[1], bd[2],
+ bd[3], bd[4], bd[5]);
+
+ bt_ping(bt_cfd, bd, NULL, 0);
}
+
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
+/* FIXME !!! -- make this work for both kernel / usermode stack */
+/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
+
+
+#ifdef BT_USERSTACK
else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %x",
&bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5],=20
&tmp[0]) =3D=3D 7)
|
|
From: Mattias A. <mat...@us...> - 2001-03-30 12:46:34
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
added ping (echo req), getinfo (info req) for kernel mode stack aswell
The diff of the modified file(s):
--- bttest.c 2001/03/26 15:35:44 1.4
+++ bttest.c 2001/03/30 12:46:32 1.5
@@ -85,12 +85,14 @@
" rf_send <nbr bytes> <nbr repeats> <line>",=20
" rf_disc <line>",
" rf_wait <line>", /* waits for a connection on that line */
- " ping <xx:xx:xx:xx:xx:xx>",
+ " ping <xx:xx:xx:xx:xx:xx> <nbr bytes>",
+ " getinfo <xx:xx:xx:xx:xx:xx> <type>",
" setbd <xx:xx:xx:xx:xx:xx>", /* only ericsson HW */
" readbd", /* read module bd address */
" reset", /* reset board */
" role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)",
" stat ", /* similar to reading the /proc/bt */
+ " testcmd <test string>",
#ifdef ECS_TEST_FUNCTIONS
" ecs_entertest <handle> (hex)",
" ecs_testctrl <par1,par2,...,par9> (hex)",
@@ -108,7 +110,6 @@
" test_conn <xx:xx:xx:xx:xx:xx> <psm>", /* l2cap test using PSM psm */
" test_disc", /* disconnect all (both) test connections */
" test_case_reject <xx:xx:xx:xx:xx:xx>",=20
- " getinfo <xx:xx:xx:xx:xx:xx> <type>",
" ",
" bb_conn <xx:xx:xx:xx:xx:xx>", /* connect only baseband */
" bb_disc <hci handle>", /* disconnect baseband */
@@ -248,6 +249,7 @@
{
unsigned char my_bd_addr[6];=20=20
read_local_bd(bt_cfd, my_bd_addr);
+ print_bd_addr("Local BD ", my_bd_addr);
}
else if(sscanf(buf, "role_switch %x:%x:%x:%x:%x:%x %d ",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4],=20
@@ -298,23 +300,46 @@
{
bt_showstatus();
}
- else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x",
- &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
+ else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x %d",
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20
+ &tmp[6]) =3D=3D 7)
{
+ unsigned char buf[1024];
unsigned char bd[6];
+ int count =3D tmp[6];
=20=20=20=20=20
for (i =3D 0; i < 6; i++)
{
bd[i] =3D (unsigned char)tmp[i];
}
=20=20
- printf("Pinging bd : %02X:%02X:%02X:%02X:%02X:%02X\n",
- bd[0], bd[1], bd[2],
- bd[3], bd[4], bd[5]);
+ print_bd_addr("Pinging ", bd);
=20
- bt_ping(bt_cfd, bd, NULL, 0);
+ /* fill it with something */
+ memset(buf, 'A', count);
+
+ bt_ping(bt_cfd, bd, (unsigned char*)&buf , (unsigned short)count);=20=
=20
+ }
+ else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %d",
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20
+ &tmp[6]) =3D=3D 7)
+ {
+ unsigned char bd[6];
+ unsigned short type =3D tmp[6];
+
+ for (i =3D 0; i < 6; i++)
+ {
+ bd[i] =3D (unsigned char)tmp[i];
}
=20
+ print_bd_addr("Get info from : ", bd);
+
+ bt_getinfo(bt_cfd, bd, type);
+ }
+ else if (strncmp(buf, "testcmd", 7) =3D=3D 0)
+ {
+ bt_testcmd(bt_cfd, buf+7);
+ }
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
/* FIXME !!! -- make this work for both kernel / usermode stack */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */
|
|
From: Mattias A. <mat...@us...> - 2001-04-25 17:56:55
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* added command bt_wrscan which sets write scan enable
* added force_ms which sets whether force m/s switch should be done
The diff of the modified file(s):
--- bttest.c 2001/04/04 10:43:04 1.6
+++ bttest.c 2001/04/25 17:56:54 1.7
@@ -90,6 +90,8 @@
" setbd <xx:xx:xx:xx:xx:xx>", /* only ericsson HW */
" readbd", /* read module bd address */
" reset", /* reset board */
+ " bt_wrscan <mode>",
+ " force_ms <0/1>", /* force ms switch */
" role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)",
" stat ", /* similar to reading the /proc/bt */
" testcmd <test string>",
@@ -209,6 +211,11 @@
=20=20=20=20=20
bt_connect(bt_cfd, tmp_bd, con_id);
}
+ else if (sscanf(buf, "bt_wrscan %d", &tmp[0]) =3D=3D 1)
+ {
+ printf("Setting wr scan enable to %d\n", tmp[0]);
+ bt_write_scan_enable(bt_cfd, tmp[0]);
+ }
else if (sscanf(buf, "rf_disc %d", &line) =3D=3D 1)
{
unsigned int con_id;
@@ -263,6 +270,11 @@
}
=20=20=20
role_switch(bt_cfd, &tmp_bd[0], tmp[6]);
+ }
+ else if (sscanf(buf, "force_ms %d", &tmp[0]) =3D=3D 1)
+ {
+ printf("Setting force m/s switch to %d\n", tmp[0]);
+ bt_force_msswitch_as_server(bt_cfd, tmp[0]);
}
#ifdef ECS_TEST_FUNCTIONS
else if (sscanf(buf, "ecs_testctrl %x,%x,%x,%x,%x,%x,%x,%x,%x",
|
|
From: Anders J. <and...@us...> - 2001-07-30 15:47:54
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Inserted an ifdef around unplug-test-specific code
The diff of the modified file(s):
--- bttest.c 2001/07/30 10:20:02 1.10
+++ bttest.c 2001/07/30 15:47:54 1.11
@@ -101,7 +101,9 @@
" ecs_testcon <xx:xx:xx:xx:xx:xx> (hex)",=20=20
" enable_dut", /* enable device under test mode */
#endif
+#ifdef INCLUDE_UNPLUG_TEST
" upt <teststring>", /* e.g testcase 4.3 't 43' */
+#endif
" quit",=20
=20
"",
@@ -345,6 +347,8 @@
{
bt_testcmd(bt_cfd, buf+7);
}
+
+#ifdef INCLUDE_UNPLUG_TEST
else if (strncmp(buf, "upt", 3) =3D=3D 0)
{
if (sscanf(buf+4, "t %d", &i) =3D=3D 1)
@@ -357,6 +361,7 @@
/* fixme */
}
}
+#endif
=20
else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20
|
|
From: Anders J. <and...@us...> - 2001-08-01 10:28:17
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Made bb_conn, bb_disc work.
* Added lcid_disconnect command to allow disconnection based on the lcid.
The diff of the modified file(s):
--- bttest.c 2001/07/31 09:02:21 1.12
+++ bttest.c 2001/08/01 10:28:16 1.13
@@ -112,11 +112,12 @@
" tcs_conn <xx:xx:xx:xx:xx:xx>",
" ",
" test_conn <xx:xx:xx:xx:xx:xx> <psm> <line>", /* l2cap test using PSM=
psm */
- " test_disc <psm>", /* disconnect one of the test connections */
+ " test_disc <psm>", /* disconnect the connection with psm=3Dpsm */
" test_case_reject <xx:xx:xx:xx:xx:xx>",=20
" ",
" bb_conn <xx:xx:xx:xx:xx:xx>", /* connect only baseband */
" bb_disc <hci handle>", /* disconnect baseband */
+ " lcid_disconnect <lcid>", /* Disconnects a connection with lcid =3D lc=
id */
" ",
"",
=20
@@ -377,14 +378,6 @@
bd[3], bd[4], bd[5], tmp[6]);
bt_getinfo(bt_cfd, bd, tmp[6]);
}
-#if 0
- else if (sscanf(buf, "t %d", &i) =3D=3D 1)
- {
- /* unplug test cases, if you don't know what it is, don't use it !!! :=
) */
- process_test_cmd(i);
- }
-#endif
-
else if(sscanf(buf, "tcs_conn %x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{=20=20=20=20
@@ -401,7 +394,6 @@
}
=20
/* FIXME so that we can specify which line to connect */
-
else if(sscanf(buf, "rf_conn %x:%x:%x:%x:%x:%x %d",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],
&srv_ch) =3D=3D 7)
@@ -441,54 +433,38 @@
bd[i] =3D (unsigned char)tmp[i];
}
=20
- printf("Connecting test layer (psm 0x%x, line %d) to bd : %02X:%02X:%0=
2X:%02X:%02X:%02X\n", tmp[6], tmp[7], bd[0], bd[1], bd[2], bd[3], bd[4], bd=
[5]);
+ printf("Connecting test layer (psm 0x%x, line %d) to bd : %02X:%02X:%0=
2X:%02X:%02X:%02X\n",=20
+ tmp[6], tmp[7], bd[0], bd[1], bd[2], bd[3], bd[4], bd[5]);
=20
bt_connect(bt_cfd, bd, ((tmp[6] << 16) & 0xffff0000) | tmp[7]);
}
-#if 0
else if (sscanf(buf, "test_case_reject %x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =
=3D=3D 6)
{
- unsigned short fake_psm =3D 0x4561;
- for (i =3D 0; i < 6; i++)
- {
- bd[i] =3D (unsigned char)tmp[i];
- }
- printf("test_case_reject, client tries to connect psm %d\n", fake_psm)=
;=20=20
- l2ca_connect_req(bd, fake_psm);
+ sprintf(buf, "test_case_reject %03d%03d%03d%03d%03d%03d\0", tmp[0], tm=
p[1], tmp[2], tmp[3], tmp[4], tmp[5]);=20
+ bt_testcmd(bt_cfd, buf);
}
-#endif
else if (sscanf(buf, "test_disc %x", &tmp[0]) =3D=3D 1)
{
- printf("Disconnecting TEST layer\n");
+ printf("Disconnecting layer (PSM: %x)\n", tmp[0]);
bt_disconnect(bt_cfd, (tmp[0] << 16) & 0xffff0000);
}
-
- /* FIXME, make a testcase of this */
-#if 0
else if(sscanf(buf, "bb_conn %x:%x:%x:%x:%x:%x",
- &tmp[5], &tmp[4], &tmp[3], &tmp[2], &tmp[1], &tmp[0]) =3D=3D 6)
- {
- for (i =3D 0; i < 6; i++)
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{
- bd[i] =3D (unsigned char)tmp[i];
- }
-
- printf("Connecting baseband to bd : %x:%x:%x:%x:%x:%x\n",
- bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]);
-
- /* we must store bd address in l2cap con to keep track of peer */
-
- l2cap_create_con(bd);
- lp_connect_req(bd);
+ sprintf(buf, "bb_conn %03d%03d%03d%03d%03d%03d\0", tmp[5], tmp[4], tmp=
[3], tmp[2], tmp[1], tmp[0]);=20
+ bt_testcmd(bt_cfd, buf);
}
else if(sscanf(buf, "bb_disc %d", &i) =3D=3D 1)
{
printf("Disconnecting hci handle %d\n", i);
- lp_disconnect((unsigned short)i);
+ bt_testcmd(bt_cfd, buf);
}
-#endif
-=20=20
+ else if(sscanf(buf, "lcid_disconnect %d", &i) =3D=3D 1)
+ {
+ printf("Disconnecting lcid %d", i);
+ bt_testcmd(bt_cfd, buf);
+ }
else
{
printf("> error: command not recognized or wrong syntax\n");
|
|
From: Mattias A. <mat...@us...> - 2001-08-02 13:00:19
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* fixed bug, used wrong file descr when sending data
* removed redundant code
The diff of the modified file(s):
--- bttest.c 2001/08/01 10:28:16 1.13
+++ bttest.c 2001/08/02 12:59:58 1.14
@@ -240,7 +240,15 @@
char dev[20];
sprintf(dev, "/dev/ttyBT%d", line);
btfd =3D open(dev, O_RDWR | O_NOCTTY);
- bt_send(bt_cfd, i, repeat);
+
+ if (btfd > 0)
+ bt_send(btfd, i, repeat);
+ else
+ {
+ perror("bt_send");
+ return -1;
+ }
+=20=20=20=20
close(btfd);
}
else if (sscanf(buf, "setbd %x:%x:%x:%x:%x:%x",
@@ -344,11 +352,6 @@
=20
bt_getinfo(bt_cfd, bd, type);
}
- else if (strncmp(buf, "testcmd", 7) =3D=3D 0)
- {
- bt_testcmd(bt_cfd, buf+7);
- }
-
#ifdef CONFIG_BLUETOOTH_UNPLUG_TEST
else if (strncmp(buf, "upt", 3) =3D=3D 0)
{
|
|
From: Mattias A. <mat...@us...> - 2001-08-02 13:02:06
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bttest.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * forgot the menu... The diff of the modified file(s): --- bttest.c 2001/08/02 12:59:58 1.14 +++ bttest.c 2001/08/02 13:01:36 1.15 @@ -93,7 +93,6 @@ " force_ms <0/1>", /* force ms switch */ " role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)", " stat ", /* similar to reading the /proc/bt */ - " testcmd <test string>", #ifdef ECS_TEST_FUNCTIONS " ecs_entertest <handle> (hex)", " ecs_testctrl <par1,par2,...,par9> (hex)", |
|
From: Anders J. <and...@us...> - 2001-08-21 10:17:36
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added "hotlist" to keep bd-addresses in.
The diff of the modified file(s):
--- bttest.c 2001/08/17 09:23:25 1.16
+++ bttest.c 2001/08/21 10:17:34 1.17
@@ -118,11 +118,17 @@
" bb_disc <hci handle>", /* disconnect baseband */
" lcid_disconnect <lcid>", /* Disconnects a connection with lcid =3D lc=
id */
" ",
+ "-------- Hotlist -------",
+ "(Use !<num> to expand the bdaddr from the list in any command)",
+ " hotlist_set <pos> <xx:xx:xx:xx:xx:xx>",
+ " hotlist_show",=20
"",
=20
NULL
};
=20
+static unsigned char hotlist[10][6];
+
#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE)
static void read_history(char *hist_file_name);
static void write_history(char *hist_file_name);
@@ -146,7 +152,8 @@
int
main(void)
{
- int bt_cfd;
+ int bt_cfd, i , j;
+ FILE *hotlist_fd;
=20
/* Open BT ctrl device */=20=20
if ((bt_cfd =3D bt_openctrl()) < 0)
@@ -162,6 +169,29 @@
exit(1);
}
=20
+ if(hotlist_fd =3D fopen("/etc/.hotlist", "rb"))
+ {
+ for (i =3D 0; i < 10 ; i++)=20
+ {
+ for (j =3D 0 ; j < 6 ; j++)=20
+ {
+ hotlist[i][j] =3D fgetc(hotlist_fd);
+ }
+ }
+ fclose(hotlist_fd);
+ }
+ else
+ {
+ for (i =3D 0; i < 10 ; i++)=20
+ {
+ for (j =3D 0 ; j < 6 ; j++)=20
+ {
+ hotlist[i][j] =3D 0;
+ }
+ }
+ }
+=20=20
+
read_history(BTD_HISTORY_FILE);=20=20
=20
show_menu();
@@ -169,10 +199,32 @@
while (1)
{
int tmp;
+ char *tmp_char, hotlist_entry;
+ char tmp_line[200];
char *line =3D (char*) readline("> ");
add_history(line);
=20=20=20=20=20
+ if((tmp_char =3D strstr(line, "!")))
+ {
+ if(*(tmp_char + 1) >=3D '0' && *(tmp_char + 1) <=3D '9')
+ {
+ hotlist_entry =3D *(tmp_char + 1) - '0';
+ memcpy(&tmp_line[0], line, tmp_char - line);
+ sprintf(&tmp_line[tmp_char - line], "%02X:%02X:%02X:%02X:%02X:%02X=
%s\0",=20
+ hotlist[hotlist_entry][0],
+ hotlist[hotlist_entry][1],
+ hotlist[hotlist_entry][2],
+ hotlist[hotlist_entry][3],
+ hotlist[hotlist_entry][4],
+ hotlist[hotlist_entry][5],
+ tmp_char + 2);
+ tmp =3D process_cmd(&tmp_line[0], bt_cfd);
+ }
+ }
+ else
+ {=20=20=20
tmp =3D process_cmd(line, bt_cfd);
+ }
=20=20=20=20=20
if (tmp =3D=3D QUIT_BTD)
{
@@ -466,6 +518,46 @@
{
printf("Disconnecting lcid %d", i);
bt_testcmd(bt_cfd, buf);
+ }
+ else if(sscanf(buf, "hotlist_set %d %x:%x:%x:%x:%x:%x",=20
+ &tmp[6], &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tm=
p[5]))
+ {
+ FILE *hotlist_fd;
+ int i, j;
+=20=20=20=20
+ if(tmp[6] > 9)
+ {
+ printf("Max number in hotlist is 9.\n");
+ }
+ else
+ {
+ hotlist[tmp[6]][0] =3D tmp[0];
+ hotlist[tmp[6]][1] =3D tmp[1];
+ hotlist[tmp[6]][2] =3D tmp[2];
+ hotlist[tmp[6]][3] =3D tmp[3];
+ hotlist[tmp[6]][4] =3D tmp[4];
+ hotlist[tmp[6]][5] =3D tmp[5];
+ if(hotlist_fd =3D fopen("/etc/.hotlist", "wb"))
+ {
+ for (i =3D 0; i < 10 ; i++)=20
+ {
+ for (j =3D 0 ; j < 6 ; j++)=20
+ {
+ fputc(hotlist[i][j], hotlist_fd);
+ }
+ }
+ fclose(hotlist_fd);
+ }
+ }
+ }
+ else if(strcmp(buf, "hotlist_show") =3D=3D 0)
+ {
+ int i, j;
+ for(i =3D 0 ; i < 10 ; i++)
+ {
+ printf("%d: %02X:%02X:%02X:%02X:%02X:%02X\n", i,=20
+ hotlist[i][0], hotlist[i][1], hotlist[i][2], hotlist[i][3], h=
otlist[i][4], hotlist[i][5]);
+ }
}
else
{
|
|
From: Mattias A. <mat...@us...> - 2001-08-21 14:40:51
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* simply forward rest of string when typing upt <string>
The diff of the modified file(s):
--- bttest.c 2001/08/21 10:17:34 1.17
+++ bttest.c 2001/08/21 14:40:50 1.18
@@ -406,18 +406,9 @@
#ifdef CONFIG_BLUETOOTH_UNPLUG_TEST
else if (strncmp(buf, "upt", 3) =3D=3D 0)
{
- if (sscanf(buf+4, "t %d", &i) =3D=3D 1)
- {
- syslog(LOG_INFO, "testcommand : %s", buf + 4);
bt_testcmd(bt_cfd, buf+4);
}
- else
- {
- /* fixme */
- }
- }
#endif
-
else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20
&tmp[6]) =3D=3D 7)
|
|
From: Mattias A. <mat...@us...> - 2001-08-22 17:48:13
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* parse command string in kernel instead
The diff of the modified file(s):
--- bttest.c 2001/08/21 14:40:50 1.18
+++ bttest.c 2001/08/22 17:48:12 1.19
@@ -458,7 +458,6 @@
else if(sscanf(buf, "sdp_conn %x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{
-=20=20=20=20
for (i =3D 0; i < 6; i++)
{
bd[i] =3D (unsigned char)tmp[i];
@@ -486,7 +485,6 @@
else if (sscanf(buf, "test_case_reject %x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =
=3D=3D 6)
{
- sprintf(buf, "test_case_reject %03d%03d%03d%03d%03d%03d\0", tmp[0], tm=
p[1], tmp[2], tmp[3], tmp[4], tmp[5]);=20
bt_testcmd(bt_cfd, buf);
}
else if (sscanf(buf, "test_disc %x", &tmp[0]) =3D=3D 1)
@@ -497,7 +495,6 @@
else if(sscanf(buf, "bb_conn %x:%x:%x:%x:%x:%x",
&tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{
- sprintf(buf, "bb_conn %03d%03d%03d%03d%03d%03d\0", tmp[5], tmp[4], tmp=
[3], tmp[2], tmp[1], tmp[0]);=20
bt_testcmd(bt_cfd, buf);
}
else if(sscanf(buf, "bb_disc %d", &i) =3D=3D 1)
|
|
From: Anders J. <and...@us...> - 2001-09-10 12:26:02
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added test_case_enable_disconnect and test_case_disable_disconnect.
The diff of the modified file(s):
--- bttest.c 2001/08/22 17:48:12 1.19
+++ bttest.c 2001/09/10 12:26:01 1.20
@@ -290,6 +290,7 @@
int btfd;
char dev[20];
sprintf(dev, "/dev/ttyBT%d", line);
+
btfd =3D open(dev, O_RDWR | O_NOCTTY);
=20
if (btfd > 0)
@@ -547,6 +548,16 @@
hotlist[i][0], hotlist[i][1], hotlist[i][2], hotlist[i][3], h=
otlist[i][4], hotlist[i][5]);
}
}
+ else if(strcmp(buf, "test_case_disable_disconnect") =3D=3D 0)
+ {
+ printf("Disabling sending of disconnect respons\n");
+ bt_testcmd(bt_cfd, buf);
+ }
+ else if(strcmp(buf, "test_case_enable_disconnect") =3D=3D 0)
+ {
+ printf("Enabling sending of disconnect respons\n");
+ bt_testcmd(bt_cfd, buf);
+ }=20=20=20
else
{
printf("> error: command not recognized or wrong syntax\n");
|
|
From: Anders J. <and...@us...> - 2002-03-07 21:34:10
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bttest.c 1.24 1.25=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Updated to reflect changes in test.c.
The diff of the modified file(s):
--- bttest.c 6 Feb 2002 11:31:56 -0000 1.24
+++ bttest.c 7 Mar 2002 21:34:09 -0000 1.25
@@ -565,16 +565,6 @@
hotlist[i][0], hotlist[i][1], hotlist[i][2], hotlist[i][3], h=
otlist[i][4], hotlist[i][5]);
}
}
- else if(strcmp(buf, "test_case_disable_disconnect") =3D=3D 0)
- {
- printf("Disabling sending of disconnect respons\n");
- bt_testcmd(bt_cfd, buf);
- }
- else if(strcmp(buf, "test_case_enable_disconnect") =3D=3D 0)
- {
- printf("Enabling sending of disconnect respons\n");
- bt_testcmd(bt_cfd, buf);
- }=20=20=20
else if(sscanf(buf, "bnep_test %d %d",=20
&tmp[0], &tmp[1]) =3D=3D 2)
{=20
@@ -598,7 +588,10 @@
printf("Remote Name (%02X:%02X:%02X:%02X:%02X:%02X): %s\n",=20
bd[0], bd[1], bd[2], bd[3], bd[4], bd[5], remote_name);
}
-
+ else if(strncmp(buf, "test_case_", 10) =3D=3D 0)
+ {
+ bt_testcmd(bt_cfd, buf);
+ }
else
{
printf("> error: command not recognized or wrong syntax\n");
|
|
From: Willy S. <sag...@us...> - 2002-04-08 15:38:31
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bttest.c 1.25 1.26=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added new commands
The diff of the modified file(s):
--- bttest.c 7 Mar 2002 21:34:09 -0000 1.25
+++ bttest.c 8 Apr 2002 11:22:08 -0000 1.26
@@ -94,6 +94,21 @@
" force_ms <0/1>", /* force ms switch */
" role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)",
" stat ", /* similar to reading the /proc/bt */
+ " read_rssi <x:x>",
+ " park_mode <x:x> <x:x> <x:x> (Connection handle, Beacon Max Interval, =
Beacon Min Interval)",
+ " exit_park_mode <x:x> (Connection handle)",
+ " sniff_mode <x:x> <x:x> <x:x> (Connection handle, Sniff Max Interval, =
Sniff Min Interval, Attempt , Timeout)",
+ " exit_sniff_mode <x:x> (Connection handle)",
+ " hold_mode <x:x> <x:x> <x:x> (Connection handle, Hold Mode Max Interva=
l, Hold Mode Min Interval)",
+ " read_clk_offset <x:x> (Connection handl",
+ " read_num_broadcast_rtx",
+ " write_num_broadcast_rtx",
+ " write_page_to <x:x>",
+ " read_tx_power_level <x:x> <x> (Connection handle, Type)",
+ " write_link_supervision_to <x:x> <x:x>",
+ " write_scan_enable <x>",
+ " write_page_scan_activity <x:x> <x:x>",
+ " write_link_policy_settings <x:x> <x:x> ( Connection handle , link pol=
icy settings )",
#ifdef ECS_TEST_FUNCTIONS
" ecs_entertest <handle> (hex)",
" ecs_testctrl <par1,par2,...,par9> (hex)",
@@ -105,6 +120,8 @@
" upt <teststring>", /* e.g testcase 4.3 't 43' */
#ifdef CONFIG_BLUETOOTH_PAN
" bnep_test <param> <testcase>",
+ " bnep_conn <xx:xx:xx:xx:xx:xx>",
+ " bnep_disconnect <xx:xx:xx:xx:xx:xx>",
#endif
#endif
" quit",=20
@@ -215,7 +232,8 @@
=20=20=20
while (1)
{
- char *tmp_char, hotlist_entry;
+ char *tmp_char;
+ int hotlist_entry;
char tmp_line[200];
char *line =3D (char*) readline("> ");
add_history(line);
@@ -255,7 +273,7 @@
int
process_cmd(char *buf, int bt_cfd)
{
- unsigned int i, con_id, tmp[10], repeat, line =3D 0, profile, srv_ch;
+ unsigned int i, con_id, tmp[10], repeat, line =3D 0, srv_ch;
int retval =3D 0;
unsigned char bd[6];
=20
@@ -282,6 +300,174 @@
=20=20=20=20=20
retval =3D bt_connect(bt_cfd, bd, con_id);
}
+ else if (sscanf(buf, "bnep_conn %x:%x:%x:%x:%x:%x",
+ &tmp[0], &tmp[1], &tmp[2],
+ &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
+ {
+ int i;
+ unsigned char tmp_bd[6];
+
+ for (i =3D 0; i < 6; i++)
+ {
+ tmp_bd[i] =3D (unsigned char)tmp[i];
+ }
+=20=20=20=20
+ bnep_connect(bt_cfd, tmp_bd);
+ }
+ else if (sscanf(buf, "bnep_disconn %x:%x:%x:%x:%x:%x",
+ &tmp[0], &tmp[1], &tmp[2],
+ &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
+ {
+ int i;
+ unsigned char tmp_bd[6];
+
+ for (i =3D 0; i < 6; i++)
+ {
+ tmp_bd[i] =3D (unsigned char)tmp[i];
+ }
+=20=20=20=20
+ bnep_disconnect(bt_cfd, tmp_bd);
+ }
+ else if (sscanf(buf, "read_rssi %x:%x", &tmp[0], &tmp[1]) =3D=3D 2)
+ {
+ unsigned char tmp_rssi[4];
+=20=20=20=20
+ for (i =3D 0; i < 2; i++)
+ tmp_rssi[i] =3D (unsigned char)tmp[i];
+
+ bt_read_rssi(bt_cfd, tmp_rssi);
+ }
+ else if (sscanf(buf, "park_mode %x:%x %x:%x %x:%x",=20
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=
=3D 6)
+ {
+ unsigned char tmp_park[6];
+
+ for (i =3D 0; i < 6; i++)
+ tmp_park[i] =3D (unsigned char)tmp[i];
+
+ bt_park_mode(bt_cfd, tmp_park);
+ }
+ else if (sscanf(buf, "exit_park_mode %x:%x", &tmp[0], &tmp[1]) =3D=3D 2)
+ {
+ unsigned char tmp_exit_park[4];
+
+ for (i =3D 0; i < 2; i++)
+ tmp_exit_park[i] =3D (unsigned char)tmp[i];
+
+ bt_exit_park_mode(bt_cfd, tmp_exit_park);
+ }
+ else if (sscanf(buf, "sniff_mode %x:%x %x:%x %x:%x %x:%x %x:%x",=20
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5], &tm=
p[6], &tmp[7], &tmp[8],&tmp[9]) =3D=3D 10)
+ {
+ unsigned char tmp_sniff[10];
+
+ for (i =3D 0; i < 6; i++)
+ tmp_sniff[i] =3D (unsigned char)tmp[i];
+
+ bt_sniff_mode(bt_cfd, tmp_sniff);
+ }
+ else if (sscanf(buf, "exit_sniff_mode %x:%x", &tmp[0], &tmp[1]) =3D=3D 2)
+ {
+ unsigned char tmp_exit_sniff[4];
+
+ for (i =3D 0; i < 2; i++)
+ tmp_exit_sniff[i] =3D (unsigned char)tmp[i];
+
+ bt_exit_sniff_mode(bt_cfd, tmp_exit_sniff);
+ }
+ else if (sscanf(buf, "hold_mode %x:%x", &tmp[0], &tmp[1], &tmp[2], &tmp[=
3], &tmp[4], &tmp[5]) =3D=3D 6)
+ {
+ unsigned char tmp_hold[6];
+
+ for (i =3D 0; i < 6; i++)
+ tmp_hold[i] =3D (unsigned char)tmp[i];
+
+ bt_hold_mode(bt_cfd, tmp_hold);
+ }=20
+ else if (sscanf(buf, "write_link_policy_settings %x:%x %x:%x", &tmp[0], =
&tmp[1], &tmp[2], &tmp[3]) =3D=3D 4)
+ {
+ unsigned char tmp_policy[4];
+
+ for (i =3D 0; i < 4; i++)
+ tmp_policy[i] =3D (unsigned char)tmp[i];
+
+ bt_write_link_policy_settings(bt_cfd, tmp_policy);
+ }
+
+ else if (sscanf(buf, "read_clk_offset %x:%x", &tmp[0], &tmp[1]) =3D=3D 2)
+ {
+ unsigned char tmp_clk_offset[4];
+
+ for (i =3D 0; i < 2; i++)
+ tmp_clk_offset[i] =3D (unsigned char)tmp[i];
+
+ bt_read_clock_offset(bt_cfd, tmp_clk_offset);
+ }
+ else if (strcmp(buf, "read_num_broadcast_rtx") =3D=3D 0)
+ {
+ bt_read_num_broadcast_rtx(bt_cfd);
+ }
+ else if (sscanf(buf, "write_num_broadcast_rtx %x", &tmp[0]) =3D=3D 1)
+ {
+ unsigned char b_rtx;
+
+ b_rtx =3D tmp[0];
+
+ bt_write_num_broadcast_rtx(bt_cfd, &b_rtx);
+ }
+ else if (sscanf(buf, "write_page_to %x:%x", &tmp[0], &tmp[1]) =3D=3D 2)
+ {
+ unsigned char tmp_page_to[4];
+
+ for (i =3D 0; i < 2; i++)
+ tmp_page_to[i] =3D (unsigned char)tmp[i];
+
+ bt_write_page_to(bt_cfd, tmp_page_to);
+ }
+ else if (sscanf(buf, "read_tx_power_level %x:%x %x", &tmp[0], &tmp[1], &=
tmp[2
+]) =3D=3D 3)
+ {
+ unsigned char tmp_tx_power[3];
+
+ for (i =3D 0; i < 3; i++)
+ tmp_tx_power[i] =3D (unsigned char)tmp[i];
+
+ bt_read_tx_power_level(bt_cfd, tmp_tx_power);
+ }
+ else if (sscanf(buf, "write_link_supervision_to %x:%x %x:%x", &tmp[0], &=
tmp[1
+], &tmp[2], &tmp[3]) =3D=3D 4)
+ {
+ unsigned char tmp_link_to[8];
+
+ for (i =3D 0; i < 2; i++)
+ tmp_link_to[i] =3D (unsigned char)tmp[i];
+ for (i =3D 2; i < 4; i++)
+ tmp_link_to[i] =3D 0;
+ for (i =3D 4; i < 6; i++)
+ tmp_link_to[i] =3D (unsigned char)tmp[i-2];
+ for (i =3D 6; i < 8; i++)
+ tmp_link_to[i] =3D 0;
+
+ bt_write_link_supervision_to(bt_cfd, tmp_link_to);
+ }
+ else if (sscanf(buf, "write_scan_enable %x", &tmp[0]) =3D=3D 1)
+ {
+ unsigned int wrscan;
+
+ wrscan =3D tmp[0];
+ bt_write_scan_enable(bt_cfd, wrscan);
+ }
+ else if (sscanf(buf, "write_page_scan_activity %x:%x %x:%x",
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3]) =3D=3D 4)
+ {
+ unsigned char wps_activity[8];
+
+ for (i =3D 0; i < 4; i++)
+ wps_activity[i+2*(i/2)] =3D tmp[i];
+=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
+ bt_write_page_scan_activity(bt_cfd, wps_activity);
+ }
+
else if (sscanf(buf, "bt_wrscan %d", &tmp[0]) =3D=3D 1)
{
printf("Setting wr scan enable to %d\n", tmp[0]);
@@ -558,7 +744,7 @@
}
else if(strcmp(buf, "hotlist_show") =3D=3D 0)
{
- int i, j;
+ int i;
for(i =3D 0 ; i < 10 ; i++)
{
printf("%d: %02X:%02X:%02X:%02X:%02X:%02X\n", i,=20
@@ -574,19 +760,24 @@
return 0;
}
}=20
- else if(sscanf(buf, "remote_name %x:%x:%x:%x:%x:%x",=20=20
- &bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5]) =3D=3D 6)
+ else if(sscanf(buf, "remote_name %02x:%02x:%02x:%02x:%02x:%02x",=20=20
+ &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=
=3D 6)
{
unsigned char remote_name[BT_NAME_LENGTH + 1];
- memcpy(&remote_name[0], &bd[0], 6);
+ int i;
=20=20=20=20=20
- if (retval =3D ioctl(bt_cfd, HCIREMOTENAME_REQUEST, &remote_name[0]))
+ for (i =3D 0; i < 6; i++)
+ {
+ remote_name[i] =3D (unsigned char)tmp[i];
+ }
+=20=20=20=20
+ if (ioctl(bt_cfd, HCIREMOTENAME_REQUEST, &remote_name[0]))
{
printf("Remote Name Request Failed (status %d)\n", retval);
return 0;
}
printf("Remote Name (%02X:%02X:%02X:%02X:%02X:%02X): %s\n",=20
- bd[0], bd[1], bd[2], bd[3], bd[4], bd[5], remote_name);
+ tmp[0], tmp[1], tmp[2], tmp[3], tmp[4], tmp[5], remote_name);
}
else if(strncmp(buf, "test_case_", 10) =3D=3D 0)
{
|