|
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)
{
|