|
From: Mattias A. <mat...@us...> - 2001-03-21 18:46:04
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
btcon.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
added two more options to write BD address, e.g 001122334455, 00-11-22-33-4=
4-55
The diff of the modified file(s):
--- btcon.c 2001/03/02 10:59:57 1.1
+++ btcon.c 2001/03/21 18:46:02 1.2
@@ -100,21 +100,45 @@
{
switch(opt)
{
+=20=20=20=20=20=20
case 'a':
{
- int tmp[6];
+ int tmp[6], all_read =3D 0;
bd_str =3D optarg;
- printf("Connecting to bd : %s\n", bd_str);
- if (sscanf(optarg, "%x:%x:%x:%x:%x:%x",
+ if (sscanf(optarg, "%2x%2x%2x%2x%2x%2x",
+ &tmp[0], &tmp[1], &tmp[2],
+ &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
+ {=20=20
+ all_read =3D 1;
+ }
+ else if (sscanf(optarg, "%x:%x:%x:%x:%x:%x",
+ &tmp[0], &tmp[1], &tmp[2],
+ &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
+ {=20=20
+ all_read =3D 1;
+ }
+ else if (sscanf(optarg, "%x-%x-%x-%x-%x-%x",
&tmp[0], &tmp[1], &tmp[2],
&tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
{
+ all_read =3D 1;
+ }
+=20=20=20=20=20=20=20=20
+ /* now convert to real bd format if syntax was correct */
+ if(all_read)
+ {
for (i =3D 0; i < 6; i++)
{
bd[i] =3D (unsigned char)tmp[i];=20
}
+ printf("Connecting to bd : %2x:%2x:%2x:%2x:%2x:%2x\n",
+ bd[0], bd[1], bd[2], bd[3], bd[4], bd[5]);
}
-=20=20=20=20=20=20=20=20
+ else
+ {
+ printf("Invalid syntax : %s\n", bd_str);
+ exit(1);
+ }
}
break;
=20
|