|
From: Anders J. <and...@us...> - 2001-10-16 16:37:48
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
modememul.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Made the emulator check if we got any BT-connection to prevent it from=20
starting on a disconnected line.
The diff of the modified file(s):
--- modememul.c 2001/10/03 17:48:50 1.13
+++ modememul.c 2001/10/16 16:18:49 1.14
@@ -58,6 +58,7 @@
=20
#include "btd.h"
#include "bt_misc.h"
+#include "bt_if.h"
=20
#define D(x) //x
=20
@@ -111,15 +112,28 @@
int btfd;
char *speedstr;
int done =3D 0;
+ int line =3D -1;
=20=20=20
setsid(); /* become session leader (to catch SIGHUPS) */=20=20
init_sighandler();
=20
speedstr =3D argv[2];
+ if(sscanf(argv[1], "/dev/ttyBT%d", &line) !=3D 1)
+ {
+ syslog(LOG_INFO, "Invalid arguments to modememulator\n");
+ exit(0);
+ }=20=20=20=20
=20
while (done !=3D START_PPP)
{
syslog(LOG_INFO, "Starting modem emulator on %s", argv[1]);
+
+ if(!bt_isconnected(-1, line))
+ {
+ D(syslog(LOG_INFO, "No BT connection, stopping modememulator\n"));
+ close(btfd);
+ _exit(0);
+ }
=20
if ((btfd =3D open(argv[1], O_RDWR, 0)) < 0)
{
|