|
From: Anders J. <and...@us...> - 2004-01-31 02:46:44
|
The following file was modified in apps/bluetooth/utils/btconnect:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btcon.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added option to do authentication/encryption.
Added option BB to connect baseband.
The diff of the modified file(s):
--- btcon.c 2004/01/09 15:31:10 1.5
+++ btcon.c 2004/01/30 12:00:04 1.6
@@ -80,7 +80,7 @@ static int connect_bnep(unsigned char *b
static void
usage()
{
- printf("btcon -a <BD> [-p <pincode>] [-P <protocol RFCOMM|BNEP|SDP>]\n");
+ printf("btcon -a <BD> [-p <pincode>] [-P <protocol RFCOMM|BNEP|SDP|BB>] =
[-A]\n");
printf("RFCOMM protocol:\n");
printf(" [-s <rfcomm srv channel>]\n");
printf(" [-d <device>]\n");
@@ -89,6 +89,11 @@ usage()
printf(" [-S <source service>]\n");
printf("SDP protocol:\n");
printf(" No options needed\n");
+ printf("BB (Baseband):\n");
+ printf(" No options needed\n");
+ printf("The -A flag:\n");
+ printf(" Set this flag to authenticate and encrypt a link, shall on=
ly be\n");
+ printf(" used with -a. The pin must have been set with a previous B=
B connect\n");
printf("Default values:\n");
printf(" -P %s\n", DEFAULT_PROTOCOL);
printf(" -s %d\n", DEFAULT_SRV_CHANNEL);
@@ -144,6 +149,13 @@ connect_sdp(unsigned char *bd)
pin, strlen(pin));
}
=20
+static int=20
+connect_bb(unsigned char *bd)
+{
+ printf("Connecting baseband\n");
+ return bb_connect(bt_cfd, bd,
+ pin, strlen(pin));
+}
=20
int
main(int argc, char **argv)
@@ -157,6 +169,7 @@ main(int argc, char **argv)
int dstservice =3D DEFAULT_DEST;
int srcservice =3D DEFAULT_SRC;
unsigned char *protocol =3D DEFAULT_PROTOCOL;=20
+ int doauthentication =3D 0;
=20
/* Print header if called via http */
if (getenv("REQUEST_METHOD") !=3D NULL)
@@ -165,10 +178,16 @@ main(int argc, char **argv)
}
=20
/* now parse options */
- while ((opt =3D getopt(argc, argv, "a:d:r:S:p:D:s:S:P:h")) !=3D -1)
+ while ((opt =3D getopt(argc, argv, "Aa:d:r:S:p:D:s:S:P:h")) !=3D -1)
{
switch (opt)
{
+ case 'A':
+ {
+ doauthentication++;
+ }
+ break;
+=20=20=20=20=20=20
case 'a':
{
bd_str =3D optarg;
@@ -279,6 +298,12 @@ main(int argc, char **argv)
exit(1);
}
=20
+ if(doauthentication)
+ {
+ result =3D bt_authenticate_encrypt(bt_cfd, bd);
+ }
+ else
+ {
if(!strcmp(protocol, "RFCOMM"))
{
result =3D connect_rfcomm(bd, srvch, line);
@@ -291,11 +316,17 @@ main(int argc, char **argv)
{
result =3D connect_sdp(bd);
}
+ else if(!strcmp(protocol, "BB"))
+ {
+ result =3D connect_bb(bd);
+ }
else
{
fprintf(stderr, "Unknown protocol, exit\n");
usage();
}
+ }
+=20=20
close(bt_cfd);
exit(result);
}
|