From: Peter K. <pk...@us...> - 2001-02-26 16:07:39
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.117 1.118=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added missing \n. The diff of the modified file(s): --- hci.c 2001/02/15 16:27:33 1.117 +++ hci.c 2001/02/26 16:08:44 1.118 @@ -654,7 +654,7 @@ #ifndef HCI_EMULATION if (buf[0]) { /* remove hci handle if connection failed */ - DSYS(__FUNCTION__", CONNECTION_COMPLETE %s", get_err_msg(buf[0])); + DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n", get_err_msg(buf[0])); hci_ctrl.nbr_of_connections -=3D 1; reset_hci_con_bd(hci_hdl); } else { |
From: Mats F. <ma...@us...> - 2001-02-27 14:58:07
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.118 1.119=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added function for Read Scan Enable Corrected host_nbr_of_completed_packets function |
From: Peter K. <pk...@us...> - 2001-03-05 16:41:21
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.122 1.123=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added checks for CONFIG_BLUETOOTH_USE_SECURITY_MANAGER around all calls to sec_man_event(). The diff of the modified file(s): --- hci.c 2001/03/02 21:52:15 1.122 +++ hci.c 2001/03/05 16:42:57 1.123 @@ -731,13 +731,14 @@ =20 case AUTHENTICATION_COMPLETE: DSYS(__FUNCTION__", AUTHENTICATION_COMPLETE\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER if (buf[0]) { D_ERR(__FUNCTION__", AUTHENTICATION_COMPLETE: %s\n", get_err_msg(buf[0]= )); =20=09=09=09 } =20=09=09 sec_man_event(HCI, get_bd(CHAR2INT12(buf[2], buf[1])), AUTHENTICATION_CO= MPLETE, buf, 1); -=09=09 +#endif break; =20 case REMOTE_NAME_REQUEST_COMPLETE: @@ -755,19 +756,21 @@ break; =20 case ENCRYPTION_CHANGE: - { - u8 tmp[2]; DSYS(__FUNCTION__", ENCRYPTION_CHANGE\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER if (buf[0]) { D_ERR(__FUNCTION__", ENCRYPTION_CHANGE: %s\n", get_err_msg(buf[0])); } =20 + { + u8 tmp[2]; tmp[0] =3D buf[0]; tmp[1] =3D buf[4]; =20=09=09 sec_man_event(HCI, get_bd(CHAR2INT12(buf[2], buf[1])), ENCRYPTION_CHANGE= , tmp, 2); - break; } +#endif + break; =20=09 case CHANGE_CONNECTION_LINK_KEY_COMPLETE: DSYS(__FUNCTION__", CHANGE_CONNECTION_LINK_KEY_COMPLETE Not implemented!= \n"); @@ -855,9 +858,10 @@ break; =20 case RETURN_LINK_KEYS: + D_CMD(__FUNCTION__", RETURN_LINK_KEYS event\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER { u8 tmp_str[23]; - D_CMD(__FUNCTION__", RETURN_LINK_KEYS event\n"); =20=09=09 for (i =3D 0; i < buf[0]; i++) { D_CMD("%d: ",i); @@ -866,24 +870,29 @@ memcpy(tmp_str + 7, (buf + 1) + (buf[0] * 6) + (i * 16), 16); sec_man_event(HCI, buf + 1, RETURN_LINK_KEYS, tmp_str, 17); } -=09=09 - break; } +#endif + break; =20=09 case PIN_CODE_REQUEST: D_CMD(__FUNCTION__", PIN_CODE_REQUEST forwarding event to security manag= er\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER sec_man_event(HCI, buf, PIN_CODE_REQUEST, NULL, 0); +#endif break; =20=09 case LINK_KEY_REQUEST: -=09 D_CMD(__FUNCTION__", LINK_KEY_REQUEST\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER sec_man_event(HCI, buf, LINK_KEY_REQUEST, NULL, 0); +#endif break; =20 case LINK_KEY_NOTIFICATION: D_CMD(__FUNCTION__", LINK_KEY_NOTIFICATION forwarding event to security = manager\n"); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER sec_man_event(HCI, buf, LINK_KEY_NOTIFICATION, buf + 6, 16); +#endif break; =20 case LOOPBACK_COMMAND: |
From: Peter K. <pk...@us...> - 2001-03-05 16:55:08
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.123 1.124=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Removed a compiler warning. The diff of the modified file(s): --- hci.c 2001/03/05 16:42:57 1.123 +++ hci.c 2001/03/05 16:56:45 1.124 @@ -186,7 +186,9 @@ static void send_cmd_queue(void); static void update_nhcp(s32 nhcp); static s32 send_inq_cmd_block(u8 *cmd, u8 len); +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER static u8* get_bd(u16 con_hdl); +#endif static s32 get_con_hdl(u8 *bd); =20 /* Link Control Commands */ @@ -2679,6 +2681,7 @@ } } =20 +#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER u8* get_bd(u16 con_hdl) { @@ -2697,7 +2700,7 @@ return hci_ctrl.con[i].bd; } } - +#endif /* CONFIG_BLUETOOTH_USE_SECURITY_MANAGER */ =20 /* * This function will return the value of the active bd address, i.e. the |
From: Peter K. <pk...@us...> - 2001-03-12 16:01:00
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.125 1.126=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected the header which got mangled in the last commit. The diff of the modified file(s): --- hci.c 2001/03/12 15:54:35 1.125 +++ hci.c 2001/03/12 16:02:57 1.126 @@ -32,10 +32,10 @@ * General Public License. Your use of that executable is in no way * restricted on account of using the AXIS OpenBT Stack code with it. * - * This exception does not however invalidate any other reasons wh + * This exception does not however invalidate any other reasons why * the executable file might be covered by the provisions of the GNU * General Public License. -=20 + * * $Id$ * */ |
From: Gordon M. <gm...@us...> - 2001-03-13 19:30:37
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.126 1.127=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Changed the way we handle trashed UART data. Instead of going into the WA= IT_FOR_TIMEOUT state (which we never seem to leave) we now just drop the bu= ffer and ttry to resync on the start of the next one. This seems to work ok= . When I see us discard a byte in the running log I can reset my Ericssons = on the fly and the stack will sync back up with the byte stream. The diff of the modified file(s): --- hci.c 2001/03/12 16:02:57 1.126 +++ hci.c 2001/03/13 19:32:37 1.127 @@ -367,34 +367,26 @@ case WAIT_FOR_PACKET_TYPE: D_STATE(__FUNCTION__", WAIT_FOR_PACKET_TYPE\n"); tmp_pos =3D 0; - if (*buf =3D=3D EVENT_PKT) { - state =3D WAIT_FOR_EVENT_TYPE; - buf +=3D 1; - count -=3D 1; - } else if (*buf =3D=3D ACL_PKT) { - state =3D WAIT_FOR_ACL_HDR; - buf +=3D 1; - count -=3D 1; - } else if (*buf =3D=3D SCO_PKT) { - state =3D WAIT_FOR_SCO_HDR; + switch(*buf) { + case EVENT_PKT: state =3D WAIT_FOR_EVENT_TYPE; break; + case ACL_PKT: state =3D WAIT_FOR_ACL_HDR; break; + case SCO_PKT: state =3D WAIT_FOR_SCO_HDR; break; + default: + D_ERR(__FUNCTION__ ": discarding %d bytes\n", + count); + /* An unrecognized HCI header type is usually a + * sign of a problem with the lower level=20 + * driver. For example, if the UART drops some + * bytes due to high interrupt latency. In this + * case we'll try to resync by just dropping=20 + * this buffer and trying again at the start of + * the next one. + * --gmcnutt + */ + return; + } buf +=3D 1; count -=3D 1; - } else { - - D_ERR(__FUNCTION__", Bad UART baud rate or trashed data on the uart\n"= ); - D_ERR(__FUNCTION__", Try reducing uart speed or change IRQ setting (PC= )\n"); - - if (syncing) {=20=20 - DSYS(__FUNCTION__", Resetting state machine and trying to resync\n"); - syncing =3D 0; - buf =3D data; - count =3D tmp_data_len; - state =3D WAIT_FOR_PACKET_TYPE; - } else { - state =3D WAIT_FOR_TIMEOUT; - count =3D 0; - } - }=20=20 break; =20 /* If it is an event packet we wait for the next byte |
From: Gordon M. <gm...@us...> - 2001-03-13 19:32:35
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.127 1.128=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Removed the WAIT_FOR_TIMEOUT state from the HCI state machine since it is= n't used any more. The diff of the modified file(s): --- hci.c 2001/03/13 19:32:37 1.127 +++ hci.c 2001/03/13 19:34:36 1.128 @@ -546,12 +546,6 @@ } break; =20 - case WAIT_FOR_TIMEOUT: - /* Discard all incoming data */ - D_ERR(__FUNCTION__", Discarding %d bytes and waiting forever...\n", cou= nt); - count =3D 0; - break; - default: D_ERR(__FUNCTION__", : Oups shouldn't be possible...\n"); break; |
From: Ulf H. <ul...@us...> - 2001-03-15 10:29:07
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.128 1.129=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected encryption status message The diff of the modified file(s): --- hci.c 2001/03/13 19:34:36 1.128 +++ hci.c 2001/03/15 10:31:11 1.129 @@ -754,7 +754,7 @@ { u8 tmp[2]; tmp[0] =3D buf[0]; - tmp[1] =3D buf[4]; + tmp[1] =3D buf[3]; =20=09=09 sec_man_event(HCI, get_bd(CHAR2INT12(buf[2], buf[1= ])), ENCRYPTION_CHANGE, tmp, 2); } |
From: Gordon M. <gm...@us...> - 2001-03-15 21:48:16
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.130 1.131=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --I don't think we want to kfree inq_res if it's NULL, and the first time t= hrough it always is. The diff of the modified file(s): --- hci.c 2001/03/15 16:27:33 1.130 +++ hci.c 2001/03/15 21:50:22 1.131 @@ -1693,6 +1693,7 @@ lap[2] =3D 0x9e; =20 /* Free any previous response */ + if (inq_res) kfree(inq_res); =20 inq_res =3D (inquiry_results*) kmalloc(sizeof(inquiry_results) |
From: Gordon M. <gm...@us...> - 2001-03-20 20:10:15
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.132.2.1 1.132.2.2=20=20=20=20=20=20=20 The accompanying log: --Fixed a bug in hci_inquiry. We needed to release the semaphore if the com= mand timer times out or Command Status returns an error. The diff of the modified file(s): --- hci.c 2001/03/20 16:42:53 1.132.2.1 +++ hci.c 2001/03/20 20:12:35 1.132.2.2 @@ -967,10 +967,12 @@ ret =3D -EAGAIN; } pending_inq_res =3D NULL; - up(&hci_inq_semaphore); #endif =20 exit: +#ifdef __KERNEL__ + up(&hci_inq_semaphore); +#endif return ret; } //------------------------------------------------------------------------= ----- |
From: Peter K. <pk...@us...> - 2001-03-21 11:53:11
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.132 1.133=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected potential NULL-dereference in send_acl_data_task() (thanks to Claus Tondering). The diff of the modified file(s): --- hci.c 2001/03/16 07:38:48 1.132 +++ hci.c 2001/03/21 11:53:09 1.133 @@ -2839,7 +2839,7 @@ bytes2send =3D tx_buf->cur_len; } =20=09 - D_SND(__FUNCTION__", %d bytes \n", tx_buf->cur_len); + D_SND(__FUNCTION__", %d bytes \n", bytes2send); =20=09 /* while there is space in the hardware buffers and we have hci packets to send, we send them. After each sent packet |
From: Gordon M. <gm...@us...> - 2001-03-21 23:23:27
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.132.2.2 1.132.2.3=20=20=20=20=20=20=20 The accompanying log: --Reversed the bytes in the GIAC and LIAC. --Extended the Inquiry timer to 40 seconds. The diff of the modified file(s): --- hci.c 2001/03/20 20:12:35 1.132.2.2 +++ hci.c 2001/03/21 23:23:25 1.132.2.3 @@ -831,9 +831,10 @@ #ifdef CONFIG_BLUETOOTH_HCI_INQUIRY /************************************= ***/ // Adds about 1k =20 -// See [BSC] Appendix VIII 1.1 -static const u8 GIAC[] =3D { 0x9e, 0x8b, 0x33 }; -static const u8 LIAC[] =3D { 0x9e, 0x8b, 0x00 }; +// See [BSC] Appendix VIII 1.1. Note that these must be reversed from that +// shown in the Spec. Why? +static const u8 GIAC[] =3D { 0x33, 0x8b, 0x9e }; +static const u8 LIAC[] =3D { 0x00, 0x8b, 0x9e }; =20 static struct inquiry_results *pending_inq_res =3D NULL; static u32 hci_inq_pending =3D 0; @@ -861,7 +862,7 @@ init_timer(&hci_inq_timer); hci_inq_timer.function =3D inq_timeout; hci_inq_timer.data =3D 0; - hci_inq_timer.expires =3D jiffies + 10*HZ; + hci_inq_timer.expires =3D jiffies + 40*HZ; add_timer(&hci_inq_timer); } static void release_inq_timer(void) @@ -922,6 +923,8 @@ #endif =20 D_CMD(__FUNCTION__ "\n"); + + PRINTPKT("LAP:", lap, 3); =20 // Check for a valid LAP. if (!memcmp(lap, GIAC, 3) && !memcmp(lap, LIAC, 3)) |
From: Ulf H. <ul...@us...> - 2001-03-26 14:58:28
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.133 1.134=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Chenged the return parameters for the HCI event READ_STORED_LINK_KEY. It now also returns both the current number of stored link keys and the total capacity (storage space for link keys) The diff of the modified file(s): --- hci.c 2001/03/21 11:53:09 1.133 +++ hci.c 2001/03/26 14:58:26 1.134 @@ -1051,7 +1051,8 @@ result_param =3D - r_val[0]; } else { D_CMD(__FUNCTION__", READ_STORED_LINK_KEY Success\n"); - result_param =3D CHAR2INT16(r_val[4], r_val[3]); + result_param =3D CHAR2INT32(r_val[4], r_val[3], + r_val[2], r_val[= 1]); } D_CMD(__FUNCTION__", Max number of Linkkeys: %d\n", CHAR2INT16(r_val[2], r_val[1])); |
From: Mattias A. <mat...@us...> - 2001-03-30 11:30:46
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.134 1.135=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added functionality to handle master slave switch * moved ACL link code into section only for ACL data (SCO links were handled in an erronoeous way) * removed role_discovery call in lp_connect_cfm, role is shown when=20 an m/s switch is performed anyway * added hci_force_msswitch which forces m/s switch as server * lots of minor changes The diff of the modified file(s): --- hci.c 2001/03/26 14:58:26 1.134 +++ hci.c 2001/03/30 11:30:44 1.135 @@ -53,11 +53,14 @@ #include <linux/bluetooth/btdebug.h> #include <linux/bluetooth/bluetooth.h> #include <linux/bluetooth/l2cap.h> +#include <linux/bluetooth/l2cap_con.h> #include <linux/bluetooth/tcs.h> #include <linux/bluetooth/btmem.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/bluetooth/sec_client.h> +#include <asm/io.h> + #else /* user mode */ #include <stdlib.h> #include <string.h> @@ -67,6 +70,7 @@ #include "include/hci_internal.h" #include "include/btdebug.h" #include "include/l2cap.h" +#include "include/l2cap_con.h" #include "include/btmem.h" #include "include/tcs.h" #include "include/sec_client.h" @@ -121,7 +125,6 @@ =20 #define HCI_SYNC_FIX =20 - #ifdef HCI_EMULATION #define ACL_NUM 10 #define ACL_LEN 800=20 @@ -214,7 +217,6 @@ =20 /* Informational Parameters (HCI_IP) */ =20 - /* Other functions */ static s32 hci_read_buffer_size(s32 block);=20 static void set_hci_con(u8 *bd, s32 con_hdl); @@ -252,7 +254,6 @@ #endif =20 static void send_acl_data_task(void); - /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 /* Struct used for sending command packets */ @@ -269,7 +270,9 @@ #ifdef USE_NCPTIMER static struct timer_list hci_ncp_timer; #endif + static struct timer_list hci_cmd_timer; + #ifdef USE_INQTIMER static struct timer_list hci_inq_timer; #endif @@ -322,6 +325,10 @@ =20 static s32 test_hci_hdl; =20 +/* temp solution to handle m/s switch */ +static s32 force_msswitch; +static s32 i_am_initiator =3D 0; + /****************** FUNCTION DEFINITION SECTION **************************= ***/ =20 /* @@ -460,11 +467,8 @@ } } =20 - host_nbrcompleted_packets(hci_hdl, 1); =20 - - /* When we change state we reset data_index, because we are using separate buffers for the HCI header and the HCI data */ @@ -572,6 +576,7 @@ /* We've just been notified that the hardware has free buffers. If we have any outstanding packets, send_acl_data_task will try to send as many packets as possible. */ + #ifdef __KERNEL__ if (buf_count()) {=09=20=20=20=20=20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) @@ -660,24 +665,32 @@ =20 if (link_type =3D=3D ACL_LINK) { lp_connect_cfm(buf + 3, (u32) buf[0], hci_hdl); - } else { - tcs_add_sco_link(buf[0], hci_hdl); - } =20 #ifndef HCI_EMULATION if (buf[0]) { /* remove hci handle if connection failed */ - DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n", get_err_msg(buf[0])); + DSYS(__FUNCTION__", CONNECTION_COMPLETE %s\n",=20 + get_err_msg(buf[0])); hci_ctrl.nbr_of_connections -=3D 1; reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); - change_connection_packet_type(hci_hdl, DM3|DH3|DM5|DH5); + change_connection_packet_type(hci_hdl,=20 + DM1|DH1|DM3|DH3|DM5|DH5); set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); -// write_link_policy_settings(hci_hdl, 0x01); /* enable m/s switch */ -// hci_switch_role(buf + 3, 0); - role_discovery(hci_hdl); + + /* enable m/s switch */=20 + write_link_policy_settings(hci_hdl, 0x01); + + /* we demand role switch as server */ + if (force_msswitch && !i_am_initiator) { + /* FIXME -- check return code */ + hci_switch_role(buf + 3, 0); + } + /* reset variable again */ + i_am_initiator =3D 0; +=09=09=09=09=09=09 } #endif /* HCI_EMULATION */ =20 @@ -685,6 +698,9 @@ test_wq_active =3D 0; wake_up_interruptible(&test_wq); } + } else { + tcs_add_sco_link(buf[0], hci_hdl); + } =20=09=09 break; } @@ -701,7 +717,6 @@ =20 case DISCONNECTION_COMPLETE: DSYS(__FUNCTION__", DISCONNECTION_COMPLETE %s\n", get_err_msg(buf[3])); - lp_disconnect_ind(CHAR2INT12(buf[2], buf[1])); /* FIXME: No more NBR_OF_COMPLETE_PACKETS will arrive for this connection handle, if we only support point-to-point @@ -817,15 +832,17 @@ break; =20 case ROLE_CHANGED: - D_CMD(__FUNCTION__", ROLE_CHANGED\n"); + DSYS(__FUNCTION__", ROLE_CHANGED\n"); =20 if (buf[0]) {=20 - D_ERR(__FUNCTION__", Role changed faild due to %s\n", + D_ERR(__FUNCTION__", Role changed failed due to %s\n", get_err_msg(buf[0])); } else if (buf[7]) { - DSYS(__FUNCTION__", Role was changed to Slave for unit with BD Address = 0x%04x%08x\n", CHAR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[2= ], buf[1])); + DSYS(__FUNCTION__", Current master is 0x%04x%08x\n",=20 + CHAR2INT16(buf[6], buf[5]),=20 + CHAR2INT32(buf[4], buf[3], buf[2], buf[1])); } else { - DSYS(__FUNCTION__", Role was changed to Master for unit with BD Address= 0x%04x%08x\n", CHAR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[= 2], buf[1])); + DSYS(__FUNCTION__", Our role is master for BD Address 0x%04x%08x\n", CH= AR2INT16(buf[6], buf[5]), CHAR2INT32(buf[4], buf[3], buf[2], buf[1])); } break; =20 @@ -1027,8 +1044,9 @@ break; =20=20=20=20=20=20=20=20=20=20=20 case HCI_HC: /* Host Controller commands */ +=09=09 release_cmd_timer(); -/* FIX ME : The correct timer should be released */ + /* FIXME -- correct timer should be released */ =20=20=20=20=20=20=20=20=20=20=20 switch (ocf) { =20=09=09=09 @@ -1045,7 +1063,7 @@ =20=09=09=09 =20=09=09=09 case READ_STORED_LINK_KEY: - D_CMD(__FUNCTION__", READ_STORED_LINK_KEY\n"); + DSYS(__FUNCTION__", READ_STORED_LINK_KEY\n"); if (r_val[0]) { D_ERR(__FUNCTION__", READ_STORED_LINK_KEY %s\n", get_err_msg(r_val[0])= ); result_param =3D - r_val[0]; @@ -1054,9 +1072,9 @@ result_param =3D CHAR2INT32(r_val[4], r_val[3], r_val[2], r_val[= 1]); } - D_CMD(__FUNCTION__", Max number of Linkkeys: %d\n", + DSYS(__FUNCTION__", Max number of Linkkeys: %d\n", CHAR2INT16(r_val[2], r_val[1])); - D_CMD(__FUNCTION__", Number of Linkkeys read: %d\n", + DSYS(__FUNCTION__", Number of Linkkeys read: %d\n", CHAR2INT16(r_val[4], r_val[3])); break; =20 @@ -1267,6 +1285,26 @@ release_cmd_timer(); =20 switch (ocf) { + + case READ_LOCAL_VERSION_INFORMATION: + D_CMD(__FUNCTION__", READ_LOCAL_VERSION_INFORMATION\n"); + if (r_val[0]) { + D_ERR(__FUNCTION__", READ_LOCAL_VERSION_INFORMATION: %s\n", + get_err_msg(r_val[0])); + break; + } +=09=09=09 + hci_ctrl.hc_buf.acl_len =3D CHAR2INT16(r_val[2],r_val[1]); + hci_ctrl.hc_buf.sco_len =3D (u32) r_val[3]; + hci_ctrl.hc_buf.acl_num =3D CHAR2INT16(r_val[5],r_val[4]); + hci_ctrl.hc_buf.sco_num =3D CHAR2INT16(r_val[7],r_val[6]); + printk("\nHW module contains...\n"); + printk("%d ACL buffers at %d bytes\n%d SCO buffers at %d bytes\n\n", + hci_ctrl.hc_buf.acl_num, hci_ctrl.hc_buf.acl_len, + hci_ctrl.hc_buf.sco_num, hci_ctrl.hc_buf.sco_len); + + break; + case READ_BUFFER_SIZE: D_CMD(__FUNCTION__", READ_BUFFER_SIZE\n"); if (r_val[0]) { @@ -1313,15 +1351,15 @@ =20 switch (ocf) {=20=20 case READ_LOOPBACK_MODE: - D_CMD(__FUNCTION__", READ_LOOPBACK_MODE -- not impl\n"); + D_ERR(__FUNCTION__", READ_LOOPBACK_MODE -- not impl\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case WRITE_LOOPBACK_MODE: - D_CMD(__FUNCTION__", WRITE_LOOPBACK_MODE -- not impl\n"); + D_ERR(__FUNCTION__", WRITE_LOOPBACK_MODE -- not impl\n"); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case ENABLE_DEVICE_UNDER_TEST_MODE: - D_CMD(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE\n"); + DSYS(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE\n"); if (r_val[0]) { D_ERR(__FUNCTION__", ENABLE_DEVICE_UNDER_TEST_MODE: %s\n", get_err_msg(r_val[0])); @@ -1331,7 +1369,7 @@ break; =20=20=20=20=20=20=20=20=20=20=20=20=20 default: - D_CMD(__FUNCTION__", HCI_TC, ocf %d not recognised!\n", ocf); + D_ERR(__FUNCTION__", HCI_TC, ocf %d not recognised!\n", ocf); break; } wake_up_interruptible(&hci_wq); @@ -1633,28 +1671,32 @@ send_data_task.data =3D NULL; #endif =20 + /* Disable parity bit and set to H4 IF + flow ctrl */ + /* Not activated until after reset !!!! */ + /* always... */ DSYS(__FUNCTION__", Reading buffer sizes in the module...\n"); hci_read_buffer_size(HCI_BLOCK); =20 hci_read_firmware_rev_info(); =20 -// hci_read_stored_link_key(NULL,1); - - //hci_write_authentication_enable(1); #ifdef HOST_FLOW_CTRL DSYS(__FUNCTION__", Host flow control enabled\n"); + hci_set_host_controller_flow_control(TRUE); #else DSYS(__FUNCTION__", Host flow control not enabled\n"); #endif -=09 - hci_set_host_controller_flow_control(TRUE); - hci_host_buffer_size(HCI_ACL_LEN,HCI_SCO_LEN,HCI_ACL_NUM,HCI_SCO_NUM); =20 #ifdef USE_NCPTIMER start_ncp_timer();=09 #endif + +#ifdef CONFIG_BLUETOOTH_FORCE_MSSWITCH + hci_force_msswitch(1); +#else + hci_force_msswitch(0); +#endif=20=20=20=20=20=20=20 } =20 void=20 @@ -1712,9 +1754,11 @@ c_pkt.data[4] =3D num_resp; c_pkt.len =3D 5; =20 - print_data("hci_inquiry", (u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR= _LEN); + print_data("hci_inquiry", (u8*) &c_pkt , + c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); =20 - tmp =3D send_inq_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HD= R_LEN); + tmp =3D send_inq_cmd_block((u8*) &c_pkt,=20 + c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); =20 if (tmp < 0) { kfree(inq_res); @@ -2048,6 +2092,9 @@ return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= ); } =20 + +/* fixme -- fix return code so we know whether role change was succesful= =20 + or not */ s32 hci_switch_role(u8 *bd, u8 role) { @@ -2552,10 +2599,8 @@ c_pkt.len =3D 5; =20 =20=09 - /*FIXME Risk for race against sending acl packets ? */ - //printk("Host pkt start\n"); + /*FIXME -- Risk for race against sending acl packets ? */ tmp =3D bt_write_lower_driver((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI= _HDR_LEN); - //printk("Host pkt stop\n"); return tmp; #else return 0; @@ -2615,6 +2660,24 @@ return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); } =20 +#if 0 +s32 +hci_read_local_version_info(s32 block) +{ + D_CMD(__FUNCTION__"\n"); +=09 + c_pkt.type =3D CMD_PKT; + c_pkt.ocf =3D READ_LOCAL_VERSION_INFORMATION; + c_pkt.ogf =3D HCI_IP; + c_pkt.len =3D 0; + + if (block) + return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + else + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} +#endif + /* * This command will read the value for the BD_ADDR parameter of the local * unit, returns bd in little endian @@ -2734,7 +2797,7 @@ } =20 =20 -/* This function is used to send custom commands over the HCI interface. */ +/* This function is used to send custom commands/data over the HCI interfa= ce. */ =20 s32 hci_send_raw_data(u8 *data, u8 len) @@ -2744,20 +2807,31 @@ return bt_write_lower_driver(data ,len); } =20 - s32 hci_test_connect_req(u8 *bd) { /* Must add a l2cap con to store bd address in !!! */ =20 +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH if (create_connection(bd, 0xcc18, 0x00, 0x00, 0x00, DONT_ALLOW_ROLE_SWITC= H)) { D_ERR("hci_test_connect_req, error sending command\n"); } +#else + if (create_connection(bd, 0xcc18, 0x00, 0x00, 0x00, ALLOW_ROLE_SWITCH)) { + D_ERR("hci_test_connect_req, error sending command\n"); + } +#endif test_wq_active =3D 1; interruptible_sleep_on(&test_wq); return test_hci_hdl; } =20 +void +hci_force_msswitch(u8 enable) +{ + printk("Setting force_msswitch to %d\n", enable); + force_msswitch =3D enable;=20 +} =20 /* Sends a connect request to the BT unit with the address bd_addr */ s32=20 @@ -2766,11 +2840,18 @@ PRINTPKT(__FUNCTION__", bd address is: ", bd_addr, 6); /* FIXME, store the inparameters in the ctrl-block instead */ =20 -// if (!get_con(bd_addr, ANY_STATE)) -// l2cap_create_con(bd_addr); + if (!get_con(bd_addr, ANY_STATE)) + l2cap_create_con(bd_addr); =20=20=20 -// return create_connection(bd_addr, 0xcc18, 0x00, 0x00, 0x00, ALLOW_ROLE_= SWITCH); - return create_connection(bd_addr, 0xcc18, 0x00, 0x00, 0x00, DONT_ALLOW_RO= LE_SWITCH); + i_am_initiator =3D 1; + +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH + return create_connection(bd_addr, 0xcc18, 0x00, 0x00,=20 + 0x00, ALLOW_ROLE_SWITCH); +#else + return create_connection(bd_addr, 0xcc18, 0x00, 0x00,=20 + 0x00, DONT_ALLOW_ROLE_SWITCH); +#endif } =20 /* A response from L2CAP to a previous lp_connect_ind */ @@ -2779,7 +2860,6 @@ {=20 D_CMD(__FUNCTION__"Status:%d\n", cfm); if (cfm) { -// return accept_connection_request(bd_addr, MS_SWITCH_BECOME_MASTER); return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); } else { return reject_connection_request(bd_addr, 0x0d); @@ -2793,8 +2873,7 @@ s32=20 lp_disconnect(u32 hci_hdl) { - return disconnect(hci_hdl, 0x14); - /* FIXME: 0x14 =3D Low Resources store this somewhere else */ + return disconnect(hci_hdl, DISCMSG_USER_ENDED_CONNECTION); } =20 =20 @@ -2810,7 +2889,6 @@ sends the data. */ tx_buf->pb_flag =3D L2CAP_FRAME_START; =20=09=09 - #ifdef __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) queue_task(&send_data_task, &tq_scheduler); @@ -2838,6 +2916,7 @@ tx_buf =3D get_bt_buf(); if (tx_buf) { bytes2send =3D tx_buf->cur_len; + D_SND(__FUNCTION__", %d bytes \n", tx_buf->cur_len); } =20=09 D_SND(__FUNCTION__", %d bytes \n", bytes2send); @@ -2851,7 +2930,6 @@ =20=09 cli(); while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) { - hci_ctrl.hc_buf.acl_num--; sti(); =20=09=09 @@ -2860,7 +2938,6 @@ D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20 hci_ctrl.hc_buf.acl_num); =20 - if (bytes2send =3D=3D 0) { /* The current frame has now been sent, check if more data is waiting to be sent from the driver. */ @@ -2869,14 +2946,12 @@ if (tx_buf) { bytes2send =3D tx_buf->cur_len; } -=09=09=09=09 } cli(); } sti(); } =20 - u32 send_acl_packet(bt_tx_buf *tx_buf) { @@ -2919,7 +2994,7 @@ /* bt_write_lower_driver checks in serial driver if there are room=20 in serial tx buffer, if 0 is returned there was insufficient=20 room */ - //printk("ACL start\n"); + if (!bt_write_lower_driver(cur_data,=20 c + ACL_HDR_LEN + HCI_HDR_LEN)) { =20=09=09 @@ -2930,7 +3005,6 @@ D_SND(__FUNCTION__", cannot send now, leave in buffers\n"); return 0; } - //printk("ACL stop\n"); #endif /* We always set the next part to be a continous part of the packet */ tx_buf->pb_flag =3D L2CAP_FRAME_CONT; @@ -3009,7 +3083,6 @@ case 0x22: return "LMP Response Timeout"; case 0x23: return "LMP Error Transaction Collision"; case 0x24: return "LMP PDU Not Allowed"; - case 0x25: return "Encryption Mode Not Acceptable"; case 0x26: return "Unit Key Used"; case 0x27: return "QOS is Not Supported"; @@ -3208,6 +3281,7 @@ =20=20=20 while ((tmp =3D get_next_cmd()) !=3D NULL) { kfree(tmp->data); + tmp->data =3D NULL; } =20=20=20 cmd_buf.first_free =3D 0; @@ -3354,8 +3428,9 @@ #else bt_write_lower_driver(tmp->data, tmp->len); #endif - D_QUEUE(__FUNCTION__", sent data..., freeing memory\n"); kfree(tmp->data); + tmp->data =3D NULL; + cli(); hci_ctrl.hc_buf.cmd_num -=3D 1; } @@ -3402,8 +3477,6 @@ =20 if (!hw.acl_num_count && /* no new buffers since last timeout */=20 hci_ctrl.hc_buf.acl_num !=3D hw.max_acl_num) { -// printk("bt_feedstack from ncp_timeout [acl:%d]\n",=20 -// hci_ctrl.hc_buf.acl_num); bt_feedstack(); } =20 @@ -3411,6 +3484,7 @@ start_ncp_timer(); } #endif + #endif /* USE_NCPTIMER */ =20 void @@ -3426,13 +3500,12 @@ #endif } =20 - void release_cmd_timer(void) { #ifdef __KERNEL__ - D_CTRL(__FUNCTION__"\n"); del_timer(&hci_cmd_timer); + D_CMD(__FUNCTION__"\n"); #endif hci_cmd_pending =3D 0; } @@ -3441,8 +3514,8 @@ static void cmd_timeout(unsigned long ptr) { - /* The command timed out, then we reset the command buffer counter to - 1 again */ + /* The command timed out, then we reset the command buffer=20 + counter to 1 again */ hci_ctrl.hc_buf.cmd_num =3D 1; =20=09 printk(__FUNCTION__", Timeout when waiting for command response\n"); @@ -3480,9 +3553,10 @@ static void inq_timeout(unsigned long ptr) { - /* The command timed out, then we reset the command buffer counter to - 1 again */ + /* The command timed out, then we reset the command buffer=20 + counter to 1 again */ /* FIX ME: What to do here !! */ + /* hci_ctrl.hc_buf.cmd_num =3D 1;*/ =20 printk(__FUNCTION__", Timeout when waiting for inquiry response\n"); @@ -3490,8 +3564,7 @@ wake_up_interruptible(&inq_wq); } #endif -#endif /* USE_INQTIMER */ - +#endif =20 s32=20 send_cmd_block(u8 *cmd, u8 len) |
From: Mattias A. <mat...@us...> - 2001-04-12 15:13:02
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.136 1.137=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * added 1 s sleep in hci_emulator when connecting/disconnecting baseband * fixed usermode stack declarations of "wait queues" The diff of the modified file(s): --- hci.c 2001/04/10 12:27:10 1.136 +++ hci.c 2001/04/12 15:13:01 1.137 @@ -304,7 +304,6 @@ static u32 hci_cmd_pending =3D 0; static u32 hci_inq_pending =3D 0; =20 -#if __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) struct wait_queue *hci_wq =3D NULL; struct wait_queue *inq_wq =3D NULL; @@ -316,7 +315,6 @@ wait_queue_head_t set_baudrate_wq; wait_queue_head_t test_wq; #endif /* LINUX_VERSION_CODE */ -#endif /* __KERNEL__ */ =20 static s32 test_wq_active =3D 0; =20 @@ -3156,6 +3154,7 @@ D_CMD(__FUNCTION__", ACCEPT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, 0, cmd->data, HCI_HDL, ACL_CON); + sleep(1); bt_write_lower_driver(o_event, o_len); =20=20=20=20=20=20=20 lp_connect_cfm(data + 4, 0, 0); @@ -3165,6 +3164,7 @@ D_CMD(__FUNCTION__", REJECT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, cmd->data[6], cmd->data, HCI_HDL, ACL_CON); + sleep(1); bt_write_lower_driver(o_event, o_len); lp_connect_cfm(data + 4, 0xd, 0); break; |
From: Gordon M. <gm...@us...> - 2001-04-17 07:03:27
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.137 1.138=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added some checks to make sure we don't write beyond the end of some of our= buffers due to bad length field values. The diff of the modified file(s): --- hci.c 2001/04/12 15:13:01 1.137 +++ hci.c 2001/04/17 07:03:27 1.138 @@ -409,6 +409,21 @@ event_len =3D *buf; buf +=3D 1; count -=3D 1; + + /* If we don't check this and the lower level driver + gives us some trashed values then we might write + beyond the end of our event buffer in a memcpy=20 + below. + --gmcnutt + */ + if (event_len > sizeof(event_buf)) { + D_ERR(__FUNCTION__ ": %d is too big for our "\ + "event buffer -- discarding buffer\n", + event_len); + state =3D WAIT_FOR_PACKET_TYPE; + return; + } + if (event_len <=3D count) { process_event(buf, event_len, event_type); buf +=3D event_len; @@ -450,6 +465,19 @@ pb_flag =3D (((u32) hdr[1]) & 0x30) >> 4; bc_flag =3D (((u32) hdr[1]) & 0xc0) >> 6; data_len =3D CHAR2INT16(hdr[3],hdr[2]); + + /* Check the length to make sure we won't=20 + overrun in_buf->buf_ptr in a memcpy later. + --gmcnutt + */ + if (data_len > HCI_IN_SIZE) { + D_ERR(__FUNCTION__ ": %d is too big "\ + "for our HCI input buffers -- "\ + "discarding buffer\n", + data_len); + state =3D WAIT_FOR_PACKET_TYPE; + return; + } =20 if (pb_flag =3D=3D L2CAP_FRAME_START) { D_REC(__FUNCTION__", new frame\n"); |
From: Peter K. <pk...@us...> - 2001-04-17 12:04:37
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.138 1.139=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Do not use DM1 and DH1 packets (they were re-added in 1.135, but using them degrades performance for Ericsson clients too much). The diff of the modified file(s): --- hci.c 2001/04/17 07:03:27 1.138 +++ hci.c 2001/04/17 12:04:00 1.139 @@ -703,7 +703,7 @@ } else { DSYS(__FUNCTION__", ACL link is up\n"); change_connection_packet_type(hci_hdl,=20 - DM1|DH1|DM3|DH3|DM5|DH5); + DM3|DH3|DM5|DH5); set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); =20 |
From: Mats F. <ma...@us...> - 2001-04-19 07:02:05
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.141 1.142=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Corrected misspelling, uint_mode -> unit_mode The diff of the modified file(s): --- hci.c 2001/04/18 15:47:13 1.141 +++ hci.c 2001/04/19 07:02:04 1.142 @@ -1538,7 +1538,7 @@ s32 pos =3D 0; s32 i; =20 - pos +=3D sprintf(buf + pos, "unit_id unit_bd_address uint_mode unit_name\= n"); + pos +=3D sprintf(buf + pos, "unit_id unit_bd_address unit_mode unit_name\= n"); =20 =20 /* Then we printout the other connections bd addresses and their user |
From: Mattias A. <mat...@us...> - 2001-04-25 16:54:47
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.142 1.143=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * only wakeup hci_wq in COMMAND_COMPLETE (not COMMAND_STATUS) * added read transmit power level * added CONFIG_BLUETOOTH_EARLY_MSSWITCH which forces m/s switch in=20 lp_connect_rsp. If not defined, acl link is first established and then a role switch is performed. (Requires scatternet functionality=20 if more than on slave).=20 * added ifdef __KERNEL__ around 2 sleeps (usermode stack) * cleaned up The diff of the modified file(s): --- hci.c 2001/04/19 07:02:04 1.142 +++ hci.c 2001/04/25 16:54:47 1.143 @@ -721,7 +721,9 @@ /* we demand role switch as server */ if (force_msswitch && !i_am_initiator) { /* FIXME -- check return code */ +#ifndef CONFIG_BLUETOOTH_EARLY_MSSWITCH hci_switch_role(buf + 3, 0); +#endif } /* reset variable again */ i_am_initiator =3D 0; @@ -826,7 +828,7 @@ break; =20 case QOS_SETUP_COMPLETE: - DSYS(__FUNCTION__", QOS_SETUP_COMPLETE Not implemented!\n"); + DSYS(__FUNCTION__", QOS_SETUP_COMPLETE\n"); break; =20 case COMMAND_COMPLETE: @@ -844,12 +846,16 @@ performing the task for this command */ =20=09=09 case COMMAND_STATUS: - release_cmd_timer(); - /*FIXME: hci_switch_role() will generate COMMAND_STATUS that - shouldn't call wake_up_interruptible() */ +=09=09 D_CMD(__FUNCTION__", COMMAND_STATUS\n"); =20=09=09 if (buf[0]) { + + /* fixme -- add parser for command status e.g when trying + to connect an acl link which already is connected, a + command status with "ACL link already exist" is returned=20 + This must be signalled using lp_connect_cfm (neg) + */ D_ERR(__FUNCTION__", COMMAND_STATUS: %s\n",get_err_msg(buf[0])); #ifdef USE_INQTIMER if (hci_inq_pending) @@ -858,7 +864,6 @@ } =20=09=09 update_nhcp(buf[1]); - wake_up_interruptible(&hci_wq); break; case FLUSH_OCCURRED: D_CMD(__FUNCTION__", FLUSH_OCCURRED on hci_hdl %d\n", @@ -876,6 +881,9 @@ if (buf[0]) {=20 D_ERR(__FUNCTION__", Role changed failed due to %s\n", get_err_msg(buf[0])); +=09=09=09 + /* fixme -- Notify l2cap that this BD will go down */ +=09=09=09 } else if (buf[7]) { DSYS(__FUNCTION__", Current master is 0x%04x%08x\n",=20 CHAR2INT16(buf[6], buf[5]),=20 @@ -1143,6 +1151,19 @@ CHAR2INT16(r_val[2], r_val[1])); break;=09 =20=20=20=20=20=20=20=20=20=20=20=20=20 + case READ_TRANSMIT_POWER_LEVEL:=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 +=09=09=20=20 + printk(__FUNCTION__", READ_TRANSMIT_POWER_LEVEL\n"); + if (r_val[0]) { + D_ERR(__FUNCTION__", READ_TRANSMIT_POWER_LEVEL: %s\n", + get_err_msg(r_val[0])); + break; + } else { + unsigned short hci_hdl =3D CHAR2INT12(r_val[2], r_val[1]); + DSYS("READ_TRANSMIT_POWER_LEVEL : handle %d, %d dBm\n", hci_hdl, r_val= [3]); + } + break; + case SET_HOST_CONTROLLER_TO_HOST_FLOW_CONTROL: D_CMD(__FUNCTION__", SET_HOST_CONTROLLER_TO_HOST_FLOW_CONTROL\n"); if (r_val[0]) { @@ -1333,15 +1354,6 @@ break; } =20=09=09=09 - hci_ctrl.hc_buf.acl_len =3D CHAR2INT16(r_val[2],r_val[1]); - hci_ctrl.hc_buf.sco_len =3D (u32) r_val[3]; - hci_ctrl.hc_buf.acl_num =3D CHAR2INT16(r_val[5],r_val[4]); - hci_ctrl.hc_buf.sco_num =3D CHAR2INT16(r_val[7],r_val[6]); - printk("\nHW module contains...\n"); - printk("%d ACL buffers at %d bytes\n%d SCO buffers at %d bytes\n\n", - hci_ctrl.hc_buf.acl_num, hci_ctrl.hc_buf.acl_len, - hci_ctrl.hc_buf.sco_num, hci_ctrl.hc_buf.sco_len); - break; =20 case READ_BUFFER_SIZE: @@ -1365,6 +1377,7 @@ hw.max_acl_num =3D hci_ctrl.hc_buf.acl_num; #endif #endif + wake_up_interruptible(&hci_wq); break; =20=20=20=20=20=20=20=20=20=20=20=20=20 case READ_BD_ADDR: @@ -1710,13 +1723,9 @@ send_data_task.data =3D NULL; #endif =20 - /* Disable parity bit and set to H4 IF + flow ctrl */ - /* Not activated until after reset !!!! */ - /* always... */ DSYS(__FUNCTION__", Reading buffer sizes in the module...\n"); hci_read_buffer_size(HCI_BLOCK); - hci_read_firmware_rev_info();=09 =20 #ifdef HOST_FLOW_CTRL @@ -1731,11 +1740,24 @@ start_ncp_timer();=09 #endif =20 +#ifdef CONFIG_BLUETOOTH_ENABLE_MSSWITCH + DSYS("M/S switch enabled\n"); + +#ifdef CONFIG_BLUETOOTH_CSR + /* CSR can't do scatternet yet, so we need to do m/s switch=20 + as early as in lp_connect_rsp */ +#define CONFIG_BLUETOOTH_EARLY_MSSWITCH +#endif + #ifdef CONFIG_BLUETOOTH_FORCE_MSSWITCH hci_force_msswitch(1); #else hci_force_msswitch(0); #endif=20=20=20=20=20=20=20 + +#else /* CONFIG_BLUETOOTH_ENABLE_MSSWITCH */ + DSYS("M/S switch disabled\n"); +#endif } =20 void=20 @@ -1795,7 +1817,6 @@ tmp =3D send_inq_cmd_block((u8*) &c_pkt,=20 c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN, inq_len); - return tmp; } =20 @@ -2127,7 +2148,7 @@ s32 hci_switch_role(u8 *bd, u8 role) { - printk(__FUNCTION__": role:%d\n", role); + DSYS(__FUNCTION__": role %d\n", role); =20 c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(SWITCH_ROLE, HCI_LP) ; @@ -2357,7 +2378,7 @@ s32=20 hci_write_scan_enable(u32 enable) { - printk(__FUNCTION__", enable %d\n", enable); + D_CMD(__FUNCTION__", enable %d\n", enable); c_pkt.type =3D CMD_PKT; c_pkt.opcode =3D hci_put_opcode(WRITE_SCAN_ENABLE, HCI_HC) ; =20=20=20 @@ -2576,6 +2597,20 @@ #endif } =20 +s32 +hci_read_power_transmit_level(u32 con_hdl, unsigned char type) +{ + D_CMD(__FUNCTION__"\n"); + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(READ_TRANSMIT_POWER_LEVEL, HCI_LP) ; + c_pkt.len =3D 3; + c_pkt.data[0] =3D con_hdl & 0xff; + c_pkt.data[1] =3D (con_hdl >> 8) & 0xff; + c_pkt.data[2] =3D type; +=09 + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + /* The hci_host_buffer_size function is used by the Host to notify the Host Controller about the maximum size of the data portion of HCI ACL and SCO Data Packets sent from the Host Controller to the Host. The Host @@ -2728,7 +2763,6 @@ memset(bd, 0, 6);=20 =20 tmp =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); - memcpy(bd, hci_ctrl.local_bd, 6); return tmp; }=20 @@ -2858,7 +2892,7 @@ void hci_force_msswitch(u8 enable) { - printk("Setting force_msswitch to %d\n", enable); + DSYS("Force M/S switch set to %d\n", enable); force_msswitch =3D enable;=20 } =20 @@ -2889,7 +2923,18 @@ {=20 D_CMD(__FUNCTION__"Status:%d\n", cfm); if (cfm) { +#ifdef CONFIG_BLUETOOTH_EARLY_MSSWITCH + if (force_msswitch) { + DSYS("lp_connect_rsp : early m/s switch\n"); + return accept_connection_request(bd_addr, MS_SWITCH_BECOME_MASTER); + } else + return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); + +#else return accept_connection_request(bd_addr, MS_SWITCH_REMAIN_SLAVE); +#endif + + } else { return reject_connection_request(bd_addr, 0x0d); /* FIXME: 0x0d =3D due to limited resourses store this @@ -2956,12 +3001,14 @@ decreased by one and checks whether there are more packets to send. Turn off interrupts since number_of_completed_packets interrupt can change hci_ctrl.hc_buf.acl_num. */ -=09 cli(); while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) { hci_ctrl.hc_buf.acl_num--; sti(); =20=09=09 + /* FIXME -- what if send_acl_packet fails ???=20 + Then acl_num will decrease anyway ... */=20 + bytes2send -=3D send_acl_packet(tx_buf); =20=09=09 D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20 @@ -3184,9 +3231,10 @@ D_CMD(__FUNCTION__", ACCEPT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, 0, cmd->data, HCI_HDL, ACL_CON); +#ifndef __KERNEL__ sleep(1); +#endif bt_write_lower_driver(o_event, o_len); -=20=20=20=20=20=20 lp_connect_cfm(data + 4, 0, 0); break; =20=20=20=20=20=20=20 @@ -3194,7 +3242,9 @@ D_CMD(__FUNCTION__", REJECT_CONNECTION->connection complete\n"); o_len =3D set_con_cpl_event(out_event, cmd->data[6], cmd->data, HCI_HDL, ACL_CON); +#ifndef __KERNEL__ sleep(1); +#endif bt_write_lower_driver(o_event, o_len); lp_connect_cfm(data + 4, 0xd, 0); break; @@ -3631,7 +3681,7 @@ up(&hci_cmd_semaphore); #else while (hci_cmd_pending)=09=09 - usleep(50000); + usleep(10000); #endif=20=20=20=20=20=20=20 return tmp; } |
From: Gordon M. <gm...@us...> - 2001-04-27 15:20:00
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.144 1.145=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Added the HCI commands written by Francesco Gallo and submitted by fabriz= io.gennari. The diff of the modified file(s): --- hci.c 2001/04/26 16:43:56 1.144 +++ hci.c 2001/04/27 15:19:29 1.145 @@ -2890,6 +2890,84 @@ force_msswitch =3D enable;=20 } =20 + +s32 +hci_hold_mode(u32 con_hdl, u32 max_interval, u32 min_interval) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(HOLD_MODE, HCI_LP) ; + c_pkt.len =3D 6; + c_pkt.data[0] =3D con_hdl & 0xff; + c_pkt.data[1] =3D (con_hdl >> 8) & 0xff; + c_pkt.data[2] =3D max_interval & 0xff; + c_pkt.data[3] =3D (max_interval >> 8) & 0xff; + c_pkt.data[4] =3D min_interval & 0xff; + c_pkt.data[5] =3D (min_interval >> 8) & 0xff; + + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 +hci_write_page_to(u32 page_to) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(WRITE_PAGE_TIMEOUT, HCI_HC) ; + c_pkt.len =3D 2; + c_pkt.data[0] =3D page_to & 0xff; + c_pkt.data[1] =3D (page_to >> 8) & 0xff; + + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 +hci_write_hold_mode_activity(u32 hma) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(WRITE_HOLD_MODE_ACTIVITY, HCI_HC) ; + c_pkt.len =3D 1; + c_pkt.data[0] =3D hma & 0xff; + + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 hci_write_connection_accept_to(u32 co_ac_to) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(WRITE_CONNECTION_ACCEPT_TIMEOUT, H= CI_HC) ; + c_pkt.len =3D 2; + c_pkt.data[0] =3D co_ac_to & 0xff; + c_pkt.data[1] =3D (co_ac_to >> 8) & 0xff; + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 hci_inquiry_cancel(void) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(INQUIRY_CANCEL, HCI_LC) ; + c_pkt.len =3D 0; + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 hci_read_clock_offset(u32 hdl) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(READ_CLOCK_OFFSET, HCI_LC) ; + c_pkt.data[0] =3D (hdl & 0xff); + c_pkt.data[1] =3D ((hdl >> 8) & 0xff); + c_pkt.len =3D 2; + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + +s32 hci_read_rssi(u32 hdl) +{ + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(READ_RSSI, HCI_SP) ; + c_pkt.data[0] =3D (hdl & 0xff); + c_pkt.data[1] =3D ((hdl >> 8) & 0xff); + c_pkt.len =3D 2; + return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); +} + /* Sends a connect request to the BT unit with the address bd_addr */ s32=20 lp_connect_req(u8 bd_addr[]) |
From: Mats F. <ma...@us...> - 2001-05-15 15:00:55
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.146 1.147=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added functions for Park, Hold and Sniff mode * Added two new functions for receiving data from BCSP The diff of the modified file(s): --- hci.c 2001/04/29 11:37:02 1.146 +++ hci.c 2001/05/15 15:00:55 1.147 @@ -140,6 +140,10 @@ #define USE_NCPTIMER=20 #define NCP_TIMEOUT (3*HZ) =20 +#ifdef CONFIG_BLUETOOTH_USE_BCSP +#define bt_write_lower_driver(data, len) bcsp_write_top(data, len) +#endif + /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 /* cmd_t and cmd_buf are structures used to handle the queue of commands @@ -327,7 +331,7 @@ static s32 test_hci_hdl; =20 /* temp solution to handle m/s switch */ -static s32 force_msswitch; +static s32 force_msswitch =3D 0; static s32 i_am_initiator =3D 0; =20 /****************** FUNCTION DEFINITION SECTION **************************= ***/ @@ -337,6 +341,7 @@ * parse_sco_packet or the parse_event_packet, depending on the packet type */ =20 + void hci_receive_data(u8* data, u32 count) { @@ -584,6 +589,99 @@ } } =20 +#ifdef CONFIG_BLUETOOTH_USE_BCSP +void +hci_receive_event(u8 *data, s32 count) +{ + u8 event_type, event_len; + u8 *tmp_buf; + + tmp_buf =3D data; +=09 + while (count > 0) { + event_type =3D tmp_buf[0]; + event_len =3D tmp_buf[1]; + tmp_buf +=3D 2; + count -=3D 2; + + D_REC(__FUNCTION__", Received event 0x%02x with len:%d\n", event_type, e= vent_len); +=09=09 + process_event(tmp_buf, event_len, event_type); + tmp_buf +=3D event_len; + count -=3D event_len; + } +} + +void +hci_receive_acl(u8 *data, s32 count) +{ + u8 *tmp_buf; + u16 hci_hdl; + u8 pb_flag; + u8 bc_flag; + u16 data_len; + hci_in_buffer *in_buf; + + tmp_buf =3D data; + + while (count > 0) { + /* Parse the HCI header */ + hci_hdl =3D CHAR2INT12(tmp_buf[1],tmp_buf[0]); + pb_flag =3D (((u32) tmp_buf[1]) & 0x30) >> 4; + bc_flag =3D (((u32) tmp_buf[1]) & 0xc0) >> 6; + data_len =3D CHAR2INT16(tmp_buf[3],tmp_buf[2]); + tmp_buf +=3D 4; + count -=3D 4; +=09=09 + /* Check the length to make sure we won't=20 + overrun in_buf->buf_ptr in a memcpy later. + --gmcnutt + */ + if (data_len > HCI_IN_SIZE) { + D_ERR(__FUNCTION__ ": %d is too big "\ + "for our HCI input buffers -- "\ + "discarding buffer\n", + data_len); + return; + } +=09=09 + if (pb_flag =3D=3D L2CAP_FRAME_START) { + D_REC(__FUNCTION__", new L2CAP frame\n"); + in_buf =3D get_free_inbuffer(); + if (in_buf) { + in_buf->nbr_of_hci_pkt =3D 1; + in_buf->hci_hdl =3D hci_hdl; + }=09 + } else { + D_REC(__FUNCTION__", cont L2CAP frame\n"); + in_buf =3D get_inbuffer(hci_hdl); + if (in_buf) { + in_buf->nbr_of_hci_pkt++; + } + } +=09=09 + if (in_buf) { + memcpy(in_buf->buf_ptr, tmp_buf, data_len); + D_REC(__FUNCTION__", Copied %d bytes into inbuffer\n", + data_len); + in_buf->buf_ptr +=3D data_len; + in_buf->count +=3D data_len; + D_REC(__FUNCTION__", in_buf->count:%d\n", in_buf->count); + } else { + D_ERR(__FUNCTION__", No inbuffer was found, "\ + "discarding data\n"); + return; + } +=09=09 + /* Decrease the amount of remaining data */ + count -=3D data_len; +=09=09 + process_acl_data(in_buf, pb_flag); + tmp_buf +=3D data_len; + } +} +#endif + void update_ncp(u8 nbr_of_hdl, u8 *pkt) { @@ -1746,6 +1844,8 @@ hci_force_msswitch(1); #else /* CONFIG_BLUETOOTH_ENABLE_MSSWITCH */ DSYS("M/S switch disabled\n"); + + hci_force_msswitch(0); #endif } =20 @@ -2698,6 +2798,7 @@ data portion of HCI ACL and SCO Data Packets sent from the Host to the = Host=20 Controller. The function can be called from both the process currently = in the driver and the interrupt handler, therefore the option to block or not.= */ + s32 hci_read_buffer_size(s32 block) { @@ -2713,6 +2814,7 @@ return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); } =20 + #if 0 s32 hci_read_local_version_info(s32 block) @@ -2770,6 +2872,100 @@ =20 =20 s32 +hci_hold_mode(u16 hci_hdl, u16 max_int, u16 min_int) +{=20=20 + D_CMD(__FUNCTION__", for connnection handle 0x%x\n", hci_hdl); + + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(HOLD_MODE, HCI_LP); +=09 + c_pkt.data[0] =3D hci_hdl & 0xff; + c_pkt.data[1] =3D (hci_hdl >> 8) & 0xff; + c_pkt.data[2] =3D max_int & 0xff; + c_pkt.data[3] =3D (max_int >> 8) & 0xff; + c_pkt.data[4] =3D min_int & 0xff; + c_pkt.data[5] =3D (min_int >> 8) & 0xff; + c_pkt.len =3D 6; + + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} + +s32 +hci_sniff_mode(u16 hci_hdl, u16 max_int, u16 min_int, u16 attempt, u16 tim= eout) +{=20=20 + D_CMD(__FUNCTION__", for connnection handle 0x%x\n", hci_hdl); + + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(SNIFF_MODE, HCI_LP); +=09 + c_pkt.data[0] =3D hci_hdl & 0xff; + c_pkt.data[1] =3D (hci_hdl >> 8) & 0xff; + c_pkt.data[2] =3D max_int & 0xff; + c_pkt.data[3] =3D (max_int >> 8) & 0xff; + c_pkt.data[4] =3D min_int & 0xff; + c_pkt.data[5] =3D (min_int >> 8) & 0xff; + c_pkt.data[6] =3D attempt & 0xff; + c_pkt.data[7] =3D (attempt >> 8) & 0xff; + c_pkt.data[8] =3D timeout & 0xff; + c_pkt.data[9] =3D (timeout >> 8) & 0xff; +=09 + c_pkt.len =3D 10; + + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} + +s32 +hci_exit_sniff_mode(u16 hci_hdl) +{=20 + D_CMD(__FUNCTION__", for connnection handle 0x%x\n", hci_hdl); + + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(EXIT_SNIFF_MODE, HCI_LP); +=09 + c_pkt.data[0] =3D hci_hdl & 0xff; + c_pkt.data[1] =3D (hci_hdl >> 8) & 0xff; + c_pkt.len =3D 2; + + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} + +s32 +hci_park_mode(u16 hci_hdl, u16 max_int, u16 min_int) +{=20=20 + D_CMD(__FUNCTION__", for connnection handle 0x%x\n", hci_hdl); + + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(PARK_MODE, HCI_LP); +=09 + c_pkt.data[0] =3D hci_hdl & 0xff; + c_pkt.data[1] =3D (hci_hdl >> 8) & 0xff; + c_pkt.data[2] =3D max_int & 0xff; + c_pkt.data[3] =3D (max_int >> 8) & 0xff; + c_pkt.data[4] =3D min_int & 0xff; + c_pkt.data[5] =3D (min_int >> 8) & 0xff; + c_pkt.len =3D 6; + + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} + +s32 +hci_exit_park_mode(u16 hci_hdl) +{=20=20 + D_CMD(__FUNCTION__", for connnection handle 0x%x\n", hci_hdl); + + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(EXIT_PARK_MODE, HCI_LP); +=09 + c_pkt.data[0] =3D hci_hdl & 0xff; + c_pkt.data[1] =3D (hci_hdl >> 8) & 0xff; + c_pkt.len =3D 2; + + return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); +} + + + +s32 get_con_hdl(u8 *bd) { u32 i; @@ -2885,24 +3081,7 @@ force_msswitch =3D enable;=20 } =20 - s32 -hci_hold_mode(u32 con_hdl, u32 max_interval, u32 min_interval) -{ - c_pkt.type =3D CMD_PKT; - c_pkt.opcode =3D hci_put_opcode(HOLD_MODE, HCI_LP) ; - c_pkt.len =3D 6; - c_pkt.data[0] =3D con_hdl & 0xff; - c_pkt.data[1] =3D (con_hdl >> 8) & 0xff; - c_pkt.data[2] =3D max_interval & 0xff; - c_pkt.data[3] =3D (max_interval >> 8) & 0xff; - c_pkt.data[4] =3D min_interval & 0xff; - c_pkt.data[5] =3D (min_interval >> 8) & 0xff; - - return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); -} - -s32 hci_write_page_to(u32 page_to) { c_pkt.type =3D CMD_PKT; @@ -3172,7 +3351,6 @@ return c; } =20 - void=20 set_acl_hdr(u8 *data, u32 len, u8 pb, u8 bc, u32 hci_hdl) { |
From: Mats F. <ma...@us...> - 2001-05-25 14:21:09
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.148 1.149=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added function for trigging hci send data * Check status of send_acl_pkt before decreasing acl_num The diff of the modified file(s): --- hci.c 2001/05/22 09:45:53 1.148 +++ hci.c 2001/05/25 14:21:09 1.149 @@ -678,6 +678,23 @@ } #endif =20 +s32 +hci_trig_send(void) +{ +=09 + if (buf_count()) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) + queue_task(&send_data_task, &tq_scheduler); +#else + queue_task(&send_data_task, &tq_immediate); + mark_bh(IMMEDIATE_BH); +#endif + return TRUE; + } else { + return FALSE; + } +} + void update_ncp(u8 nbr_of_hdl, u8 *pkt) { @@ -694,6 +711,9 @@ tmp =3D CHAR2INT16(pkt[i+3], pkt[i+2]); hci_ctrl.hc_buf.acl_num +=3D CHAR2INT16(pkt[i+3], pkt[i+2]); } +=09 + D_QUEUE("<NCP:%d>\n",hci_ctrl.hc_buf.acl_num); + D_REC(__FUNCTION__", acl_num after : %d\n", hci_ctrl.hc_buf.acl_num); =20 /* We've just been notified that the hardware has free buffers. @@ -804,13 +824,13 @@ reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); - change_connection_packet_type(hci_hdl,=20 - DM3|DH3|DM5|DH5); + change_connection_packet_type(hci_hdl,DM1|DH1|=20 + DM3|DH3); set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); =20 /* enable m/s switch */=20 - write_link_policy_settings(hci_hdl, 0x01); + write_link_policy_settings(hci_hdl, 0x04); =20 /* we demand role switch as server */ if (force_msswitch && !i_am_initiator) { @@ -993,8 +1013,6 @@ =20 update_ncp(buf[0], buf + 1); =20 - D_QUEUE("<NCP:%d>\n",hci_ctrl.hc_buf.acl_num); - break; =20 case MODE_CHANGE: @@ -2804,13 +2822,26 @@ c_pkt.opcode =3D hci_put_opcode(READ_BUFFER_SIZE, HCI_IP); c_pkt.len =3D 0; =20 - if (block) - return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N); + if (block) { + int ret =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_H= DR_LEN); +#if 0 + if (ret >=3D 0 && + hci_ctrl.hc_buf.acl_len =3D=3D 256 && + hci_ctrl.hc_buf.acl_num =3D=3D 4 && + hci_set_buffer_sizes(hci_ctrl.hc_buf.acl_len / 2, + hci_ctrl.hc_buf.acl_num * 2) >=3D= 0) { + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(READ_BUFFER_SIZE, = HCI_IP); + c_pkt.len =3D 0; + ret =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + C= MD_HDR_LEN + HCI_HDR_LEN); + } +#endif + return ret; + } else return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); } =20 - #if 0 s32 hci_read_local_version_info(s32 block) @@ -3226,6 +3257,7 @@ send_acl_data_task(void) { s32 bytes2send =3D 0;=09 + s32 sent_bytes =3D 0; bt_tx_buf *tx_buf; =20=09 /* get pointer to next unsent transmission chunk */ @@ -3245,13 +3277,22 @@ interrupt can change hci_ctrl.hc_buf.acl_num. */ cli(); while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) { - hci_ctrl.hc_buf.acl_num--; sti(); =20=09=09 /* FIXME -- what if send_acl_packet fails ???=20 Then acl_num will decrease anyway ... */=20 =20 - bytes2send -=3D send_acl_packet(tx_buf); + sent_bytes =3D send_acl_packet(tx_buf); + + if (sent_bytes !=3D 0) { + bytes2send -=3D sent_bytes; + cli(); + hci_ctrl.hc_buf.acl_num--; + sti(); + } else { + break; + } + =20=09=09 D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20 hci_ctrl.hc_buf.acl_num); |
From: Peter K. <pk...@us...> - 2001-05-28 12:05:44
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.149 1.150=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Reverted unintended changes to link mode policy and allowed packet types in last commit. The diff of the modified file(s): --- hci.c 2001/05/25 14:21:09 1.149 +++ hci.c 2001/05/28 12:05:43 1.150 @@ -824,13 +824,13 @@ reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); - change_connection_packet_type(hci_hdl,DM1|DH1|=20 - DM3|DH3); + change_connection_packet_type(hci_hdl,=20 + DM3|DH3|DM5|DH5); set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); =20 /* enable m/s switch */=20 - write_link_policy_settings(hci_hdl, 0x04); + write_link_policy_settings(hci_hdl, 0x01); =20 /* we demand role switch as server */ if (force_msswitch && !i_am_initiator) { |
From: Peter K. <pk...@us...> - 2001-05-30 12:39:21
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.150 1.151=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Enable DM1 and DH1 packets too for all but Ericsson. The diff of the modified file(s): --- hci.c 2001/05/28 12:05:43 1.150 +++ hci.c 2001/05/30 10:32:07 1.151 @@ -824,8 +824,13 @@ reset_hci_con_bd(hci_hdl); } else { DSYS(__FUNCTION__", ACL link is up\n"); +#ifdef CONFIG_BLUETOOTH_ERICSSON change_connection_packet_type(hci_hdl,=20 DM3|DH3|DM5|DH5); +#else + change_connection_packet_type(hci_hdl,=20 + DM1|DH1|DM3|DH3|DM5|DH5); +#endif set_hci_con(buf + 3, hci_hdl); remote_name_request(buf + 3); =20 |
From: Peter K. <pk...@us...> - 2001-06-05 09:19:35
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.151 1.152=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made hci_trig_send() a no-op in user mode. The diff of the modified file(s): --- hci.c 2001/05/30 10:32:07 1.151 +++ hci.c 2001/06/05 09:19:34 1.152 @@ -681,7 +681,7 @@ s32 hci_trig_send(void) { -=09 +#ifdef __KERNEL__ if (buf_count()) { #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) queue_task(&send_data_task, &tq_scheduler); @@ -693,6 +693,10 @@ } else { return FALSE; } +#else + /* FIXME? */ + return FALSE; +#endif } =20 void |