|
From: Alain P. <apa...@us...> - 2002-06-03 10:07:31
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bt_if.c 1.46 1.47=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_if.h 1.34 1.35=20=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_vendor.c 1.34 1.35=20=20=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20=20=20
btinit.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Correct the option -n (for the custom local name). It was not completely
implemented and it crashed the bti.
The diff of the modified file(s):
--- bt_if.c 22 Apr 2002 15:22:03 -0000 1.46
+++ bt_if.c 3 Jun 2002 10:07:28 -0000 1.47
@@ -70,7 +70,7 @@
/* Functions common for kernel and 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 */
=20
-int init_stack(int bt_cfd)
+int init_stack(int bt_cfd, char * local_name)
{
syslog(LOG_INFO, "Init stack");
=20
@@ -89,7 +89,10 @@
bt_set_classofdevice(bt_cfd, 0x10, 0x3, 0x0, 0x0);
=20
#ifndef __CRIS__
- set_local_hostname(bt_cfd, "AXIS");
+ if (! local_name)
+ set_local_hostname(bt_cfd, "AXIS", 1);
+ else
+ set_local_hostname(bt_cfd, local_name, 0);
#endif
}
=20=20=20
@@ -1331,7 +1334,7 @@
}
=20
=20
-void set_local_hostname(int bt_cfd, const char *local_name)
+void set_local_hostname(int bt_cfd, const char *local_name, int add_host)
{
unsigned char buf[LOCAL_NAME_LENGTH + HOST_NAME_LENGTH +=20
DOMAIN_NAME_LENGTH + 5];
@@ -1349,7 +1352,7 @@
}
}
=20=20
- if (len)
+ if (len && add_host)
{
buf[len++] =3D ' ';
buf[len++] =3D '(';
@@ -1370,7 +1373,7 @@
}
}
=20
- if (len)
+ if (len && add_host)
{
strcat(buf, ")");
}
--- bt_if.h 22 Apr 2002 15:22:03 -0000 1.34
+++ bt_if.h 3 Jun 2002 10:07:28 -0000 1.35
@@ -300,7 +300,7 @@
* Init/shutdown and control of stack=20
*/
=20
-int init_stack(int bt_cfd);
+int init_stack(int bt_cfd, char * local_name);
int bt_isinitiated(int bt_cfd);
void shutdown_stack(int bt_cfd);
#ifndef BT_USERSTACK
@@ -385,7 +385,7 @@
=20
=20
/* Sets friendly name to local_name + hostname in HW */
-void set_local_hostname(int bt_cfd, const char *local_name);
+void set_local_hostname(int bt_cfd, const char *local_name, int add_host);
=20
/* Sets friendly name to name */
void bt_set_local_name(int bt_cfd, const unsigned char *name);
--- bt_vendor.c 16 May 2002 15:12:45 -0000 1.34
+++ bt_vendor.c 3 Jun 2002 10:07:28 -0000 1.35
@@ -444,12 +444,12 @@
sleep(1);
=20
/* Initialize stack */
- init_stack(bt_cfd);
+ init_stack(bt_cfd, NULL);
=20
if (csr_disable_deep_sleep(bt_cfd))
{
reset_hw();
- init_stack(bt_cfd); /* reinitialize */
+ init_stack(bt_cfd, NULL); /* reinitialize */
}
=20
/* Read params for ps key PSKEY_HOSTIO_UART_PS_BLOCK */
--- btd.c 20 Dec 2001 14:47:41 -0000 1.37
+++ btd.c 3 Jun 2002 10:07:28 -0000 1.38
@@ -192,7 +192,7 @@
=20
static char *physdev =3D DEFAULT_PHYS_DEV;
static char *speedstr =3D DEFAULT_SPEED;
-static char local_name[LOCAL_NAME_LENGTH+1]; /* 'friendly' name in HW modu=
le */
+static char * local_name =3D NULL; /* not set */
=20
static int btd_pid =3D -1;
static int sdpsrv_pid =3D 0;
@@ -248,7 +248,7 @@
}
=20=20=20
/* now parse options */
- while ((opt =3D getopt_long(argc, argv, "fi:m:nRs:u:IUB",
+ while ((opt =3D getopt_long(argc, argv, "fi:m:n:Rs:u:IUB",
long_options, &option_index)) !=3D -1)
{
switch(opt)
@@ -271,9 +271,8 @@
break;
=20=20=20=20=20=20=20
case 'n':
- D(syslog(LOG_INFO, "setting local name to %s", optarg));
- strncpy(local_name, optarg, LOCAL_NAME_LENGTH);
- local_name[LOCAL_NAME_LENGTH] =3D '\0';
+ local_name =3D optarg;
+ D(syslog(LOG_INFO, "setting local name to %s", local_name));
break;
=20=20=20=20=20=20=20
case 'R':
@@ -351,11 +350,11 @@
if (do_reset)
reset_hw();
=20
- if (init_stack(bt_cfd) < 0)
+ if (init_stack(bt_cfd, local_name) < 0)
{
/* For some reason, the stack sometimes fails to initialize the first
time. So let us try an extra time, just to be sure... */
- if (init_stack(bt_cfd) < 0)
+ if (init_stack(bt_cfd, local_name) < 0)
{
init_failed(bt_cfd, phys_fd, init_hw_speedstr, flow_control);
}
--- btinit.c 15 May 2002 13:07:56 -0000 1.20
+++ btinit.c 3 Jun 2002 10:07:28 -0000 1.21
@@ -114,7 +114,7 @@
static int bt_cfd =3D -1; /* control tty for bt stack */
=20
static int btd_pid;
-static char local_name[LOCAL_NAME_LENGTH+1]; /* 'friendly' name in HW modu=
le */
+static char * local_name =3D NULL; /* not set */
static const char *init_hw_speedstr =3D NULL; /* not set */
static int do_hwinit =3D 1; /* do vendor specific initialization */
static int do_reset =3D 0; /* reset hw using I/O pins */
@@ -183,7 +183,7 @@
}
=20
/* now parse options */
- while ((opt =3D getopt_long(argc, argv, "fi:nRs:u:D",
+ while ((opt =3D getopt_long(argc, argv, "fi:n:Rs:u:D",
long_options, &option_index)) !=3D -1)
{
switch(opt)
@@ -201,9 +201,8 @@
break;
=20
case 'n':
- D(syslog(LOG_INFO, "setting local name to %s", optarg));
- strncpy(local_name, optarg, LOCAL_NAME_LENGTH);
- local_name[LOCAL_NAME_LENGTH] =3D '\0';
+ local_name =3D optarg;
+ D(syslog(LOG_INFO, "setting local name to %s", local_name));
break;
=20
case 'R':
@@ -281,11 +280,11 @@
if (do_reset)
reset_hw();
=20=20=20
- if (init_stack(bt_cfd) < 0)
+ if (init_stack(bt_cfd, local_name) < 0)
{
/* For some reason, the stack sometimes fails to initialize the first
time. So let us try an extra time, just to be sure... */
- if (init_stack(bt_cfd) < 0)
+ if (init_stack(bt_cfd, local_name) < 0)
{
init_failed(bt_cfd, phys_fd, init_hw_speedstr, flow_control);
}
|