From: Peter K. <pk...@us...> - 2001-03-10 12:47:41
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Support for compiling without readline (by Matthias Fuchs). The diff of the modified file(s): --- Makefile 2001/03/02 13:14:29 1.1 +++ Makefile 2001/03/10 12:49:32 1.2 @@ -7,33 +7,38 @@ =20 PROGS =3D btdm memul bti btinq btcon btsend btdisc =20 +# Define HAVE_READLINE_READLINE if you have readline support, with the inc= lude +# files in $(include_dir)/readline. Define HAVE_READLINE if you have the +# include files in $(include_dir). Define neither if you do not want to use +# readline. +HAVE_READLINE_READLINE =3D 1 +#HAVE_READLINE =3D 1 + INSTDIR =3D $(prefix)/bin/ INSTMODE =3D 0755 INSTOWNER =3D root INSTGROUP =3D root - -SRCS =3D btd.c - -OBJS =3D btd.o - -LDLIBS +=3D -lreadline -ltermcap - -CFLAGS +=3D -I$(prefix)/include=20 =20 -BTDOBJS =3D bt_vendor.o bt_misc.o bt_if.o bttest.o bt_ipa.o btd.o - +BTDOBJS =3D btd.o bttest.o bt_ipa.o bt_vendor.o bt_if.o bt_misc.o MEMULOBJS =3D modememul.o bt_misc.o - -BTINITOBJS =3D bt_vendor.o bt_misc.o bt_if.o btinit.o - +BTINITOBJS =3D btinit.o bt_vendor.o bt_if.o bt_misc.o BTCONOBJS =3D btcon.o bt_if.o bt_misc.o - BTSENDOBJS =3D btsend.o bt_if.o bt_misc.o - BTDISCOBJS =3D btdisc.o bt_if.o - BTINQOBJS =3D btinq.o bt_if.o =20 +ifdef HAVE_READLINE_READLINE +LDLIBS +=3D -lreadline -ltermcap +CFLAGS +=3D -DHAVE_READLINE_READLINE -I$(prefix)/include +endif + +ifdef HAVE_READLINE +LDLIBS +=3D -lreadline -ltermcap +CFLAGS +=3D -DHAVE_READLINE -I$(prefix)/include +endif + +CFLAGS +=3D -MD + all: $(PROGS) =20 # 'btdm' =3D> 'multipoint btd' instead of btd to differentiate from=20 @@ -65,13 +70,6 @@ $(INSTALL) -m $(INSTMODE) -o $(INSTOWNER) -g $(INSTGROUP) $(PROGS) $(INST= DIR) =20 clean: - rm -f $(PROGS) *.o core - -depend: - makedepend -Y $(SRCS) 2>/dev/null - -# ------------------------------------------------------------------------- -# The following is used to automatically generate dependencies. -# DO NOT DELETE + rm -f $(PROGS) *.o *.d core =20 -btd.o: btd.h +-include *.d --- bttest.c 2001/03/02 10:59:57 1.1 +++ bttest.c 2001/03/10 12:49:32 1.2 @@ -63,8 +63,14 @@ #include <signal.h> #include <getopt.h> =20 +#if defined(HAVE_READLINE_READLINE) #include <readline/readline.h> #include <readline/history.h> +#elif defined(HAVE_READLINE) +#include <readline.h> +#include <history.h> +#endif + #include "btd.h" #include "bttest.h" #include "bt_if.h" @@ -124,6 +130,13 @@ NULL }; =20 +#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE) +static void read_history(char *hist_file_name); +static void write_history(char *hist_file_name); +static void add_history(char *command); +static char *readline(char *promt); +#endif=20 + void show_menu(void) { @@ -165,6 +178,13 @@ { int tmp; char *line =3D (char*) readline("> "); + + if (!line) + { + start_ppp =3D 0; + break; + } + add_history(line); =20=20=20=20=20=20=20 tmp =3D process_cmd(line, bt_cfd); @@ -183,14 +203,8 @@ } write_history(BTD_HISTORY_FILE); }=20=20 - } =20 - - - - - int process_cmd(char *buf, int bt_cfd) { @@ -565,8 +579,41 @@ return 0; } =20 +/* readline replacement - mfuchs */ +#if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE) +#define MAXLINE 100 =20 +static void read_history(char *hist_file_name) +{ +} + +static void write_history(char *hist_file_name) +{ +} + +static void add_history(char *command) +{ +} + +static char *readline(char *promt) +{ + int len; + char *line; =20 + if ((line =3D malloc(MAXLINE))) + { + printf("%s", promt); + fflush(stdout); + *line =3D 0; + if ((len =3D read(STDIN_FILENO, line, MAXLINE-1)) >=3D 0) + { + line[len] =3D 0; + } + } + + return line; +} +#endif /* !HAVE_READLINE */ =20 /* bttest.c */ /* =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 */ |
From: Mattias A. <mat...@us...> - 2001-03-21 18:35:21
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_ipa.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_ipa.h 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: fixed error in show_ipset minor changes and added some debug The diff of the modified file(s): --- bt_ipa.c 2001/03/02 10:59:57 1.1 +++ bt_ipa.c 2001/03/21 18:35:20 1.2 @@ -46,6 +46,7 @@ #include <syslog.h> #include <sys/types.h> #include <sys/stat.h> +#include <string.h> =20 /* print in_addr */ #include <sys/socket.h> @@ -81,7 +82,9 @@ /* Sends msg to IPA socket */ int ipa_write(int ipa_fd, ipa_msg *msg) { - syslog(LOG_INFO, "ipa_send : sending ipa request (type : %d)\n", msg->ty= pe); + syslog(LOG_INFO, "ipa_send : sending ipa request (type : %d) len %d \n", + msg->type, msg->len); +=20=20 return write(ipa_fd, msg, msg->len + sizeof(struct ipa_msg)); } =20 @@ -99,6 +102,8 @@ { c =3D read(ipa_fd, &ipa_buf+offset, 256-offset);=20=20 =20 + syslog(LOG_INFO, "ipa_receive : got %d bytes", c);=20=20 + if (c < 0) return c; =20 @@ -117,25 +122,36 @@ =20=20=20 memcpy(msg, ipa_buf, offset); =20 + syslog(LOG_INFO, "Got %d bytes", offset); + return msg_len;=20=20 } =20 void show_ipset(struct ip_set* set, int line) { - printf("IP set [line:%d]\n", line); - printf(" ip : %s\n", inet_ntoa(set->ip)); + syslog(LOG_INFO, "IP set [line:%d]\n", line); + + if (set) + {=20=20=20=20 + syslog(LOG_INFO, " ip : %s\n", inet_ntoa(set->ip)); + if (set->nbr_of_dns >=3D 1) - printf(" dns1 : %s\n", inet_ntoa(set->dns[1])); + syslog(LOG_INFO, " dns1 : %s\n", inet_ntoa(set->dns[0])); + if (set->nbr_of_dns =3D=3D 2) - printf(" dns2 : %s\n", inet_ntoa(set->dns[2])); + syslog(LOG_INFO, " dns2 : %s\n", inet_ntoa(set->dns[1])); + if (set->nbr_of_wins >=3D 1) - printf(" wins 1 : %s\n", inet_ntoa(set->wins[1])); - if (set->nbr_of_dns =3D=3D 2) - printf(" wins2 : %s\n", inet_ntoa(set->wins[2])); - printf(" netmask : %s\n", inet_ntoa(set->netmask)); - printf("useradius : %d\n", set->useradius); - printf("useradiusip : %d\n", set->useradiusip); - printf("usingmasq : %d\n", set->usingmasq); + syslog(LOG_INFO, " wins 1 : %s\n", inet_ntoa(set->wins[0])); + + if (set->nbr_of_wins =3D=3D 2) + syslog(LOG_INFO, " wins2 : %s\n", inet_ntoa(set->wins[1])); + + syslog(LOG_INFO, " netmask : %s\n", inet_ntoa(set->netmask)); + syslog(LOG_INFO, "useradius : %d\n", set->useradius); + syslog(LOG_INFO, "useradiusip : %d\n", set->useradiusip); + syslog(LOG_INFO, "usingmasq : %d\n", set->usingmasq); + } } =20 #endif /* USE_IPASSIGN */ --- bt_ipa.h 2001/03/02 10:59:57 1.1 +++ bt_ipa.h 2001/03/21 18:35:20 1.2 @@ -63,8 +63,8 @@ #define IPARSP_PEERSETTINGS 11 =20 /* Status codes */ -#define IPA_STATUSFAILED 0 -#define IPA_STATUSSUCCESS 1 +#define IPA_STATUSSUCCESS 0 +#define IPA_STATUSFAILED 1 =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=3D*/ /* IPA Client struct */ |
From: Mattias A. <mat...@us...> - 2001-03-26 15:33:14
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added bt_ping (sends l2cap echo requests) The diff of the modified file(s): --- bt_if.c 2001/03/21 17:26:44 1.3 +++ bt_if.c 2001/03/26 15:33:13 1.4 @@ -62,7 +62,6 @@ #include "bt_misc.h" #include "bt_conf.h" =20 - int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len) { unsigned char buf[261]; @@ -76,7 +75,7 @@ #ifndef BT_USERSTACK=20 if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) { - perror("ecs_testctrl"); + perror("bt_send_raw_hci"); } #else printf("not yet for usermode stack...\n"); @@ -85,6 +84,35 @@ return 0; } =20 +int bt_ping(int bt_cfd, unsigned char bd[6],=20 + unsigned char *data, unsigned short len) +{ + unsigned char buf[264]; + int ret_val; +=20=20 + printf("bt_ping\n"); + + memcpy(buf, bd, 6); + buf[6] =3D len>>8; + buf[7] =3D len&0xff; + memcpy(buf, data, len); + +#ifndef BT_USERSTACK=20 + if ((ret_val =3D ioctl(bt_cfd, BTPING, buf)) < 0) + { + printf("Error : %s\n", error_msg(ret_val)); + } + else + printf("Success!\n"); + +#else + printf("not yet for usermode stack...\n"); +#endif + return 0;=20=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 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 */ @@ -382,14 +410,14 @@ { int result; =20=20=20 - printf("bt_waitnewconnections\n"); + syslog(LOG_INFO, "bt_waitnewconnections\n"); #ifndef BT_USERSTACK if ((result =3D ioctl(bt_fd, BTWAITNEWCONNECTIONS)) < 0) { perror("bt_waitnewconnections"); exit(1); } - printf("bt_waitnewconnections : got a connection !\n"); + printf("bt_waitnewconnections : found a connection !\n"); return; #else /* fixme<1>*/ --- bt_if.h 2001/03/21 17:29:55 1.2 +++ bt_if.h 2001/03/26 15:33:13 1.3 @@ -191,6 +191,9 @@ /* | len 1 byte | 4 bytes hci header | data (max 256) | */ #define HCISENDRAWDATA _IOW(BT_IOC_MAGIC, 0x72, unsigned char[261]) =20 +/* | BD(6) | len(2) | data(max 256) |*/ +#define BTPING _IOW(BT_IOC_MAGIC, 0x73, unsigned char[264]) + /* Used to calculate opcode for HCI commands using raw interface */ #define OPCODE_MSB(ocf, ogf) ((ocf) & 0xff) #define OPCODE_LSB(ocf, ogf) (((ocf) >> 8) | (((ogf) & 0x3f) << 2)) @@ -263,6 +266,9 @@ */ =20 int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len); +int bt_ping(int bt_cfd, unsigned char bd[6],=20 + unsigned char *data, unsigned short len); + void bt_inquiry(int bt_cfd, int nbr_rsp, int t); int bt_set_baudrate(int bt_cfd, int spd); void bt_set_bd_addr(int bt_cfd, unsigned char *bd); |
From: Peter K. <pk...@us...> - 2001-04-20 15:29:22
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.9 1.10=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added BTHWVENDOR ioctl and bt_hw_vendor() to retrieve the harware vendor. * Some clean-up. The diff of the modified file(s): --- bt_if.c 2001/04/18 14:01:34 1.9 +++ bt_if.c 2001/04/20 15:29:21 1.10 @@ -78,7 +78,7 @@ =20=20=20 if (ioctl(bt_cfd, BTINITSTACK)<0) { - perror("Init stack"); + perror(__FUNCTION__); exit(1); } #endif @@ -100,9 +100,9 @@ int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY); int stack_initiated =3D -1; =20 - if (ioctl(bt_cfd, BTISINITIATED, &stack_initiated) < 0) + if (bt_cfd < 0 || ioctl(bt_cfd, BTISINITIATED, &stack_initiated) < 0) { - perror("bt_isinitiated"); + perror(__FUNCTION__); exit(1); } close(bt_cfd); @@ -131,6 +131,22 @@ #endif } =20 +#ifndef BT_USERSTACK +char* bt_hw_vendor(void) +{ + int bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY); + static char buffer[20]; + + if (bt_cfd < 0 || ioctl(bt_cfd, BTHWVENDOR, buffer) < 0) + { + perror(__FUNCTION__); + return NULL; + } + close(bt_cfd); + return buffer; +} +#endif + void reset_hw(void) { #ifdef __CRIS__ @@ -141,7 +157,7 @@ { if (ioctl(devfd, BTRESETPHYSICALHW) < 0) { - perror("Resetting hardware"); + perror(__FUNCTION__); exit(1); } sleep(2); @@ -152,7 +168,7 @@ } else { - printf("ERROR! Failed to open " BT_CTRL_TTY "\n"); + fprintf(stderr, "ERROR! Failed to open " BT_CTRL_TTY "\n"); } #else printf("Please reset HW board within 5 seconds\n"); @@ -165,12 +181,12 @@ int bt_cfd; printf("Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY); #ifdef BT_USERSTACK - printf("bt_openctrl : ignored in userstack\n"); + printf(__FUNCTION__ ": ignored in userstack\n"); return FD_BTUSERCTRL; #else=20 if ((bt_cfd =3D open(BT_CTRL_TTY, O_RDWR | O_NOCTTY)) < 0) { - printf("could not open %s\n", BT_CTRL_TTY); + fprintf(stderr, "could not open %s\n", BT_CTRL_TTY); exit(1); } #endif @@ -209,7 +225,8 @@ srv_ch =3D GET_RFCOMMSRVCH(con_id); line =3D GET_RFCOMMLINE(con_id); =20=20 - if (line !=3D 0) { + if (line !=3D 0) + { printf("Use line 0 instead ! (usermode only)\n"); return -1; } @@ -238,7 +255,8 @@ CHECK_RFCOMM(con_id); line =3D GET_RFCOMMLINE(con_id); =20=20=20 - if (line !=3D 0) { + if (line !=3D 0) + { printf("Use line 0 instead ! (usermode only)\n"); return -1; } @@ -256,11 +274,11 @@ #ifndef BT_USERSTACK if ((ret =3D ioctl(bt_fd, BTISLOWERCONNECTED, &line)) < 0) { - perror("bt_isconnected"); + perror(__FUNCTION__); exit(1); } #else - printf("bt_isconnected NOT IMPL FOR USERMODE STACK !!\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); ret =3D -1; #endif return ret; @@ -274,10 +292,10 @@ =20 len =3D bt_read_internal(tmp); tmp[len] =3D 0; - printf("%s", tmp); + printf(tmp); #else /*FIXME -- read /proc/bt_internal and print it on the console */ - printf("not yet...\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif=20 } =20 @@ -299,7 +317,7 @@ len =3D MAXSIZE; } =20=20=20 - printf("bt_send %d X %d bytes [%d k]\n", len, repeat, len*repeat/1000);= =20 + printf(__FUNCTION__ ": %d X %d bytes [%d k]\n", len, repeat, len*repeat/= 1000);=20 =20=20=20 /* fill them with letters... */ for (j =3D 0; j < len; j++) @@ -348,32 +366,30 @@ #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0) { - perror("bt_waitline"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitline : got a connection !\n"); + printf(__FUNCTION__ ": got a connection !\n"); #else /* fixme<1> */ - printf("bt_waitline : not impl in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20 void bt_waitnewconnections(int bt_fd) { - syslog(LOG_INFO, "bt_waitnewconnections\n"); + printf("Wait for a new connection\n"); #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITNEWCONNECTIONS) < 0) { - perror("bt_waitnewconnections"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitnewconnections : found a connection !\n"); - return; + printf(__FUNCTION__ ": found a connection !\n"); #else /* fixme<1>*/ - printf("bt_waitnewconnections : not impl in usermode stack\n"); - return; + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20=20 @@ -384,13 +400,13 @@ #ifndef BT_USERSTACK if (ioctl(bt_fd, BTWAITFORCONNECTION, &line) < 0) { - perror("bt_waitconnection"); + perror(__FUNCTION__); exit(1); } - printf("bt_waitconnection : got a connection !\n"); + printf(__FUNCTION__ ": got a connection !\n"); #else /* fixme<1>*/ - printf("bt_waitconnection : not impl in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif } =20 @@ -407,10 +423,10 @@ #ifndef BT_USERSTACK=20 if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) { - perror("bt_send_raw_hci"); + perror(__FUNCTION__); } #else - printf("not yet for usermode stack...\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); //hci_send_raw_data(data, 16); #endif return 0; @@ -422,7 +438,7 @@ int ret_val; struct ping_struct ping; =20=20=20 - print_data("bt_ping BD : ", bd, 6); + print_data(__FUNCTION__ " BD : ", bd, 6); memcpy(ping.bd, bd, 6); ping.len =3D len;=20=20 memcpy(ping.data, data, len); @@ -465,9 +481,9 @@ =20 int bt_testcmd(int bt_cfd, unsigned char *cmd) { - int ret_val; + int ret_val =3D 0; =20=20=20 - printf("bt_testcmd\n"); + printf(__FUNCTION__ "\n"); print_data("cmd ", cmd, strlen(cmd)); =20 #ifndef BT_USERSTACK=20 @@ -478,7 +494,7 @@ else printf("Success!\n"); #else - printf("bt_testcmd mpt for usermode stack yet\n"); + fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); #endif return ret_val; } @@ -487,11 +503,11 @@ { int ret_val; =20 - syslog(LOG_INFO, "bt_force_msswitch_as_server: %d\n", enable); + syslog(LOG_INFO, __FUNCTION__ ": %d", enable); #ifndef BT_USERSTACK=20 if ((ret_val =3D ioctl(bt_cfd, BTSETMSSWITCH, &enable)) !=3D 0) { - printf("Error : %s\n", error_msg(ret_val)); + fprintf(stderr, __FUNCTION__ ": %s\n", error_msg(ret_val)); } #else hci_force_msswitch(enable); @@ -499,7 +515,6 @@ return ret_val; } =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 */ /* HCI functions */ =20 @@ -527,7 +542,7 @@ =20 if (ioctl(bt_cfd, HCIINQUIRY, inq_res) < 0) { - perror("Inquiry"); + perror(__FUNCTION__); exit(1); } =20 @@ -551,7 +566,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIWRITEBDADDR, bd) < 0) { - perror("Set bd addr"); + perror(__FUNCTION__); } #else hci_set_bd_addr(bd); @@ -566,7 +581,7 @@ { int result; =20 - syslog(LOG_INFO, "bt_set_baudrate %d baud", spd); + syslog(LOG_INFO, __FUNCTION__ ": %d baud", spd); #ifdef BT_USERSTACK tcflush(phys_fd, TCIOFLUSH); result =3D hci_set_baudrate(spd); @@ -574,7 +589,7 @@ #else if ((result =3D ioctl(bt_cfd, HCISETBAUDRATE, &spd)) < 0) { - perror("HCISETBAUDRATE"); + perror(__FUNCTION__); exit(1); } #endif @@ -587,7 +602,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIREADLOCALBDADDR, bd_addr) < 0) { - perror("Read bd addr"); + perror(__FUNCTION__); } #else int i; @@ -610,7 +625,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCIENABLEDUT) < 0) { - perror("enable_dut"); + perror(__FUNCTION__); } #else hci_enable_dut(); @@ -626,7 +641,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, BTREADREMOTEBDADDR, bd_addr) < 0) { - perror("Read client bd addr"); + perror(__FUNCTION__); } #else BD_ADDR rev_bd; @@ -647,7 +662,7 @@ unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); int result; =20=20=20 - syslog(LOG_INFO, "Setting write_scan_enable [0x%x]\n", wrscan); + syslog(LOG_INFO, "Setting write_scan_enable [0x%x]", wrscan); =20 #ifdef BT_USERSTACK result =3D hci_write_scan_enable(wrscan); @@ -655,7 +670,7 @@ =20 if ((result =3D ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan)) < 0) {=20 - perror("bt_set_writescanenable"); + perror(__FUNCTION__); exit(1); } #endif=09 @@ -667,10 +682,9 @@ unsigned int wind) { /* improves reliability when doing a connect */ - syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!\n"); + syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!"); =20 #ifdef BT_USERSTACK - hci_write_pagescan_activity(interval, wind); #else { @@ -681,7 +695,7 @@ =20 if (ioctl(bt_cfd, HCIWRITEPAGESCANACTIVITY, &tmp) < 0) {=20 - perror("bt_write_pagescan_activity"); + perror(__FUNCTION__); exit(1); } } @@ -707,7 +721,7 @@ =20 if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, &evfilter)) < 0) {=20 - perror("HCISET_EVENT_FILTER"); + perror(__FUNCTION__); exit(1); } #endif @@ -732,7 +746,7 @@ #ifndef BT_USERSTACK=20 if (ioctl(bt_cfd, HCIWRITECLASSOFDEVICE, class_of_device) < 0) { - perror("bt_set_classofdevice"); + perror(__FUNCTION__); exit(1); } #else @@ -741,16 +755,15 @@ break; =20 case 1: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n",= =20 - format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; =20 case 2: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; =20 default: - syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); + syslog(LOG_INFO, __FUNCTION__ ": Unsupported format 0x%02x\n", format); break; } } @@ -775,7 +788,7 @@ #ifndef BT_USERSTACK if (ioctl(bt_cfd, HCISWITCHROLE, tmp) < 0) { - perror("role_switch"); + perror(__FUNCTION__); } #else hci_switch_role(bd_addr, role); @@ -788,14 +801,14 @@ #ifndef BT_USERSTACK if (ioctl(phys_fd, TIOCSETD, &bt_disc) < 0) { - perror("Set bt line disc"); + perror(__FUNCTION__); syslog(LOG_INFO, "Forgot to insmod bt.o ? [bt_disc %d]\n", bt_disc); exit(1); } syslog(LOG_INFO, "Registered bluetooth line discipline on %s\n", physdev= ); printf("Registered bluetooth line discipline on %s\n", physdev); #else - printf("set_bt_line_disc, ignored in usermode stack\n"); + fprintf(stderr, __FUNCTION__ ": ignored in usermode stack\n"); #endif } =20 @@ -847,7 +860,7 @@ #ifndef BT_USERSTACK=20=20 if (ioctl(bt_cfd, HCISETLOCALNAME, buf) < 0) { - perror("HCI set local name");=20 + perror(__FUNCTION__); exit(1); } #else @@ -992,7 +1005,7 @@ syslog(LOG_INFO, "Opening dev %s\n", dev); if ((fd =3D open(dev, flags | O_NOCTTY)) < 0) { - perror("open_device"); + perror(__FUNCTION__); exit(1); } =20=20=20 @@ -1002,7 +1015,7 @@ =20 void close_device(int fd) { - syslog(LOG_INFO, "close_device"); + syslog(LOG_INFO, __FUNCTION__); =20=20=20 #ifdef BT_USERSTACK /* if fake fd is used, ignore close since there are no open fd */ @@ -1071,7 +1084,7 @@ { printf("Initiating read thread\n"); if (pthread_create(&read_thread, NULL, (void*)hci_receive_thread, NULL) = !=3D 0) - perror("pthread_create");=20=20=20=20 + perror(__FUNCTION__); sleep(1); /* wait for thread to start */ return 0; } @@ -1105,7 +1118,7 @@ void init_upper_pty(void) { - printf("init_upper_pty"); + printf(__FUNCTION__); // open_pty(); // init_pty_thread();=20=20 } @@ -1208,8 +1221,7 @@ =20=20=20 if ((n =3D write(pty_master_fd, data, len)) !=3D len) { - BT_DATA("bt_receive_top: tried to write %d bytes, wrote %d\n", - len, n); + BT_DATA(__FUNCTION__ ": tried to write %d bytes, wrote %d\n", len, n); } #endif =20 @@ -1222,10 +1234,10 @@ bt_connect_ind(unsigned int con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - printf("bt_connect_ind : RFCOMM dlci : %d\n",=20 + printf(__FUNCTION__ ": RFCOMM dlci : %d\n",=20 GET_RFCOMMDLCI(con_id)); else - printf("bt_connect_ind : psm %d\n", GET_PSM(con_id)); + printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id)); } =20 void @@ -1242,29 +1254,29 @@ =20 if ((line < 0) || (line > BT_NBR_DATAPORTS)) { =20 - printf("bt_connect_cfm on invalid line (%d)\n", line); + fprintf(stderr, __FUNCTION__ ": invalid line (%d)\n", line); return; } - printf("bt_connect_cfm : failed, status %d [%s] line %d\n", status, ps= mname(psm), line); + fprintf(stderr, __FUNCTION__": failed, status %d [%s] line %d\n", stat= us, psmname(psm), line); =20 return; } =20 switch (psm) { case RFCOMM_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 case SDP_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 case TCS_LAYER: - printf("bt_connect_cfm [%s]\n", psmname(psm)); + printf(__FUNCTION__ ": [%s]\n", psmname(psm)); break; =20 default: - printf("bt_connect_cfm : unknown layer %d\n", psm); + printf(__FUNCTION__ ": unknown layer %d\n", psm); break; } } @@ -1273,15 +1285,15 @@ bt_disconnect_ind(unsigned int con_id)=20 { if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) - printf("bt_disconnect_ind : RFCOMM dlci : %d\n", GET_RFCOMMDLCI(con_id= )); + printf(__FUNCTION__ ": RFCOMM dlci : %d\n", GET_RFCOMMDLCI(con_id)); else - printf("bt_disconnect_ind : psm %d\n", GET_PSM(con_id)); + printf(__FUNCTION__ ": psm %d\n", GET_PSM(con_id)); } =20 int bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci) { - printf("bt_register_rfcomm on dlci %d\n", dlci); + printf(__FUNCTION__ ": dlci %d\n", dlci); test_rfcomm =3D rfcomm; test_dlci =3D dlci; return 0; @@ -1290,20 +1302,20 @@ s32 bt_unregister_rfcomm(s32 line) { - printf("bt_unregister_rfcomm on line %d\n", line); + printf(__FUNCTION__ ": line %d\n", line); /* fixme -- stub for now */ } =20 s32 bt_register_sdp(u8 line, u8 sdpID) { - printf("bt_register_sdp\n"); + printf(__FUNCTION__ "\n"); return 0; } =20 s32 bt_unregister_sdp(s32 line) { - printf("bt_unregister_sdp\n"); + printf(__FUNCTION__ "\n"); return 0; } =20 --- bt_if.h 2001/03/30 12:32:47 1.4 +++ bt_if.h 2001/04/20 15:29:21 1.5 @@ -41,7 +41,7 @@ =20=20 =20 #ifndef __BT_IF_H__ -#define __BT_IP_H__ +#define __BT_IF_H__ =20 #include "btd.h" #ifdef BT_USERSTACK @@ -61,10 +61,10 @@ #ifndef N_BT #define N_BT 15 #endif + #define HOST_NAME_LENGTH 100 #define DOMAIN_NAME_LENGTH 100 =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 */ /* BT defines */ =20 @@ -112,7 +112,6 @@ #define L2CAP_FAILED 0xf0 #define L2CAP_CON_UNRESPONSIVE 0xf1 =20 - #ifndef BT_USERSTACK =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 */ @@ -148,6 +147,7 @@ #define BTREADREMOTEBDADDR _IOR(BT_IOC_MAGIC, 0x07, unsigned char[6]) #define BTRESETPHYSICALHW _IO(BT_IOC_MAGIC, 0x08) #define BTISINITIATED _IOR(BT_IOC_MAGIC, 0x09, int) +#define BTHWVENDOR _IOR(BT_IOC_MAGIC, 0x0A, char[20]) =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 */ /* Ioctls for executing HCI commands */ @@ -166,7 +166,6 @@ =20 #define HCISWITCHROLE _IOW(BT_IOC_MAGIC, 0x20, unsigned char[7]) =20 - /* Host Controller & Baseband Commands */ =20 #define HCIRESET _IO(BT_IOC_MAGIC, 0x30) @@ -186,19 +185,16 @@ #define HCIWRITE_ENCRYPTION_MODE _IOWR(BT_IOC_MAGIC, 0x3e, int) #define HCISET_EVENT_FILTER _IOW(BT_IOC_MAGIC, 0x3f, unsigned char[3]) =20 - /* Informational Parameters */ =20 #define HCIREADLOCALBDADDR _IOR(BT_IOC_MAGIC, 0x45, unsigned char[6]) =20 - /* Status Parameters */ =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 */ /* Testing Commands */ #define HCIENABLEDUT _IO(BT_IOC_MAGIC, 0x65) =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 */ /* Ioctls Vendor specific HCI commands */ =20 @@ -243,12 +239,14 @@ /* =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 */ /* Structs */ =20 -typedef struct bt_connection{ +typedef struct bt_connection +{ unsigned char bd[6]; unsigned int id; /* | psm(16 bits)=A0| layer_specific (16 bits)=A0|=A0*/ } bt_connection; =20 -typedef struct inquiry_results { +typedef struct inquiry_results +{ unsigned int nbr_of_units; unsigned int inq_time; unsigned char bd_addr[0]; @@ -262,6 +260,7 @@ } ping_struct; =20 #endif /* BT_USERSTACK */ + /* =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 */ /* Functions common to both usermode and kernel stack */ =20 @@ -272,8 +271,11 @@ void init_stack(int bt_cfd, int spd); int bt_isinitiated(void); void shutdown_stack(int bt_cfd); -int bt_openctrl(void); +#ifndef BT_USERSTACK +char* bt_hw_vendor(void); +#endif void reset_hw(void); +int bt_openctrl(void); void set_bt_line_disc(int phys_fd, int bt_disc, char* physdev); =20 /*=20 @@ -333,10 +335,6 @@ const char *error_msg(int err); int start_sdp_server(void); =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 */ /* Functions only used in usermode stack */ =20 @@ -369,4 +367,4 @@ =20 #endif /* =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 */ -#endif /* __BT_IP_H__*/ +#endif /* __BT_IF_H__ */ |
From: Mattias A. <mat...@us...> - 2001-04-27 14:53:32
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * extracted the ioctl part from set_local_name into bt_set_local_name=20 and renamed set_local_name to set_local_hostname * changed some debug The diff of the modified file(s): --- bt_if.c 2001/04/26 10:52:30 1.12 +++ bt_if.c 2001/04/27 14:53:31 1.13 @@ -64,13 +64,15 @@ #include "bt_user.h" #include "bt_errno.h" =20 +#define D(x) //x + /* =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 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 void init_stack(int bt_cfd, int spd) { - printf("Init stack\n"); + syslog(LOG_INFO, "Init stack\n"); =20=20=20 #ifdef BT_USERSTACK init_userstack(); @@ -87,9 +89,8 @@ bt_set_classofdevice(bt_cfd, 0x10, 0x3, 0x0, 0x0); =20 #ifndef __CRIS__ - set_local_name(bt_cfd, "AXIS"); + set_local_hostname(bt_cfd, "AXIS"); #endif -=20=20 } =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 */ @@ -179,7 +180,7 @@ int bt_openctrl(void) { int bt_cfd; - printf("Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY); + D(syslog(LOG_INFO, "Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY)); #ifdef BT_USERSTACK printf(__FUNCTION__ ": ignored in userstack\n"); return FD_BTUSERCTRL; @@ -207,7 +208,7 @@ if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) con.id =3D con_id; else{=20=20 - printf("Only connects rfcomm as client !\n"); + printf("Only connects rfcomm (yet)\n"); return -1; } =20 @@ -804,7 +805,8 @@ #endif } =20 -void set_local_name(int bt_cfd, const char *local_name) + +void set_local_hostname(int bt_cfd, const char *local_name) { unsigned char domainname[DOMAIN_NAME_LENGTH+1]; unsigned char buf[LOCAL_NAME_LENGTH + HOST_NAME_LENGTH +=20 @@ -849,17 +851,23 @@ strcat(buf, ")"); } =20 + bt_set_local_name(bt_cfd, buf); + +} + +void bt_set_local_name(int bt_cfd, const char *name) +{ + syslog(LOG_INFO, "bt_set_local_name %s", name); #ifndef BT_USERSTACK=20=20 - if (ioctl(bt_cfd, HCISETLOCALNAME, buf) < 0) + if (ioctl(bt_cfd, HCISETLOCALNAME, name) < 0) { perror(__FUNCTION__); exit(1); } #else - hci_change_local_name(buf); + hci_change_local_name(name); #endif } - =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 */ /* Misc functions */ --- bt_if.h 2001/04/26 14:07:10 1.7 +++ bt_if.h 2001/04/27 14:53:31 1.8 @@ -322,9 +322,11 @@ void enable_dut(int bt_cfd); =20 =20 -/* Sets friendly name in HW to hostname */ -void set_local_name(int bt_cfd, const char *local_name); +/* Sets friendly name to local_name + hostname in HW */ +void set_local_hostname(int bt_cfd, const char *local_name); =20 +/* Sets friendly name to name */ +void bt_set_local_name(int bt_cfd, const char *name); /*=20 * Misc functions=20 */ |
From: Mattias A. <mat...@us...> - 2001-05-15 12:13:07
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_ipa.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * when USE_IPASSIGN is defined in bt_conf.h, btd will try to connect to IPA server. If this fails btd will continue just as USE_IPASSIGN never was defined (before this change, it used to exit btd). * some cleanup The diff of the modified file(s): --- bt_ipa.c 2001/04/11 12:54:52 1.3 +++ bt_ipa.c 2001/05/15 12:13:04 1.4 @@ -58,8 +58,6 @@ #include "bt_conf.h" #include "bt_misc.h" =20 -#ifdef USE_IPASSIGN - int ipa_open(void) { int ipa_fd; @@ -153,5 +151,3 @@ syslog(LOG_INFO, " usingmasq: %d", set->usingmasq); } } - -#endif /* USE_IPASSIGN */ --- btd.c 2001/05/14 11:29:36 1.12 +++ btd.c 2001/05/15 12:13:04 1.13 @@ -148,14 +148,12 @@ /* =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 */ /* IPA stuff */ =20 -#ifdef USE_IPASSIGN static int ipa_fd =3D -1; static struct ipa_msg *msg; static unsigned char ipa_buf[256]; static int parse_ipa_response(struct ipa_msg *msg); static int ipa_sendrequest(int line, unsigned char *bd, unsigned short type); -#endif =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 */ /* General BTD stuff */ @@ -164,20 +162,23 @@ #define MODEMEMULCMD "memul" /* change name !*/ #define PPPDCMD "pppd" =20 +static int do_hwinit =3D 1; /* do vendor specific initialization */ +static int do_reset =3D 0; /* reset hw using I/O pins */ + +static int ipa_available =3D 0; /* is set if IPA was successfully initiali= zed */ +static int modem_emul =3D 1; /* default modem emulation is enabled */ +static int init_hw_speed =3D 0; /* not set */ =20 static char *physdev =3D DEFAULT_PHYS_DEV; static char *speedstr =3D DEFAULT_SPEED; -static int bt_cfd =3D -1; /* control tty for bt stack */ - -static int btd_pid; static char local_name[LOCAL_NAME_LENGTH+1]; /* 'friendly' name in HW modu= le */ -static int do_hwinit =3D 1; /* do vendor specific initialization */ -static int do_reset =3D 0; /* reset hw using I/O pins */ -static int init_hw_speed =3D 0; /* not set */ -static int modem_emul =3D 1; /* default modem emulation is enabled */ + +static int btd_pid =3D -1; +static int sdpsrv_pid =3D 0; +static int bt_cfd =3D -1; /* control tty for bt stack */ static int phys_fd =3D -1; /* physical device e.g ttyS0 */ static jmp_buf jmpbuffer; /* used to jump back in program after doing rese= t */ -static int sdpsrv_pid =3D 0; + =20 /* long option list */ static struct option long_options[] =3D @@ -308,9 +309,10 @@ tv.tv_usec =3D 0; =20 FD_ZERO(&rfd);=20=20 -#ifdef USE_IPASSIGN + + if (ipa_available) FD_SET(ipa_fd, &rfd); -#endif +=20=20=20=20 FD_SET(0, &rfd); =20 result =3D select(FD_SETSIZE, &rfd, NULL, NULL, &tv); @@ -394,7 +396,8 @@ read_remote_bd(bt_cfd, PEER(line).remote_bd); printf("Remote bd: %s\n", bd2str(PEER(line).remote_bd)); =20=20=20=20=20=20=20 -#ifdef USE_IPASSIGN + if (ipa_available) + {=20=20 D(syslog(LOG_INFO, "Sending IPA request\n")); =20=20=20=20=20=20=20 PEER(line).ipset =3D &IPSET(line); @@ -412,14 +415,16 @@ } else D(syslog(LOG_INFO, "IPA request sent")); -#else + } + else /* No IPA server available */ + {=20 STATE(line) =3D PPPCONF_DONE; build_pppdopts(line, (char**)pppd_options);=20=20=20=20=20=20 start_pppd(line, speedstr, (char**)pppd_options);=20=20=20=20=20 -#endif=20=20 } } } +} =20 /* only server */ void build_pppdopts(int line, char **opts) @@ -428,9 +433,8 @@ struct ip_set *ipset =3D PEER(line).ipset; char local_ip[20]; =20 -#ifdef USE_IPASSIGN + if (ipa_available) show_ipset(ipset, line); -#endif =20=20=20 D(syslog(LOG_INFO, "build_pppdopts\n")); =20=20=20 @@ -698,7 +702,8 @@ =20=20=20=20=20 syslog(LOG_INFO, "PPP line %d was shutdown\n", line); =20=20=20=20=20 -#ifdef USE_IPASSIGN + if (ipa_available)=20 + {=20 STATE(line) =3D WAITING_RETURN_PPPCONF; =20 if (ipa_sendrequest(line, (unsigned char *)&PEER(line).remote_bd,=20 @@ -709,9 +714,11 @@ will be discovered in timout */ STATE(line) =3D NOCONNECTION;=20=20=20=20 } -#else + } + else + { STATE(line) =3D NOCONNECTION;=20=20=20=20 -#endif=20=20=20=20 + } =20 PEER(line).ipset =3D NULL; PEER(line).pppd_pid =3D -1; @@ -759,7 +766,7 @@ =20 if (i > 8) {=20=20 - exit(1); + break; } else { @@ -768,7 +775,12 @@ i *=3D 2; }=20=20=20=20=20=20 }=20 + else=20 + {=20=20=20=20=20=20 + syslog(LOG_INFO, "Found IPA server"); + ipa_available =3D 1; }=20 + }=20 #endif =20=20=20 if (modem_emul =3D=3D 1) @@ -802,7 +814,6 @@ phys_fd =3D -1; } =20 -#ifdef USE_IPASSIGN if (ipa_fd !=3D -1) { syslog(LOG_INFO, "closing IPA"); @@ -810,7 +821,7 @@ close(ipa_fd); ipa_fd =3D -1; } -#endif=20 + /* pid_fd is set if we created the pid file when we started */ if (btd_pid !=3D -1) { @@ -851,8 +862,6 @@ /* =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 */ /* IPA stuff */ =20 -#ifdef USE_IPASSIGN - static int ipa_sendrequest(int line, unsigned char *bd, unsigned short typ= e) { unsigned char buf[IPA_MSG_MAXSIZE]; @@ -942,6 +951,5 @@ } return 0; } -#endif =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 */ |
From: Mats F. <ma...@us...> - 2001-05-17 10:22:04
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.9 1.10=20=20=20=20=20=20=20=20=20=20=20=20 bt_misc.h 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added param to fd_setup() to support BCSP The diff of the modified file(s): --- bt_misc.c 2001/05/14 11:29:36 1.9 +++ bt_misc.c 2001/05/17 10:22:04 1.10 @@ -300,7 +300,7 @@ =20 =20 void -fd_setup(int fd, int speed, int flow) +fd_setup(int fd, int speed, int flow, int use_bcsp) { struct termios t; =20 @@ -319,7 +319,16 @@ cfmakeraw(&t); =20=09 t.c_cflag &=3D ~CBAUD; + if (use_bcsp) + { + flow =3D 0; + t.c_cflag |=3D translate_speed(speed) | CS8 | CLOCAL | PARENB; + t.c_cflag &=3D ~PARODD; + } + else + { t.c_cflag |=3D translate_speed(speed) | CS8 | CLOCAL; + } t.c_oflag =3D 0; /* turn off output processing */ t.c_lflag =3D 0; /* no local modes */ =20=20=20 --- bt_misc.h 2001/04/26 15:58:15 1.5 +++ bt_misc.h 2001/05/17 10:22:04 1.6 @@ -50,7 +50,7 @@ =20 #define LOCAL_NAME_LENGTH 32 =20 -void fd_setup(int fd, int speed, int flow); +void fd_setup(int fd, int speed, int flow, int use_bcsp); int translate_speed(int spd); =20 /* Socket handling */ |
From: Mats F. <ma...@us...> - 2001-05-17 10:23:01
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btd.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20 btinit.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added check for BCSP when setting up phys_fd The diff of the modified file(s): --- btd.c 2001/05/15 12:13:04 1.13 +++ btd.c 2001/05/17 10:23:01 1.14 @@ -259,7 +259,6 @@ syslog(LOG_INFO, "phys dev : %s\n", optarg); physdev =3D optarg; break; -=20=20=20=20=20=20 default: break; } @@ -286,7 +285,7 @@ =20 /* Sets initial HW baudrate */ if (init_hw_speed !=3D 0) - fd_setup(phys_fd, init_hw_speed, USE_FLOW_CTRL); + fd_setup(phys_fd, init_hw_speed, USE_FLOW_CTRL, hw_vendor() =3D=3D HW_= CSR_BCSP); else init_phys(phys_fd); =20 --- btinit.c 2001/05/14 11:29:36 1.6 +++ btinit.c 2001/05/17 10:23:01 1.7 @@ -208,7 +208,7 @@ /* Set default speed */ =20 if (init_hw_speed !=3D 0) - fd_setup(phys_fd, init_hw_speed, 1); + fd_setup(phys_fd, init_hw_speed, 1, hw_vendor() =3D=3D HW_CSR_BCSP); else init_phys(phys_fd); =20 |
From: Mats F. <ma...@us...> - 2001-05-17 10:36:37
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btinit.c 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20 modememul.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Replaced static value with define The diff of the modified file(s): --- btinit.c 2001/05/17 10:23:01 1.7 +++ btinit.c 2001/05/17 10:36:36 1.8 @@ -208,7 +208,7 @@ /* Set default speed */ =20 if (init_hw_speed !=3D 0) - fd_setup(phys_fd, init_hw_speed, 1, 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 --- modememul.c 2001/05/17 10:24:04 1.6 +++ modememul.c 2001/05/17 10:36:36 1.7 @@ -125,7 +125,7 @@ } =20 /* not necessary for BT devices... */ - fd_setup(btfd, speed, USE_NO_FLOW, 0); + fd_setup(btfd, speed, USE_NO_FLOW, DONT_USE_BCSP); =20 syslog(LOG_INFO, "done."); done =3D modem_emulator(btfd); |
From: Peter K. <pk...@us...> - 2001-05-29 10:04:14
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.9 1.10=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added a hack to convert from ISO 8859-1 to UTF-8 in bt_set_local_name(). The diff of the modified file(s): --- bt_if.c 2001/05/14 11:47:45 1.15 +++ bt_if.c 2001/05/29 10:04:12 1.16 @@ -858,17 +858,36 @@ =20 } =20 -void bt_set_local_name(int bt_cfd, const char *name) +void bt_set_local_name(int bt_cfd, const unsigned char *name) { - syslog(LOG_INFO, "bt_set_local_name %s", name); + unsigned char buffer[248]; + int i =3D 0; + + syslog(LOG_INFO, __FUNCTION__ ": %s", name); + + /* Hack to convert ISO 8859-1 to UTF-8 */ + for (; *name && i < sizeof buffer - 3; name++) + { + if (*name < 128) + { + buffer[i++] =3D *name; + } + else + { + buffer[i++] =3D 0xC0 | (*name >> 6); + buffer[i++] =3D 0x80 | (*name & 0x3F); + } + } + buffer[i] =3D '\0'; + #ifndef BT_USERSTACK=20=20 - if (ioctl(bt_cfd, HCISETLOCALNAME, name) < 0) + if (ioctl(bt_cfd, HCISETLOCALNAME, buffer) < 0) { perror(__FUNCTION__); exit(1); } #else - hci_change_local_name(name); + hci_change_local_name(buffer); #endif } =20 --- bt_if.h 2001/05/14 11:09:22 1.9 +++ bt_if.h 2001/05/29 10:04:12 1.10 @@ -326,7 +326,7 @@ void set_local_hostname(int bt_cfd, const char *local_name); =20 /* Sets friendly name to name */ -void bt_set_local_name(int bt_cfd, const char *name); +void bt_set_local_name(int bt_cfd, const unsigned char *name); /*=20 * Misc functions=20 */ |
From: Anders J. <and...@us...> - 2001-07-31 09:02:22
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Changed #INCLUDE_UNPLUG_TEST -> #CONFIG_BLUETOOTH_UNPLUG_TEST The diff of the modified file(s): --- Makefile 2001/06/18 13:59:57 1.6 +++ Makefile 2001/07/31 09:02:21 1.7 @@ -15,6 +15,8 @@ HAVE_READLINE_READLINE =3D 1 #HAVE_READLINE =3D 1 =20 +INCLUDE_UNPLUG_TEST =3D 1 + INSTDIR =3D $(prefix)/bin/ INSTMODE =3D 0755 INSTOWNER =3D root @@ -38,6 +40,10 @@ ifdef HAVE_READLINE LDLIBS +=3D -lreadline -ltermcap CFLAGS +=3D -DHAVE_READLINE -I$(prefix)/include +endif + +ifdef INCLUDE_UNPLUG_TEST +CFLAGS +=3D -DCONFIG_BLUETOOTH_UNPLUG_TEST endif =20 CFLAGS +=3D -MD --- bttest.c 2001/07/30 15:47:54 1.11 +++ bttest.c 2001/07/31 09:02:21 1.12 @@ -101,7 +101,7 @@ " ecs_testcon <xx:xx:xx:xx:xx:xx> (hex)",=20=20 " enable_dut", /* enable device under test mode */ #endif -#ifdef INCLUDE_UNPLUG_TEST +#ifdef CONFIG_BLUETOOTH_UNPLUG_TEST " upt <teststring>", /* e.g testcase 4.3 't 43' */ #endif " quit",=20 @@ -348,7 +348,7 @@ bt_testcmd(bt_cfd, buf+7); } =20 -#ifdef INCLUDE_UNPLUG_TEST +#ifdef CONFIG_BLUETOOTH_UNPLUG_TEST else if (strncmp(buf, "upt", 3) =3D=3D 0) { if (sscanf(buf+4, "t %d", &i) =3D=3D 1) |
From: Anders J. <and...@us...> - 2001-08-17 09:23:26
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added missing PSM in bt_if.c * Changed parameters to sdp_send in bttest.c The diff of the modified file(s): --- bt_if.c 2001/08/02 13:02:40 1.27 +++ bt_if.c 2001/08/17 09:23:25 1.28 @@ -234,6 +234,7 @@ con.id =3D con_id; switch(GET_PSM(con_id)) { + case SDP_LAYER: case RFCOMM_LAYER: case TCS_LAYER: case L2CAP_TEST_LAYER: --- bttest.c 2001/08/02 13:01:36 1.15 +++ bttest.c 2001/08/17 09:23:25 1.16 @@ -107,7 +107,7 @@ =20 "", "--- Test commands ------", - " sdp_conn <xx:xx:xx:xx:xx:xx> <profile>", + " sdp_conn <xx:xx:xx:xx:xx:xx>", " tcs_conn <xx:xx:xx:xx:xx:xx>", " ", " test_conn <xx:xx:xx:xx:xx:xx> <psm> <line>", /* l2cap test using PSM= psm */ @@ -412,8 +412,8 @@ printf("RFCOMM server channel is %d\n", srv_ch); bt_connect(bt_cfd, bd, CREATE_RFCOMM_ID(0, srv_ch << 1)); } - else if(sscanf(buf, "sdp_conn %x:%x:%x:%x:%x:%x %d", - &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5], &profile) =3D=3D7) + else if(sscanf(buf, "sdp_conn %x:%x:%x:%x:%x:%x", + &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6) { =20=20=20=20=20 for (i =3D 0; i < 6; i++) |
From: Peter K. <pk...@us...> - 2001-08-29 09:43:49
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_vendor.c 1.24 1.25=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.h 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Broke out the functionality to change between BCSP and H4 from csr_change_if() to csr_bcsp_to_h4() and csr_h4_to_bcsp(). The diff of the modified file(s): --- bt_vendor.c 2001/08/29 09:36:45 1.24 +++ bt_vendor.c 2001/08/29 09:43:49 1.25 @@ -257,7 +257,6 @@ fd_setup(fd, 115200, USE_FLOW_CTRL, USE_BCSP); } =20 - /* * Read/Write any PS key in CSR module=20 * ps_vals holds return values / set params depending on=20 @@ -324,12 +323,23 @@ =20 void csr_change_if(int bt_cfd, int phys_fd) { + /* This may seem reversed, but hw_vendor() returns what we want, + not what we have, in this situation... */ + if (hw_vendor() =3D=3D HW_CSR_H4) + { + csr_bcsp_to_h4(bt_cfd, phys_fd); + } + else + { + csr_h4_to_bcsp(bt_cfd, phys_fd); + } +} =20 +void csr_bcsp_to_h4(int bt_cfd, int phys_fd) +{ unsigned short ps_parbuf[10]; =20 - if (hw_vendor() =3D=3D HW_CSR_H4) - { - syslog(LOG_INFO, "Changing CSR host IF: H4 -> BCSP"); + syslog(LOG_INFO, "Changing CSR host IF: BCSP -> H4"); =20=20=20=20=20 /* Temporarily set stack to use BCSP framing */ bt_bcsp_mode(bt_cfd, 1); @@ -387,9 +397,12 @@ /* Set back stack to use H4 framing */ bt_bcsp_mode(bt_cfd, 0); } - else + +void csr_h4_to_bcsp(int bt_cfd, int phys_fd) { - syslog(LOG_INFO, "Changing CSR host IF: BCSP -> H4"); + unsigned short ps_parbuf[10]; + + syslog(LOG_INFO, "Changing CSR host IF: H4 -> BCSP"); =20 /* Set stack to use H4 temporarily */=20=20=20=20=20=20=20=20 bt_bcsp_mode(bt_cfd, 0); @@ -436,8 +449,8 @@ { syslog(LOG_ERR, __FUNCTION__ ": Unknown PS key parameter: %d", ps_pa= rbuf[1]); } - } } + =20 /* fixme -- remove hardcoded values */ void --- bt_vendor.h 2001/08/29 08:39:09 1.5 +++ bt_vendor.h 2001/08/29 09:43:49 1.6 @@ -72,5 +72,7 @@ int hw_vendor(void); =20 void csr_change_if(int bt_cfd, int phys_fd); +void csr_bcsp_to_h4(int bt_cfd, int phys_fd); +void csr_h4_to_bcsp(int bt_cfd, int phys_fd); =20 #endif /* __BT_VENDOR_H__*/ |
From: Peter K. <pk...@us...> - 2001-08-29 10:15:54
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20 modememul.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made the modem emulator build again. The diff of the modified file(s): --- Makefile 2001/07/31 09:02:21 1.7 +++ Makefile 2001/08/29 10:15:53 1.8 @@ -23,7 +23,7 @@ INSTGROUP =3D root =20 BTDOBJS =3D btd.o bt_ipa.o bt_vendor.o bt_if.o bt_misc.o -MEMULOBJS =3D modememul.o bt_misc.o +MEMULOBJS =3D modememul.o bt_if.o bt_misc.o BTINITOBJS =3D btinit.o bt_vendor.o bt_if.o bt_misc.o BTCONOBJS =3D btcon.o bt_if.o bt_misc.o BTSENDOBJS =3D btsend.o bt_if.o bt_misc.o --- modememul.c 2001/08/29 10:02:05 1.10 +++ modememul.c 2001/08/29 10:15:53 1.11 @@ -57,6 +57,7 @@ #include <signal.h> =20 #include "btd.h" +#include "bt_if.h" #include "bt_misc.h" =20 #define D(x) //x |
From: Peter K. <pk...@us...> - 2001-08-29 11:15:21
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20 modememul.c 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Include bt_if.h in bt_misc.c instead of modememul.c (as was intended). The diff of the modified file(s): --- bt_misc.c 2001/08/29 10:02:05 1.14 +++ bt_misc.c 2001/08/29 11:15:20 1.15 @@ -64,6 +64,7 @@ =20 #include "btd.h" #include "bt_misc.h" +#include "bt_if.h" =20 #define D(x) //x =20 --- modememul.c 2001/08/29 10:15:53 1.11 +++ modememul.c 2001/08/29 11:15:20 1.12 @@ -57,7 +57,6 @@ #include <signal.h> =20 #include "btd.h" -#include "bt_if.h" #include "bt_misc.h" =20 #define D(x) //x |
From: Peter K. <pk...@us...> - 2001-09-07 12:47:10
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.31 1.32=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Corrected bt_read_country_code(). * Removed a couple of printf()'s. * Fixed a couple of compiler warnings. The diff of the modified file(s): --- bt_if.c 2001/08/29 09:36:45 1.31 +++ bt_if.c 2001/09/07 12:47:09 1.32 @@ -72,7 +72,8 @@ =20 int init_stack(int bt_cfd) { - int ret; + int ret =3D 0; + syslog(LOG_INFO, "Init stack"); =20 #ifndef BT_USERSTACK @@ -199,7 +200,6 @@ #ifdef __CRIS__ int devfd; =20 - printf("Resetting HW board...\n"); if ((devfd =3D bt_openctrl()) >=3D 0) { if (ioctl(devfd, BTRESETPHYSICALHW) < 0) @@ -210,8 +210,6 @@ sleep(2); =20 close(devfd); - - printf("Done.\n"); } else { @@ -248,8 +246,10 @@ { bt_connection con; int result; +#ifdef BT_USERSTACK unsigned short srv_ch; unsigned short line; +#endif =20=20=20 memcpy(con.bd, bd, 6); con.id =3D con_id; @@ -261,17 +261,14 @@ case L2CAP_TEST_LAYER: case L2CAP_TEST2_LAYER: case L2CAP_TEST3_LAYER: - { break; - } =20=20=20=20=20 default: - { printf(__FUNCTION__" : Unknown layer\n"); con.id =3D 0; return -1; - } } + #ifndef BT_USERSTACK if ((result =3D ioctl(bt_fd, BTCONNECT, &con))) printf("Connect failed [%s (%d)]\n", error_msg(result), result); @@ -285,7 +282,7 @@ return -1; } =20=20=20=20=20 - printf("Connecting srv ch %d on line %d\n", srv_ch, line); +// printf("Connecting srv ch %d on line %d\n", srv_ch, line); result =3D bt_connect(bd, con_id);=09=09 } #endif @@ -472,6 +469,7 @@ if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) { perror(__FUNCTION__); + return -1; } #else fprintf(stderr, __FUNCTION__ ": not yet implemented...\n"); @@ -869,7 +867,6 @@ exit(1); } 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"); #endif @@ -958,10 +955,12 @@ #endif } =20 -int bt_read_country_code(int bt_cfd, unsigned char *result) +int bt_read_country_code(int bt_cfd) { + int result; + #ifndef BT_USERSTACK=20=20 - if (ioctl(bt_cfd, HCIREADCOUNTRYCODE, result) < 0) + if (ioctl(bt_cfd, HCIREADCOUNTRYCODE, &result) < 0) { perror(__FUNCTION__); exit(1); --- bt_if.h 2001/08/29 09:36:45 1.21 +++ bt_if.h 2001/09/07 12:47:09 1.22 @@ -259,6 +259,7 @@ #define BT_CSR_PSKEY _IOWR(BT_IOC_MAGIC, 0xf5, unsigned short[CSR_PSKEY_MS= GHDR_SIZE + CSR_PSKEY_MAXPARAMS]) =20 #define BTINITBCSP _IO(BT_IOC_MAGIC, 0xf6) + #define BTSETMAXCONNECTIONS _IOW(BT_IOC_MAGIC, 0xf7, unsigned char) /* =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 */ /* Structs */ @@ -345,7 +346,7 @@ unsigned char minor_class,=20 unsigned char format); =20 -int bt_read_country_code(int bt_cfd, unsigned char *result); +int bt_read_country_code(int bt_cfd); =20 void enable_dut(int bt_cfd); =20 |
From: Peter K. <pk...@us...> - 2001-09-07 12:53:50
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.32 1.33=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added BCSP DFU support. The diff of the modified file(s): --- bt_if.c 2001/09/07 12:47:09 1.32 +++ bt_if.c 2001/09/07 12:53:50 1.33 @@ -86,12 +86,15 @@ init_userstack(); #endif =20 + if (!bt_dfu_mode(bt_cfd, -1)) + { /* fixme<3> -- read these parameters from config file ? */ bt_set_classofdevice(bt_cfd, 0x10, 0x3, 0x0, 0x0); =20 #ifndef __CRIS__ set_local_hostname(bt_cfd, "AXIS"); #endif + } =20=20=20 return ret; } @@ -195,6 +198,22 @@ #endif } =20 +int +bt_dfu_mode(int bt_cfd, int enable) +{ +#ifndef BT_USERSTACK + if (ioctl(bt_cfd, BT_SET_DFU_MODE, &enable) < 0) + { + perror(__FUNCTION__); + exit(1); + } + + return enable; +#else + return 0; +#endif +} + void reset_hw(void) { #ifdef __CRIS__ @@ -476,6 +495,59 @@ //hci_send_raw_data(data, 16); #endif return 0; +} + +int +bt_send_dfu_command(int bt_cfd, int len, unsigned char *data) +{ + static unsigned char buf[2048]; + + if (len > sizeof buf - sizeof(int)) + { + errno =3D EINVAL; + return -1; + } + + *(int *)buf =3D len; +=20=20 + memcpy((int *)buf+1, data, len); + +#ifndef BT_USERSTACK=20 + if (ioctl(bt_cfd, BT_SEND_DFU_COMMAND, buf) < 0) + { + perror(__FUNCTION__); + return -1; + } + + return 0; +#else + fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n"); + errno =3D EPERM; + return -1; +#endif +} + +int +bt_retrieve_dfu_response(int bt_cfd, int len, unsigned char *data) +{ + *(int *)data =3D len - sizeof(int); + +#ifndef BT_USERSTACK=20 + if (ioctl(bt_cfd, BT_RETRIEVE_DFU_RESPONSE, data) < 0) + { + perror(__FUNCTION__); + return -1; + } + + len =3D *(int *)data; +=20=20 + memmove(data, (int *)data+1, len); + return len; +#else + fprintf(stderr, __FUNCTION__ ": Not yet implemented...\n"); + errno =3D EPERM; + return -1; +#endif } =20 int bt_ping(int bt_cfd, unsigned char bd[6],=20 --- bt_if.h 2001/09/07 12:47:09 1.22 +++ bt_if.h 2001/09/07 12:53:50 1.23 @@ -260,7 +260,11 @@ =20 #define BTINITBCSP _IO(BT_IOC_MAGIC, 0xf6) =20 -#define BTSETMAXCONNECTIONS _IOW(BT_IOC_MAGIC, 0xf7, unsigned char) +#define BT_SET_DFU_MODE _IOWR(BT_IOC_MAGIC, 0xf7, int) +#define BT_SEND_DFU_COMMAND _IOWR(BT_IOC_MAGIC, 0xf8, unsigned char[2048]) +#define BT_RETRIEVE_DFU_RESPONSE _IOWR(BT_IOC_MAGIC, 0xf9, unsigned char[2= 048]) + +#define BTSETMAXCONNECTIONS _IOW(BT_IOC_MAGIC, 0xfa, unsigned char) /* =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 */ /* Structs */ =20 @@ -301,6 +305,7 @@ #endif char* bt_firmware_info(void); int bt_bcsp_mode(int bt_cfd, int enable); +int bt_dfu_mode(int bt_cfd, int enable); void reset_hw(void); int bt_openctrl(void); void set_bt_line_disc(int phys_fd, int bt_disc, char* physdev); @@ -325,6 +330,8 @@ */ =20 int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len); +int bt_send_dfu_command(int bt_cfd, int len, unsigned char *data); +int bt_retrieve_dfu_response(int bt_cfd, int len, unsigned char *data); int bt_ping(int bt_cfd, unsigned char bd[6],=20 unsigned char *data, unsigned short len); int bt_getinfo(int bt_cfd, unsigned char bd[6], unsigned short type); |
From: Peter K. <pk...@us...> - 2001-10-10 16:20:42
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20 bt_misc.h 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added restart_btd() which sends SIGUSR1 to the pid registered in /var/run/btd.pid to make it reinitialise the stack. The diff of the modified file(s): --- bt_misc.c 2001/10/04 15:10:40 1.20 +++ bt_misc.c 2001/10/10 16:20:40 1.21 @@ -96,6 +96,36 @@ return pid_fd; } =20 +int +restart_btd(void) +{ + int fd; + int pid =3D -1; + int size; + char buf[100]; + + if ((fd =3D open("/var/run/btd.pid", O_RDONLY)) < 0) + { + return -1; + } + + if ((size =3D read(fd, buf, sizeof buf - 1)) > 0) + { + buf[size-1] =3D '\0'; + pid =3D atoi(buf); + } + + close(fd); + + if (pid > 0) + { + kill(pid, SIGUSR1); + return 0; + } + + return -1; +} + /* Local UNIX socket */ int open_socket(const char *name, int role) --- bt_misc.h 2001/10/03 17:45:44 1.10 +++ bt_misc.h 2001/10/10 16:20:40 1.11 @@ -59,6 +59,9 @@ int open_tcpsocket(const char *addrstr, int role); =20 int write_pidfile(const char *pidname); + +int restart_btd(void); + char *get_local_ip_address(void); const char *bd2str(const unsigned char *bd); #ifndef BT_USERSTACK |
From: Anders J. <and...@us...> - 2001-10-12 12:01:17
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_errno.h 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.c 1.37 1.38=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added RFCOMM error messages. The diff of the modified file(s): --- bt_errno.h 2001/10/10 14:56:00 1.2 +++ bt_errno.h 2001/10/12 12:01:16 1.3 @@ -82,6 +82,11 @@ =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=3D=3D=3D*/ /* RFCOMM */ +#define RFCOMM_INVALID_LINE 0xf0 +#define RFCOMM_SRVCHN_CONNECTED 0xf1 +#define RFCOMM_NO_DATA_ALLOWED 0xf2 +#define RFCOMM_NO_CONNECTION 0xf3 +#define RFCOMM_BAD_MAGIC_NUMBER 0Xf4 =20 /* fixme */ =20 --- bt_if.c 2001/10/10 14:56:00 1.37 +++ bt_if.c 2001/10/12 12:01:16 1.38 @@ -1131,6 +1131,11 @@ case MSG_LAYER_RFCOMM: switch(code) { + case RFCOMM_INVALID_LINE: return "RFCOMM: Trying to use an invalid li= ne";=20 + case RFCOMM_SRVCHN_CONNECTED: return "RFCOMM: Serverchannel already c= onnected"; + case RFCOMM_NO_DATA_ALLOWED: return "RFCOMM: No data allowed on contr= ol channel"; + case RFCOMM_NO_CONNECTION: return "RFCOMM: No connection"; + case RFCOMM_BAD_MAGIC_NUMBER: return "RFCOMM: Bad magic number";=20 default: return "RFCOMM: No debug msg defined"; } case MSG_LAYER_SDP: |
From: Anders J. <and...@us...> - 2001-10-15 08:48:55
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.39 1.40=20=20=20=20=20=20=20=20=20=20=20=20 bt_if.h 1.27 1.28=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Made bt_inq return a returnvalue. * Added errormessages. The diff of the modified file(s): --- bt_if.c 2001/10/12 14:56:41 1.39 +++ bt_if.c 2001/10/15 08:48:53 1.40 @@ -663,9 +663,10 @@ /* HCI functions */ =20 =20 -void +int bt_inquiry(int bt_cfd, int nbr_rsp, int t) { + int retval =3D 0; #ifdef BTD_USERSTACK char inq_lap[6]; =20 @@ -675,7 +676,7 @@ inq_lap[1] =3D 0x8b; inq_lap[2] =3D 0x9e; =20 - hci_inquiry(inq_lap, t, nbr_rsp); + retval =3D hci_inquiry(inq_lap, t, nbr_rsp); #else int i; inquiry_results *inq_res; @@ -683,15 +684,17 @@ if (!(inq_res =3D malloc(sizeof *inq_res + nbr_rsp * 6))) { fprintf(stderr, __FUNCTION__ ": Failed to allocate result structure!\n= "); + return -ENOMEM; } =20 inq_res->nbr_of_units =3D nbr_rsp; inq_res->inq_time =3D t; =20 - if (ioctl(bt_cfd, HCIINQUIRY, inq_res) < 0) + if ((retval =3D ioctl(bt_cfd, HCIINQUIRY, inq_res)) < 0) { - perror(__FUNCTION__); - exit(1); + printf("Inquiry failed [%s (%d)]\n", error_msg(retval), MSG_GET_CODE(-= retval)); + free(inq_res); + return retval; } =20 for (i =3D 0; i < inq_res->nbr_of_units; i++) @@ -704,6 +707,7 @@ =20 free(inq_res); #endif + return retval; } =20 void --- bt_if.h 2001/10/10 14:56:00 1.27 +++ bt_if.h 2001/10/15 08:48:53 1.28 @@ -317,7 +317,7 @@ int bt_getinfo(int bt_cfd, unsigned char bd[6], unsigned short type); int bt_testcmd(int bt_cfd, unsigned char *cmd); =20 -void bt_inquiry(int bt_cfd, int nbr_rsp, int t); +int bt_inquiry(int bt_cfd, int nbr_rsp, int t); int bt_set_baudrate(int bt_cfd, const char *speedstr); void bt_set_bd_addr(int bt_cfd, unsigned char *bd); void read_local_bd(int bt_cfd, unsigned char *bd_addr); |
From: Anders J. <and...@us...> - 2001-10-16 16:37:51
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_errno.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * bttest can now run with arguments, as example bttest 'rf_conn xx:xx:xx:xx= :xx:xx 1 0' will start bttest, run the cmd and then exit. * Added HCI_INQUIRY_FAILED. The diff of the modified file(s): --- bt_errno.h 2001/10/12 12:01:16 1.3 +++ bt_errno.h 2001/10/16 16:26:43 1.4 @@ -107,3 +107,4 @@ #define BT_ALREADYCONNECTED 0x2 #define BT_TIMEOUT 0x3 #define BT_LINE_BUSY 0x4 +#define BT_INQ_FAILED 0x5 --- bttest.c 2001/10/10 14:56:00 1.22 +++ bttest.c 2001/10/16 16:26:43 1.23 @@ -128,6 +128,7 @@ }; =20 static unsigned char hotlist[10][6]; +static int quit_bttest; =20 #if !defined(HAVE_READLINE) && !defined(HAVE_READLINE_READLINE) static void read_history(char *hist_file_name); @@ -150,10 +151,11 @@ } =20 int -main(void) +main(int argc, char **argv) { - int bt_cfd, i , j; + int bt_cfd, i , j, tmp; FILE *hotlist_fd; + quit_bttest =3D 0; =20 /* Open BT ctrl device */=20=20 if ((bt_cfd =3D bt_openctrl()) < 0) @@ -191,6 +193,17 @@ } } =20=20=20 + if(argc > 1) + { + for(i =3D 1 ; i < argc ; i++) + { + if((tmp =3D process_cmd(argv[i], bt_cfd)) < 0) + { + return -1; + } + } + return 0; + } =20 read_history(BTD_HISTORY_FILE);=20=20 =20=20=20 @@ -198,7 +211,6 @@ =20=20=20 while (1) { - int tmp; char *tmp_char, hotlist_entry; char tmp_line[200]; char *line =3D (char*) readline("> "); @@ -226,7 +238,7 @@ tmp =3D process_cmd(line, bt_cfd); } =20 - if (tmp =3D=3D QUIT_BTD) + if (quit_bttest =3D=3D QUIT_BTD) { break; } @@ -245,7 +257,7 @@ =20 if (!strncmp(buf, "quit", 4)) { - return QUIT_BTD; + quit_bttest =3D QUIT_BTD; } else if (sscanf(buf, "rf_conn %x:%x:%x:%x:%x:%x %d %d", &tmp[0], &tmp[1], &tmp[2], @@ -284,7 +296,7 @@ } else if (sscanf(buf, "inq %d %d", &tmp[0], &tmp[1]) =3D=3D 2) { - bt_inquiry(bt_cfd, tmp[0], tmp[1]); + retval =3D bt_inquiry(bt_cfd, tmp[0], tmp[1]); } else if (sscanf(buf, "rf_send %d %d %d", &i, &repeat, &line) =3D=3D 3) { @@ -295,7 +307,7 @@ btfd =3D open(dev, O_RDWR | O_NOCTTY); =20 if (btfd > 0) - bt_send(btfd, i, repeat); + return bt_send(btfd, i, repeat); else { perror("bt_send"); |
From: Anders J. <and...@us...> - 2002-02-19 19:03:45
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20 btping.c 1.1 Added The accompanying log: * Added btping. The diff of the modified file(s): --- Makefile 6 Feb 2002 11:31:56 -0000 1.12 +++ Makefile 19 Feb 2002 19:03:44 -0000 1.13 @@ -5,7 +5,7 @@ include $(APPS)/Rules.elinux endif =20 -PROGS =3D btdm memul bti btinq btcon btdisc btconfig # btsend bttest +PROGS =3D btdm memul bti btinq btcon btdisc btconfig btping # btsend b= ttest =20 # Define HAVE_READLINE_READLINE if you have readline support, with the inc= lude # files in $(include_dir)/readline. Define HAVE_READLINE if you have the @@ -32,6 +32,7 @@ BTINQOBJS =3D btinq.o bt_if.o bt_misc.o BTTESTOBJS =3D bttest.o bt_misc.o bt_vendor.o bt_if.o BTCONFIGOBJS =3D btconfig.o bt_vendor.o bt_if.o bt_misc.o +BTPINGOBJS =3D btping.o bt_if.o bt_misc.o =20 ifdef HAVE_READLINE_READLINE LDLIBS +=3D -lreadline -ltermcap @@ -83,6 +84,9 @@ $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ =20 btconfig: $(BTCONFIGOBJS) + $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ + +btping: $(BTPINGOBJS) $(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@ =20 install: $(PROGS) |
From: Alain P. <apa...@us...> - 2002-04-03 00:30:46
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bt_linkkey_common.c 1.1 Added bt_linkkey_common.h 1.1 Added The accompanying log: Add files for compiling the simple security manager. |
From: Alain P. <apa...@us...> - 2002-05-10 12:29:01
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bt_vendor.c 1.32 1.33=20=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_vendor.h 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added settings and functions for new bluetooth hardware from Texas Instrume= nts. The diff of the modified file(s): --- bt_vendor.c 28 Feb 2002 20:08:31 -0000 1.32 +++ bt_vendor.c 10 May 2002 12:29:00 -0000 1.33 @@ -99,6 +99,10 @@ infineon_init_phys(fd, flow_control); break; =20 + case HW_TEXASINSTRUMENTS: + texasinstruments_init_phys(fd, flow_control); + break; + case HW_USB: usb_init_phys(fd, flow_control); break; @@ -139,6 +143,10 @@ infineon_init_hw(bt_cfd, phys_fd, speedstr); break; =20 + case HW_TEXASINSTRUMENTS: + texasinstruments_init_hw(bt_cfd, phys_fd, speedstr); + break; + case HW_USB: usb_init_hw(bt_cfd, phys_fd, speedstr); break; @@ -234,6 +242,8 @@ hw_vendor =3D HW_ERICSSON; else if (!strcmp(vendor, "Infineon")) hw_vendor =3D HW_INFINEON; + else if (!strcmp(vendor, "Texas Instruments")) + hw_vendor =3D HW_TEXASINSTRUMENTS; else if (!strcmp(vendor, "USB")) hw_vendor =3D HW_USB; else if (!strcmp(vendor, "Generic")) @@ -654,6 +664,34 @@ tcflush(phys_fd, TCIOFLUSH); } } + +/* =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*/ +/* Texas Instruments specific commands */ +/* =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*/ + +void +texasinstruments_init_phys(int fd, int flow_control) +{ + fd_setup(fd, "115200", flow_control); +} + +void +texasinstruments_init_hw(int bt_cfd, int phys_fd, const char *speedstr) +{ + unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); + + sleep(1); + D(syslog(LOG_INFO, "Setting write_scan_enable in Texas Instruments modul= e")); + bt_write_scan_enable(bt_cfd, wrscan); + + sleep(1); // wait for HW... + + if (speedstr) + { + syslog(LOG_INFO, "Setting baudrate in Texas Instruments not supported"= ); + } +} + =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*/ /* USB specific commands */ --- bt_vendor.h 16 Oct 2001 15:02:20 -0000 1.12 +++ bt_vendor.h 10 May 2002 12:29:00 -0000 1.13 @@ -59,6 +59,7 @@ #define HW_GENERIC 5 #define HW_NO_INIT 6 #define HW_UNKNOWN 7 +#define HW_TEXASINSTRUMENTS 8 =20 /*=20 * Vendor specific functions=20 |
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); |