|
From: Peter K. <pk...@us...> - 2001-06-08 09:55:48
|
The following files were modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_if.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20
bt_ipa.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20
bt_vendor.c 1.16 1.17=20=20=20=20=20=20=20=20=20=20=20=20
btd.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20
modememul.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Improved some log messages.
* Marked debug messages as such.
The diff of the modified file(s):
--- bt_if.c 2001/05/29 10:04:12 1.16
+++ bt_if.c 2001/06/08 09:55:47 1.17
@@ -72,7 +72,7 @@
=20
void init_stack(int bt_cfd, int spd)
{
- syslog(LOG_INFO, "Init stack\n");
+ syslog(LOG_INFO, "Init stack");
=20=20=20
#ifdef BT_USERSTACK
init_userstack();
@@ -116,7 +116,7 @@
=20
void shutdown_stack(int bt_cfd)
{
- syslog(LOG_INFO, "Shutting down bluetooth stack\n");
+ syslog(LOG_INFO, "Shutting down bluetooth stack");
#ifndef BT_USERSTACK
if (bt_cfd !=3D -1 && (ioctl(bt_cfd, BTSHUTDOWN) < 0))
{
@@ -183,6 +183,7 @@
int bt_openctrl(void)
{
int bt_cfd;
+
D(syslog(LOG_INFO, "Now opening BT Ctrl TTY [" BT_CTRL_TTY "]"));
#ifdef BT_USERSTACK
printf(__FUNCTION__ ": ignored in userstack\n");
@@ -448,7 +449,7 @@
memcpy(ping.data, data, len);
=20=20=20
#ifndef BT_USERSTACK=20
- if ((ret_val =3D ioctl(bt_cfd, BTPING, &ping)) !=3D 0)
+ if ((ret_val =3D ioctl(bt_cfd, BTPING, &ping)) < 0)
{
printf("Error : %s\n", error_msg(ret_val));
}
@@ -471,7 +472,7 @@
msg[7] =3D (unsigned char)(type & 0xff);
=20
#ifndef BT_USERSTACK=20
- if ((ret_val =3D ioctl(bt_cfd, BTGETINFO, &msg)) !=3D 0)
+ if ((ret_val =3D ioctl(bt_cfd, BTGETINFO, &msg)) < 0)
{
printf("Error : %s\n", error_msg(ret_val));
}
@@ -491,7 +492,7 @@
print_data("cmd ", cmd, strlen(cmd));
=20
#ifndef BT_USERSTACK=20
- if ((ret_val =3D ioctl(bt_cfd, BTTESTCOMMAND, cmd)) !=3D 0)
+ if ((ret_val =3D ioctl(bt_cfd, BTTESTCOMMAND, cmd)) < 0)
{
printf("Error : %s\n", error_msg(ret_val));
}
@@ -506,9 +507,10 @@
int bt_force_msswitch_as_server(int bt_cfd, int enable)
{
int ret_val;
+
syslog(LOG_INFO, __FUNCTION__ ": %d", enable);
#ifndef BT_USERSTACK=20
- if ((ret_val =3D ioctl(bt_cfd, BTSETMSSWITCH, &enable)) !=3D 0)
+ if ((ret_val =3D ioctl(bt_cfd, BTSETMSSWITCH, &enable)) < 0)
{
fprintf(stderr, __FUNCTION__ ": %s\n", error_msg(ret_val));
}
@@ -662,7 +664,8 @@
int bt_write_scan_enable(int bt_cfd, unsigned int flags)
{
int result;
- syslog(LOG_INFO, "Setting write_scan_enable [0x%x]\n", flags);
+
+ syslog(LOG_INFO, "Setting write_scan_enable: 0x%x", flags);
=20
#ifdef BT_USERSTACK
result =3D hci_write_scan_enable(flags);
@@ -682,7 +685,6 @@
unsigned int wind)
{
/* improves reliability when doing a connect */
- syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!");
=20
#ifdef BT_USERSTACK
hci_write_pagescan_activity(interval, wind);
@@ -706,7 +708,7 @@
{
int result;
=20
- syslog(LOG_INFO, "Setting event filter [0x%1x 0x%1x 0x%1x]\n",=20
+ syslog(LOG_INFO, "Setting event filter [0x%x 0x%x 0x%x]",=20
filter[0], filter[1], filter[2]);
=20
#ifdef BT_USERSTACK
@@ -751,15 +753,15 @@
break;
=20
case 1:
- syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format);
+ syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x", format);
break;
=20
case 2:
- syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format);
+ syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x", format);
break;
=20
default:
- syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format);
+ syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x", format);
break;
}
}
@@ -770,7 +772,7 @@
int i;
unsigned char tmp[7];
=20
- syslog(LOG_INFO, "Performing role switch to peer: %02X:%02X:%02X:%02X:%0=
2X:%02X\n",
+ syslog(LOG_INFO, "Performing role switch to peer: %02X:%02X:%02X:%02X:%0=
2X:%02X",
bd_addr[0], bd_addr[1], bd_addr[2],
bd_addr[3], bd_addr[4], bd_addr[5]);
=20
@@ -798,10 +800,10 @@
if (ioctl(phys_fd, TIOCSETD, &bt_disc) < 0)
{
perror(__FUNCTION__);
- syslog(LOG_INFO, "Forgot to insmod bt.o ? [bt_disc %d]\n", bt_disc);
+ syslog(LOG_INFO, "Forgot to insmod bt.o ? [bt_disc %d]", bt_disc);
exit(1);
}
- syslog(LOG_INFO, "Registered bluetooth line discipline on %s\n", physdev=
);
+ syslog(LOG_INFO, "Registered bluetooth line discipline on %s", physdev);
printf("Registered bluetooth line discipline on %s\n", physdev);
#else
fprintf(stderr, __FUNCTION__ ": ignored in usermode stack\n");
@@ -1024,7 +1026,7 @@
#endif
#endif=20=20
=20
- syslog(LOG_INFO, "Opening dev %s\n", dev);
+ D(syslog(LOG_INFO, "Opening dev %s", dev));
if ((fd =3D open(dev, flags | O_NOCTTY)) < 0)
{
perror(__FUNCTION__);
@@ -1037,7 +1039,7 @@
=20
void close_device(int fd)
{
- syslog(LOG_INFO, __FUNCTION__);
+ D(syslog(LOG_INFO, __FUNCTION__));
=20=20=20
#ifdef BT_USERSTACK
/* if fake fd is used, ignore close since there are no open fd */
@@ -1054,7 +1056,7 @@
int sdpsrv_pid;
char *args[] =3D { SDPSRV_CMD, SDPSRV_CONF, SDPSRV_PROC, NULL };
=20
- syslog(LOG_INFO, "Starting SDP server [%s]\n", SDPSRV_CMD);=20=20
+ D(syslog(LOG_INFO, "Starting SDP server [%s]", SDPSRV_CMD));
=20
if (!(sdpsrv_pid =3D vfork()))
{
@@ -1068,12 +1070,9 @@
return sdpsrv_pid;
}
=20
-
-
/* =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 */
/* Functions used in usermode stack only */
/* =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
/*=20
*
--- bt_ipa.c 2001/05/15 12:13:04 1.4
+++ bt_ipa.c 2001/06/08 09:55:47 1.5
@@ -58,11 +58,13 @@
#include "bt_conf.h"
#include "bt_misc.h"
=20
+#define D(x) //x
+
int ipa_open(void)
{
int ipa_fd;
=20=20=20
- syslog(LOG_INFO, "Opening socket to IP Assigner");
+ D(syslog(LOG_INFO, "Opening socket to IP Assigner"));
if ((ipa_fd =3D open_socket(IPASERVER, CLIENT)) < 0)
{=20=20
perror("open_socket");
@@ -73,15 +75,15 @@
=20
void ipa_close(int ipa_fd)
{
- syslog(LOG_INFO, "Closing socket to IP Assigner");=20=20
+ D(syslog(LOG_INFO, "Closing socket to IP Assigner"));
close(ipa_fd);
}
=20
/* Sends msg to IPA socket */
int ipa_write(int ipa_fd, ipa_msg *msg)
{
- syslog(LOG_INFO, "ipa_send: sending ipa request (type: %d) len %d",
- msg->type, msg->len);
+ D(syslog(LOG_INFO, __FUNCTION__ ": Sending ipa request (type: %d) len %d=
",
+ msg->type, msg->len));
=20=20=20
return write(ipa_fd, msg, msg->len + sizeof(struct ipa_msg));
}
@@ -94,13 +96,13 @@
int offset =3D 0, all_read =3D 0, msg_len =3D -1, c;
ipa_msg *tmp;
=20
- syslog(LOG_INFO, "ipa_receive: reading response");=20=20
+ D(syslog(LOG_INFO, __FUNCTION__ ": Reading response"));
=20
while (!all_read)
{
c =3D read(ipa_fd, &ipa_buf+offset, 256-offset);=20=20
=20
- syslog(LOG_INFO, "ipa_receive: got %d bytes", c);=20=20
+ D(syslog(LOG_INFO, __FUNCTION__ ": Got %d bytes", c));
=20
if (c < 0)
return c;
@@ -120,7 +122,7 @@
=20=20=20
memcpy(msg, ipa_buf, offset);
=20
- syslog(LOG_INFO, "Got %d bytes", offset);
+ D(syslog(LOG_INFO, __FUNCTION__ ": Got %d bytes total", offset));
=20
return msg_len;=20=20
}
--- bt_vendor.c 2001/06/06 15:02:54 1.16
+++ bt_vendor.c 2001/06/08 09:55:47 1.17
@@ -54,6 +54,8 @@
#include "bt_vendor.h"
#include "bt_if.h"
=20
+#define D(x) //x
+
static void csr_init_phys(int fd);
static void csr_init_hw(int bt_cfd, int phys_fd, int spd);
static void digianswer_init_phys(int fd);
@@ -202,7 +204,7 @@
void
csr_init_phys(int fd)
{
- syslog(LOG_INFO, "Setting default speed 115200");
+ D(syslog(LOG_INFO, "Setting default speed 115200"));
if (hw_vendor() =3D=3D HW_CSR_H4)=20
fd_setup(fd, 115200, USE_FLOW_CTRL, DONT_USE_BCSP);
else
@@ -231,7 +233,7 @@
{
unsigned short msg[CSR_PSKEY_MAXPARAMS + CSR_PSKEY_MSGHDR_SIZE];
=20
- syslog(LOG_INFO ,": ps_key 0x%x rw_mode : %d\n", ps_key, rw_mode);
+ syslog(LOG_INFO, __FUNCTION__": ps_key 0x%x rw_mode : %d", ps_key, rw_mo=
de);
=20
msg[0] =3D ps_key;
msg[1] =3D rw_mode;
@@ -239,7 +241,7 @@
=20
if (n_pars > CSR_PSKEY_MAXPARAMS)
{
- syslog(LOG_INFO, "error : max nbr pskey params is %d [%d]\n",=20
+ syslog(LOG_INFO, __FUNCTION__ ": Error: Max nbr pskey params is %d [%d=
]",
CSR_PSKEY_MAXPARAMS, n_pars);
return;
}
@@ -277,7 +279,7 @@
=20=20=20
if (hw_vendor() =3D=3D HW_CSR_H4)
{
- syslog(LOG_INFO, "Changing CSR host IF BCSP -> H4");
+ syslog(LOG_INFO, "Changing CSR host IF: BCSP -> H4");
=20=20=20=20=20
/* Temporarily set stack to use BCSP framing */
csr_bcspmode(bt_cfd, 1);
@@ -336,7 +338,7 @@
}
else
{
- syslog(LOG_ERR, __FUNCTION__": PS key parameter unknown [%d]", ps_pa=
rbuf[1]);
+ syslog(LOG_ERR, __FUNCTION__ ": Unknown PS key parameter: %d", ps_pa=
rbuf[1]);
}=20=20=20
=20=20=20=20=20
/* Set back stack to use H4 framing */
@@ -344,7 +346,7 @@
}
else
{
- syslog(LOG_INFO, "Changing CSR host IF BCSP -> H4");
+ syslog(LOG_INFO, "Changing CSR host IF: BCSP -> H4");
=20
/* Set stack to use H4 temporarily */=20=20=20=20=20=20=20=20
csr_bcspmode(bt_cfd, 0);
@@ -382,7 +384,7 @@
}=20
else
{
- syslog(LOG_ERR, __FUNCTION__": PS key parameter unknown [%d]", ps_pa=
rbuf[1]);
+ syslog(LOG_ERR, __FUNCTION__ ": Unknown PS key parameter: %d", ps_pa=
rbuf[1]);
}
}
=20
@@ -433,18 +435,18 @@
}
}
=20=20=20
- syslog(LOG_INFO, "Setting write_scan_enable in CSR module!\n");
+ D(syslog(LOG_INFO, "Setting write_scan_enable in CSR module!"));
=20
bt_write_scan_enable(bt_cfd, wrscan);
=20=20=20
/* improves reliability when doing a connect */
- syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!\n");
+ D(syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!"));
=20
bt_write_pagescan_activity(bt_cfd, 0x0800, 0x12);
=20
bt_set_event_filter(bt_cfd, filter);
=20
- syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20
+ D(syslog(LOG_INFO, "Setting baudrate in CSR module!"));
=20
sleep(1);
=20=20=20
@@ -458,7 +460,7 @@
=20
tcflush(phys_fd, TCIOFLUSH);
=20
- syslog(LOG_INFO, "Baudrate set\n");
+ D(syslog(LOG_INFO, "Baudrate set"));
}
=20
/* =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=3D=3D*/
@@ -478,7 +480,7 @@
/* Connection setup, all devices, no auto accept */
unsigned char filter[3] =3D { 0x02, 0x00, 0x01 };
=20
- syslog(LOG_INFO, "Setting baudrate in Digianswer PC card\n");
+ D(syslog(LOG_INFO, "Setting baudrate in Digianswer PC card"));
=20
bt_set_baudrate(bt_cfd, spd);
=20=20=20
@@ -521,7 +523,7 @@
=20
sleep(1); // wait for HW...
=20
- syslog(LOG_INFO, "Setting baudrate in Ericsson module!\n");=20=20
+ D(syslog(LOG_INFO, "Setting baudrate in Ericsson module!"));
bt_set_baudrate(bt_cfd, spd);
usleep(10000);
=20
@@ -545,11 +547,11 @@
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
=20=20=20
sleep(1);
- syslog(LOG_INFO, "Setting write_scan_enable in Infineon module!\n");
+ D(syslog(LOG_INFO, "Setting write_scan_enable in Infineon module!"));
bt_write_scan_enable(bt_cfd, wrscan);
=20
sleep(1); // wait for HW...=20
- syslog(LOG_INFO, "Setting baudrate in Infineon module!\n");=20=20
+ D(syslog(LOG_INFO, "Setting baudrate in Infineon module!"));
bt_set_baudrate(bt_cfd, spd);
=20=20=20
/* Now set phys device speed to whatever HW was set to use */
@@ -574,12 +576,12 @@
unsigned char filter[3] =3D { 0x02, 0x00, 0x01 };
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
=20
- syslog(LOG_INFO, "Setting write_scan_enable in USB module!\n");
+ D(syslog(LOG_INFO, "Setting write_scan_enable in USB module!"));
=20
bt_write_scan_enable(bt_cfd, wrscan);
=20=20=20
/* improves reliability when doing a connect */
- syslog(LOG_INFO, "Setting write_pagescan_activity in USB module!\n");
+ D(syslog(LOG_INFO, "Setting write_pagescan_activity in USB module!"));
=20
bt_write_pagescan_activity(bt_cfd, 0x0800, 0x12);
=20
@@ -605,7 +607,7 @@
unsigned char filter[3] =3D { 0x02, 0x00, 0x01 };
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
=20
- syslog(LOG_INFO, "Setting write_scan_enable in generic module!\n");
+ D(syslog(LOG_INFO, "Setting write_scan_enable in generic module!"));
=20=20=20
bt_write_scan_enable(bt_cfd, wrscan);
bt_set_event_filter(bt_cfd, filter);
--- btd.c 2001/06/06 15:05:40 1.18
+++ btd.c 2001/06/08 09:55:47 1.19
@@ -50,10 +50,6 @@
=20=09=20=20=20=20=20
options:=20
=20
- -i, --hwinit=20
-=09
- default: ttyS0
-=20=20
-u, --physdev <uart device>
Sets which uart device that will be used by the stack
default: ttyS0
@@ -63,7 +59,7 @@
Can also be done from command line mode.=20
default: on
=20=20=20
- -n, --local-name
+ -n, --local-name <prefix>
prefix used for the local bluetooth device name
default: nothing
=20=20=20
@@ -71,6 +67,10 @@
reset bluetooth hardware before use
default: no reset
=20=20=20
+ -i, --initial-speed <speed>
+ sets initial uart speed
+ default: 115200 baud
+
-s, --speed <speed>
sets uart speed
9600, 19200, 38400, 57600, 115200, 230400, 460800
@@ -85,6 +85,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <syslog.h>
@@ -184,11 +185,12 @@
/* long option list */
static struct option long_options[] =3D
{
+ {"initial-speed", 1, NULL, 'i'}, /* initial uart speed */
{"physdev", 1, NULL, 'u'}, /* phys device used from stac=
k */
- {"speed", 1, NULL, 's'}, /* uart speed towards hw */
+ {"modem-emul", 1, NULL, 'm'},
{"local-name", 1, NULL, 'n'}, /* set local bluetooth name =
*/
{"reset", 1, NULL, 'R'}, /* reset BT HW */
- {"modem-emul", 1, NULL, 'm'},
+ {"speed", 1, NULL, 's'}, /* uart speed towards hw */
{0, 0, 0, 0}
};
=20
@@ -212,7 +214,7 @@
int result, opt;
int bt_disc =3D N_BT;
=20=20=20
- syslog(LOG_INFO, "Bluetooth daemon starting\n");
+ syslog(LOG_INFO, "Bluetooth daemon starting");
=20=20=20
if (atexit(btd_cleanup) < 0)
{
@@ -229,7 +231,7 @@
case 'i':
/* uart device */
init_hw_speed =3D atoi(optarg);
- syslog(LOG_INFO, "init_hw_speed %d baud\n", init_hw_speed);
+ D(syslog(LOG_INFO, "init_hw_speed %d baud", init_hw_speed));
break;
=20
case 'm':
@@ -238,28 +240,29 @@
break;
=20=20=20=20=20=20=20
case 'n':
- syslog(LOG_INFO, "setting local name to %s\n", optarg);
+ D(syslog(LOG_INFO, "setting local name to %s", optarg));
strncpy(local_name, optarg, LOCAL_NAME_LENGTH);
local_name[LOCAL_NAME_LENGTH] =3D '\0';
break;
=20=20=20=20=20=20=20
case 'R':
/* try to reset the hardware */
- syslog(LOG_INFO, "reset HW\n");
+ D(syslog(LOG_INFO, "reset HW"));
do_reset =3D 1;
break;
=20=20=20=20=20=20=20
case 's':
/* speed */
- syslog(LOG_INFO, "phys dev running at %s\n", optarg);
+ D(syslog(LOG_INFO, "phys dev running at %s", optarg));
speedstr =3D optarg;
break;
=20=20=20=20=20=20=20
case 'u':
/* uart device */
- syslog(LOG_INFO, "phys dev : %s\n", optarg);
+ D(syslog(LOG_INFO, "phys dev: %s", optarg));
physdev =3D optarg;
break;
+
default:
break;
}
@@ -268,7 +271,7 @@
/* Set restart point */
if (sigsetjmp(jmpbuffer, 1) !=3D 0)
{
- syslog(LOG_INFO, "restart...\n\n\n\n");
+ syslog(LOG_INFO, "Restart...");
sleep(1);
}=20=20=20=20
=20=20=20
@@ -276,14 +279,13 @@
=20
if ((phys_fd =3D open(physdev, O_RDWR | O_NOCTTY)) < 0)
{
- perror("could not open phys dev\n");
+ perror("Could not open phys dev");
exit(1);
}
=20
/* Sets initial HW baudrate */
if (init_hw_speed !=3D 0)
- fd_setup(phys_fd, init_hw_speed,=20
- USE_FLOW_CTRL, hw_vendor() =3D=3D HW_CSR_BCSP);
+ fd_setup(phys_fd, init_hw_speed, USE_FLOW_CTRL, hw_vendor() =3D=3D HW_=
CSR_BCSP);
else
init_phys(phys_fd);
=20=20
@@ -332,7 +334,7 @@
if ((STATE(i) =3D=3D WAITING_PPPCONF) ||
(STATE(i) =3D=3D WAITING_RETURN_PPPCONF))
{
- D(syslog(LOG_INFO, "Waiting for IPA response\n"));
+ D(syslog(LOG_INFO, "Waiting for IPA response"));
waiting_iparsp =3D 1;
}
i++;
@@ -390,13 +392,13 @@
{
int line;
=20
- D(syslog(LOG_INFO, "discover_connections"));
+ D(syslog(LOG_INFO, __FUNCTION__));
for (line =3D 0; line < BT_NBR_DATAPORTS; line++)
{
if ((STATE(line) =3D=3D NOCONNECTION) &&=20
bt_isconnected(bt_cfd, line))
{
- syslog(LOG_INFO, "Found connection on line : %d !\n", line);
+ syslog(LOG_INFO, "Found connection on line: %d", line);
STATE(line) =3D CONNECTED;
=20=20=20=20=20=20=20
read_remote_bd(bt_cfd, PEER(line).remote_bd);
@@ -404,7 +406,7 @@
=20=20=20=20=20=20=20
if (ipa_available)
{=20=20
- D(syslog(LOG_INFO, "Sending IPA request\n"));
+ D(syslog(LOG_INFO, "Sending IPA request"));
=20=20=20=20=20=20=20=20=20
PEER(line).ipset =3D &IPSET(line);
=20=20=20=20=20=20=20=20=20
@@ -442,7 +444,7 @@
if (ipa_available)
show_ipset(ipset, line);
=20=20=20
- D(syslog(LOG_INFO, "build_pppdopts\n"));
+ D(syslog(LOG_INFO, __FUNCTION__));
=20=20=20
sprintf(dev, "/dev/ttyBT%d",line);
=20
@@ -579,7 +581,7 @@
options.ttyBT1 which contains the remote IP address,=20
dns, wins etc*/
=20=20=20=20=20
- syslog(LOG_INFO, "WARNING No remote ip addr set, only local %s",=20
+ syslog(LOG_INFO, "WARNING: No remote ip addr set, only local %s",=20
ip_addresses);
=20
opts[i++] =3D ip_addresses;
@@ -613,7 +615,7 @@
/* check state */
if (STATE(line) !=3D PPPCONF_DONE)
{
- syslog(LOG_INFO, "Warning : ppp config not done (%d)\n", STATE(line));
+ syslog(LOG_INFO, "Warning: PPP config not done (%d)", STATE(line));
return -1;
}
=20=20=20
@@ -624,8 +626,6 @@
/* run modem emulator in a child */
if (!(PEER(line).pppd_pid =3D vfork()))
{
- syslog(LOG_INFO, "Starting modem emulator on %s", dev);=20
-=20=20=20=20=20=20
/* replace first arg with MODEMEMULCMD (is handled by=20
modem emulator) */
=20=20=20=20=20=20=20
@@ -648,8 +648,6 @@
STATE(line) =3D PPPD_STARTED;
if (!(PEER(line).pppd_pid =3D vfork()))
{
- syslog(LOG_INFO, "Starting pppd on %s", dev);
-=20=20=20=20=20=20
/* FIXME -- use opts inparam and not static opts */
execvp(PPPDCMD, opts);
=20=20=20=20=20=20=20
@@ -674,20 +672,20 @@
{
struct sigaction act;
=20=20=20
- syslog(LOG_INFO, "Initiating signal handler\n");
+ D(syslog(LOG_INFO, "Initiating signal handler"));
act.sa_handler =3D sighandler;
sigemptyset(&act.sa_mask);
act.sa_flags =3D 0;
sigaction(SIGCHLD, &act, 0); /* Catches when pppd childs are done */
sigaction(SIGUSR1, &act, 0); /* Restart application */
sigaction(SIGUSR2, &act, 0); /* HW Upgrade ? */
- sigaction(SIGTERM, &act, 0); /* Received when kill cmd is used */
+ sigaction(SIGTERM, &act, 0); /* Terminate application */
}
=20
static void
sighandler(int sig)
{
- syslog(LOG_INFO, "Sighandler got signal : %d\n", sig);
+ D(syslog(LOG_INFO, "Sighandler got signal: %d", sig));
=20=20=20
if (sig =3D=3D SIGUSR1)
{
@@ -703,30 +701,31 @@
/* FIXME -- execvp(hw_upgrade_prog) */
// siglongjmp(jmpbuffer, 1);
}
- else if (sig =3D=3D SIGTERM) /* ? */
+ else if (sig =3D=3D SIGTERM)
{=20
- syslog(LOG_INFO, "Got SIGTERM, now exiting");
+ D(syslog(LOG_INFO, "Got SIGTERM, now exiting"));
exit(0);
}
else if (sig =3D=3D SIGCHLD)=20=20
{
int line =3D 0, pid, status;
- syslog(LOG_INFO, "One of the childs terminated\n");
+
+ D(syslog(LOG_INFO, "One of the childs terminated"));
/* Find pid for this child */
=20=20=20=20=20
if ((pid =3D waitpid(-1, &status, WNOHANG)) <=3D 0)
return;
=20=20=20=20=20
- syslog(LOG_INFO, "pid %d terminated with status %d\n", pid, status);
+ D(syslog(LOG_INFO, "pid %d terminated with status %d", pid, status));
=20=20=20=20=20
/* find corresponding line */
while (line < BT_NBR_DATAPORTS)
{=20=20=20=20=20
- syslog(LOG_INFO, "line %d pid : %d\n", line, PEER(line).pppd_pid);
+ D(syslog(LOG_INFO, "line %d pid: %d", line, PEER(line).pppd_pid));
=20=20=20=20=20=20=20
if (PEER(line).pppd_pid =3D=3D pid)
{
- syslog(LOG_INFO, "line %d found\n", line);
+ D(syslog(LOG_INFO, "line %d found", line));
break;
}
line++;
@@ -734,11 +733,11 @@
=20=20=20=20=20
if (line =3D=3D BT_NBR_DATAPORTS)
{
- syslog(LOG_INFO, "Not a pppd pid\n");
+ D(syslog(LOG_INFO, "Not a pppd pid"));
return;
}
=20=20=20=20=20
- syslog(LOG_INFO, "PPP line %d was shutdown\n", line);
+ D(syslog(LOG_INFO, "PPP line %d was shutdown", line));
=20=20=20=20=20
if (ipa_available)=20
{=20
@@ -800,7 +799,7 @@
ipa_fd =3D open_socket(IPASERVER, CLIENT);
if (ipa_fd < 0)
{
- syslog(LOG_INFO, "Found no IPA server");
+ D(syslog(LOG_INFO, "Found no IPA server"));
=20
if (i > 8)
{=20=20
@@ -808,35 +807,34 @@
}
else
{
- syslog(LOG_INFO, "Retrying in %d sec", i);
+ D(syslog(LOG_INFO, "Retrying in %d sec", i));
sleep(i);
i *=3D 2;
}=20=20=20=20=20=20
}
else=20
{=20=20=20=20=20=20
- syslog(LOG_INFO, "Found IPA server");
+ D(syslog(LOG_INFO, "Found IPA server"));
ipa_available =3D 1;
}
}=20
#endif
=20
if (modem_emul =3D=3D 1)
- syslog(LOG_INFO, "Using modem emulation");
+ D(syslog(LOG_INFO, "Using modem emulation"));
else
- syslog(LOG_INFO, "Using NO modem emulation");
+ D(syslog(LOG_INFO, "Using NO modem emulation"));
}
=20
static void
btd_cleanup(void)
{
- syslog(LOG_INFO, "btd_cleanup\n");
+ D(syslog(LOG_INFO, __FUNCTION__));
btd_killchilds();
=20=20=20
- printf("shutdown_stack\n");
+ printf("Shutting down Bluetooth stack\n");
shutdown_stack(bt_cfd);
-=20=20
- printf("shutdown_stack done\n");
+ printf("Bluetooth stack shut down\n");
=20=20=20
if (bt_cfd !=3D -1)
{
@@ -854,7 +852,7 @@
=20
if (ipa_fd !=3D -1)
{
- syslog(LOG_INFO, "closing IPA");
+ D(syslog(LOG_INFO, "Closing connection to IPA"));
tcflush(ipa_fd, TCIOFLUSH);
close(ipa_fd);
ipa_fd =3D -1;
@@ -871,10 +869,10 @@
btd_killchilds(void)
{
int line;
- printf("btd_killchilds\n");
+
if (sdpsrv_pid > 0)
{
- syslog(LOG_INFO, "Killing SDP server\n");
+ D(syslog(LOG_INFO, "Killing SDP server"));
kill(sdpsrv_pid, SIGTERM);
=20=20=20=20=20
if (waitpid(sdpsrv_pid, NULL, 0) < 0)
@@ -888,7 +886,7 @@
{
if (STATE(line) =3D=3D PPPD_STARTED)
{
- syslog(LOG_INFO, "Killing pppd on line %d\n", line);
+ D(syslog(LOG_INFO, "Killing pppd on line %d", line));
kill(PEER(line).pppd_pid, SIGTERM);
if (waitpid(PEER(line).pppd_pid, NULL, 0) < 0)
perror("waitpid pppd");
@@ -906,7 +904,7 @@
struct ipa_msg *msg;
struct ipa_request *req;
=20=20=20
- D(syslog(LOG_INFO, "ipa_request : type %d\n", type));
+ D(syslog(LOG_INFO, __FUNCTION__ ": Type %d", type));
=20
msg =3D (struct ipa_msg*)buf;
msg->type =3D type;
@@ -924,25 +922,25 @@
case IPARSP_STATUS:
{
ipa_status *rsp =3D (struct ipa_status*)(msg->msg);
- D(syslog(LOG_INFO, "parse_ipa_response : got status %d on line %d\n"=
,=20
+ D(syslog(LOG_INFO, __FUNCTION__ ": Got status %d on line %d",=20
rsp->status, rsp->id));
=20
/* Check state */
if (STATE(rsp->id) !=3D WAITING_RETURN_PPPCONF)
{
- syslog(LOG_INFO, "parse_ipa_response : wrong state");
+ syslog(LOG_INFO, __FUNCTION__ ": Wrong state");
return -ERR_WRONGSTATE;
}
=20
/* Check status */
if (rsp->status =3D=3D IPA_STATUSFAILED)
{
- syslog(LOG_INFO, "parse_ipa_response : request failed [line:%d]\n"=
,=20
- rsp->id);
+ syslog(LOG_INFO, __FUNCTION__ ": Request failed [line:%d]", rsp->i=
d);
return -IPA_STATUSFAILED;
}=20=20=20=20=20=20
else
- D(syslog(LOG_INFO, "parse_ipa_response : request succeeded [line:%d]\n", =
rsp->id));
+ D(syslog(LOG_INFO, __FUNCTION__ ": Request succeeded [line:%d]",
+ rsp->id));
=20
/* put peer into NOCONNECTION, if still connected this will=20
be discovered from timeout */
@@ -955,12 +953,12 @@
case IPARSP_PEERSETTINGS:
{
ipa_response* rsp =3D (struct ipa_response*)(msg->msg);
- D(syslog(LOG_INFO, "parse_ipa_response : got client settings\n"));
+ D(syslog(LOG_INFO, __FUNCTION__ ": Got client settings"));
=20=20=20=20=20=20=20
/* Check state */
if (STATE(rsp->id) !=3D WAITING_PPPCONF)
{
- syslog(LOG_INFO, "parse_ipa_response : wrong state");
+ syslog(LOG_INFO, __FUNCTION__ ": Wrong state");
return -ERR_WRONGSTATE;
}
=20
@@ -968,7 +966,7 @@
if (rsp->status =3D=3D IPA_STATUSFAILED)
{
/* error */
- printf("parse_ipa_response : failed to get client settings\n");
+ syslog(LOG_INFO, __FUNCTION__ ": Failed to get client settings\n");
return -ERR_REQUESTFAILED;
}
=20
@@ -984,7 +982,7 @@
}
=20=20=20=20=20
default :
- syslog(LOG_INFO, "Error : Unknown message type");
+ syslog(LOG_INFO, __FUNCTION__ ": Unknown message type");
break;
}
return 0;
--- modememul.c 2001/06/06 15:06:00 1.8
+++ modememul.c 2001/06/08 09:55:47 1.9
@@ -83,10 +83,10 @@
void
sighandler(int sig)
{
- syslog(LOG_INFO, "got signal %d", sig);
+ D(syslog(LOG_INFO, "Got signal %d", sig));
if ((sig =3D=3D SIGQUIT) || (sig =3D=3D SIGTERM || (sig =3D=3D SIGHUP)))
{
- syslog(LOG_INFO, "Modem emulator exiting\n");
+ D(syslog(LOG_INFO, "Modem emulator exiting"));
exit(0);
}
}
@@ -96,13 +96,13 @@
{
struct sigaction act;
=20
- syslog(LOG_INFO, "Initiating signal handler\n");
+ D(syslog(LOG_INFO, "Initiating signal handler"));
act.sa_handler =3D sighandler;
sigemptyset(&act.sa_mask);
act.sa_flags =3D 0;
sigaction(SIGHUP, &act, 0);
sigaction(SIGQUIT, &act, 0);
- sigaction(SIGTERM, &act, 0); /* Received when kill cmd is used */
+ sigaction(SIGTERM, &act, 0);
}
=20
int
@@ -119,7 +119,7 @@
=20
while (done !=3D START_PPP)
{
- syslog(LOG_INFO, "Starting modem emulator on %s\n", argv[1]);
+ syslog(LOG_INFO, "Starting modem emulator on %s", argv[1]);
=20
if ((btfd =3D open(argv[1], O_RDWR, 0)) < 0)
{
@@ -131,7 +131,7 @@
fd_setup(btfd, speed, USE_NO_FLOW, DONT_USE_BCSP);
done =3D modem_emulator(btfd);
close(btfd);
- syslog(LOG_INFO, "Closing %s", argv[1], speed);=20=20
+ D(syslog(LOG_INFO, "Closing %s", argv[1]));
}
=20
/* replace first arg with pppd instead of modem emulator=20
@@ -154,7 +154,7 @@
int done =3D 0, i;
fd_set rfd;
=20
- syslog(LOG_INFO, "Modem emulator starting\n");
+ D(syslog(LOG_INFO, "Modem emulator starting"));
=20
while (!done)
{=20=20
@@ -167,7 +167,7 @@
int len =3D read(bt_fd, &data, 128);=20=20=20=20=20=20
data[len] =3D 0;
=20=20=20=20=20=20=20
- syslog(LOG_INFO, "Modem emulator got %d bytes\n", len);
+ D(syslog(LOG_INFO, "Modem emulator got %d bytes", len));
=20=20=20=20=20=20=20
if (len <=3D 0)
return RESTART;=20=20=20=20=20=20
@@ -186,7 +186,7 @@
/* check for escaped chars */=20=20=20=20=20=20=20=20=20=20=20=
=20
if (data[i+2] =3D=3D PPP_CONTROL_ESCAPE)=20
{=20
- D(syslog(LOG_INFO, "Found ctrl esc\n"));
+ D(syslog(LOG_INFO, "Found ctrl esc"));
prot =3D ((data[i+4]<<8) | (data[i+5]));
}
else
@@ -231,16 +231,16 @@
=20
if(!strncasecmp(data, "ATD", 3)) /* windows standard modem */
{
- syslog(LOG_INFO, "got ATD");=09
+ D(syslog(LOG_INFO, "Got ATD"));
=20
- syslog(LOG_INFO, "Write : %s", connect);
+ D(syslog(LOG_INFO, "Write: %s", connect));
write(bt_fd, connect, strlen(connect));=20=20=20
syslog(LOG_INFO, "Modem connected !");
return START_PPP;
}
else if(!strncasecmp(data, "CLIENT", 6)) /* windows null modem */
{
- syslog(LOG_INFO, "got CLIENT");
+ D(syslog(LOG_INFO, "Got CLIENT"));
write(bt_fd, client_server, strlen(client_server));=20=20=20
syslog(LOG_INFO, "Nullmodem connected !");
return START_PPP;
|