You can subscribe to this list here.
2001 |
Jan
|
Feb
(44) |
Mar
(202) |
Apr
(134) |
May
(89) |
Jun
(94) |
Jul
(58) |
Aug
(58) |
Sep
(56) |
Oct
(75) |
Nov
(26) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(24) |
Feb
(30) |
Mar
(15) |
Apr
(49) |
May
(12) |
Jun
(6) |
Jul
(11) |
Aug
(20) |
Sep
(19) |
Oct
(3) |
Nov
(13) |
Dec
(1) |
2003 |
Jan
(7) |
Feb
(4) |
Mar
(7) |
Apr
(5) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(51) |
Dec
(1) |
2004 |
Jan
(11) |
Feb
(5) |
Mar
|
Apr
(5) |
May
(2) |
Jun
|
Jul
(21) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Peter K. <pk...@us...> - 2001-04-11 11:16:31
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.97 1.98=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Do not dereference con if it is NULL in process_request() (thanks to Eric Muehlhausen). The diff of the modified file(s): --- l2cap.c 2001/04/10 12:27:10 1.97 +++ l2cap.c 2001/04/11 11:16:30 1.98 @@ -696,7 +696,7 @@ if ((con =3D check_remote_cid(hci_handle,=20 conreq->src_cid)) =3D=3D NULL) { D_ERR(FNC"couldn't find l2cap connection\n"); - l2cap_cmdrej(con->hci_hdl, CMDREJ_INVALIDCID, + l2cap_cmdrej(hci_handle, CMDREJ_INVALIDCID, "Invalid CID", 13); return; } @@ -740,7 +740,7 @@ if ((con =3D get_lcon(confreq->dst_cid)) =3D=3D NULL) { D_ERR("Couldn't find local CID\n"); /* send back response ? */ - l2cap_cmdrej(con->hci_hdl, CMDREJ_INVALIDCID, NULL, 0); + l2cap_cmdrej(hci_handle, CMDREJ_INVALIDCID, NULL, 0); return; } =20=09=09 @@ -1246,8 +1246,6 @@ } =20 =20 - - /*******************************************************************/ /*-------------------------- EVENTS -------------------------------*/ /*******************************************************************/ @@ -1478,8 +1476,7 @@ if (len > (con->local_mtu)) { DSYS("l2cap process_frame : len > local_mtu (%d/%d)\n",=20 len- L2CAP_HDRSIZE, con->local_mtu); - l2cap_cmdrej(con->hci_hdl, CMDREJ_MTUEXCEEDED, - NULL, 0); + l2cap_cmdrej(con->hci_hdl, CMDREJ_MTUEXCEEDED, NULL, 0); return; }=20 =20 |
From: liu j. <ljk...@ya...> - 2001-04-10 15:07:54
|
hi all: If I have established 1 rfcomm connection between a and b,can I establish another rfcomm connection between the same 2 devices on the same line,or on the same BTn, use another dlci. thanks for any reply. __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Peter K. <pk...@us...> - 2001-04-10 13:04:25
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_vendor.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Some clean-up. The diff of the modified file(s): --- hci_vendor.c 2001/04/10 12:27:10 1.20 +++ hci_vendor.c 2001/04/10 13:04:24 1.21 @@ -145,7 +145,6 @@ return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); } =20 - s32=20 hci_set_baudrate(u32 baudrate) { @@ -153,18 +152,22 @@ on the new baudrate, this function can not block (Since btd sets the new physical device speed when this function returns). */=20=20 =20=20=20 - D_CMD(__FUNCTION__ VENDOR "(%d baud)\n", baudrate); + D_CMD(__FUNCTION__ VENDOR " (%u baud)\n", baudrate); c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(ERICSSON_SET_UART_BAUD_RATE, 0x3f) ; c_pkt.len =3D 1; switch (baudrate) { - case 57600: c_pkt.data[0] =3D 0x03; + case 57600: + c_pkt.data[0] =3D 0x03; break; - case 115200: c_pkt.data[0] =3D 0x02; + case 115200: + c_pkt.data[0] =3D 0x02; break; - case 230400: c_pkt.data[0] =3D 0x01; + case 230400: + c_pkt.data[0] =3D 0x01; break; - case 460800: c_pkt.data[0] =3D 0x00; + case 460800: + c_pkt.data[0] =3D 0x00; break; default: D_ERR(__FUNCTION__ VENDOR ": Baudrate not supported\n"); @@ -187,7 +190,6 @@ return 0; } =20 - void process_vendor_return_param(u32 ocf, u8* r_val) { @@ -258,20 +260,18 @@ } } =20 - void process_vendor_event(u8 *buf, u32 len, u32 event_code) { D_ERR(__FUNCTION__ VENDOR " Vendor specicic event not recognized.\n"); } - =20 -char* get_hw_name(void) +char* +get_hw_name(void) { return "Ericsson"; } =20 - #elif defined(CONFIG_BLUETOOTH_DIGIANSWER) /*************************************************************************= ****/ /************************* Digianswer functions **************************= ****/ @@ -286,7 +286,6 @@ return 0; } =20 - s32 hci_read_firmware_rev_info(void) { @@ -294,28 +293,32 @@ return 0; } =20 - s32=20 hci_set_baudrate(u32 baudrate) { u8 pkt[5]; s32 tmp; =20=20=20 - D_CMD(__FUNCTION__ VENDOR "(%d baud)\n", baudrate); + D_CMD(__FUNCTION__ VENDOR " (%u baud)\n", baudrate); pkt[0] =3D CMD_PKT; pkt[1] =3D 0x07; pkt[2] =3D 0xfc; pkt[3] =3D 0x01; switch (baudrate) { - case 9600: pkt[4] =3D 0x03; + case 9600: + pkt[4] =3D 0x03; break; - case 19200:pkt[4] =3D 0x05; + case 19200: + pkt[4] =3D 0x05; break; - case 38400: pkt[4] =3D 0x07; + case 38400: + pkt[4] =3D 0x07; break; - case 57600: pkt[4] =3D 0x09; + case 57600: + pkt[4] =3D 0x09; break; - case 115200: pkt[4] =3D 0x09; + case 115200: + pkt[4] =3D 0x09; break; } tmp =3D send_cmd(pkt,5); @@ -325,9 +328,9 @@ =20=20=20 return tmp; } - =20 -u8* get_digi_err_code(u8 code) +u8* +get_digi_err_code(u8 code) { switch (code) { case 0x01: @@ -346,11 +349,10 @@ return "Unspecified error\n"; =20=20=20=20=20 default: - return "Unkown error digianswer code"; + return "Unkown error digianswer code\n"; } } =20 - void process_vendor_event(u8 *buf, u32 len, u32 event_code) { @@ -360,10 +362,8 @@ } else {=09=09=09 printk(get_digi_err_code(buf[0])); } - } =20 - void process_vendor_return_param(u32 ocf, u8* r_val) { @@ -380,13 +380,12 @@ } } =20 - -char* get_hw_name(void) +char* +get_hw_name(void) { return "Digianswer"; } =20 - #if RS232_SUPPORT s32=20 send_negotiation_pkt(void) @@ -397,8 +396,8 @@ pkt[1] =3D seq_nbr; seq_nbr++; pkt[2] =3D SET_UART(0x0,0x0,0x0,0xb); - pkt[3] =3D (SET_BAUD_RATE(115200) & 0xff); - pkt[4] =3D ((SET_BAUD_RATE(115200) >> 8) & 0xff); + pkt[3] =3D SET_BAUD_RATE(115200) & 0xff; + pkt[4] =3D (SET_BAUD_RATE(115200) >> 8) & 0xff; pkt[5] =3D 10; /*?!? Try with this ?!?*/ pkt[6] =3D 0; pkt[7] =3D SET_PROTOCOL_MODE(0,0,0,1,0,0); @@ -421,7 +420,6 @@ return 0; } =20 - s32 hci_read_firmware_rev_info(void) { @@ -429,7 +427,6 @@ return 0; } =20 - s32=20 hci_set_baudrate(u32 baudrate) { @@ -437,27 +434,24 @@ return 0; } =20 - void process_vendor_event(u8 *buf, u32 len, u32 event_code) { D_REC(__FUNCTION__ VENDOR "\n"); } =20 - void process_vendor_return_param(u32 ocf, u8* r_val) { D_ERR(__FUNCTION__ VENDOR "Manufacturer specific : Invalid reply (0x%x)\n= ", ocf); } =20 - -char* get_hw_name(void) +char* +get_hw_name(void) { return "CSR"; } =20 - #else /*************************************************************************= ****/ /************************* HW_NOINIT and HW_GENERIC **********************= ****/ @@ -470,7 +464,6 @@ return 0; } =20 - s32 hci_read_firmware_rev_info(void) { @@ -478,7 +471,6 @@ return 0; } =20 - s32=20 hci_set_baudrate(u32 baudrate) { @@ -486,29 +478,27 @@ return 0; } =20 - void process_vendor_event(u8 *buf, u32 len, u32 event_code) { D_REC(__FUNCTION__ VENDOR "Manufacturer specific : Unknown event.\n"); } =20 - void process_vendor_return_param(u32 ocf, u8* r_val) { D_ERR(__FUNCTION__ VENDOR "Manufacturer specific : Invalid reply (0x%x)\n= ", ocf); } - =20 -char* get_hw_name(void) +char* +get_hw_name(void) { return "Unknown hardware"; } - #endif =20 -void show_bt_vendor() +void +show_bt_vendor() { DSYS("Current HW : %s\n", VENDOR); } |
From: Peter K. <pk...@us...> - 2001-04-10 12:27:11
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.135 1.136=20=20=20=20=20=20=20=20=20=20=20 hci_vendor.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 l2cap.c 1.96 1.97=20=20=20=20=20=20=20=20=20=20=20=20 rfcomm.c 1.97 1.98=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Include linux/config.h where required to keep 'make dep' happy. The diff of the modified file(s): --- hci.c 2001/03/30 11:30:44 1.135 +++ hci.c 2001/04/10 12:27:10 1.136 @@ -45,6 +45,7 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/bluetooth/sysdep-2.1.h> #include <linux/malloc.h> #include <linux/timer.h> --- hci_vendor.c 2001/03/31 15:49:02 1.19 +++ hci_vendor.c 2001/04/10 12:27:10 1.20 @@ -44,6 +44,7 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/bluetooth/sysdep-2.1.h> #include <linux/malloc.h> #include <linux/timer.h> --- l2cap.c 2001/03/31 16:35:58 1.96 +++ l2cap.c 2001/04/10 12:27:10 1.97 @@ -45,9 +45,9 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ -#include <linux/malloc.h> - +#include <linux/config.h> #include <linux/bluetooth/sysdep-2.1.h> +#include <linux/malloc.h> #include <linux/bluetooth/l2cap.h> #include <linux/bluetooth/hci.h> #include <linux/bluetooth/rfcomm.h> --- rfcomm.c 2001/04/10 10:50:39 1.97 +++ rfcomm.c 2001/04/10 12:27:10 1.98 @@ -45,6 +45,7 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__=20 +#include <linux/config.h> #include <linux/bluetooth/sysdep-2.1.h> #include <linux/malloc.h> #include <linux/types.h> |
From: Peter K. <pk...@us...> - 2001-04-10 12:26:41
|
The following files were modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- btcommon.h 1.67 1.68=20=20=20=20=20=20=20=20=20=20=20=20 btconfig.h 1.23 1.24=20=20=20=20=20=20=20=20=20=20=20=20 rfcomm.h 1.35 1.36=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Include linux/config.h where required to keep 'make dep' happy. The diff of the modified file(s): --- btcommon.h 2001/03/30 09:40:53 1.67 +++ btcommon.h 2001/04/10 12:26:41 1.68 @@ -51,7 +51,6 @@ #include <linux/bluetooth/btconfig.h> #include <linux/timer.h> #include <linux/module.h> -#include <linux/config.h> #include <linux/sched.h> #include <linux/version.h> #else --- btconfig.h 2001/03/05 16:33:36 1.23 +++ btconfig.h 2001/04/10 12:26:41 1.24 @@ -39,6 +39,10 @@ * */ =20 +#ifdef __KERNEL__ +#include <linux/config.h> +#endif + /* * When the stack is included as part of the kernel source tree, this macro * is defined, and we can use the standard Linux kernel config instead of --- rfcomm.h 2001/03/07 20:09:24 1.35 +++ rfcomm.h 2001/04/10 12:26:41 1.36 @@ -47,6 +47,7 @@ /****************** INCLUDE FILES SECTION ********************************= ***/ =20 #ifdef __KERNEL__ +#include <linux/config.h> #include <linux/types.h> #include <linux/bluetooth/btcommon.h> #else |
From: Peter K. <pk...@us...> - 2001-04-10 10:50:41
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.96 1.97=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added the packed attribute to the bits structure in the long_length union (thanks to Claus Tondering). The diff of the modified file(s): --- rfcomm.c 2001/03/30 12:03:25 1.96 +++ rfcomm.c 2001/04/10 10:50:39 1.97 @@ -185,11 +185,10 @@ } __attribute__ ((packed)) short_length; =20 typedef union long_length{ -// David LIBAULT : THIS WAS NOT WORKING AT UPF4.5... struct bits { u8 ea:1; unsigned short len:15; - } bits ; + } __attribute__ ((packed)) bits ; u16 val ; } __attribute__ ((packed)) long_length; =20 @@ -388,7 +387,7 @@ struct bits { unsigned short len:15; u8 ea:1; - } bits; + } __attribute__ ((packed)) bits; u16 val; } __attribute__ ((packed)) long_length; =20 |
From: liu j. <ljk...@ya...> - 2001-04-09 03:25:47
|
hello all: Is there any one interested in giving the protocol stack a socket interface? __________________________________________________ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ |
From: Peter K. <pk...@us...> - 2001-04-04 12:39:18
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_vendor.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected #endif's. The diff of the modified file(s): --- bt_vendor.c 2001/03/30 12:44:11 1.5 +++ bt_vendor.c 2001/04/04 12:39:17 1.6 @@ -186,7 +186,6 @@ { perror("test con req"); } -=20=20 #else hdl =3D hci_test_connect_req(btcon.bd); #endif @@ -264,7 +263,6 @@ fd_setup(phys_fd, spd, USE_FLOW_CTRL);=20=20 =20 tcflush(phys_fd, TCIOFLUSH); - } =20 #elif HW_USED(HW_CSR) @@ -326,6 +324,7 @@ printf("Setting write_scan_enable in USB module!\n"); =20=20=20 bt_write_scan_enable(bt_cfd, wrscan); +#endif } =20 #elif HW_USED(HW_NOINIT) @@ -359,15 +358,6 @@ printf("ERROR: init_hw() not implemented!\n"); } =20 - #endif /* HW_USED() */ =20 - - - -#endif /* TEST */ - /*********************************************************************/ - - - |
From: Peter K. <pk...@us...> - 2001-04-04 10:43:06
|
The following files were modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_misc.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 btcon.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 btd.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 bttest.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use bd2str() instead of print_bd_addr(). The diff of the modified file(s): --- bt_misc.c 2001/04/04 10:31:19 1.4 +++ bt_misc.c 2001/04/04 10:43:04 1.5 @@ -331,10 +331,14 @@ return; } =20 -void print_bd_addr(char* str, unsigned char bd[6]) +const char* bd2str(const unsigned char *bd) { - printf("%s: %02X:%02X:%02X:%02X:%02X:%02X\n", - str, bd[0], bd[1], bd[2], bd[3], bd[4], bd[5]); + static char buf[20]; + + sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", + bd[0], bd[1], bd[2], bd[3], bd[4], bd[5]); + + return buf; } =20 void=20 --- bt_misc.h 2001/03/30 12:34:54 1.3 +++ bt_misc.h 2001/04/04 10:43:04 1.4 @@ -59,7 +59,7 @@ =20 int write_pidfile(char *pidname); void get_local_addr(char *str); -void print_bd_addr(char* str, unsigned char *bd); +const char* bd2str(const unsigned char *bd); #ifndef BT_USERSTACK void print_data(const char *message, unsigned char *buf, int len); #endif --- btcon.c 2001/04/04 10:32:03 1.3 +++ btcon.c 2001/04/04 10:43:04 1.4 @@ -175,8 +175,7 @@ =20=20=20 /* Connect RFCOMM session on line */ =20=20 - print_bd_addr("Connecting to ", bd); - printf("on line %d\n", line); + printf("Connecting to %s on line %d\n", bd2str(bd), line); =20 con_id =3D CREATE_RFCOMM_ID(line, srvch << 1); =20 --- btd.c 2001/03/26 15:30:36 1.6 +++ btd.c 2001/04/04 10:43:04 1.7 @@ -268,8 +268,7 @@ physdev =3D optarg; break; =20=20=20=20=20=20=20 - case '?' : - printf("unknown option: %c\n", optopt); + default: break; } } @@ -294,7 +293,7 @@ =20 /* Sets initial HW baudrate */ if (init_hw_speed !=3D 0) - fd_setup(phys_fd, init_hw_speed, 1); + fd_setup(phys_fd, init_hw_speed, USE_FLOW_CTRL); else init_phys(phys_fd); =20 @@ -359,10 +358,10 @@ =20=20=20=20=20=20=20 default: { +#ifdef USE_IPASSIGN /* Got data on some fd */ int i, retval; =20 -#ifdef USE_IPASSIGN=20 for (i=3D0; i < result; i++)=20 { /* IPA response */ @@ -400,7 +399,7 @@ STATE(line) =3D CONNECTED; =20=20=20=20=20=20=20 read_remote_bd(bt_cfd, PEER(line).remote_bd); - print_bd_addr("remote bd ", PEER(line).remote_bd); + printf("Remote bd: %s\n", bd2str(PEER(line).remote_bd)); =20=20=20=20=20=20=20 #ifdef USE_IPASSIGN D(syslog(LOG_INFO, "Sending IPA request\n")); --- bttest.c 2001/03/30 12:46:32 1.5 +++ bttest.c 2001/04/04 10:43:04 1.6 @@ -249,7 +249,7 @@ { unsigned char my_bd_addr[6];=20=20 read_local_bd(bt_cfd, my_bd_addr); - print_bd_addr("Local BD ", my_bd_addr); + printf("Local BD: %s\n", bd2str(my_bd_addr)); } else if(sscanf(buf, "role_switch %x:%x:%x:%x:%x:%x %d ", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4],=20 @@ -313,7 +313,7 @@ bd[i] =3D (unsigned char)tmp[i]; } =20=20 - print_bd_addr("Pinging ", bd); + printf("Pinging: %s\n", bd2str(bd)); =20 /* fill it with something */ memset(buf, 'A', count); @@ -332,7 +332,7 @@ bd[i] =3D (unsigned char)tmp[i]; } =20=20 - print_bd_addr("Get info from : ", bd); + printf("Get info from: %s\n", bd2str(bd)); =20 bt_getinfo(bt_cfd, bd, type); } |
From: Peter K. <pk...@us...> - 2001-04-04 10:33:05
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btdisc.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Correctly support -D as option. * Minor clean-up. The diff of the modified file(s): --- btdisc.c 2001/03/31 16:31:21 1.3 +++ btdisc.c 2001/04/04 10:33:03 1.4 @@ -62,34 +62,27 @@ #include "bt_conf.h" #include "bt_misc.h" =20=20=20=20=20 +#define DEFAULT_BTDEV "/dev/ttyBT0" + /*=20 - * Syntax : btdisc -d <dev> -D <rfcomm dlci>=20 + * Syntax : btdisc [-d <dev>] -D <rfcomm dlci>=20 */ =20 int main(int argc, char **argv) { + char *btdev =3D DEFAULT_BTDEV; int con_id, bt_cfd, dlci=3D-1, line, opt; - char *btdev =3D "/dev/ttyBT0"; /* default */=20=20 - int ret_val; + int result; =20 -#ifdef __CRIS__ /* Print header if called via http */ if (getenv("REQUEST_METHOD") !=3D NULL) { printf("Content-type: text/plain\r\n\r\n"); } -#endif =20 - /* First of all check that stack is running */ - if (!bt_isinitiated()) - { - printf("Stack not initiated, exit\n"); - exit(1); - } - /* now parse options */ -#define OPTIONS_STRING "d:S:" +#define OPTIONS_STRING "d:D:" =20=20 while ((opt =3D getopt(argc, argv, OPTIONS_STRING)) !=3D -1) { @@ -106,19 +99,25 @@ printf("RFCOMM dlci : %d\n", dlci); break; =20=20=20=20=20=20=20 - case '?': - printf("unknown option: %c\n", optopt); + default: break; } } =20 - if (argc < 2 || (dlci < 0)) + if (optind < argc || dlci < 0) { printf("Wrong syntax or missing parameters\n"); - printf("Syntax : btdisc -d <dev> -D <rfcomm dlci>\n"); + printf("Syntax: %s [-d <dev>] -D <rfcomm dlci>\n", argv[0]); exit(0); } =20 + /* First of all check that stack is running */ + if (!bt_isinitiated()) + { + printf("Stack not initiated, exit\n"); + exit(1); + } + /* Open BT ctrl device */ bt_cfd =3D bt_openctrl(); =20 @@ -129,8 +128,8 @@ =20 con_id =3D CREATE_RFCOMM_ID(line, dlci); =20 - ret_val =3D bt_disconnect(bt_cfd, con_id); + result =3D bt_disconnect(bt_cfd, con_id); =20 close(bt_cfd); - exit(ret_val); + exit(result); } |
From: Peter K. <pk...@us...> - 2001-04-04 10:32:05
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btcon.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Minor clean-up. The diff of the modified file(s): --- btcon.c 2001/03/21 18:46:02 1.2 +++ btcon.c 2001/04/04 10:32:03 1.3 @@ -65,33 +65,24 @@ #define DEFAULT_BTDEV "/dev/ttyBT0" =20 /* - * Syntax : btcon -d <device> -p <pincode> -a <BD> -S <rfcomm srv ch> + * Syntax : btcon [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm srv ch>] * If using 'disable' as pin, authentication is disabled=20 */ =20 int main(int argc, char **argv) { - char *btdev =3D NULL; + char *btdev =3D DEFAULT_BTDEV; char *bd_str =3D NULL; unsigned char bd[6]; int con_id, opt, i, result; int line, bt_cfd, srvch =3D 1; =20 -#ifdef __CRIS__ /* Print header if called via http */ if (getenv("REQUEST_METHOD") !=3D NULL) { printf("Content-type: text/plain\r\n\r\n"); } -#endif - - /* First of all check that stack is running */ - if (!bt_isinitiated()) - { - printf("Stack not initiated, exit\n"); - exit(1); - } =20 /* now parse options */ #define OPTIONS_STRING "a:d:r:S:p:" @@ -100,7 +91,6 @@ { switch(opt) { -=20=20=20=20=20=20 case 'a': { int tmp[6], all_read =3D 0; @@ -145,15 +135,13 @@ case 'd': /* BT device */ btdev=3Doptarg; - printf("btdev : %s\n", btdev); + printf("btdev %s\n", btdev); break; =20=20=20=20=20=20=20 case 'p': - {=20 /* If using 'disable' as pin, authentication is disabled */ printf("Using pin code : %s\n", optarg); set_pin_code(optarg); - } break; =20 case 'S': @@ -161,19 +149,22 @@ printf("Using rfcomm server ch : %d\n", srvch); break; =20=20=20=20=20=20=20 - case '?': - printf("unknown option: %c\n", optopt); + default: break; } } =20 - if (!btdev) - btdev =3D DEFAULT_BTDEV; - - if (argc < 2 || (bd_str =3D=3D NULL)) + if (optind < argc || !bd_str) {=20=20=20=20 printf("Wrong syntax or missing parameters\n"); - printf("Syntax : btcon -d <device> -p <pincode> -a <BD> -S <rfcomm srv= ch>\n");=20=20=20=20=20=20=20=20 + printf("Syntax: %s [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm sr= v ch>]\n", argv[0]); + exit(1); + } + + /* First of all check that stack is running */ + if (!bt_isinitiated()) + { + printf("Stack not initiated, exit\n"); exit(1); } =20 |
From: Peter K. <pk...@us...> - 2001-04-04 10:31:21
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Allow 921600 as baud rate also for non-CRIS compiles. * Minor clean-up. The diff of the modified file(s): --- bt_misc.c 2001/03/21 18:24:40 1.3 +++ bt_misc.c 2001/04/04 10:31:19 1.4 @@ -201,7 +201,6 @@ &client_len); =20=20=20=20=20 return client_sockfd; - } else { @@ -283,12 +282,9 @@ case 460800: speed_c =3D B460800; break; - -#ifdef __CRIS__ case 921600: speed_c =3D B921600; break; -#endif =20 default: printf("Bad baudrate %d.\n", spd); @@ -345,12 +341,13 @@ print_data(const char *message, unsigned char *buf, int len) {=20 int t; + printf("\n%s (%d)", message, len); for (t=3D0;t<len;t++)=20 { - if((t%16)=3D=3D0) + if(!(t % 16)) printf("\n "); - printf("0x%02x ", (uint)(buf[t])); + printf("0x%02x ", (uint)buf[t]); } printf("\n"); } @@ -359,25 +356,20 @@ void set_pin_code(char *pin) { #ifdef __CRIS__ - /* Set pincode */ char exec_pinstr[100];=20=20=20=20=20=20=20=20 =20 - if (strncmp(pin, "disable", 7) =3D=3D 0) + if (strcmp(pin, "disable") =3D=3D 0) { printf("Disable PIN usage\n"); - system("/bin/parhandclient -nosync set root.Security.UseLANSecurity no= "); - system("/bin/parhandclient sync"); + system("/bin/parhandclient -nosync set root.Security.UseLANSecurity no= sync"); return; } - - /* Set pin in stack */ - sprintf(exec_pinstr, "/bin/parhandclient -nosync set root.Security.PINCo= de %s", (char*) pin);=20=20 =20=20=20 + /* Set pinconde */ system("/bin/parhandclient -nosync set root.Security.UseLANSecurity yes"= ); + sprintf(exec_pinstr, "/bin/parhandclient -nosync set root.Security.PINCo= de %s sync", pin);=20=20 system(exec_pinstr); - system("/bin/parhandclient sync"); #else - printf("set_pin_code not implemented [%s, line %d]\n",=20 - __FILE__, __LINE__); + printf("set_pin_code not implemented [%s, line %d]\n", __FILE__, __LINE_= _); #endif } |
From: Gordon M. <gm...@us...> - 2001-04-01 15:50:15
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.159 1.160=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Fixed a bug where bt_write_top could write past the end of an allocated b= uffer. The diff of the modified file(s): --- bluetooth.c 2001/03/31 15:51:26 1.159 +++ bluetooth.c 2001/04/01 15:50:12 1.160 @@ -1373,6 +1373,11 @@ rfcomm_conid =3D CREATE_RFCOMM_ID(line, bt->dlci); =20=09 if (from_user) { + /* Our tmp_bt_buf is only one page, but nothing prevents the + * caller from giving us more than that to send. Make sure we + * don't try to write beyond the end of tmp_bt_buf. + */ + count =3D MIN(count, PAGE_SIZE); copy_from_user(tmp_bt_buf, buf, count); bytes_sent =3D rfcomm_send_data(rfcomm_conid, tmp_bt_buf, count); } else { |
From: Mattias A. <mat...@us...> - 2001-03-31 16:36:00
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- l2cap.c 1.95 1.96=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: don't do cfm to upper layers before setting c_result The diff of the modified file(s): --- l2cap.c 2001/03/30 11:59:20 1.95 +++ l2cap.c 2001/03/31 16:35:58 1.96 @@ -1176,8 +1176,8 @@ #ifdef CONFIG_BLUETOOTH_L2CAP_USE_TIMERS disable_rtx(con); #endif - l2ca_disconnect_cfm(con); con->c_result =3D RES_SUCCESS; + l2ca_disconnect_cfm(con); l2ca_wakeup("l2cap_disconnect_rsp", con); break; =20=20=20=20=20=20=20=20 |
From: Mattias A. <mat...@us...> - 2001-03-31 16:31:31
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btdisc.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: changed name of dlci option The diff of the modified file(s): --- btdisc.c 2001/03/21 18:47:18 1.2 +++ btdisc.c 2001/03/31 16:31:21 1.3 @@ -63,7 +63,7 @@ #include "bt_misc.h" =20=20=20=20=20 /*=20 - * Syntax : btdisc -d <dev> -S <rfcomm dlci>=20 + * Syntax : btdisc -d <dev> -D <rfcomm dlci>=20 */ =20 int @@ -101,7 +101,7 @@ printf("btdev : %s\n", btdev); break; =20=20=20=20=20=20=20=20=20=20=20 - case 'S': + case 'D': dlci =3D atoi(optarg); printf("RFCOMM dlci : %d\n", dlci); break; @@ -115,7 +115,7 @@ if (argc < 2 || (dlci < 0)) { printf("Wrong syntax or missing parameters\n"); - printf("Syntax : btdisc -d <dev> -S <rfcomm dlci>\n"); + printf("Syntax : btdisc -d <dev> -D <rfcomm dlci>\n"); exit(0); } =20 |
From: Mattias A. <mat...@us...> - 2001-03-31 15:51:28
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.158 1.159=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added show_bt_vendor during init which shows the configured BT vendor The diff of the modified file(s): --- bluetooth.c 2001/03/30 11:00:41 1.158 +++ bluetooth.c 2001/03/31 15:51:26 1.159 @@ -2195,6 +2195,8 @@ /* Initialise all layers in the bluetooth stack */ =20=09 DSYS("Initialising Bluetooth Stack\n"); + + show_bt_vendor(); hci_init(); l2cap_init(); =20 |
From: Mattias A. <mat...@us...> - 2001-03-31 15:49:41
|
The following file was modified in linux/include/linux/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.h 1.49 1.50=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added show_bt_vendor The diff of the modified file(s): --- hci.h 2001/03/30 10:48:07 1.49 +++ hci.h 2001/03/31 15:49:39 1.50 @@ -155,6 +155,7 @@ s32 hci_set_bd_addr(u8 bd[6]); s32 hci_set_baudrate(u32 baudrate);=20 s32 hci_read_firmware_rev_info(void); +void show_bt_vendor(void); =20 #endif /****************** END OF FILE hci.h ************************************= ***/ |
From: Mattias A. <mat...@us...> - 2001-03-31 15:49:06
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_vendor.c 1.18 1.19=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added function show_bt_vendor added define VENDOR in all debug printouts The diff of the modified file(s): --- hci_vendor.c 2001/03/16 07:38:48 1.18 +++ hci_vendor.c 2001/03/31 15:49:02 1.19 @@ -108,6 +108,8 @@ /********************** Ericsson functions *******************************= ****/ /*************************************************************************= ****/ =20 +#define VENDOR " [Ericsson]" + s32=20 hci_set_bd_addr(u8 bd[6]) { @@ -115,13 +117,13 @@ u8 tmp_bd[6]; s32 i; =20=20=20 - D_CMD(__FUNCTION__"\n"); + D_CMD(__FUNCTION__ VENDOR "\n"); =20 for (i =3D 0; i < 6; i++) { tmp_bd[5-i] =3D bd[i]; } =20=20=20 - PRINTPKT(__FUNCTION__":", bd, 6); + PRINTPKT(__FUNCTION__ VENDOR ":", bd, 6); pkt[0] =3D CMD_PKT; pkt[1] =3D 0x0d; pkt[2] =3D 0xfc; @@ -134,7 +136,7 @@ s32 hci_read_firmware_rev_info(void) { - D_CMD(__FUNCTION__"\n"); + D_CMD(__FUNCTION__ VENDOR "\n"); c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(0xf, 0x3f) ; c_pkt.len =3D 0; @@ -150,7 +152,7 @@ on the new baudrate, this function can not block (Since btd sets the new physical device speed when this function returns). */=20=20 =20=20=20 - D_CMD(__FUNCTION__"(%d baud)\n", baudrate); + D_CMD(__FUNCTION__ VENDOR "(%d baud)\n", baudrate); c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(ERICSSON_SET_UART_BAUD_RATE, 0x3f) ; c_pkt.len =3D 1; @@ -164,7 +166,7 @@ case 460800: c_pkt.data[0] =3D 0x00; break; default: - D_ERR(__FUNCTION__ ": Baudrate not supported\n"); + D_ERR(__FUNCTION__ VENDOR ": Baudrate not supported\n"); return -EINVAL; } =20 @@ -172,7 +174,7 @@ send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); #else if (hci_ctrl.hc_buf.cmd_num < 1) { - DSYS(__FUNCTION__ ": sleeping\n"); + DSYS(__FUNCTION__ VENDOR ": sleeping\n"); interruptible_sleep_on(&set_baudrate_wq); } bt_write_lower_driver((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); @@ -190,13 +192,13 @@ { switch (ocf) { case 0x04: - D_CMD(__FUNCTION__" Synth on set\n"); + D_CMD(__FUNCTION__ VENDOR " Synth on set\n"); release_cmd_timer(); wake_up_interruptible(&hci_wq); break; =20=20=20=20=20 case ERICSSON_SET_UART_BAUD_RATE: - D_CMD(__FUNCTION__" Ericsson baudrate set\n"); + D_CMD(__FUNCTION__ VENDOR " baudrate set\n"); #ifdef CONFIG_BLUETOOTH_SET_BAUDRATE_BLOCKING release_cmd_timer(); wake_up_interruptible(&hci_wq); @@ -204,7 +206,7 @@ break; =20 case ERICSSON_WRITE_BD_ADDR: - D_CMD(__FUNCTION__" Ericsson BD_ADDR set\n"); + D_CMD(__FUNCTION__ VENDOR " BD_ADDR set\n"); release_cmd_timer(); wake_up_interruptible(&hci_wq); break; @@ -224,7 +226,7 @@ case ERICSSON_ENTER_TEST_MODE: release_cmd_timer(); if (r_val[0]) { - D_ERR(__FUNCTION__" ERICSSON_ENTER_TEST_MODE %s\n", + D_ERR(__FUNCTION__ VENDOR " ENTER_TEST_MODE %s\n", get_err_msg(r_val[0])); } wake_up_interruptible(&hci_wq); @@ -233,7 +235,7 @@ case ERICSSON_TEST_CONTROL: release_cmd_timer(); if (r_val[0]) { - D_ERR(__FUNCTION__" ERICSSON_TEST_CONTROL %s\n", + D_ERR(__FUNCTION__ VENDOR " TEST_CONTROL %s\n", get_err_msg(r_val[0])); } wake_up_interruptible(&hci_wq); @@ -242,14 +244,14 @@ case ERICSSON_TX_TEST: release_cmd_timer(); if (r_val[0]) { - D_ERR(__FUNCTION__" ERICSSON_TX_TEST %s\n", get_err_msg(r_val[0])); + D_ERR(__FUNCTION__ VENDOR " TX_TEST %s\n", get_err_msg(r_val[0])); } wake_up_interruptible(&hci_wq); break; =20=20=20=20=20 default: release_cmd_timer(); - D_ERR(__FUNCTION__" Manufacturer specific : Invalid reply (0x%x)\n", ocf= ); + D_ERR(__FUNCTION__ VENDOR " Manufacturer specific : Invalid reply (0x%x)= \n", ocf); wake_up_interruptible(&hci_wq); break; } @@ -259,7 +261,7 @@ void process_vendor_event(u8 *buf, u32 len, u32 event_code) { - D_ERR(__FUNCTION__" Vendor specicic event not recognized.\n"); + D_ERR(__FUNCTION__ VENDOR " Vendor specicic event not recognized.\n"); } =20 =20 @@ -274,10 +276,12 @@ /************************* Digianswer functions **************************= ****/ /*************************************************************************= ****/ =20 +#define VENDOR " [Digianswer]" + s32=20 hci_set_bd_addr(u8 bd[6]) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -285,7 +289,7 @@ s32 hci_read_firmware_rev_info(void) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -296,7 +300,7 @@ u8 pkt[5]; s32 tmp; =20=20=20 - D_CMD(__FUNCTION__"(%d baud)\n", baudrate); + D_CMD(__FUNCTION__ VENDOR "(%d baud)\n", baudrate); pkt[0] =3D CMD_PKT; pkt[1] =3D 0x07; pkt[2] =3D 0xfc; @@ -349,9 +353,9 @@ void process_vendor_event(u8 *buf, u32 len, u32 event_code) { - D_REC(__FUNCTION__"DIGIANSWER EVENT\n"); + D_REC(__FUNCTION__ VENDOR "\n"); if (len =3D=3D 0x01) { - D_REC(__FUNCTION__"DIGIANSWER RESET REQUEST EVENT\n"); + D_REC(__FUNCTION__ VENDOR "RESET REQUEST EVENT\n"); } else {=09=09=09 printk(get_digi_err_code(buf[0])); } @@ -364,13 +368,13 @@ { switch (ocf) { case 0x07: - D_CMD(__FUNCTION__" Digianswer baudrate set\n"); + D_CMD(__FUNCTION__ VENDOR "baudrate set\n"); release_cmd_timer(); wake_up_interruptible(&hci_wq); break; =20=20=20=20=20 default: - D_ERR(__FUNCTION__" Manufacturer specific : Invalid reply (0x%x)\n", ocf= ); + D_ERR(__FUNCTION__ VENDOR " Manufacturer specific : Invalid reply (0x%x)= \n", ocf); break; } } @@ -387,7 +391,7 @@ send_negotiation_pkt(void) { u8 pkt[8]; - D_CTRL(__FUNCTION__"\n"); + D_CTRL(__FUNCTION__ VENDOR "\n"); pkt[0] =3D NEG_PKT; pkt[1] =3D seq_nbr; seq_nbr++; @@ -407,10 +411,12 @@ /****************************** CSR functions ****************************= ****/ /*************************************************************************= ****/ =20 +#define VENDOR " [CSR]" + s32=20 hci_set_bd_addr(u8 bd[6]) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -418,7 +424,7 @@ s32 hci_read_firmware_rev_info(void) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -426,7 +432,7 @@ s32=20 hci_set_baudrate(u32 baudrate) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -434,14 +440,14 @@ void process_vendor_event(u8 *buf, u32 len, u32 event_code) { - D_REC(__FUNCTION__"CSR EVENT\n"); + D_REC(__FUNCTION__ VENDOR "\n"); } =20 =20 void process_vendor_return_param(u32 ocf, u8* r_val) { - D_ERR(__FUNCTION__"Manufacturer specific : Invalid reply (0x%x)\n", ocf); + D_ERR(__FUNCTION__ VENDOR "Manufacturer specific : Invalid reply (0x%x)\n= ", ocf); } =20 =20 @@ -459,7 +465,7 @@ s32=20 hci_set_bd_addr(u8 bd[6]) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -467,7 +473,7 @@ s32 hci_read_firmware_rev_info(void) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -475,7 +481,7 @@ s32=20 hci_set_baudrate(u32 baudrate) { - D_ERR(__FUNCTION__" not supported.\n"); + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); return 0; } =20 @@ -483,14 +489,14 @@ void process_vendor_event(u8 *buf, u32 len, u32 event_code) { - D_REC(__FUNCTION__"Manufacturer specific : Unknown event.\n"); + D_REC(__FUNCTION__ VENDOR "Manufacturer specific : Unknown event.\n"); } =20 =20 void process_vendor_return_param(u32 ocf, u8* r_val) { - D_ERR(__FUNCTION__"Manufacturer specific : Invalid reply (0x%x)\n", ocf); + D_ERR(__FUNCTION__ VENDOR "Manufacturer specific : Invalid reply (0x%x)\n= ", ocf); } =20 =20 @@ -500,5 +506,10 @@ } =20 #endif + +void show_bt_vendor() +{ + DSYS("Current HW : %s\n", VENDOR); +} =20 /********************* END OF FILE hci_vendor.c **************************= ****/ |
From: Mattias A. <mat...@us...> - 2001-03-30 12:49:08
|
The following file was modified in apps/bluetooth/btd: Name Old version New version Comment ---- ----------- ----------- ------- btd.c 1.88 1.89=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: don't exit if inquiry fails updated l2cap_ping function for usermode stack The diff of the modified file(s): --- btd.c 2001/03/20 12:13:17 1.88 +++ btd.c 2001/03/30 12:49:06 1.89 @@ -1455,7 +1455,7 @@ printf("Pinging bd : %02X:%02X:%02X:%02X:%02X:%02X\n", tmp_bd[0], tmp_bd[1], tmp_bd[2], tmp_bd[3], tmp_bd[4], tmp_bd[5]); - l2ca_ping(tmp_bd); + l2ca_ping(tmp_bd, NULL, 0); } else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %x", &bd[0], &bd[1], &bd[2], &bd[3], &bd[4], &bd[5],=20 @@ -2906,7 +2906,7 @@ if (ioctl(bt_cfd, HCIINQUIRY, inq_res) < 0) { perror("Inquiry"); - exit(1); + return; } =20=20=20=20=20 for (i =3D 0; i < inq_res->nbr_of_units; i++) |
From: Mattias A. <mat...@us...> - 2001-03-30 12:46:34
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bttest.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added ping (echo req), getinfo (info req) for kernel mode stack aswell The diff of the modified file(s): --- bttest.c 2001/03/26 15:35:44 1.4 +++ bttest.c 2001/03/30 12:46:32 1.5 @@ -85,12 +85,14 @@ " rf_send <nbr bytes> <nbr repeats> <line>",=20 " rf_disc <line>", " rf_wait <line>", /* waits for a connection on that line */ - " ping <xx:xx:xx:xx:xx:xx>", + " ping <xx:xx:xx:xx:xx:xx> <nbr bytes>", + " getinfo <xx:xx:xx:xx:xx:xx> <type>", " setbd <xx:xx:xx:xx:xx:xx>", /* only ericsson HW */ " readbd", /* read module bd address */ " reset", /* reset board */ " role_switch <xx:xx:xx:xx:xx:xx> <role> (0=3Dmaster, 1=3Dslave)", " stat ", /* similar to reading the /proc/bt */ + " testcmd <test string>", #ifdef ECS_TEST_FUNCTIONS " ecs_entertest <handle> (hex)", " ecs_testctrl <par1,par2,...,par9> (hex)", @@ -108,7 +110,6 @@ " test_conn <xx:xx:xx:xx:xx:xx> <psm>", /* l2cap test using PSM psm */ " test_disc", /* disconnect all (both) test connections */ " test_case_reject <xx:xx:xx:xx:xx:xx>",=20 - " getinfo <xx:xx:xx:xx:xx:xx> <type>", " ", " bb_conn <xx:xx:xx:xx:xx:xx>", /* connect only baseband */ " bb_disc <hci handle>", /* disconnect baseband */ @@ -248,6 +249,7 @@ { unsigned char my_bd_addr[6];=20=20 read_local_bd(bt_cfd, my_bd_addr); + print_bd_addr("Local BD ", my_bd_addr); } else if(sscanf(buf, "role_switch %x:%x:%x:%x:%x:%x %d ", &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4],=20 @@ -298,23 +300,46 @@ { bt_showstatus(); } - else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x", - &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6) + else if (sscanf(buf, "ping %x:%x:%x:%x:%x:%x %d", + &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20 + &tmp[6]) =3D=3D 7) { + unsigned char buf[1024]; unsigned char bd[6]; + int count =3D tmp[6]; =20=20=20=20=20 for (i =3D 0; i < 6; i++) { bd[i] =3D (unsigned char)tmp[i]; } =20=20 - printf("Pinging bd : %02X:%02X:%02X:%02X:%02X:%02X\n", - bd[0], bd[1], bd[2], - bd[3], bd[4], bd[5]); + print_bd_addr("Pinging ", bd); =20 - bt_ping(bt_cfd, bd, NULL, 0); + /* fill it with something */ + memset(buf, 'A', count); + + bt_ping(bt_cfd, bd, (unsigned char*)&buf , (unsigned short)count);=20= =20 + } + else if (sscanf(buf, "getinfo %x:%x:%x:%x:%x:%x %d", + &tmp[0], &tmp[1], &tmp[2], &tmp[3], &tmp[4], &tmp[5],=20 + &tmp[6]) =3D=3D 7) + { + unsigned char bd[6]; + unsigned short type =3D tmp[6]; + + for (i =3D 0; i < 6; i++) + { + bd[i] =3D (unsigned char)tmp[i]; } =20 + print_bd_addr("Get info from : ", bd); + + bt_getinfo(bt_cfd, bd, type); + } + else if (strncmp(buf, "testcmd", 7) =3D=3D 0) + { + bt_testcmd(bt_cfd, buf+7); + } /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ /* FIXME !!! -- make this work for both kernel / 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=3D=3D */ |
From: Mattias A. <mat...@us...> - 2001-03-30 12:45:13
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- btinit.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: minor changes, now btinit works with usermode stack The diff of the modified file(s): --- btinit.c 2001/03/22 11:12:10 1.4 +++ btinit.c 2001/03/30 12:45:11 1.5 @@ -96,7 +96,6 @@ #include "bt_vendor.h" #include "bt_misc.h" #include "bt_if.h" -#include "bt_ipa.h" =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 */ @@ -110,9 +109,9 @@ static int init_hw_speed =3D 0; /* not set */ static int do_hwinit =3D 1; /* do vendor specific initialization */ static int do_reset =3D 0; /* reset hw using I/O pins */ -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; +int phys_fd =3D -1; /* physical device e.g ttyS0 */ =20 /* long option list */ static struct option long_options[] =3D @@ -141,7 +140,6 @@ =20 syslog(LOG_INFO, "Bluetooth daemon starting\n"); =20 - if (atexit(btd_cleanup) < 0) { printf("btd failed to register cleanup function.\n"); @@ -290,6 +288,7 @@ static void btd_cleanup(void) { + printf("btd_cleanup : Shutting down stack and terminating childs\n"); syslog(LOG_INFO, "btd_cleanup\n"); btd_killchilds(); =20 |
From: Mattias A. <mat...@us...> - 2001-03-30 12:44:13
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_vendor.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: updated according to changes replace redundant code with functions fixed communication with usermode stack minor changes & cleanup The diff of the modified file(s): --- bt_vendor.c 2001/03/21 18:27:23 1.4 +++ bt_vendor.c 2001/03/30 12:44:11 1.5 @@ -68,7 +68,6 @@ =20 #include "bt_misc.h" #include "bt_vendor.h" -#include "bt_conf.h" #include "bt_if.h" =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*/ @@ -86,7 +85,7 @@ void init_hw(int bt_cfd, int phys_fd, int spd) { - bt_set_writescanenable(bt_cfd, 0 /* not used */); + bt_write_scan_enable(bt_cfd, 0 /* not used */); =20 sleep(1); =20 @@ -148,25 +147,14 @@ printf("Poll_Period : 0x%x\n", ecs_test_msg[11]); printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[12]); printf("Length_Of_Test_Data : 0x%x\n", tmp[8]); - -#ifndef BT_USERSTACK - test_msg[0] =3D 16; - memcpy(test_msg + 1, ecs_test_msg, 16); =20 - if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0) - { - perror("ecs_testctrl"); - } -#else - hci_send_raw_data(test_msg, 16); -#endif + bt_send_raw_data(test_msg, 16); } =20 void ericsson_enter_test_mode(int bt_cfd, int* tmp) { unsigned char ecs_test_msg[7]; - unsigned char test_msg[16]; =20=20=20=20=20 ecs_test_msg[0] =3D CMD_PKT; ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_= SPEC); @@ -177,17 +165,7 @@ =20=20=20=20=20 printf("*** Sending enter test mode (handle : 0x%x)***\n", tmp[0]); =20 - test_msg[0] =3D 7; - memcpy(test_msg + 1, ecs_test_msg, 7); -=20=20=20=20 -#ifndef BT_USERSTACK - if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0) - { - perror("ecs_entertest"); - } -#else - hci_send_raw_data(test_msg, 7); -#endif + bt_send_raw_data(ecs_test_msg, 7); } =20 void @@ -216,7 +194,6 @@ printf("Returned handle : %d\n", hdl); } =20 - void ericsson_tx_test(int bt_cfd, int* tmp) { @@ -224,7 +201,6 @@ unsigned char test_msg[17]; int i; =20 -=20=20 ecs_test_msg[0] =3D CMD_PKT; ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC); @@ -254,23 +230,15 @@ printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[13]); printf("Length_Of_Test_Data : 0x%x\n", tmp[10]); =20=20=20 -#ifndef BT_USERSTACK - - test_msg[0] =3D 17; - memcpy(test_msg + 1, ecs_test_msg, 17); + bt_send_raw_data(bt_cfd, test_msg, 17); =20=20=20 - if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0) - { - perror("ecs_txtest"); - } -#else - hci_send_raw_data(test_msg, 17); -#endif printf("TX test starting.\n"); } -#endif =20 +#endif /* ECS_TEST_FUNCTIONS */ + #elif HW_USED(HW_DIGIANSWER) + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ /* Digianswer 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*/ @@ -284,19 +252,8 @@ init_hw(int bt_cfd, int phys_fd, int spd) { printf("Setting baudrate in Digianswer PC card\n"); -#ifndef BT_USERSTACK - if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0) - { - perror("HCISETBAUDRATE"); - exit(1); - } -#else - hci_set_baudrate(spd); -#if DIGI_DONGLE_SUPPORT - hci_set_baudrate(115200); -#endif =20 -#endif + bt_set_baudrate(spd); =20=20=20 if (spd > 115200) { @@ -322,49 +279,32 @@ fd_setup(fd, 115200, USE_FLOW_CTRL); } =20 +/* fixme -- remove hardcoded values */ void init_hw(int bt_cfd, int phys_fd, int spd) {=20=20 -#ifndef BT_USERSTACK unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); - unsigned int tmp[2]; - tmp[0]=3D0x50; - tmp[1]=3D0x20; =20=20=20 - sleep(1); printf("Setting write_scan_enable in CSR module!\n"); =20=20=20 - if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0) - {=20 - perror("HCIWRITESCANENABLE"); - exit(1); - } + bt_write_scan_enable(bt_cfd, wrscan); =20=20=20 /* improves reliability when doing a connect */ printf("Setting write_pagescan_activity in CSR module!\n"); - if (ioctl(bt_cfd, HCIWRITEPAGESCANACTIVITY, &tmp) < 0) - {=20 - perror("HCIWRITESCANENABLE"); - exit(1); - } =20 + bt_write_pagescan_activity(bt_cfd, 0x50, 0x20); + sleep(1); =20 syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20 =20 bt_set_baudrate(bt_cfd, spd); =20=20=20 + syslog(LOG_INFO, "Baudrate set\n"); +=20=20 /* Now set phys device speed to whatever HW was set to use */ fd_setup(phys_fd, spd, USE_FLOW_CTRL); tcflush(phys_fd, TCIOFLUSH); - -#else - printf("Setting write_scan_enable in CSR module!\n"); - hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE); - printf("Setting write_pagescan_activity in CSR module!\n"); - hci_write_pagescan_activity(0x50, 0x20); /* more reliable connection pro= cess */ - sleep(1); /* wait for HW */ -#endif } =20 #elif HW_USED(HW_GENERIC) @@ -382,18 +322,10 @@ { #ifndef BT_USERSTACK unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); - sleep(1); + printf("Setting write_scan_enable in USB module!\n"); =20=20=20 - if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0) - {=20 - perror("HCIWRITESCANENABLE"); - exit(1); - } -#else - hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE); - sleep(1); /* wait for HW */ -#endif + bt_write_scan_enable(bt_cfd, wrscan); } =20 #elif HW_USED(HW_NOINIT) @@ -429,6 +361,11 @@ =20 =20 #endif /* HW_USED() */ + + + + +#endif /* TEST */ =20 /*********************************************************************/ =20 |
From: Mattias A. <mat...@us...> - 2001-03-30 12:34:55
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_misc.h 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: don't declare print_data when linking with usermode stack The diff of the modified file(s): --- bt_misc.h 2001/03/21 18:25:56 1.2 +++ bt_misc.h 2001/03/30 12:34:54 1.3 @@ -60,7 +60,9 @@ int write_pidfile(char *pidname); void get_local_addr(char *str); void print_bd_addr(char* str, unsigned char *bd); +#ifndef BT_USERSTACK void print_data(const char *message, unsigned char *buf, int len); +#endif void set_pin_code(char *pin); =20 #endif /* __BT_MISC_H__*/ |
From: Mattias A. <mat...@us...> - 2001-03-30 12:32:49
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.h 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: added includes ueed when running with usermode stack The diff of the modified file(s): --- bt_if.h 2001/03/26 15:33:13 1.3 +++ bt_if.h 2001/03/30 12:32:47 1.4 @@ -43,8 +43,11 @@ #ifndef __BT_IF_H__ #define __BT_IP_H__ =20 -#include <pthread.h> #include "btd.h" +#ifdef BT_USERSTACK +#include <pthread.h> +#include "include/rfcomm.h" +#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=3D */ /* General defines */=20 @@ -76,12 +79,19 @@ /* SDP server */ =20 #define PID_FILE "/var/run/btd.pid" + +#ifdef BT_USERSTACK +#define SDPSRV_CMD "sdp_user" +#define SDPSRV_PROC "/tmp/sdp_sock" +#else #define SDPSRV_CMD "sdp_server" -#define SDPSRV_CONF "/etc/sdp.xml" #define SDPSRV_PROC "/proc/sdp_srv" +#endif =20 +#define SDPSRV_CONF "/etc/sdp.xml" + /* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D */ -/* Return code defines */ +/* Return code defines (see bt_errno.h in kernel)*/ =20 /* unique message status codes 32 bits : | layer 16 bits | code 16 bits | = */ =20 @@ -91,13 +101,20 @@ #define MSG_LAYER_SDP 4 #define MSG_LAYER_TCS 8 =20 +#define L2CAP_SUCCESS 0x0 +#define L2CAP_CON_PENDING 0x1 + /* Result in responses in L2CAP */ #define L2CAP_PSMNEG 0x02 #define L2CAP_SECNEG 0x03 #define L2CAP_NOSRC 0x04 =20 +#define L2CAP_FAILED 0xf0 #define L2CAP_CON_UNRESPONSIVE 0xf1 =20 + +#ifndef 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 */ /* IF Macros */ =20 @@ -192,11 +209,14 @@ #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]) +#define BTPING _IOW(BT_IOC_MAGIC, 0x73, ping_struct) + +/* | BD(6) | type (2) |*/ +#define BTGETINFO _IOW(BT_IOC_MAGIC, 0x74, unsigned char[8]) =20 /* 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)) +#define OPCODE_LSB(ocf, ogf) ((ocf) & 0xff) +#define OPCODE_MSB(ocf, ogf) (((ocf) >> 8) | (((ogf) & 0x3f) << 2)) =20 /* HCI packet types */ #define CMD_PKT 0x01 @@ -217,6 +237,8 @@ =20 #define BTSENDTESTDATA _IOW(BT_IOC_MAGIC, 0xf0, int[2]) #define HCITESTCONNECTREQ _IOW(BT_IOC_MAGIC, 0xf1, unsigned char[6]) +#define BTTESTCOMMAND _IOW(BT_IOC_MAGIC, 0xf2, unsigned char[261]) +#define BTSETMSSWITCH _IOW(BT_IOC_MAGIC, 0xf3, unsigned char) =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 */ /* Structs */ @@ -232,7 +254,14 @@ unsigned char bd_addr[0]; } inquiry_results; =20 +typedef struct ping_struct +{ + unsigned char bd[6]; + unsigned short len; + unsigned char data[1024]; +} 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 @@ -260,6 +289,7 @@ int bt_isconnected(int bt_cfd, int line); int bt_send(int fd, int len, int repeat); void bt_showstatus(void); +int bt_force_msswitch_as_server(int bt_cfd, int enable); =20 /*=20 * HCI command functions=20 @@ -268,6 +298,8 @@ 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); +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_set_baudrate(int bt_cfd, int spd); @@ -276,8 +308,10 @@ void read_remote_bd(int bt_cfd, unsigned char *bd_addr); void role_switch(int bt_cfd, unsigned char *bd_addr, int role); =20 -int bt_set_event_filter(int bt_cfd, int filter); -int bt_set_writescanenable(int bt_cfd, int flags); +int bt_set_event_filter(int bt_cfd, unsigned int filter); +int bt_write_scan_enable(int bt_cfd, unsigned int flags); +void bt_write_pagescan_activity(int bt_cfd, unsigned int interval,=20 + unsigned int wind); void bt_set_classofdevice(int bt_cfd, unsigned short service_class,=20 unsigned char major_class,=20 unsigned char minor_class,=20 @@ -303,13 +337,11 @@ =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=3D=3D */ /* Functions only used in usermode stack */ =20 #ifdef BT_USERSTACK + const char* psmname(unsigned short psm); int bt_write_lower_driver(unsigned char *data, int len); int bt_write_top(char *buf, int count, int line); @@ -318,14 +350,15 @@ void bt_sdp_connection_ready(int status); int bt_initiated(void); extern int bt_read_proc(char *buf, int len); +void init_userstack(); =20 +#ifdef BT_USERSTACK +int bt_register_rfcomm(struct rfcomm_con *rfcomm, unsigned char dlci); +void bt_connect_cfm(unsigned int con_id, int status); +#endif =20 /* FIXME<1> clean this up !!! */ bt_stat_struct bt_stat; -int bt_initdone =3D 0; -int ready_for_ppp =3D 0; -rfcomm_con *test_rfcomm; -int test_dlci; =20 /* Thread used to read data on "physical" device i.e where BT HW sits */ pthread_t read_thread; |
From: Mattias A. <mat...@us...> - 2001-03-30 12:31:47
|
The following file was modified in apps/bluetooth/experimental: Name Old version New version Comment ---- ----------- ----------- ------- bt_if.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: ignore bt_openctrl calls when running usermode stack fixed usermode stack related problems moved around some functions added sleep after setting baudrate in usermode stack fixed some return values minor changes The diff of the modified file(s): --- bt_if.c 2001/03/26 15:33:13 1.4 +++ bt_if.c 2001/03/30 12:31:46 1.5 @@ -61,57 +61,7 @@ #include "bt_vendor.h" #include "bt_misc.h" #include "bt_conf.h" - -int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len) -{ - unsigned char buf[261]; - - buf[0] =3D len; -=20=20 - memcpy(buf+1, data, len); - - print_data("data :",(char*) buf,(int) len+1); - -#ifndef BT_USERSTACK=20 - if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) - { - perror("bt_send_raw_hci"); - } -#else - printf("not yet for usermode stack...\n"); - //hci_send_raw_data(data, 16); -#endif - return 0; -} - -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 - -} - +#include "bt_user.h" =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 */ @@ -213,11 +163,16 @@ { int bt_cfd; printf("Now opening BT Ctrl TTY [%s]\n", BT_CTRL_TTY); +#ifdef BT_USERSTACK + printf("bt_openctrl : 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); exit(1); } +#endif return bt_cfd; } =20 @@ -255,7 +210,7 @@ =20=20 if (line !=3D 0) { printf("Use line 0 instead ! (usermode only)\n"); - return; + return -1; } =20 printf("Connecting srv ch %d on line %d\n", srv_ch, line); @@ -268,7 +223,7 @@ int bt_disconnect(int bt_fd, unsigned int con_id) { - int ret_val; + int ret_val =3D 0; =20=20=20 #ifndef BT_USERSTACK=20=20 if ((ret_val =3D ioctl(bt_fd, BTDISCONNECT, &con_id))) @@ -284,10 +239,10 @@ =20=20=20 if (line !=3D 0) { printf("Use line 0 instead ! (usermode only)\n"); - return; + return -1; } =20=20=20 - ret_val =3D rfcomm_disconnect_req(GET_RFCOMMLINE(con_id)); + rfcomm_disconnect_req(GET_RFCOMMLINE(con_id)); #endif =20 return ret_val; @@ -408,11 +363,9 @@ void bt_waitnewconnections(int bt_fd) { - int result; -=20=20 syslog(LOG_INFO, "bt_waitnewconnections\n"); #ifndef BT_USERSTACK - if ((result =3D ioctl(bt_fd, BTWAITNEWCONNECTIONS)) < 0) + if (ioctl(bt_fd, BTWAITNEWCONNECTIONS) < 0) { perror("bt_waitnewconnections"); exit(1); @@ -443,6 +396,113 @@ #endif } =20 +int bt_send_raw_hci(int bt_cfd, unsigned char *data, char len) +{ + unsigned char buf[261]; + + buf[0] =3D len; +=20=20 + memcpy(buf+1, data, len); + + print_data("data :",(char*) buf,(int) len+1); + +#ifndef BT_USERSTACK=20 + if (ioctl(bt_cfd, HCISENDRAWDATA, buf) < 0) + { + perror("bt_send_raw_hci"); + } +#else + printf("not yet for usermode stack...\n"); + //hci_send_raw_data(data, 16); +#endif + return 0; +} + +int bt_ping(int bt_cfd, unsigned char bd[6],=20 + unsigned char *data, unsigned short len) +{ + int ret_val; + struct ping_struct ping; +=20=20 + print_data("bt_ping BD : ", bd, 6); + memcpy(ping.bd, bd, 6); + ping.len =3D len;=20=20 + memcpy(ping.data, data, len); +=20=20 +#ifndef BT_USERSTACK=20 + if ((ret_val =3D ioctl(bt_cfd, BTPING, &ping)) !=3D 0) + { + printf("Error : %s\n", error_msg(ret_val)); + } + else + printf("Success!\n"); + +#else + ret_val =3D l2ca_ping(bd, data, len); +#endif + return ret_val; +} + + +int=20 +bt_getinfo(int bt_cfd, unsigned char bd[6], unsigned short type) +{ + int ret_val; + unsigned char msg[8]; +=20=20 + memcpy(msg, bd, 6); + msg[6] =3D (unsigned char)(type>>8); + msg[7] =3D (unsigned char)(type&0xff); + +#ifndef BT_USERSTACK=20 + if ((ret_val =3D ioctl(bt_cfd, BTGETINFO, &msg)) !=3D 0) + { + printf("Error : %s\n", error_msg(ret_val)); + } + else + printf("Success!\n"); +#else + ret_val =3D l2ca_getinfo(bd, type); +#endif + return ret_val; +} + + +int bt_testcmd(int bt_cfd, unsigned char *cmd) +{ + int ret_val; +=20=20 + printf("bt_testcmd\n"); + print_data("cmd ", cmd, strlen(cmd)); + +#ifndef BT_USERSTACK=20 + if ((ret_val =3D ioctl(bt_cfd, BTTESTCOMMAND, cmd)) !=3D 0) + { + printf("Error : %s\n", error_msg(ret_val)); + } + else + printf("Success!\n"); +#else + printf("bt_testcmd mpt for usermode stack yet\n"); +#endif + return ret_val; +} + +int bt_force_msswitch_as_server(int bt_cfd, int enable) +{ + int ret_val; + syslog(LOG_INFO, "bt_force_msswitch_as_server : % d\n"), enable; +#ifndef BT_USERSTACK=20 + if ((ret_val =3D ioctl(bt_cfd, BTSETMSSWITCH, &enable)) !=3D 0) + { + printf("Error : %s\n", error_msg(ret_val)); + } +#else + hci_force_msswitch(enable); +#endif + 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 */ @@ -512,7 +572,8 @@ syslog(LOG_INFO, "bt_set_baudrate %d baud", spd); #ifdef BT_USERSTACK tcflush(phys_fd, TCIOFLUSH); - hci_set_baudrate(spd); + result =3D hci_set_baudrate(spd); + usleep(10000); #else if ((result =3D ioctl(bt_cfd, HCISETBAUDRATE, &spd)) < 0) { @@ -532,6 +593,7 @@ perror("Read bd addr"); } #else + int i; BD_ADDR rev_bd; hci_read_local_bd(rev_bd); =20 @@ -558,7 +620,6 @@ printf("done.\n"); } =20=20 - /* fixme<1> -- add "line" parameter to differentiate between the=20 remote devices */ void @@ -584,28 +645,53 @@ } =20 /* fixme<3> - get flags from somewhere */ -int bt_set_writescanenable(int bt_cfd, int flags) +int bt_write_scan_enable(int bt_cfd, unsigned int flags) { unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE); int result; =20=20=20 - printf("Setting write_scan_enable [0x%x]\n", wrscan); + syslog(LOG_INFO, "Setting write_scan_enable [0x%x]\n", wrscan); =20 #ifdef BT_USERSTACK - hci_write_scan_enable(wrscan); + result =3D hci_write_scan_enable(wrscan); #else =20 if ((result =3D ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan)) < 0) {=20 - perror("HCIWRITESCANENABLE"); + perror("bt_set_writescanenable"); exit(1); } #endif=09 return result; } =20 -/* fixme<3> get filter from somwhere */ -int bt_set_event_filter(int bt_cfd, int filter) +void +bt_write_pagescan_activity(int bt_cfd, unsigned int interval,=20 + unsigned int wind) +{ + /* improves reliability when doing a connect */ + syslog(LOG_INFO, "Setting write_pagescan_activity in CSR module!\n"); + +#ifdef BT_USERSTACK + + hci_write_pagescan_activity(interval, wind); +#else + { + unsigned int tmp [2];=20=20 + tmp[0] =3D interval; + tmp[1] =3D wind; +=20=20=20=20 + if (ioctl(bt_cfd, HCIWRITEPAGESCANACTIVITY, &tmp) < 0) + {=20 + perror("bt_write_pagescan_activity"); + exit(1); + } + } +#endif +} + +/* fixme<3> get filter from somewhere */ +int bt_set_event_filter(int bt_cfd, unsigned int filter) { unsigned char evfilter[3]; int result; @@ -614,11 +700,11 @@ evfilter[1] =3D 0x00; /* All devices */ evfilter[2] =3D 0x01; /* No auto accept */=20=20 =20 - printf("Setting event filter [0x%1x 0x%1x 0x%1x]\n",=20 + syslog(LOG_INFO, "Setting event filter [0x%1x 0x%1x 0x%1x]\n",=20 evfilter[0], evfilter[1], evfilter[2]); =20 #ifdef BT_USERSTACK - result =3D hci_set_event_filter(&evfilter); + result =3D hci_set_event_filter((u8*)&evfilter); #else =20 if ((result =3D ioctl(bt_cfd, HCISET_EVENT_FILTER, &evfilter)) < 0) @@ -637,6 +723,7 @@ { unsigned char class_of_device[3];=20 =20=20=20 + syslog(LOG_INFO, "bt_set_classofdevice : srv class 0x%x, maj class 0x%x,= min class 0x%x, format 0x%x", service_class, major_class, minor_class, for= mat); switch (format) { case 0: @@ -655,13 +742,14 @@ #endif break; case 1: - printf("bt_set_classofdevice, Unsupported format 0x%02x\n", format); + syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n",= =20 + format); break; case 2: - printf("bt_set_classofdevice, Unsupported format 0x%02x\n", format); + syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); break; default: - printf("bt_set_classofdevice, Unsupported format 0x%02x\n", format); + syslog(LOG_INFO, "bt_set_classofdevice, Unsupported format 0x%02x\n", = format); break; } } @@ -672,7 +760,7 @@ int i; unsigned char tmp[7]; =20=09 - printf("Performing role switch to peer: %02X:%02X:%02X:%02X:%02X:%02X\n", + syslog(LOG_INFO, "Performing role switch to peer: %02X:%02X:%02X:%02X:%02= X:%02X\n", bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]); =20=09 @@ -689,7 +777,7 @@ perror("role_switch"); } #else - role_switch(bd_addr, role); + hci_switch_role(bd_addr, role); #endif } =20 @@ -700,15 +788,14 @@ if (ioctl(phys_fd, TIOCSETD, &bt_disc) < 0) { perror("Set bt line disc"); - printf("Forgot to insmod bt.o ? [bt_disc %d]\n", bt_disc); + syslog(LOG_INFO, "Forgot to insmod bt.o ? [bt_disc %d]\n", bt_disc); exit(1); } -#else - printf("ERROR : No line disciplines in usermode stack\n"); - exit(1); -#endif 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"); +#endif } =20 void set_local_name(int bt_cfd, const char *local_name) @@ -771,7 +858,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=3D=3D */ /* Misc functions */ =20 - /* See spec p 769 error codes for HCI */ const char *error_msg(int err) { @@ -853,14 +939,15 @@ =20 #ifdef BT_USERSTACK=20=20 /* if opening bt dev or control dev simply discard and return fake fd */ - if ((strcmp(dev, btdev) =3D=3D 0) || (strcmp(dev, BT_CTRL_TTY) =3D=3D 0)) + if ((strncmp(dev, "/dev/ttyBT", 11) =3D=3D 0) || (strcmp(dev, BT_CTRL_TT= Y) =3D=3D 0)) return 0xb055e; - +#if 0 /* fixme */ if (use_local_socket) return open_socket(dev, role); else if (use_tcp_socket) return open_tcpsocket(dev, role); #endif=20=20 +#endif=20=20 =20 syslog(LOG_INFO, "Opening dev %s\n", dev); if ((fd =3D open(dev, flags | O_NOCTTY)) < 0) @@ -892,13 +979,14 @@ int sdpsrv_pid; char *args[] =3D { SDPSRV_CMD, SDPSRV_CONF, SDPSRV_PROC, NULL }; =20=20=20 - syslog(LOG_INFO, "Starting SDP server\n"); + syslog(LOG_INFO, "Starting SDP server [%s]\n", SDPSRV_CMD);=20=20 =20=20=20 if (!(sdpsrv_pid =3D vfork())) { execvp(SDPSRV_CMD, args); =20 fprintf(stderr, "%s: no such file or directory\n", SDPSRV_CMD); + syslog(LOG_INFO, "%s not found", SDPSRV_CMD); =20 _exit(0); } @@ -920,6 +1008,25 @@ =20 #ifdef BT_USERSTACK =20 + +#if BT_DATADUMP_DEBUG +#define BT_DATADUMP(str, data, len) print_data(str, data, len) +#else +#define BT_DATADUMP(str, data, len) +#endif + +#if BT_DATA_DEBUG +#if BT_USE_TIMESTAMPS +#define BT_DATA(fmt...) do {print_time(1);printk(BT_DBG_STR"DATA " fmt);} = while (0) +#else +#define BT_DATA(fmt...) printk(BT_DBG_STR"DATA " fmt) +#endif + +#else /* BT_DATA_DEBUG */ +#define BT_DATA(fmt...) +#endif /* BT_DATA_DEBUG */ + + int init_read_thread(void) { printf("Initiating read thread\n"); @@ -949,13 +1056,21 @@ if (len > 0) { BT_DATA("-->|X| %3d\n", len); - PRINTPKT("data rec : ", databuf, len); + BT_DATADUMP("-->|X|", databuf, len); hci_receive_data(databuf, len); } } } } =20 +void +init_upper_pty(void) +{ + printf("init_upper_pty"); + //open_pty(); + //init_pty_thread();=20=20 +} + =20 void init_userstack() {=20=20 @@ -969,7 +1084,7 @@ hci_init(); l2cap_init(); rfcomm_init(); - sdp_init(); + sdp_init(SERVER); tcs_init(); test_init(); btmem_init(); @@ -990,7 +1105,7 @@ =20 BT_DATA("<--|X| %3d\n", len); =20 - PRINTPKT("bt_write_lower_driver ", data, len); + BT_DATADUMP("<--|X|", data, len); i =3D write(phys_fd, data, len); return i; } @@ -1004,6 +1119,7 @@ int bytes_sent =3D 0; =20 BT_DATA(" |X|<-- %3d [%d]\n", count, line); + BT_DATADUMP("|X|<--", buf, count); =20=20=20 while (bytes_sent!=3Dcount) { @@ -1030,10 +1146,13 @@ =20 int bt_receive_top(rfcomm_con *rfcomm, unsigned char *data, int len) { - int n; + int n =3D 0; =20 BT_DATA(" |X|--> %3d [%d]\n", len, rfcomm->line); + BT_DATADUMP("|X|-->", data, len); =20 +#if 0 /* fixme */ + if (modem_emulation && !modem_connected) { modem_emulator(0xb055e, data, len); @@ -1054,6 +1173,7 @@ BT_DATA("bt_receive_top: tried to write %d bytes, wrote %d\n", len, n); } +#endif =20 bt_stat.bytes_received+=3Dn; =20 @@ -1063,7 +1183,11 @@ void bt_connect_ind(unsigned int con_id)=20 { - DSYS("Got connect indication on PSM %d\n", GET_PSM(con_id)); + if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) + printf("bt_connect_ind : RFCOMM dlci : %d\n",=20 + GET_RFCOMMDLCI(con_id)); + else + printf("bt_connect_ind : psm %d\n", GET_PSM(con_id)); } =20 void @@ -1112,16 +1236,30 @@ void bt_disconnect_ind(unsigned int con_id)=20 { - DSYS("Got disconnect indication on PSM %d\n", GET_PSM(con_id)); + if (GET_PSM(con_id) =3D=3D RFCOMM_LAYER) + printf("bt_disconnect_ind : RFCOMM dlci : %d\n",=20 + GET_RFCOMMDLCI(con_id)); + else + printf("bt_disconnect_ind : psm %d\n", GET_PSM(con_id)); } =20 - int bt_register_rfcomm(struct rfcomm_con *rfcomm, u8 dlci) { test_rfcomm =3D rfcomm; - test_dlci =3D dlci; + testdlci =3D dlci; return 0; +} + +s32 +bt_register_sdp(u8 line, u8 sdpID) +{ + printf("bt_register_sdp\n"); +} + +s32 bt_unregister_sdp(s32 line) +{ + printf("bt_unregister_sdp\n"); } =20 int bt_initiated(void) |