|
From: Peter K. <pk...@us...> - 2001-12-07 18:42:26
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
btd.c 1.34 1.35=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Kill all memul children when restarting/exiting (just like we
do with pppd).
* Added options --use-uart and --use-bcsp.
The diff of the modified file(s):
--- btd.c 2001/11/22 15:31:30 1.34
+++ btd.c 2001/12/07 18:42:24 1.35
@@ -84,6 +84,14 @@
enable use of ipa
default: not enabled
=20
+ -U, --use-uart
+ use the UART protocol to communicate with the Bluetooth module
+ default: whatever the kernel defaults to
+
+ -B, --use-bcsp
+ use the BCSP protocol to communicate with the Bluetooth module
+ default: whatever the kernel defaults to
+
e.g
./btdm --reset --speed 460800 --physdev /dev/ttyS0 --local-name OpenBT
./btdm --reset --speed 1000000/1 --physdev /dev/ttyS0 --local-name Open=
BT
@@ -193,6 +201,7 @@
static sigjmp_buf jmpbuffer; /* used to jump back in program after doing r=
eset */
=20
static int use_ipa =3D 0;=20
+static int use_bcsp =3D -1;
=20
/* long option list */
static struct option long_options[] =3D
@@ -205,6 +214,8 @@
{ "reset", 0, NULL, 'R' }, /* reset BT HW */
{ "speed", 1, NULL, 's' }, /* uart speed towards hw */
{ "use-ipa", 0, NULL, 'I' },
+ { "use-uart", 0, NULL, 'U' },
+ { "use-bcsp", 0, NULL, 'B' },
{ 0, 0, 0, 0 }
};
=20
@@ -237,7 +248,7 @@
}
=20=20=20
/* now parse options */
- while ((opt =3D getopt_long(argc, argv, "fi:m:nRs:u:I",
+ while ((opt =3D getopt_long(argc, argv, "fi:m:nRs:u:IUB",
long_options, &option_index)) !=3D -1)
{
switch(opt)
@@ -282,11 +293,22 @@
D(syslog(LOG_INFO, "phys dev: %s", optarg));
physdev =3D optarg;
break;
+
case 'I':
D(syslog(LOG_INFO, "using IPA"));
use_ipa =3D 1;
break;
=20
+ case 'U':
+ D(syslog(LOG_INFO, "using UART"));
+ use_bcsp =3D 0;
+ break;
+
+ case 'B':
+ D(syslog(LOG_INFO, "using BCSP"));
+ use_bcsp =3D 1;
+ break;
+
default:
break;
}
@@ -324,6 +346,11 @@
if (do_reset)
reset_hw();
=20
+ if (use_bcsp >=3D 0)
+ {
+ bt_bcsp_mode(bt_cfd, use_bcsp);
+ }
+
if (init_stack(bt_cfd) < 0)
{
/* For some reason, the stack sometimes fails to initialize the first
@@ -893,9 +920,9 @@
/* Kill all pppd:s */
for (line =3D 0; line < BT_NBR_DATAPORTS; line++)
{
- if (STATE(line) =3D=3D PPPD_STARTED)
+ if (STATE(line) =3D=3D PPPD_STARTED || STATE(line) =3D=3D MODEM_STARTE=
D)
{
- D(syslog(LOG_INFO, "Killing pppd on line %d", line));
+ D(syslog(LOG_INFO, "Killing pppd/memul on line %d", line));
kill(PEER(line).pppd_pid, SIGTERM);
if (waitpid(PEER(line).pppd_pid, NULL, 0) < 0)
perror("waitpid pppd");
|