|
From: Alain P. <apa...@us...> - 2002-07-22 17:22:15
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
README.txt 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
btinit.c 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Changed soft reset. It now uses DTR pin to make the reset. This allow to use
flow control and soft reset at the same time.
The diff of the modified file(s):
--- README.txt 22 Apr 2002 15:22:03 -0000 1.6
+++ README.txt 22 Jul 2002 17:22:13 -0000 1.7
@@ -54,11 +54,10 @@
-f, --noflow
Don't use RTS and CTS signals when communicating with the module through =
UART
=20=09
- -D /* RTS reset the module */
- Set the RTS to 0 after the serial port has been opened. This allow to mak=
e a
+ -D /* DTR reset the module */
+ Makes a Reset throuth DTR pin of serial port. This allow to make a
soft reset for a bluetooth module like the module from ericsson if you
- wire the rts to the reset pin of the module.
- This option is valid only if -f option is present.=20
+ wire the DTR to the reset pin of the module.=20
=20
e.g
./bti --reset --speed 460800 --physdev /dev/ttyS0 --local-name OpenBT
--- btinit.c 3 Jun 2002 10:07:28 -0000 1.21
+++ btinit.c 22 Jul 2002 17:22:13 -0000 1.22
@@ -74,9 +74,9 @@
force uart communication to not use CTS and RTS
default: flow control activated if defined hardware support it
=20
- -D, --user-rts
- Use RTS for hard reset
- default: no use of RTS
+ -D, --user-dtr
+ Use DTR for hard reset
+ default: no use of DTR
=20
e.g
./bti --reset --speed 460800 --physdev /dev/ttyS0 --local-name OpenBT
@@ -132,7 +132,7 @@
{ "local-name", 1, NULL, 'n' }, /* set local bluetooth name */
{ "reset", 0, NULL, 'R' }, /* reset BT HW */
{ "speed", 1, NULL, 's' }, /* uart speed towards hw */
- { "use-rts", 1, NULL, 'D' }, /* user rts for hard reset */
+ { "use-dtr", 1, NULL, 'D' }, /* user dtr for hard reset */
{ 0, 0, 0, 0 }
};
=20
@@ -152,17 +152,30 @@
/* Normally, the RTS should be LOW after having opened the serial port */
/* Wait 200 ms to be sure to have a valid reset */
=20
- usleep(200000);
+=09
if (ioctl (phys_fd, TIOCMGET, &iosettings) !=3D 0) {
fprintf(stderr, "btinit : Error for ioctl TIOCMGET\n");
}
- iosettings &=3D ~TIOCM_RTS;
+ printf("Set DTR to 0\n");
+ iosettings &=3D ~TIOCM_DTR;
if (ioctl (phys_fd, TIOCMSET, &iosettings) !=3D 0) {
fprintf(stderr, "btinit : Error for ioctl TIOCMSET\n");
}
- D(syslogprintf("btinit : RTS set to HIGH\n"));
+ usleep(500000);=09
+ printf("Set DTR to 1\n");
+ iosettings |=3D TIOCM_DTR;
+ ioctl (phys_fd, TIOCMSET, &iosettings);
+ //DBG ("Resetting the module");
+ usleep(200000); /*Sleep 200 ms for reset*/
+ printf("Set DTR to 0 again\n");
+ iosettings &=3D ~TIOCM_DTR;
+ ioctl (phys_fd, TIOCMSET, &iosettings);
+ //DBG ("End of reset");
+ D(syslogprintf("btinit : DTR set to HIGH\n"));
sleep(2); /* Wait that module boot. 1 second is too short */
=20
+=09
+=09
}
=20
=20
@@ -172,7 +185,7 @@
{=20=20
int opt;
int bt_disc =3D N_BT;
- volatile int rts_hard_reset =3D 0;
+ volatile int dtr_hard_reset =3D 0;
=20
syslog(LOG_INFO, "Bluetooth daemon starting");
=20
@@ -224,10 +237,9 @@
break;
=20=20=20=20=20=20
case 'D':
- /* If called with -f option, set RTS to 1 after the port has been op=
ened */
- /* It's usefull if you command a reset by the RTS pin */
+ /* Make a reset on DTR pin of serial port */
D(syslog(LOG_INFO, "Use RTS for hard reset", optarg));
- rts_hard_reset =3D 1;
+ dtr_hard_reset =3D 1;
break;
=20
default:
@@ -235,14 +247,6 @@
}
}
=20=09
- /* Verify that options if we have -D option, we have -f too */
- if (rts_hard_reset & !(flow_control =3D=3D USE_NO_FLOW))
- {
- fprintf(stderr, "You can't use -D option without -f option.\n");
- fprintf(stderr, "bti won't care about -D option\n");
- rts_hard_reset =3D 0;
- }
-=09
/* Set restart point */
if (sigsetjmp(jmpbuffer, 1) !=3D 0)
{
@@ -271,7 +275,7 @@
bt_cfd =3D bt_openctrl();
=20=20=20
/* Use RTS to reset/unreset the card (only if option selected) */
- if (rts_hard_reset)
+ if (dtr_hard_reset)
unreset_force_rts();
=20=20=20
tcflush(phys_fd, TCIOFLUSH);
|