From: Peter K. <pk...@us...> - 2001-09-10 11:20:28
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.193 1.194=20=20=20=20=20=20=20=20=20=20=20 hci.c 1.175 1.176=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made hci_set_max_connections() resturn a result. The diff of the modified file(s): --- bluetooth.c 2001/09/10 11:17:11 1.193 +++ bluetooth.c 2001/09/10 11:19:57 1.194 @@ -1079,17 +1079,10 @@ =20 /* Set max number of connections */ case BTSETMAXCONNECTIONS: - { - u8 max_connections; - GET_USER(tmp, (s32*)arg); =20 - max_connections =3D (u8)(tmp & 0xff); - - BT_DRIVER("BTSETMAXCONNECTIONS: %d\n", max_connections); - hci_set_max_connections(max_connections); - return 0; - } + BT_DRIVER("BTSETMAXCONNECTIONS: %d\n", tmp); + return hci_set_max_connections(tmp); =20 case BTSETBCSPMODE: GET_USER(tmp, (s32*)arg); --- hci.c 2001/09/07 12:53:24 1.175 +++ hci.c 2001/09/10 11:19:57 1.176 @@ -2728,12 +2728,16 @@ } =20 =20 -void -hci_set_max_connections(u8 max_connections) +s32 +hci_set_max_connections(s32 max_connections) { - bt_max_connections =3D (int)max_connections; + if (max_connections < 0 || max_connections > 7) + return -EINVAL; +=20=20 + bt_max_connections =3D max_connections; DSYS("Setting max BT connections to %d\n", bt_max_connections); hci_update_load_factor(); + return 0; } =20 =20 |
From: Peter K. <pk...@us...> - 2001-09-12 12:13:00
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.177 1.178=20=20=20=20=20=20=20=20=20=20=20 l2cap.c 1.116 1.117=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Improved the calculation of the number of active connections. The diff of the modified file(s): --- hci.c 2001/09/10 12:10:56 1.177 +++ hci.c 2001/09/12 12:12:29 1.178 @@ -823,15 +823,16 @@ D_CMD(__FUNCTION__ ": CONNECTION_COMPLETE: %s\n", get_err_msg(buf[0])); =20 - - link_type =3D buf[9]; hci_hdl =3D CHAR2INT12(buf[2], buf[1]); test_hci_hdl =3D hci_hdl; =20 if (link_type =3D=3D ACL_LINK) { + if (lp_connect_cfm(buf + 3, (u32) buf[0], hci_hdl)) { + hci_ctrl.nbr_of_connections++; + hci_update_load_factor(); + } =20 - lp_connect_cfm(buf + 3, (u32) buf[0], hci_hdl); #ifndef HCI_EMULATION if (buf[0]) { /* remove hci handle if connection failed */ @@ -864,8 +865,6 @@ } /* reset variable again */ i_am_initiator =3D 0; - hci_ctrl.nbr_of_connections++; - hci_update_load_factor(); } #endif /* HCI_EMULATION */ =20 @@ -881,6 +880,7 @@ =20=09=09 break; } + case CONNECTION_REQUEST: D_CMD(__FUNCTION__ ": CONNECTION_REQUEST\n"); =20 @@ -898,15 +898,17 @@ release_cmd_timer(); wake_up_interruptible(&hci_wq); =20 - lp_disconnect_ind(CHAR2INT12(buf[2], buf[1])); + if (lp_disconnect_ind(CHAR2INT12(buf[2], buf[1]))) + if (hci_ctrl.nbr_of_connections > 0) { + hci_ctrl.nbr_of_connections--; + hci_update_load_factor(); + } =20 /* FIXME: No more NBR_OF_COMPLETE_PACKETS will arrive for this connection handle, if we only support point-to-point connections we can acl_num by reading the buffersizes again, but this will not work in a multipoint connection. */ =20 - hci_ctrl.nbr_of_connections--; - hci_update_load_factor(); reset_hci_con_bd(CHAR2INT12(buf[2], buf[1])); =20=09=09 if (hci_ctrl.nbr_of_connections <=3D 0) { @@ -1001,12 +1003,11 @@ D_CMD(__FUNCTION__ ": COMMAND_STATUS\n"); =20=09=09 if (buf[0]) {=09=09=09 - - /* 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) - */ + /* 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. This must be signalled using + lp_connect_cfm (neg) */ D_ERR(__FUNCTION__ ": COMMAND_STATUS: %s\n", get_err_msg(buf[0])); =20 #ifdef USE_INQTIMER @@ -1018,6 +1019,7 @@ update_nhcp(buf[1]); wake_up_interruptible(&hci_wq); break; + case FLUSH_OCCURRED: D_CMD(__FUNCTION__ ": FLUSH_OCCURRED on hci_hdl %d\n", CHAR2INT12(buf[1],buf[0])); @@ -2795,7 +2797,6 @@ c_pkt.len =3D 3; =20=20=20 return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= , DEFAULT_TIMEOUT); -=09 } =20 =20 @@ -3340,7 +3341,7 @@ if (cfm) { #ifdef CONFIG_BLUETOOTH_EARLY_MSSWITCH if (force_msswitch) { - DSYS("lp_connect_rsp : early m/s switch\n"); + DSYS(__FUNCTION__ ": 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); @@ -3649,7 +3650,11 @@ D_CMD(__FUNCTION__ ": DISCONNECT->disconnection complete\n"); o_len =3D set_discon_cpl_event(out_event, CHAR2INT12(cmd->data[1], cmd-= >data[0]), 0x13); bt_write_lower_driver(o_event, o_len); - lp_disconnect_ind(CHAR2INT12(cmd->data[1],cmd->data[0])); + if (lp_disconnect_ind(CHAR2INT12(cmd->data[1],cmd->data[0]))) + if (hci_ctrl.nbr_of_connections > 0) { + hci_ctrl.nbr_of_connections--; + hci_update_load_factor(); + } break; =20 case ACCEPT_CONNECTION_REQUEST: @@ -3660,7 +3665,10 @@ sleep(1); #endif bt_write_lower_driver(o_event, o_len); - lp_connect_cfm(data + 4, 0, 0); + if (lp_connect_cfm(data + 4, 0, 0)) { + hci_ctrl.nbr_of_connections++; + hci_update_load_factor(); + } break; =20 case REJECT_CONNECTION_REQUEST: --- l2cap.c 2001/09/12 11:45:02 1.116 +++ l2cap.c 2001/09/12 12:12:29 1.117 @@ -1365,7 +1365,7 @@ Confirms the request to establish a baseband connection */ =20=20=20 -void +s32 lp_connect_cfm(u8 *bd_addr, u32 status, u16 con_hdl) { l2cap_con *con; @@ -1388,7 +1388,7 @@ /* search for the corresponding l2cap connection */ if ((con =3D get_con(bd_addr, CLOSED)) =3D=3D NULL) { D_ERR(__FUNCTION__ ": couldn't find l2cap con!\n"); - return; + return 0; } =20 con->c_status =3D status; @@ -1405,7 +1405,7 @@ D_STATE(__FUNCTION__" Return NOW\n"); /* clear flag & set status */ con->c_flags &=3D ~FLAG_RETURNNOW; - return; + return 0; } #ifdef __CRIS__ bt_connections++; @@ -1424,6 +1424,8 @@ =20=09=09=09 l2ca_wakeup(__FUNCTION__, con); } + + return 1; } else { /* neg cfm */ D_STATE(__FUNCTION__ ": (neg) %s\n",get_err_msg(status)); @@ -1433,7 +1435,7 @@ =20=09=09 if (con->c_flags & FLAG_RETURNNOW) { con->c_flags &=3D ~FLAG_RETURNNOW; - return; + return 0; } =20 if (con->initiator) { @@ -1444,14 +1446,17 @@ /* delete connection if non-initiator */ delete_con(con); }=20 + + return 0; } } =20=20 /* Indicates that one of the baseband connections has been shutdown */ -void +s32 lp_disconnect_ind(u32 con_hdl) { l2cap_con *con; + s32 found =3D 0; =20 /* temp link down */ DSYS(__FUNCTION__": Connection handle %d disconnected\n", @@ -1489,6 +1494,8 @@ /* notify upper layers that phys link is down */ get_upper(con->psm)->disc_ind(con); } + + found =3D 1; } =20 D_CON(__FUNCTION__ ": no more l2cap cons on this handle\n"); @@ -1502,6 +1509,8 @@ else D_ERR(__FUNCTION__ ": bt_connections =3D=3D 0\n"); #endif + + return found; } =20 /* FIXME - lp_qos_violation_ind() */ |
From: Peter K. <pk...@us...> - 2001-09-12 12:38:11
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.194 1.195=20=20=20=20=20=20=20=20=20=20=20 l2cap.c 1.117 1.118=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Use hci_ctrl.nbr_of_connections instead of calculating bt_connections for bt_set_leds(). The diff of the modified file(s): --- bluetooth.c 2001/09/10 11:19:57 1.194 +++ bluetooth.c 2001/09/12 12:38:10 1.195 @@ -76,6 +76,7 @@ #include <linux/bluetooth/btcommon.h> #include <linux/bluetooth/btmem.h> #include <linux/bluetooth/hci.h> +#include <linux/bluetooth/hci_internal.h> #include <linux/bluetooth/l2cap.h> #include <linux/bluetooth/rfcomm.h> #include <linux/bluetooth/tcs.h> @@ -251,6 +252,8 @@ =20 /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 +extern hci_controller hci_ctrl; + /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) @@ -2252,14 +2255,10 @@ static void bt_set_leds(int active) { - extern int bt_connections; - int light_leds =3D ((!bt_connections && active =3D=3D BLUETOOTH_ACTIVITY)= || - (bt_connections && active =3D=3D NO_BLUETOOTH_ACTIVITY)); - - if (light_leds) { + if ((!hci_ctrl.nbr_of_connections && active =3D=3D BLUETOOTH_ACTIVITY) || + (hci_ctrl.nbr_of_connections && active =3D=3D NO_BLUETOOTH_ACT= IVITY)) { LED_ACTIVE_SET(bt_dfu_mode(-1) ? LED_ORANGE : LED_GREEN); - } - else { + } else { LED_ACTIVE_SET(LED_OFF); } } --- l2cap.c 2001/09/12 12:12:29 1.117 +++ l2cap.c 2001/09/12 12:38:10 1.118 @@ -247,10 +247,6 @@ =20 /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 -#ifdef __CRIS__ -int bt_connections =3D 0; -#endif - /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 static l2cap_layer l2capmain; /* Main structure */ @@ -275,10 +271,6 @@ init_con_list(); l2cap->cid_count =3D MIN_CID; /* Moved from init_con_list */ =20 -#ifdef __CRIS__ - bt_connections =3D 0; -#endif - /* Set all upper layers to default */ =20 l2cap_protocol_default(&default_protocol); @@ -367,10 +359,6 @@ free_con_list(); remove_all_upper(); =20 -#ifdef __CRIS__ - bt_connections =3D 0; -#endif - /* ALWAYS SUCCESS */ return 0; } @@ -1407,9 +1395,6 @@ con->c_flags &=3D ~FLAG_RETURNNOW; return 0; } -#ifdef __CRIS__ - bt_connections++; -#endif =20=09=09 if (!(con->initiator)) {=09=09 D_STATE("We are server\n"); @@ -1502,13 +1487,6 @@ =20 /* flush old buffers waiting to be sent on this handle */ btmem_flushhandle((u16)con_hdl); - -#ifdef __CRIS__ - if (bt_connections > 0) - bt_connections--; - else - D_ERR(__FUNCTION__ ": bt_connections =3D=3D 0\n"); -#endif =20 return found; } |
From: Peter K. <pk...@us...> - 2001-09-18 08:32:50
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_vendor.c 1.52 1.53=20=20=20=20=20=20=20=20=20=20=20=20 sdp.c 1.77 1.78=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added the packed attribute to a couple of structs. The diff of the modified file(s): --- hci_vendor.c 2001/09/07 12:53:24 1.52 +++ hci_vendor.c 2001/09/18 08:32:50 1.53 @@ -468,13 +468,13 @@ u8 ch_id:6; u8 first:1; u8 last:1; -} payload_descr; +} __attribute__ ((packed)) payload_descr; =20 typedef struct csr_msg { payload_descr p_descr; u8 msg[0]; -} csr_msg; +} __attribute__ ((packed)) csr_msg; =20 typedef struct csr_bccmd { @@ -484,7 +484,7 @@ u16 var_id; u16 status; u16 payload[0]; -} csr_bccmd; +} __attribute__ ((packed)) csr_bccmd; =20=20=20 typedef struct csr_bccmd_ps { @@ -492,12 +492,12 @@ u16 ps_len; /* len of only ps_val */ u16 unused; /* always 0x0000 */ u16 ps_val[0]; -} csr_bccmd_ps; +} __attribute__ ((packed)) csr_bccmd_ps; =20 typedef struct csr_rssi_rep {=20=20 u16 rssi; -} csr_rssi_rep; +} __attribute__ ((packed)) csr_rssi_rep; =20 typedef struct csr_packstat_rep {=20=20 @@ -506,14 +506,14 @@ u16 n_corr; u16 rssi; u16 rssi_valid; -} csr_packstat_rep; +} __attribute__ ((packed)) csr_packstat_rep; =20 typedef struct csr_biterr_rep {=20=20 u16 index; u16 val_last; u16 val_tot; -} csr_biterr_rep; +} __attribute__ ((packed)) csr_biterr_rep; =20 static u16 csr_count =3D 0; =20 --- sdp.c 2001/06/14 10:34:53 1.77 +++ sdp.c 2001/09/18 08:32:50 1.78 @@ -294,12 +294,12 @@ u16 sdp_con_id; u16 len; u8 data[0]; -} data_struct; +} __attribute__ ((packed)) data_struct; =20 struct database_query { u32 count; u8 query[256]; -} database_query; +} __attribute__ ((packed)) database_query; =20 sdp_con sdp_con_list[MAX_NBR_SDP]; =20 |
From: Peter K. <pk...@us...> - 2001-09-18 12:11:20
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bcsp.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 bcsp_slip.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Made bcsp_slip_receive() call bcsp_integrity_receive() instead of having bcsp_receive_lower() do it. * Moved bcsp_dbg() to bcsp_slip.c and renamed it to slip_debug(). Previously there was a chance of it displaying incorrect seq and ack values for outgoing packets (as it used the slip encoded values). The diff of the modified file(s): --- bcsp.c 2001/09/07 12:53:24 1.19 +++ bcsp.c 2001/09/18 12:10:49 1.20 @@ -56,7 +56,6 @@ #include <linux/bluetooth/btcommon.h> #include <linux/bluetooth/bluetooth.h> #include <linux/bluetooth/hci.h> -#include <linux/bluetooth/btmem.h> #include <linux/bluetooth/bcsp.h> #include <linux/bluetooth/bcsp_debug.h> #else @@ -68,7 +67,6 @@ #include "btcommon.h" #include "bluetooth.h" #include "hci.h" -#include "btmem.h" #include "bcsp.h" #include "bcsp_debug.h" #endif @@ -235,56 +233,18 @@ return 0; } =20 -#if BCSP_PARSELOWER - -/* - * Used to parse headers of sent/incoming BCSP packets - * Also prints other potentially interesting stats=20 - */ - -void -bcsp_dbg(const u8 *str, u8 flags, u32 tot_len) -{ -#include <linux/bluetooth/hci_internal.h> - extern hci_controller hci_ctrl; - extern u8 winspace; - extern u8 txseq; - extern u8 txack; - extern u8 rxack; - extern u8 expected_rxseq; - - printk("%s | seq:%d | ack:%d | winsize:%d | acl:%d | bufc:%d [%d]\n", - str, (flags&BCSP_FLAG_SEQ),=20 - (flags&BCSP_FLAG_ACK) >> 3,=20 - winspace, hci_ctrl.hc_buf.acl_num, buf_byte_count(-1), tot_len); - - printk("status: txseq[%d] txack[%d] cur_rxack[%d] exp_rxseq[%d]\n\n",=20 - txseq, txack, rxack, expected_rxseq); -} -#endif - s32 bcsp_receive_lower(u8 *data, u32 len) { s32 handled =3D 0; - struct bcsp bcsp; =20 D(__FUNCTION__ ": Incoming data:\n"); =20 BCSPDUMP(data, len); =20 while (handled < len) { - bcsp_init_packet(&bcsp); - handled +=3D bcsp_slip_receive(&bcsp, data + handled,=20 - len - handled); + handled +=3D bcsp_slip_receive(data + handled, len - handled); D(__FUNCTION__ ": So far handled: %d bytes\n", handled); - if (bcsp.packet) { -#if BCSP_PARSELOWER - bcsp_dbg("=3D=3D> ", bcsp.packet[0], bcsp.packet_length); -#endif - bcsp_integrity_receive(&bcsp); - kfree(bcsp.packet); - } } return 0; } @@ -325,9 +285,6 @@ =20 BCSPDUMP(data, len); =20 -#if BCSP_PARSELOWER - bcsp_dbg("<-- ", data[1], len); -#endif=20 return bt_write_lower_driver_real(data, len); } =20 --- bcsp_slip.c 2001/08/16 13:01:22 1.6 +++ bcsp_slip.c 2001/09/18 12:10:49 1.7 @@ -46,6 +46,8 @@ #ifdef __KERNEL__ #include <linux/malloc.h> =20 +#include <linux/bluetooth/btcommon.h> +#include <linux/bluetooth/btmem.h> #include <linux/bluetooth/bcsp.h> #include <linux/bluetooth/bcsp_debug.h> #else @@ -53,6 +55,7 @@ #include <errno.h> =20 #include "btcommon.h" +#include "btmem.h" #include "bcsp.h" #include "bcsp_debug.h" #endif @@ -73,6 +76,10 @@ =20 static void slip_send_add_byte(struct bcsp* bcsp, u8 data); =20 +#if BCSP_PARSELOWER +static void slip_debug(const u8 *str, const struct bcsp *bcsp); +#endif + /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ @@ -114,6 +121,10 @@ =20 bcsp->packet[bcsp->packet_length++] =3D 0xC0; =20 +#if BCSP_PARSELOWER + slip_debug("<=3D=3D ", bcsp); +#endif=20 + bcsp_write_lower(bcsp->packet, bcsp->packet_length); kfree(bcsp->packet); =20 @@ -121,15 +132,18 @@ } =20 s32 -bcsp_slip_receive(struct bcsp* bcsp, const u8* packet, u32 len) +bcsp_slip_receive(const u8* packet, u32 len) { static u8 buffer[4 + 4096 + 2 + 1]; static s32 length =3D 0; static s32 skipping =3D TRUE; + struct bcsp bcsp; s32 i =3D 0; =20 D(__FUNCTION__ "\n"); =20=09 + bcsp_init_packet(&bcsp); +=09 if (skipping) { while (i < len) { if (packet[i++] =3D=3D 0xC0) { @@ -139,7 +153,7 @@ } } =20 - bcsp->packet =3D NULL; + bcsp.packet =3D NULL; } =20 for (; i < len && !skipping; i++) { @@ -149,9 +163,9 @@ if (!length) { i--; } - else if ((bcsp->packet =3D kmalloc(length, GFP_ATOMIC))) { - memcpy(bcsp->packet, buffer, length); - bcsp->packet_length =3D length; + else if ((bcsp.packet =3D kmalloc(length, GFP_ATOMIC))) { + memcpy(bcsp.packet, buffer, length); + bcsp.packet_length =3D length; } break; =20 @@ -181,6 +195,14 @@ } } =20 + if (bcsp.packet) { +#if BCSP_PARSELOWER + slip_debug("=3D=3D> ", &bcsp); +#endif + bcsp_integrity_receive(&bcsp); + kfree(bcsp.packet); + } + return i; } =20 @@ -203,5 +225,34 @@ break; } } + +#if BCSP_PARSELOWER + +/* + * Used to parse headers of sent/incoming BCSP packets + * Also prints other potentially interesting stats=20 + */ + +#include <linux/bluetooth/hci_internal.h> + +void +slip_debug(const u8 *str, const struct bcsp *bcsp) +{ + extern hci_controller hci_ctrl; + extern u8 winspace; + extern u8 txseq; + extern u8 txack; + extern u8 rxack; + extern u8 expected_rxseq; + + printk("%sseq: %ld, ack: %ld, winsize: %d, acl: %d, bufc: %d, length: %d\= n", + str, BCSP_GET_SEQ(bcsp), BCSP_GET_ACK(bcsp), winspace, + hci_ctrl.hc_buf.acl_num, buf_byte_count(-1), + bcsp->packet_length); + + printk("Status: txseq: %d, txack: %d, cur_rxack: %d, exp_rxseq: %d\n", + txseq, txack, rxack, expected_rxseq); +} +#endif =20 /****************** END OF FILE slip.c ***********************************= ***/ |
From: Peter K. <pk...@us...> - 2001-10-02 11:00:59
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci.c 1.181 1.182=20=20=20=20=20=20=20=20=20=20=20 hci_vendor.c 1.54 1.55=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Removed an unused hack to change the buffer sizes in a CSR module. The diff of the modified file(s): --- hci.c 2001/09/21 12:51:06 1.181 +++ hci.c 2001/10/02 11:00:25 1.182 @@ -2948,20 +2948,7 @@ c_pkt.len =3D 0; =20 if (block) { - int ret =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_H= DR_LEN, DEFAULT_TIMEOUT); -#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, DEFAULT_TIMEOUT); - } -#endif - return ret; + return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N, DEFAULT_TIMEOUT); } else return send_cmd((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN); --- hci_vendor.c 2001/09/18 12:22:00 1.54 +++ hci_vendor.c 2001/10/02 11:00:25 1.55 @@ -897,55 +897,6 @@ return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= , DEFAULT_TIMEOUT); } =20 -s32=20 -hci_set_buffer_sizes(u16 len, u16 num) -{ - csr_msg *msg; - csr_bccmd *cmd; - csr_bccmd_ps *ps; - int ret; - - D_CMD(__FUNCTION__ VENDOR "\n"); - - /* HCI Manufacturer specific header */ - c_pkt.type =3D CMD_PKT; - c_pkt.opcode =3D hci_put_opcode(0x00, MANUFACTURER_SPEC); - c_pkt.len =3D 1 + 5*sizeof(u16) + 3*sizeof(u16) + 1*sizeof(u16); - - msg =3D (csr_msg *)c_pkt.data; - cmd =3D (csr_bccmd *)msg->msg; - ps =3D (csr_bccmd_ps *)cmd->payload; - - /* General msg header */ - CSR_SET_LAST(msg, 1); /* first and last segment */ - CSR_SET_FIRST(msg, 1); - CSR_SET_CH_ID(msg, CSR_CH_ID_BCCMD); - - /* BCCMD type */ - cmd->type =3D CSR_MSGTYPE_SETREQ; - cmd->len =3D 5 + 3 + 1; - cmd->seq =3D csr_count++; - cmd->var_id =3D CSR_CMD_PS; - cmd->status =3D CSR_STATUS_OK; /* always OK in SETREQ */ - - /* Actual PS key request */ - ps->ps_key =3D CSR_PS_MAX_ACL_PKTS; - ps->ps_len =3D 1; /* x 16 bits */ - ps->unused =3D 0x0000; - - ps->ps_val[0] =3D num; - - ret =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE= N, DEFAULT_TIMEOUT); - if (ret < 0) - return ret; -=09 - cmd->seq =3D csr_count++; - ps->ps_key =3D CSR_PS_MAX_ACL_PKT_LEN; - ps->ps_val[0] =3D len; - - return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN= , DEFAULT_TIMEOUT); -} - s32 hci_read_firmware_rev_info(void) { |
From: Anders J. <and...@us...> - 2001-10-12 12:03:23
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.203 1.204=20=20=20=20=20=20=20=20=20=20=20 rfcomm.c 1.123 1.124=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Corrected bug in RFCOMM, now using correct length when determine if there= are any data in the ACL packet. * Changed returnvalues to use bt_err-errorcodes and standard defines. The diff of the modified file(s): --- bluetooth.c 2001/10/10 14:58:18 1.203 +++ bluetooth.c 2001/10/12 12:03:22 1.204 @@ -1855,6 +1855,7 @@ case RFCOMM_LAYER: { u8 srv_ch; + s32 retval =3D 0; =20 CHECK_RFCOMM(con_id); srv_ch =3D GET_RFCOMMSRVCH(con_id);=20 @@ -1865,9 +1866,9 @@ srv_ch, line); BT_DATADUMP("Remote BD: ", bd_addr, 6); =20 - if (rfcomm_connect_req(bd_addr, srv_ch, line) < 0) { + if ((retval =3D rfcomm_connect_req(bd_addr, srv_ch, line)) < 0) { BT_DRIVER(__FUNCTION__ ": Failed\n"); - return bt_ctrl.session[line].connect_status; + return retval; } =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 /* sleep if not yet connected */ --- rfcomm.c 2001/10/10 14:58:18 1.123 +++ rfcomm.c 2001/10/12 12:03:22 1.124 @@ -58,6 +58,7 @@ #include <linux/bluetooth/l2cap.h> #include <linux/bluetooth/bluetooth.h> #include <linux/bluetooth/btconfig.h> +#include <linux/bluetooth/bt_errno.h> #else #include <stdlib.h> #include <string.h> @@ -68,6 +69,7 @@ #include "include/l2cap.h" #include "include/bluetooth.h" #include "include/local.h" +#include "include/bt_errno.h" #endif =20 /****************** DEBUG CONSTANT AND MACRO SECTION *********************= ***/ @@ -671,13 +673,14 @@ { rfcomm_con *rfcomm; u8 tmp_dlci; + s32 retval =3D 0; =20=20=20 D_CTRL(FNC"server channel:%d, line:%d\n", server_chn, line); =20 if (!(rfcomm =3D get_rfcomm_con(line))) { D_ERR(FNC"%d is an invalid line\n", line); - return 0; + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_INVALID_LINE); } =20 if (rfcomm->dlci[0].state =3D=3D DISCONNECTED) { @@ -693,13 +696,14 @@ rfcomm->dlci[0].state =3D CONNECTING;=20=20=20=20 =20 /* we don't have a l2cap connection yet */ - if (l2ca_connect_req(bd_addr, RFCOMM_LAYER)) { + if ((retval =3D l2ca_connect_req(bd_addr, RFCOMM_LAYER)) < 0) { D_ERR(FNC"l2ca_connect_req failed\n"); - return -1; + return retval; } } else if (!((rfcomm->l2cap)->current_state =3D=3D OPEN)) { =20 D_ERR(FNC"L2CAP_CON exists but is not in OPEN state (yet?)\n"); + /* FIXME: Should we really return no error here? */ return 0; } else if (rfcomm->dlci[0].state !=3D CONNECTED) { =20 @@ -713,19 +717,19 @@ } else { rfcomm->dlci[0].state =3D CONNECTING; /* Establish the control channel */ - send_sabm(rfcomm, 0); + return send_sabm(rfcomm, 0); } } else if (rfcomm->dlci[tmp_dlci].state !=3D DISCONNECTED) { =20 D_ERR(FNC"trying to connect a non DISCONNECTED server channel (%d)\n",se= rver_chn); - return 0; + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_SRVCHN_CONNECTED); } else { D_CTRL(FNC"We are negotiating rfcomm (pn msg)\n"); rfcomm->dlci[tmp_dlci].state =3D NEGOTIATING; /* must fit i l2cap mtu */ D_CTRL(FNC"negotiate mtu : %d bytes\n", rfcomm->l2cap->remote_mtu - 5); - send_pn_msg(rfcomm, 7, rfcomm->dlci[tmp_dlci].mtu, 0, 0, + return send_pn_msg(rfcomm, 7, rfcomm->dlci[tmp_dlci].mtu, 0, 0, tmp_dlci, TRUE); } =20 @@ -742,6 +746,11 @@ s32 tmp; =20 D_CTRL("rfcomm_disconnect_req %d\n", line); + if(line >=3D BT_NBR_DATAPORTS) { + D_ERR("rfcomm_disconnect_req : Invalid line\n"); + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_INVALID_LINE); + } +=09 if (!(rfcomm =3D &rfcomm_con_list[line])) { D_ERR("rfcomm_disconnect_req : no rfcomm con\n"); @@ -1268,7 +1277,7 @@ #endif D_REC(FNC"Local_credits:%d\n", rfcomm->dlci[tmp_dlci].local_credits);= =20 uih_data_start++; - if (short_pkt->h.length.len =3D=3D 0) { + if (uih_len =3D=3D 0) { break; } =20=09=09=09 @@ -1330,7 +1339,7 @@ =20=09 if (dlci =3D=3D 0) { D_ERR(FNC"Not allowed to send data on DLCI 0\n"); - return -1; + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_NO_DATA_ALLOWED); } =20=09 rfcomm =3D &rfcomm_con_list[line]; @@ -1338,17 +1347,15 @@ =20 if (rfcomm =3D=3D NULL) { D_ERR(FNC" ERROR rfcomm_con =3D=3D NULL\n"); - return -1; + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_NO_CONNECTION); } else if (rfcomm->magic !=3D RFCOMM_MAGIC) { D_ERR(FNC"ERROR magic test failed\n"); - return -1; + return -MSGCODE(MSG_LAYER_RFCOMM, RFCOMM_BAD_MAGIC_NUMBER); } else if(rfcomm->dlci[0].state =3D=3D FLOW_STOPPED) { D_SND(FNC"Flow stopped on all channels, returning zero\n"); - /* FIXME: We need to buffer the incoming data here... */ return 0; } else if (rfcomm->dlci[dlci].state =3D=3D FLOW_STOPPED) { D_SND(FNC"Flow stopped, returning zero\n"); - /* FIXME: We need to buffer the incoming data here... */ return 0; } /* Check whether there are any data channels connected */ @@ -1665,7 +1672,7 @@ =20=09 if (!tx_buf) { D_ERR("send_ua : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20=09 tx_buf->cur_len =3D rfcomm_frame_size; @@ -1706,7 +1713,7 @@ =20 if (!tx_buf) { D_ERR("send_dm : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -1745,7 +1752,7 @@ =20=09 if (!tx_buf) { D_ERR("send_sabm : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -1784,7 +1791,7 @@ =20 if (!tx_buf) { D_ERR("send_disc : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -1819,6 +1826,7 @@ bt_tx_buf *tx_buf; u32 rfcomm_frame_size; u8 send_credit =3D 0; + s32 retval =3D 0; =20=09=09 D_CTRL(FNC"Creating UIH packet with %d bytes data to DLCI %d\n", len, dlci); @@ -1853,7 +1861,7 @@ + rfcomm_frame_size);=20=20=20=20 if (!tx_buf) { D_ERR(FNC"didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } tx_buf->cur_len =3D rfcomm_frame_size; =20=20=20=20=20 @@ -1885,7 +1893,7 @@ + rfcomm_frame_size); if (!tx_buf) { D_ERR(FNC"didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } tx_buf->cur_len =3D rfcomm_frame_size; =20=20=20=20=20 @@ -1909,7 +1917,10 @@ /* FIXME - How should we propagate result up to higher layers ? through len or success/no success? */ tx_buf->line =3D rfcomm->line; - l2cap_send_data(tx_buf, rfcomm->l2cap); + if((retval =3D l2cap_send_data(tx_buf, rfcomm->l2cap)) < 0) { + return retval; + } +=09 return len; } =20 @@ -1927,7 +1938,7 @@ =20 if (!tx_buf) { D_ERR("rfcomm_fcon_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -1964,7 +1975,7 @@ + rfcomm_frame_size); if (!tx_buf) { D_ERR("rfcomm_test_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } tx_buf->cur_len =3D rfcomm_frame_size; uih_pkt =3D (long_frame*) (tx_buf->data + sizeof(rfcomm_tx_buf)); @@ -1996,7 +2007,7 @@ + rfcomm_frame_size); if (!tx_buf) { D_ERR("rfcomm_test_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20=09=09 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2029,7 +2040,7 @@ + rfcomm_frame_size); if (!tx_buf) { D_ERR("rfcomm_test_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20=09=09 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2071,7 +2082,7 @@ =20 if (!tx_buf) { D_ERR("rfcomm_fcon_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2108,7 +2119,7 @@ =20 if (!tx_buf) { D_ERR("rfcomm_fcoff_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2149,7 +2160,7 @@ =20 if (!tx_buf) { D_ERR("rfcomm_rpn_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2198,7 +2209,7 @@ =20 if (!tx_buf) { D_ERR("rfcomm_rls_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2242,7 +2253,7 @@ =20 if (!tx_buf) { D_ERR("send_pn_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2292,7 +2303,7 @@ =20 if (!tx_buf) { D_ERR("send_nsc_msg : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2330,7 +2341,7 @@ =20 if (!tx_buf) { D_ERR(FNC"didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; @@ -2398,6 +2409,9 @@ rfcomm_con*=20 get_rfcomm_con(u8 line) { + if(line >=3D BT_NBR_DATAPORTS) { + return NULL; + } return &rfcomm_con_list[line]; } =20 @@ -2553,7 +2567,7 @@ =20 if (!tx_buf) { D_ERR(FNC"didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D rfcomm_frame_size; |
From: Anders J. <and...@us...> - 2001-10-16 16:23:52
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- test.c 1.29 1.30=20=20=20=20=20=20=20=20=20=20=20=20 unplug_test.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * All testcases in unplug_test.c should now return a value. * Made some functions in test.c return proper values. The diff of the modified file(s): --- test.c 2001/10/10 14:58:18 1.29 +++ test.c 2001/10/16 16:23:47 1.30 @@ -171,13 +171,13 @@ s32 test_connect_req(BD_ADDR bd) { + s32 retval =3D 0; D_STATE("test_connect_req to psm 0x%x\n", L2CAP_TEST_LAYER); =20 - if (l2ca_connect_req(bd, L2CAP_TEST_LAYER)) { + if ((retval =3D l2ca_connect_req(bd, L2CAP_TEST_LAYER)) < 0) { D_ERR(" tcs_connect_req: l2ca_connect_req failed\n"); - return -1;=20 } - return 0; + return retval; } =20 s32 @@ -414,15 +414,18 @@ =20 printk("test_send_data : sending %d bytes\n", len); =20=09 - if (!con) + if (!con) { + D_ERR("test_send_data : No connection object\n"); return -1; + } +=09 =20 /* tx bufs are all the same for each upper layer ... FIX one common */ tx_buf =3D subscribe_bt_buf(sizeof(rfcomm_tx_buf) + len); =20 if (!tx_buf) { D_ERR("test_send_data : didn't get a valid tx_buf\n"); - return -1; + return -ENOMEM; } =20 tx_buf->cur_len =3D len; @@ -435,7 +438,7 @@ =20 /* FIXME -- add new commands in user application menu !!!! */ =20 -void +s32 test_process_cmd(unsigned char *cmd, s32 size) {=20 #ifdef CONFIG_BLUETOOTH_UNPLUG_TEST @@ -456,13 +459,13 @@ bd[2], bd[1], bd[0]); =20=09=09 l2cap_create_con(bd); - lp_connect_req(bd); + return lp_connect_req(bd); } else if(strncmp(cmd, "t ", 2) =3D=3D 0) { testcase =3D strtoul(cmd+2, NULL, 0); =20 if (testcase > 0) { - process_test_cmd(testcase); + return process_test_cmd(testcase); } else { printk("test_process_cmd: Couldn't parse testcase\n"); @@ -470,16 +473,17 @@ } else if(!strncmp(cmd, "bb_disc ", 8)) { int i =3D strtoul(cmd+8, NULL, 0); - lp_disconnect((unsigned short)i); + return lp_disconnect((unsigned short)i); } else if(!strncmp(cmd, "lcid_disconnect ", 16)) { l2cap_con *con =3D NULL; int i =3D strtoul(cmd + 16, NULL, 0); if((con =3D get_lcon(i))) { - l2ca_disconnect_req(con); + return l2ca_disconnect_req(con); } else { printk("Didn't find lcid %d\n", i); + return -1; } } else if(!strncmp(cmd, "test_case_reject ", 17)) { @@ -490,7 +494,7 @@ printk("bb_conn read [%d] =3D 0x%x\n", i, bd[i]); p++; }=20=20 - l2ca_connect_req(bd, fake_psm); + return l2ca_connect_req(bd, fake_psm); } else if(!strncmp(cmd, "tx_data ", 8)) { int lcid, len; @@ -503,23 +507,27 @@ con =3D get_lcon(lcid); if (!con) { printk("Found no connection with lcid : %d\n", lcid); - return; + return -1; } =20 - test_send_data(con, testdata, len); + return test_send_data(con, testdata, len); } else if(!strncmp(cmd, "sdptest ", 8)) { int n =3D strtoul(cmd+8, NULL, 0);=09 - do_sdp_test(n); + return do_sdp_test(n); } else if(!strcmp(cmd, "test_case_disable_disconnect")) { dont_send_disconnect_rsp =3D 1; + return 0; } else if(!strcmp(cmd, "test_case_enable_disconnect")) { dont_send_disconnect_rsp =3D 0; + return 0; } else { printk("Unknown test cmd!\n"); + return -1; } =20=09 #else printk("test_process_cmd: Not available\n"); + return 0; #endif } =20 --- unplug_test.c 2001/08/27 15:22:04 1.5 +++ unplug_test.c 2001/10/16 16:23:45 1.6 @@ -331,16 +331,18 @@ #define SERVER 0 #define CLIENT 1 =20 -static void test_server(void) +static s32 test_server(void) { printk("Now we are test server (device A)\n"); test_role =3D SERVER; + return 0; } =20 -static void test_client(void) +static s32 test_client(void) { printk("Now we are test client (device B)\n"); test_role =3D CLIENT; + return 0; } =20 =20 @@ -369,55 +371,56 @@ * Test case : Data transfer via Open L2CAP Channel (L2CAP Test 3) */ =20 -static void test_2_2_1(void) +static s32 test_2_2_1(void) { /* client sends 10 bytes */ printk("test_2_2_1, client sends 10 bytes\n");=20 - test_send_data(testcon, testdata, 10); + return test_send_data(testcon, testdata, 10); } =20 -static void test_2_2_2(void) +static s32 test_2_2_2(void) { /* client sends 350 bytes */ printk("test_2_2_2, client sends 350 bytes\n");=20 - test_send_data(testcon, testdata, 350); + return test_send_data(testcon, testdata, 350); } =20 -static void test_2_2_3(void) +static s32 test_2_2_3(void) { /* client sends 672 bytes */ printk("test_2_2_3, client sends 672 bytes\n");=20 - test_send_data(testcon, testdata, 672); + return test_send_data(testcon, testdata, 672); } =20 -static void test_2_2_4(void) +static s32 test_2_2_4(void) { /* server sends 10 bytes */ printk("test_2_2_4, server sends 10 bytes\n");=20 - test_send_data(testcon, testdata, 10); + return test_send_data(testcon, testdata, 10); } =20 -static void test_2_2_5(void) +static s32 test_2_2_5(void) { /* server sends 350 bytes */ printk("test_2_2_5, server sends 350 bytes\n");=20 - test_send_data(testcon, testdata, 350); + return test_send_data(testcon, testdata, 350); } =20 -static void test_2_2_6(void) +static s32 test_2_2_6(void) { /* server sends 672 bytes */ printk("test_2_2_6, server sends 672 bytes\n");=20 - test_send_data(testcon, testdata, 672); + return test_send_data(testcon, testdata, 672); } =20 -/* - * Test case : Disconnection of a Connection Oriented Channel - * Device B Initiator (L2CAP Test 3) - * (see btd.c, issue command 'test_disc <local CID>') - */ +static s32 test_2_3(void) +{ + printk("test_2_3, disconnect\n"); + return test_disconnect_req(testcon); +} =20 =20=20 +=20 /* * Test case : Echo * Device A Initiator (L2CAP Test 4) @@ -434,57 +437,64 @@ #define OPTION_MTU1 4096 #define OPTION_MTU2 8192 =20 -static void test_2_5_1(void) +static s32 test_2_5_1(void) { + s32 retval =3D 0; printk("[Client] Sending config req for mtu =3D %d\n", OPTION_MTU1); - if (l2ca_config_req(testcon, OPTION_MTU1, NULL, 0, 0)) { + if ((retval =3D l2ca_config_req(testcon, OPTION_MTU1, NULL, 0, 0)) < 0) { D_ERR("l2ca_connect_cfm : Configuration request failed\n"); } + return retval; } =20 -static void test_2_5_2(void) +static s32 test_2_5_2(void) { printk("[Server] Set our in_mtu to :%d\n", OPTION_MTU2); test_inmtu =3D OPTION_MTU2; + return 0; } =20 =20 -static void test_2_5_3(void) +static s32 test_2_5_3(void) { + s32 retval =3D 0; printk("[Client] Sending config req for mtu =3D %d\n", OPTION_MTU2); - if (l2ca_config_req(testcon, OPTION_MTU2, NULL, 0xffff, 0)) { + if ((retval =3D l2ca_config_req(testcon, OPTION_MTU2, NULL, 0xffff, 0)) <= 0) { D_ERR("l2ca_connect_cfm : Configuration request failed\n"); } + return retval; } =20 -static void test_2_5_4(void) +static s32 test_2_5_4(void) { printk("[Server] Set our in_mtu to :%d\n", OPTION_MTU1); test_inmtu =3D OPTION_MTU1; + return 0; } =20 -static void test_2_5_5(void) +static s32 test_2_5_5(void) { /* Client sends 8192 bytes of data */ printk("Sends 8192 bytes\n"); - test_send_data(testcon, testdata, 8192); + return test_send_data(testcon, testdata, 8192); } =20 -static void test_2_5_6(void) +static s32 test_2_5_6(void) { printk("Sending 4096 bytes\n"); /* Server sends 4096 bytes of data */ - test_send_data(testcon, testdata, 4096); + return test_send_data(testcon, testdata, 4096); } =20 /* * Test case : Connection reject on psm 0x4561 */ =20 -static void test_2_6_1(void) +static s32 test_2_6_1(void) { printk("Now disabling test psm\n"); disable_testpsm =3D 1; + return 0; } =20 /* @@ -498,58 +508,63 @@ */ =20 =20 -static void test_2_7_2(void) +static s32 test_2_7_2(void) { printk("Emulating authorization pending...\n"); emulate_pending =3D 1; + return 0; } =20 -static void test_2_8_1(void) +static s32 test_2_8_1(void) { printk("Client sends 350 bytes on testcon 1\n"); - test_send_data(testcon, testdata, 350); + return test_send_data(testcon, testdata, 350); } =20 -static void test_2_8_2(void) +static s32 test_2_8_2(void) { printk("Server sends 350 bytes on testcon 1\n"); - test_send_data(testcon, testdata, 350); + return test_send_data(testcon, testdata, 350); } =20 -static void test_2_8_3(void) +static s32 test_2_8_3(void) { printk("Client sends 350 bytes on testcon 2\n"); - test_send_data(testcon2, testdata, 350); + return test_send_data(testcon2, testdata, 350); } =20 -static void test_2_8_4(void) +static s32 test_2_8_4(void) { printk("Server sends 350 bytes on testcon 2\n"); - test_send_data(testcon2, testdata, 350); + return test_send_data(testcon2, testdata, 350); } =20 -static void test_2_9_1(void) +static s32 test_2_9_1(void) { + s32 retval =3D 0; printk("Now testing timeout in reconfigure state\n"); printk("Client tries to reconfigure mtu 4096\n"); =20 - if (l2ca_config_req(testcon, 4096, NULL, 0xffff, 0)) { + if ((retval =3D l2ca_config_req(testcon, 4096, NULL, 0xffff, 0)) < 0){ D_ERR("test_connect_cfm : Configuration request failed\n"); } + return retval; } =20 -static void test_2_9_2(void) +static s32 test_2_9_2(void) { printk("Server won't send a config req back...\n"); dont_send_config_req =3D 1; + return 0; } =20 =20 -static void test_2_10(void) +static s32 test_2_10(void) { /* set to use mutiple config parameters */ printk("Using multiple config parameters\n"); use_multiple_conf_params =3D 1; + return 0; } =20 #if 0 @@ -566,8 +581,9 @@ } flow; #endif =20 -static void test_2_13_1(void) +static s32 test_2_13_1(void) { + s32 retval =3D 0; flow qos; init_flow(&qos); qos.bucket_size =3D 0x16; @@ -575,30 +591,31 @@ qos.service =3D 0x2; =20 printk("Client sending QOS options\n"); - if (l2ca_config_req(testcon, 0, &qos, 0, 0)) { + if ((retval =3D l2ca_config_req(testcon, 0, &qos, 0, 0)) < 0) { D_ERR("test_connect_cfm : Configuration request failed\n"); } + return retval; } =20 =20 =20 -static void test_2_13_5(void) +static s32 test_2_13_5(void) { printk("test_2_13_5, client sending 672 bytes\n");=20 - test_send_data(testcon, testdata, 672);=09 + return test_send_data(testcon, testdata, 672);=09 } =20 -static void test_2_13_6(void) +static s32 test_2_13_6(void) { printk("test_2_13_6, server sending 672 bytes\n");=20 - test_send_data(testcon, testdata, 672);=09 + return test_send_data(testcon, testdata, 672);=09 } =20 /* * SDP Stuff */ =20 -void do_sdp_test(int n) +s32 do_sdp_test(int n) { unsigned char *q; int q_len; @@ -618,233 +635,242 @@ case 9: q =3D q9; break; case 10: q =3D q10; break; case 11: q =3D q11; break; - default: printk("Unknown SDP test.\n");return; + default: printk("Unknown SDP test.\n"); + return -1; } =20 q_len =3D q[4] + 5; /* assumes less than 255 bytes long pdu:s */ =20=09 /* Now send the request */=20=20 - sdp_send_data(&sdp_con_list[0], q, q_len); + return sdp_send_data(&sdp_con_list[0], q, q_len); } =20 =20 =20 -static void sdp_test_52111(void) +static s32 sdp_test_52111(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_52111, sdp_data_52111[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_52111, sdp_data_52111[4] = + 5); } =20 -static void sdp_test_52113(void) +static s32 sdp_test_52113(void) { static int t =3D 0; + s32 retval =3D 0; =20 if (!t) { - sdp_send_data(&sdp_con_list[0], sdp_data_52113_1, sdp_data_52113_1[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_52113_1, sdp_data_52= 113_1[4] + 5); t =3D 1; } else { - sdp_send_data(&sdp_con_list[0], sdp_data_52113_2, sdp_data_52113_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_52113_2, sdp_data_52= 113_2[4] + 5); t =3D 0; } + return retval; } =20 =20 -static void sdp_test_52114(void) +static s32 sdp_test_52114(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_52114, sdp_data_52114[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_52114, sdp_data_52114[4] = + 5); } =20 -static void sdp_test_52121(void) +static s32 sdp_test_52121(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_52121, sdp_data_52121[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_52121, sdp_data_52121[4] = + 5); } =20 -static void sdp_test_52122(void) +static s32 sdp_test_52122(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_52122, sdp_data_52122[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_52122, sdp_data_52122[4] = + 5); } =20 -static void sdp_test_53111(void) +static s32 sdp_test_53111(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53111, sdp_data_53111[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53111, sdp_data_53111[4] = + 5); } =20 -static void sdp_test_53113(void) +static s32 sdp_test_53113(void) { static int t =3D 0; + s32 retval; =20 if (!t) { - sdp_send_data(&sdp_con_list[0], sdp_data_53113_1, sdp_data_53113_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_53113_1, sdp_data_53= 113_2[4] + 5); t =3D 1; } else { - sdp_send_data(&sdp_con_list[0], sdp_data_53113_2, sdp_data_53113_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_53113_2, sdp_data_53= 113_2[4] + 5); t =3D 0; } + return retval; } =20 -static void sdp_test_53114(void) +static s32 sdp_test_53114(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53114, sdp_data_53114[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53114, sdp_data_53114[4] = + 5); } =20 -static void sdp_test_53115(void) +static s32 sdp_test_53115(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53115, sdp_data_53115[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53115, sdp_data_53115[4] = + 5); } =20 -static void sdp_test_53118(void) +static s32 sdp_test_53118(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53118, sdp_data_53118[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53118, sdp_data_53118[4] = + 5); } =20 -static void sdp_test_531110(void) +static s32 sdp_test_531110(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_531110, sdp_data_531110[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_531110, sdp_data_531110[4= ] + 5); } =20 -static void sdp_test_531117(void) +static s32 sdp_test_531117(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_531117, sdp_data_531117[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_531117, sdp_data_531117[4= ] + 5); } =20 -static void sdp_test_531120(void) +static s32 sdp_test_531120(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_531120, sdp_data_531120[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_531120, sdp_data_531120[4= ] + 5); } =20 -static void sdp_test_53121(void) +static s32 sdp_test_53121(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53121, sdp_data_53121[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53121, sdp_data_53121[4] = + 5); } =20 -static void sdp_test_53122(void) +static s32 sdp_test_53122(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53122, sdp_data_53122[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53122, sdp_data_53122[4] = + 5); } =20 -static void sdp_test_53123(void) +static s32 sdp_test_53123(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_53123, sdp_data_53123[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_53123, sdp_data_53123[4] = + 5); } =20 -static void sdp_test_54111(void) +static s32 sdp_test_54111(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54111, sdp_data_54111[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54111, sdp_data_54111[4] = + 5); } =20 -static void sdp_test_54112(void) +static s32 sdp_test_54112(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54112, sdp_data_54112[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54112, sdp_data_54112[4] = + 5); } =20 -static void sdp_test_54113(void) +static s32 sdp_test_54113(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54113, sdp_data_54113[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54113, sdp_data_54113[4] = + 5); } =20 -static void sdp_test_54114(void) +static s32 sdp_test_54114(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54114, sdp_data_54114[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54114, sdp_data_54114[4] = + 5); } =20 -static void sdp_test_54116(void) +static s32 sdp_test_54116(void) { static int t =3D 0; - + s32 retval; if (!t) { - sdp_send_data(&sdp_con_list[0], sdp_data_54116_1, sdp_data_54116_1[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_54116_1, sdp_data_54= 116_1[4] + 5); t =3D 1; } else { - sdp_send_data(&sdp_con_list[0], sdp_data_54116_2, sdp_data_54116_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_54116_2, sdp_data_54= 116_2[4] + 5); t =3D 0; }=20 + return retval; } =20 -static void sdp_test_541110(void) +static s32 sdp_test_541110(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_541110, sdp_data_541110[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_541110, sdp_data_541110[4= ] + 5); } =20 -static void sdp_test_541111(void) +static s32 sdp_test_541111(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_541111, sdp_data_541111[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_541111, sdp_data_541111[4= ] + 5); } =20 -static void sdp_test_541112(void) +static s32 sdp_test_541112(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_541112, sdp_data_541112[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_541112, sdp_data_541112[4= ] + 5); } =20 -static void sdp_test_541120(void) +static s32 sdp_test_541120(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_541120, sdp_data_541120[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_541120, sdp_data_541120[4= ] + 5); } =20 -static void sdp_test_54121(void) +static s32 sdp_test_54121(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54121, sdp_data_54121[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54121, sdp_data_54121[4] = + 5); } =20 -static void sdp_test_54122(void) +static s32 sdp_test_54122(void) { - sdp_send_data(&sdp_con_list[0], sdp_data_54122, sdp_data_54122[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_data_54122, sdp_data_54122[4] = + 5); } =20 -static void sdp_test_55111(void) +static s32 sdp_test_55111(void) { static int t =3D 0; + s32 retval =3D 0; =20 switch (t) { case 0: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_1, sdp_data_55111_1[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_1, sdp_data_55= 111_1[4] + 5); t =3D 1; break; =20 case 1: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_2, sdp_data_55111_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_2, sdp_data_55= 111_2[4] + 5); t =3D 2; // break; case 2: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_3, sdp_data_55111_3[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_3, sdp_data_55= 111_3[4] + 5); t =3D 3; // break; case 3: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_4, sdp_data_55111_4[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_4, sdp_data_55= 111_4[4] + 5); t =3D 4; // break; case 4: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_5, sdp_data_55111_5[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_5, sdp_data_55= 111_5[4] + 5); t =3D 5; // break; case 5: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_6, sdp_data_55111_6[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_6, sdp_data_55= 111_6[4] + 5); t =3D 6; // break; case 6: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_7, sdp_data_55111_7[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_7, sdp_data_55= 111_7[4] + 5); t =3D 7; // break; case 7: - sdp_send_data(&sdp_con_list[0], sdp_data_55111_8, sdp_data_55111_8[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_8, sdp_data_55= 111_8[4] + 5); t =3D 0; break;=20=20 }=20 + return retval; } =20 -static void sdp_test_55112(void) +static s32 sdp_test_55112(void) { static int t =3D 0; - + s32 retval =3D 0; switch (t) { case 0: - sdp_send_data(&sdp_con_list[0], sdp_data_55112_1, sdp_data_55112_1[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55112_1, sdp_data_55= 112_1[4] + 5); t =3D 1; break; =20 case 1: - sdp_send_data(&sdp_con_list[0], sdp_data_55112_2, sdp_data_55112_2[4] + = 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55112_2, sdp_data_55= 112_2[4] + 5); t =3D 0; break; } + return retval; } =20 =20 @@ -852,9 +878,10 @@ * Serial Port Profile Stuff */ =20 -static void spp_test_52211(void) +static s32 spp_test_52211(void) { static int t =3D 0; + s32 retval =3D 0; =20=20=20 unsigned char sdp_query[] =3D { 0x06, 0x88, 0x88, 0x00, 0x0d, 0x35, 0x03, 0x19, 0x11, 0x01, 0x00, 0xff, @@ -862,7 +889,7 @@ =20 switch (t) { case 0: - sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); + retval =3D sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); t++; break; =20 @@ -876,110 +903,118 @@ t =3D 0; break; } + return retval; } =20 -static void spp_test_52311(void) +static s32 spp_test_52311(void) { static int t =3D 0; + s32 retval =3D 0; =20 switch (t) { case 0: - hci_sniff_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xff, 0xf0, 0x10, 0x05= ); + retval =3D hci_sniff_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xff, 0xf0,= 0x10, 0x05); t =3D 1; break; =20 case 1: - hci_exit_sniff_mode(rfcomm_con_list[0].l2cap->hci_hdl); + retval =3D hci_exit_sniff_mode(rfcomm_con_list[0].l2cap->hci_hdl); t =3D 0; break; } + return retval; } =20 -static void spp_test_52312(void) +static s32 spp_test_52312(void) { static int t =3D 0; + s32 retval =3D 0; =20 switch (t) { case 0: - hci_park_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xfff, 0xf0); + retval =3D hci_park_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xfff, 0xf0); t =3D 1; break; =20 case 1: - hci_exit_park_mode(rfcomm_con_list[0].l2cap->hci_hdl); + retval =3D hci_exit_park_mode(rfcomm_con_list[0].l2cap->hci_hdl); t =3D 0; break; } + return retval; } =20 -static void spp_test_52313(void) +static s32 spp_test_52313(void) { - hci_hold_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xfff, 0xf0); + return hci_hold_mode(rfcomm_con_list[0].l2cap->hci_hdl, 0xfff, 0xf0); } =20 -static void spp_test_52314(void) +static s32 spp_test_52314(void) { printk(__FUNCTION__": Do test 52211, then do a M/S switch\n"); + return 0; } =20 =20 -static void spp_test_53112(void) +static s32 spp_test_53112(void) { /* Establish a L2CAP channel in PSM 3 (RFCOMM), before doing this test */ =20 - rfcomm_sabm_msg(&rfcomm_con_list[0], 0); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 0); } =20 -static void spp_test_53211(void) +static s32 spp_test_53211(void) { /* This test has to be done rigth after test 53112 */ =20 - rfcomm_disc_msg(&rfcomm_con_list[0], 0); + return rfcomm_disc_msg(&rfcomm_con_list[0], 0); } =20 -static void spp_test_53312(void) +static s32 spp_test_53312(void) { /* Establish a L2CAP channel in PSM 3 (RFCOMM), and establish DLCI 0 before doing this test */ =20 - rfcomm_sabm_msg(&rfcomm_con_list[0], 2); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } =20 -static void spp_test_53411(void) +static s32 spp_test_53411(void) { /* Establish a L2CAP channel in PSM 3 (RFCOMM), and establish DLCI 0 and 2 before doing this test */ =20 /* Here the BAP should send the disc command so we just have to wait for that, rf_disc should probably work in the BAP */ + return 0; } =20 -static void spp_test_53412(void) +static s32 spp_test_53412(void) { /* This test has to be done rigth after test 53116 */ =20 - rfcomm_disc_msg(&rfcomm_con_list[0], 2); + return rfcomm_disc_msg(&rfcomm_con_list[0], 2); } =20 -static void spp_test_53511(void) +static s32 spp_test_53511(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20 /* Send data from the BAp with the rf_send command */ =20=20=20 - rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 2); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 2); } =20 -static void spp_test_53611(void) +static s32 spp_test_53611(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20=20=20 /* Then send data from the BAP with the rf_send command */ + return 0; } =20 -static void spp_test_53711(void) +static s32 spp_test_53711(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ @@ -987,85 +1022,88 @@ unsigned char data[] =3D {0,1,2,3,4,5,6,7,9}; =20 /* We send a test messages of ten bytes size */ - rfcomm_test_msg(&rfcomm_con_list[0], data, 10, MCC_CMD); + return rfcomm_test_msg(&rfcomm_con_list[0], data, 10, MCC_CMD); } =20 -static void spp_test_53811(void) +static s32 spp_test_53811(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ - + s32 retval =3D 0; static int t =3D 0; =20 switch (t) { case 0: - rfcomm_fcoff_msg(&rfcomm_con_list[0], MCC_CMD); + retval =3D rfcomm_fcoff_msg(&rfcomm_con_list[0], MCC_CMD); printk(__FUNCTION__": Flow is set to OFF\n"); t++; break; =20 case 1: - rfcomm_fcon_msg(&rfcomm_con_list[0], MCC_CMD); + retval =3D rfcomm_fcon_msg(&rfcomm_con_list[0], MCC_CMD); printk(__FUNCTION__": Flow is set to ON\n"); t =3D 0; break; } + return retval; } =20 -static void spp_test_53911(void) +static s32 spp_test_53911(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20 - rfcomm_rls_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0x05); + return rfcomm_rls_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0x05); } =20 -static void spp_test_531011(void) +static s32 spp_test_531011(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20 static int t =3D 0; + s32 retval =3D 0; =20 switch (t) { case 0: - rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 1000); + retval =3D rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 1000); t++; break; =20 case 1: - rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 667); + retval =3D rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 667); break; } + return retval; } =20 -static void spp_test_531111(void) +static s32 spp_test_531111(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20 - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0); + return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0); } =20 -static void spp_test_531112(void) +static s32 spp_test_531112(void) { /* Do test 52211 before to establish RFCOMM, DLCI 1 and 2. You also have to verify so both sides have sent a MSC command with flow on */ =20 - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1); + return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1); } =20 -static void spp_test_55111(void) +static s32 spp_test_55111(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ =20 unsigned char sdp_query[] =3D { 0x02, 0x77, 0x77, 0x00, 0x08, 0x35, 0x03, 0x19, 0x00, 0x03, 0x00, 0xff, 0x00 }; =20 - sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } =20 -static void spp_test_55112(void) +static s32 spp_test_55112(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ =20 @@ -1074,10 +1112,10 @@ 0x09, 0x00, 0x01, 0x09, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00 }; =20 - sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } =20 -static void spp_test_55113(void) +static s32 spp_test_55113(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ =20 @@ -1086,294 +1124,307 @@ 0x09, 0x09, 0x00, 0x01, 0x09, 0x00, 0x04, 0x09, 0x01, 0x00, 0x00 }; =20 - sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); + return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } =20 =20 -static void spp_test_56211(void) +static s32 spp_test_56211(void) { /* Run the hci_write_encryption_mode(1) in hci_init */ + return 0; } =20 /*=20 * RFCOMM stuff=20 */ =20 -static void test_4_1(void) +static s32 test_4_1(void) { /* Create a connection */ printk("Please use rf_conn server channel 2\n"); + return 0; } =20 -static void test_4_2_1(void) +static s32 test_4_2_1(void) { /* Send stop flow command on dlci 4*/ printk("test_4_2\n"); - rfcomm_msc_msg(&rfcomm_con_list[0], 0x87 ,MCC_CMD, 4); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x87 ,MCC_CMD, 4); } =20 -static void test_4_2_2(void) +static s32 test_4_2_2(void) { /* Send start flow command on dlci 4 */ printk("test_4_2\n"); - rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 4); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 4); } =20 -static void test_4_2_3(void) +static s32 test_4_2_3(void) { /* Send start flow command on dlci 4 */ printk("test_4_2\n"); - rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 3); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 3); } =20 -static void test_4_2_4(void) +static s32 test_4_2_4(void) { /* Send start flow command on dlci 4 */ printk("test_4_2\n"); - rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 2); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x85 ,MCC_CMD, 2); } =20 -static void test_4_3(void) +static s32 test_4_3(void) { + s32 retval =3D 0; /* Here we should send data after we received a flow stop command */ printk("test_4_3\n"); =20=09 - if (rfcomm_send_data(CREATE_RFCOMM_ID(0,4),testdata, 1024) =3D=3D 0) { - printk("Success!\n"); + if ((retval =3D rfcomm_send_data(CREATE_RFCOMM_ID(0,4),testdata, 1024)) <= 0) { + D_ERR("rfcomm_send_data: Failed\n"); } + return retval; } =20 -static void test_4_4(void) +static s32 test_4_4(void) { /* If we should initiate the disconnection we do this */ printk("test_4_4\n"); - rfcomm_disconnect_req(0); + return rfcomm_disconnect_req(0); } =20 -static void test_4_5_1(void) +static s32 test_4_5_1(void) { printk("test_4_5_1\n"); - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1); + return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1); } =20 -static void test_4_5_2(void) +static s32 test_4_5_2(void) { + s32 retval =3D 0; printk("test_4_5_2\n"); rpn_val.rtr_input =3D 1; rpn_val.rtr_output =3D 1; rpn_val.pm.rtr_input =3D 1; rpn_val.pm.rtr_output =3D 1; - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0); + retval =3D rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0); rpn_val.pm.rtr_input =3D 0; rpn_val.pm.rtr_output =3D 0; + return retval; } =20 -static void test_4_6(void) +static s32 test_4_6(void) { u8 data[1]; =20 printk("test_4_6\n"); data[0] =3D 'b'; /* We send a test messages of one byte size */ - rfcomm_test_msg(&rfcomm_con_list[0], data, 1, MCC_CMD); + return rfcomm_test_msg(&rfcomm_con_list[0], data, 1, MCC_CMD); } =20 -static void test_4_7(void) +static s32 test_4_7(void) { printk("test_4_7\n"); - rfcomm_rls_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0x03); + return rfcomm_rls_msg(&rfcomm_con_list[0], MCC_CMD, 4, 0x03); } =20 -static void test_4_8_1(void) +static s32 test_4_8_1(void) { /* Here we send a fcoff command */ printk("test_4_8\n"); - rfcomm_fcoff_msg(&rfcomm_con_list[0], MCC_CMD); + return rfcomm_fcoff_msg(&rfcomm_con_list[0], MCC_CMD); } =20 -static void test_4_8_2(void) +static s32 test_4_8_2(void) { /* Here we send a fcon command */ printk("test_4_8\n"); - rfcomm_fcon_msg(&rfcomm_con_list[0], MCC_CMD); + return rfcomm_fcon_msg(&rfcomm_con_list[0], MCC_CMD); } =20 -static void test_4_9(void) +static s32 test_4_9(void) { /* Test to send data after received fcoff command */ printk("test_4_9\n"); - test_4_3(); + return test_4_3(); } =20 -static void test_4_10(void) +static s32 test_4_10(void) { /* Create a connection on serverchannel one */ printk("Please use rfcomm_connect server channel 1, line 0 instead\n"); + return 0; } =20 -static void test_4_11(void) +static s32 test_4_11(void) { /* Same as test 4.10, but here we should be the responder */ printk("test_4_11\n"); - test_4_10(); + return test_4_10(); } =20 -static void test_4_12(void) +static s32 test_4_12(void) { printk("test_4_12\n"); - test_4_4(); + return test_4_4(); } =20 -static void test_4_13(void) +static s32 test_4_13(void) {=09 printk("test_4_13\n"); - rfcomm_set_mtu(&rfcomm_con_list[0], 4, 500); + return rfcomm_set_mtu(&rfcomm_con_list[0], 4, 500); printk("MTU set to 500\n"); printk("Please use rfcomm_connect server channel 2, line 0 to connect\n"); } =20 -static void test_4_14(void) +static s32 test_4_14(void) { printk("test_4_14\n"); printk("PLease use rfcomm_conn on serverchannel 4\n"); + return 0; } =20 -static void test_4_15(void) +static s32 test_4_15(void) { printk("test_4_15\n"); - rfcomm_crap_msg(&rfcomm_con_list[0]); + return rfcomm_crap_msg(&rfcomm_con_list[0]); } =20 -static void test_4_16(void) +static s32 test_4_16(void) { printk("test_4_16\n"); - rfcomm_msc_msg(&rfcomm_con_list[0], 0x8d ,MCC_CMD, 8); + return rfcomm_msc_msg(&rfcomm_con_list[0], 0x8d ,MCC_CMD, 8); } =20 -static void test_4_21_1(void) +static s32 test_4_21_1(void) { printk("test_4_21_1\n"); - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1); + return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1); } =20 -static void test_4_21_2(void) +static s32 test_4_21_2(void) { + s32 retval =3D 0; printk("test_4_21_2\n"); rpn_val.rtr_input =3D 1; rpn_val.rtr_output =3D 1; rpn_val.pm.rtr_input =3D 1; rpn_val.pm.rtr_output =3D 1; - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); + retval =3D rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); rpn_val.pm.rtr_input =3D 0; rpn_val.pm.rtr_output =3D 0; + return retval; } =20 -static void test_4_22_1(void) +static s32 test_4_22_1(void) { + s32 retval =3D 0; printk("test_4_22_1\n"); rpn_val.rtr_input =3D 1; rpn_val.rtr_output =3D 1; rpn_val.pm.rtr_input =3D 1; rpn_val.pm.rtr_output =3D 1; - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); + retval =3D rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 0); rpn_val.pm.rtr_input =3D 0; rpn_val.pm.rtr_output =3D 0; + return retval; } =20 -static void test_4_22_2(void) +static s32 test_4_22_2(void) { printk("test_4_22_2\n"); - rfcomm_sabm_msg(&rfcomm_con_list[0], 2);; + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2);; } =20 -static void test_4_22_3(void) +static s32 test_4_22_3(void) { printk("test_4_21_1\n"); - rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1); + return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 2, 1); } =20 -static void test_4_23_1(void) +static s32 test_4_23_1(void) { printk("test_4_23_1\n"); - test_4_22_1(); + return test_4_22_1(); } =20 -static void test_4_23_2(void) +static s32 test_4_23_2(void) { printk("test_4_23_2\n"); - rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 127); + return rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 127); } =20 -static void test_4_23_3(void) +static s32 test_4_23_3(void) { printk("test_4_23_2\n"); - rfcomm_sabm_msg(&rfcomm_con_list[0], 2); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } =20 -static void test_4_23_4(void) +static s32 test_4_23_4(void) { printk("test_4_23_1\n"); - test_4_22_3(); + return test_4_22_3(); } =20 -static void test_4_24_1(void) +static s32 test_4_24_1(void) { printk("test_4_23_1\n"); - test_4_23_2(); + return test_4_23_2(); } =20 -static void test_4_24_2(void) +static s32 test_4_24_2(void) { printk("test_4_23_2\n"); - test_4_23_1(); + return test_4_23_1(); } =20 -static void test_4_24_3(void) +static s32 test_4_24_3(void) { printk("test_4_23_2\n"); - rfcomm_sabm_msg(&rfcomm_con_list[0], 2); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } =20 -static void test_4_24_4(void) +static s32 test_4_24_4(void) { printk("test_4_23_1\n"); - rfcomm_sabm_msg(&rfcomm_con_list[0], 2); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } =20 -static void test_4_25_1(void) +static s32 test_4_25_1(void) { printk("test_4_25_1\n"); - rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 500); + return rfcomm_pn_msg(&rfcomm_con_list[0], 2, 0, 500); } =20 -static void test_4_25_2(void) +static s32 test_4_25_2(void) { printk("test_4_25_2\n"); rfcomm_con_list[0].l2cap->local_mtu =3D 65; + return 0; } =20 -static void test_4_25_3(void) +static s32 test_4_25_3(void) { printk("test_4_25_3\n"); - rfcomm_sabm_msg(&rfcomm_con_list[0], 2); + return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } =20 -static void test_4_26(void) +static s32 test_4_26(void) { printk("test_4_26\n"); - rfcomm_pn_msg(&rfcomm_con_list[0], 4, 0, 127); + return rfcomm_pn_msg(&rfcomm_con_list[0], 4, 0, 127); } =20 -static void test_4_27(void) +static s32 test_4_27(void) { printk("test_4_27\n"); - rfcomm_pn_msg(&rfcomm_con_list[0], 4, 10, 127); + return rfcomm_pn_msg(&rfcomm_con_list[0], 4, 10, 127); } =20 -static void test_4_28(void) +static s32 test_4_28(void) { printk("test_4_28\n"); - rfcomm_send_credits(&rfcomm_con_list[0], 4, 10); + return rfcomm_send_credits(&rfcomm_con_list[0], 4, 10); } =20 =20 @@ -1382,22 +1433,22 @@ * TCS stuff */ =20 -static void test_5_1(void) +static s32 test_5_1(void) { if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); - return; + return -1; } - tcs_setup(tcs[0].l2cap, NULL, 0); + return tcs_setup(tcs[0].l2cap, NULL, 0); } =20 -static void test_5_1_1(void) +static s32 test_5_1_1(void) { u8 nbr[2]; =20 if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); - return; + return -1; } =20=20=20 nbr[0] =3D '0'; @@ -1413,61 +1464,61 @@ nbr[10] =3D '7'; nbr[11] =3D '2'; =20=20=20 - tcs_setup(tcs[0].l2cap, nbr, 12); + return tcs_setup(tcs[0].l2cap, nbr, 12); } =20 =20 -static void test_5_2(void) +static s32 test_5_2(void) { if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); - return; + return -1; } - tcs_connect(tcs[0].l2cap); + return tcs_connect(tcs[0].l2cap); } =20 -static void test_5_3(void) +static s32 test_5_3(void) { if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); - return; + return -1; } - tcs_disconnect(tcs[0].l2cap); + return tcs_disconnect(tcs[0].l2cap); } =20 -static void test_5_4(void) +static s32 test_5_4(void) { - test_5_1(); + return test_5_1(); } =20 -static void test_5_5(void) +static s32 test_5_5(void) { - test_5_2(); + return test_5_2(); } =20 -static void test_5_6(void) +static s32 test_5_6(void) { - test_5_3(); + return test_5_3(); } =20 -static void test_5_7(void) +static s32 test_5_7(void) { if (!tcs[0].l2cap) { printk("Please connect TCS first with tcs_connect bd_addr\n"); - return;=20 + return -1;=20 } - tcs_send_information(tcs[0].l2cap, '1'); + return tcs_send_information(tcs[0].l2cap, '1'); } =20 -static void test_gateway_call(void) +static s32 test_gateway_call(void) { unsigned char *atd =3D "ATD4257272353\r\n"; =20 printk("test_gateway_call, sending %s\n", atd); - rfcomm_send_data(CREATE_RFCOMM_ID(0,2), atd, strlen(atd)); + return rfcomm_send_data(CREATE_RFCOMM_ID(0,2), atd, strlen(atd)); } =20 -void process_test_cmd(s32 test_case) +s32 process_test_cmd(s32 test_case) { if (!test_is_initialized) { unplug_test_init(); @@ -1476,261 +1527,137 @@ printk("test_case %d\n",test_case); =20 switch (test_case) { - case 0: test_server(); - break; - case 1: test_client(); - break; - - case 221: test_2_2_1(); - break; - case 222: test_2_2_2(); - break; - case 223: test_2_2_3(); - break; - case 224: test_2_2_4(); - break; - case 225: test_2_2_5(); - break; - case 226: test_2_2_6(); - break; - case 251: test_2_5_1(); - break; - case 252: test_2_5_2(); - break; - case 253: test_2_5_3(); - break; - case 254: test_2_5_4(); - break;=20=20 - case 255: test_2_5_5(); - break; - case 256: test_2_5_6(); - break; - case 261: test_2_6_1(); - break; - - case 272: test_2_7_2(); - break; - - case 281: test_2_8_1(); - break; - case 282: test_2_8_2(); - break; - case 283: test_2_8_3(); - break; - case 284: test_2_8_4(); - break; - - case 291: test_2_9_1(); - break; - case 292: test_2_9_2(); - break; - - case 210: test_2_10(); - break; + case 0: return test_server(); + case 1: return test_client(); =20 - case 2131 : test_2_13_1(); - break; + case 221: return test_2_2_1(); + case 222: return test_2_2_2(); + case 223: return test_2_2_3(); + case 224: return test_2_2_4(); + case 225: return test_2_2_5(); + case 226: return test_2_2_6(); + case 23: return test_2_3(); + case 251: return test_2_5_1(); + case 252: return test_2_5_2(); + case 253: return test_2_5_3(); + case 254: return test_2_5_4(); + case 255: return test_2_5_5(); + case 256: return test_2_5_6(); + case 261: return test_2_6_1(); + case 272: return test_2_7_2(); + case 281: return test_2_8_1(); + case 282: return test_2_8_2(); + case 283: return test_2_8_3(); + case 284: return test_2_8_4(); =20 - case 52111: sdp_test_52111(); - break; - case 52113: sdp_test_52113(); - break; - case 52114: sdp_test_52114(); - break;=20 - case 52121: sdp_test_52121(); - break; - case 52122: sdp_test_52122(); - break;=20=20 - case 53111: sdp_test_53111(); - break; - case 53113: sdp_test_53113(); - break; - case 53114: sdp_test_53114(); - break; - case 53115: sdp_test_53115(); - break; - case 53118: sdp_test_53118(); - break; - case 531110: sdp_test_531110(); - break; - case 531117: sdp_test_531117(); - break; - case 531120: sdp_test_531120(); - break; - case 53121: sdp_test_53121(); - break; - case 53122: sdp_test_53122(); - break; - case 53123: sdp_test_53123(); - break; - case 54111: sdp_test_54111(); - break; - case 54112: sdp_test_54112(); - break; - case 54113: sdp_test_54113(); - break; - case 54114: sdp_test_54114(); - break; - case 54116: sdp_test_54116(); - break; - case 541110: sdp_test_541110(); - break; - case 541111: sdp_test_541111(); - break; - case 541112: sdp_test_541112(); - break; - case 541120: sdp_test_541120(); - break; - case 54121: sdp_test_54121(); - break; - case 54122: sdp_test_54122(); - break; - case 55111: sdp_test_55111(); - break; - case 55112: sdp_test_55112(); - break; + case 291: return test_2_9_1(); + case 292: return test_2_9_2(); =20 - case 62211: spp_test_52211(); - break; + case 210: return test_2_10(); =20 - case 62311: spp_test_52311(); - break; - case 62312: spp_test_52312(); - break; - case 62313: spp_test_52313(); - break; - case 62314: spp_test_52314(); - break; - case 63112: spp_test_53112(); - break; - case 63211: spp_test_53211(); - break; - case 63312: spp_test_53312(); - break; - case 63411: spp_test_53411(); - break; - case 63412: spp_test_53412(); - break; - case 63511: spp_test_53511(); - break; - case 63611: spp_test_53611(); - break; - case 63711: spp_test_53711(); - break; - case 63811: spp_test_53811(); - break; - case 63911: spp_test_53911(); - break; - case 631011: spp_test_531011(); - break; - case 631111: spp_test_531111(); - break; - case 631112: spp_test_531112(); - break; - case 66211: spp_test_56211(); - break; + case 2131 : return test_2_13_1(); =20 - case 41: test_4_1(); - break; - case 421: test_4_2_1(); - break; - case 422: test_4_2_2(); - break; - case 423: test_4_2_3(); - break; - case 424: test_4_2_4(); - break; - case 43: test_4_3(); - break; - case 44: test_4_4(); - break; - case 451: test_4_5_1(); - break; - case 452: test_4_5_2(); - break;=20=20 - case 46: test_4_6(); - break; - case 47: test_4_7(); - break; - case 481: test_4_8_1(); - break; - case 482: test_4_8_2(); - break; - case 49: test_4_9(); - break; - case 410: test_4_10(); - break; - case 411: test_4_11(); - break; - case 412: test_4_12(); - break; - case 413: test_4_13(); - break; - case 414: test_4_14(); - break; - case 415: test_4_15(); - break; - case 416: test_4_16(); - break; - case 4211: test_4_21_1(); - break; - case 4212: test_4_21_2(); - break; - case 4221: test_4_22_1(); - break; - case 4222: test_4_22_2(); - break; - case 4223: test_4_22_3(); - break; - case 4231: test_4_23_1(); - break; - case 4232: test_4_23_2(); - break; - case 4233: test_4_23_3(); - break; - case 4234: test_4_23_4(); - break; - case 4241: test_4_24_1(); - break; - case 4242: test_4_24_2(); - break; - case 4243: test_4_24_3(); - break; - case 4244: test_4_24_4(); - break; - case 4251: test_4_25_1(); - break; - case 4252: test_4_25_2(); - break; - case 426: test_4_26(); - break; - case 427: test_4_27(); - break; - case 428: test_4_28(); - break; + case 52111: return sdp_test_52111(); + case 52113: return sdp_test_52113(); + case 52114: return sdp_test_52114(); + case 52121: return sdp_test_52121(); + case 52122: return sdp_test_52122(); + case 53111: return sdp_test_53111(); + case 53113: return sdp_test_53113(); + case 53114: return sdp_test_53114(); + case 53115: return sdp_test_53115(); + case 53118: return sdp_test_53118(); + case 531110: return sdp_test_531110(); + case 531117: return sdp_test_531117(); + case 531120: return sdp_test_531120(); + case 53121: return sdp_test_53121(); + case 53122: return sdp_test_53122(); + case 53123: return sdp_test_53123(); + case 54111: return sdp_test_54111(); + case 54112: return sdp_test_54112(); + case 54113: return sdp_test_54113(); + case 54114: return sdp_test_54114(); + case 54116: return sdp_test_54116(); + case 541110: return sdp_test_541110(); + case 541111: return sdp_test_541111(); + case 541112: return sdp_test_541112(); + case 541120: return sdp_test_541120(); + case 54121: return sdp_test_54121(); + case 54122: return sdp_test_54122(); + case 55111: return sdp_test_55111(); + case 55112: return sdp_test_55112(); =20 - case 51: test_5_1(); - break; - case 511: test_5_1_1(); - break; - case 52: test_5_2(); - break;=09 - case 53: test_5_3(); - break; - case 54: test_5_4(); - break; - case 55: test_5_5(); - break; - case 56: test_5_6(); - break; - case 57: test_5_7(); - break; + case 62211: return spp_test_52211(); =20 - case 100: test_gateway_call(); - break; + case 62311: return spp_test_52311(); + case 62312: return spp_test_52312(); + case 62313: return spp_test_52313(); + case 62314: return spp_test_52314(); + case 63112: return spp_test_53112(); + case 63211: return spp_test_53211(); + case 63312: return spp_test_53312(); + case 63411: return spp_test_53411(); + case 63412: return spp_test_53412(); + case 63511: return spp_test_53511(); + case 63611: return spp_test_53611(); + case 63711: return spp_test_53711(); + case 63811: return spp_test_53811(); + case 63911: return spp_test_53911(); + case 631011: return spp_test_531011(); + case 631111: return spp_test_531111(); + case 631112: return spp_test_531112(); + case 66211: return spp_test_56211(); =20 + case 41: return test_4_1(); + case 421: return test_4_2_1(); + case 422: return test_4_2_2(); + case 423: return test_4_2_3(); + case 424: return test_4_2_4(); + case 43: return test_4_3(); + case 44: return test_4_4(); + case 451: return test_4_5_1(); + case 452: return test_4_5_2(); + case 46: return test_4_6(); + case 47: return test_4_7(); + case 481: return test_4_8_1(); + case 482: return test_4_8_2(); + case 49: return test_4_9(); + case 410: return test_4_10(); + case 411: return test_4_11(); + case 412: return test_4_12(); + case 413: return test_4_13(); + case 414: return test_4_14(); + case 415: return test_4_15(); + case 416: return test_4_16(); + case 4211: return test_4_21_1(); + case 4212: return test_4_21_2(); + case 4221: return test_4_22_1(); + case 4222: return test_4_22_2(); + case 4223: return test_4_22_3(); + case 4231: return test_4_23_1(); + case 4232: return test_4_23_2(); + case 4233: return test_4_23_3(); + case 4234: return test_4_23_4(); + case 4241: return test_4_24_1(); + case 4242: return test_4_24_2(); + case 4243: return test_4_24_3(); + case 4244: return test_4_24_4(); + case 4251: return test_4_25_1(); + case 4252: return test_4_25_2(); + case 426: return test_4_26(); + case 427: return test_4_27(); + case 428: return test_4_28(); + case 51: return test_5_1(); + case 511: return test_5_1_1(); + case 52: return test_5_2(); + case 53: return test_5_3(); + case 54: return test_5_4(); + case 55: return test_5_5(); + case 56: return test_5_6(); + case 57: return test_5_7(); + case 100: return test_gateway_call(); default: printk("Unknown test case\n"); - break; + return -1; } } |
From: Peter K. <pk...@us...> - 2001-10-18 15:49:26
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.126 1.127=20=20=20=20=20=20=20=20=20=20=20 test.c 1.30 1.31=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Made it compile for user mode again. The diff of the modified file(s): --- rfcomm.c 2001/10/16 14:59:29 1.126 +++ rfcomm.c 2001/10/18 15:49:25 1.127 @@ -65,6 +65,9 @@ #include <stdlib.h> #include <string.h> #include <errno.h> + +#include <asm/unaligned.h> + #include "include/rfcomm.h" #include "include/rfcomm_sec.h" #include "include/btmem.h" --- test.c 2001/10/16 16:23:47 1.30 +++ test.c 2001/10/18 15:49:25 1.31 @@ -54,6 +54,7 @@ #include <linux/bluetooth/unplug_test.h> #else #include <string.h> +#include <errno.h> =20 #include "include/test.h" #include "include/btcommon.h" |
From: Peter K. <pk...@us...> - 2001-10-22 12:52:14
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bcsp.c 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20 hci.c 1.187 1.188=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: hci_get_ocf() and hci_get_ogf() should now work correctly regarding endianness and alignment. The diff of the modified file(s): --- bcsp.c 2001/09/18 13:04:27 1.21 +++ bcsp.c 2001/10/22 12:51:44 1.22 @@ -252,13 +252,11 @@ s32 bcsp_write_top(u8 *data, u32 len) { - u16 opcode; s32 ret =3D -EINVAL; =20=09 switch (data[0]) { case CMD_PKT: - opcode =3D le16_to_cpu(get_unaligned((u16 *)&data[1])); - if (hci_get_ocf(opcode) =3D=3D BCSP_OCF) { + if (hci_get_ocf(data+1) =3D=3D BCSP_OCF) { ret =3D bcsp_sequence_send(data + 5, len - 5, data[4] & 0x3f); } else { ret =3D bcsp_sequence_send(data + 1, len - 1, BCSP_CMD_CHN); --- hci.c 2001/10/16 14:57:10 1.187 +++ hci.c 2001/10/22 12:51:44 1.188 @@ -3622,10 +3622,10 @@ =20 PRINTPKT(__FUNCTION__, data, cmd->len + CMD_HDR_LEN + HCI_HDR_LEN); =20 - switch (hci_get_ogf(cmd->opcode)) { + switch (hci_get_ogf(&cmd->opcode)) { =20 case HCI_LC: /* Host Controller commands */ - switch (hci_get_ocf(cmd->opcode)) { + switch (hci_get_ocf(&cmd->opcode)) { =20 case CREATE_CONNECTION: /* Send connection request event */ @@ -3676,13 +3676,13 @@ =20 default: printk(__FUNCTION__ ": Unknown command ogf:0x%x,ocf:0x%x\n", - hci_get_ogf(cmd->opcode), hci_get_ocf(cmd->opcode)); + hci_get_ogf(&cmd->opcode), hci_get_ocf(&cmd->opcode)); break; } break; =20 case HCI_IP: /* Informational parameters */ - switch (hci_get_ocf(cmd->opcode)) { + switch (hci_get_ocf(&cmd->opcode)) { =20 case READ_BUFFER_SIZE: D_CMD(__FUNCTION__ ": READ_BUFFER_SIZE->setting buffer size\n"); @@ -3694,14 +3694,14 @@ =20 default: printk(__FUNCTION__ ": Unknown command ogf:0x%x,ocf:0x%x\n", - hci_get_ogf(cmd->opcode), hci_get_ocf(cmd->opcode)); + hci_get_ogf(&cmd->opcode), hci_get_ocf(&cmd->opcode)); break; } break; =20 default: printk(__FUNCTION__ ": Unknown command ogf:0x%x,ocf:0x%x\n", - hci_get_ogf(cmd->opcode), hci_get_ocf(cmd->opcode)); + hci_get_ogf(&cmd->opcode), hci_get_ocf(&cmd->opcode)); break; } } |
From: Peter K. <pk...@us...> - 2001-10-30 15:04:53
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- Config.in 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20 bluetooth.c 1.208 1.209=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Define and use CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH to decide whether the reset pin is active high or low. The diff of the modified file(s): --- Config.in 2001/07/31 09:04:13 1.19 +++ Config.in 2001/10/30 15:04:52 1.20 @@ -52,6 +52,12 @@ Port_PB_Bit_5 CONFIG_BLUETOOTH_RESET_PB5 \ Port_G_Bit_10 CONFIG_BLUETOOTH_RESET_G10 \ Port_G_Bit_11 CONFIG_BLUETOOTH_RESET_G11" None + + if [ "$CONFIG_BLUETOOTH_RESET_NONE" !=3D "y" -a "$CONFIG_BLUETOOTH_CSR" = =3D "y" ]; then + define_bool CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH y + else + define_bool CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH n + fi fi =20 endmenu --- bluetooth.c 2001/10/22 12:49:20 1.208 +++ bluetooth.c 2001/10/30 15:04:52 1.209 @@ -1391,7 +1391,7 @@ void bt_reset_phys_hw(void) { #ifdef __CRIS__ -#ifdef CONFIG_BLUETOOTH_CSR +#ifdef CONFIG_BLUETOOTH_RESET_ACTIVE_HIGH int do_reset =3D 1; #else int do_reset =3D 0; |
From: Fredrik S. <fre...@us...> - 2002-01-29 09:00:39
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bnep.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 bnep_test.c 1.1 1.2=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Multicast filters should now work. The diff of the modified file(s): --- bnep.c 2002/01/24 16:08:47 1.1 +++ bnep.c 2002/01/29 09:00:37 1.2 @@ -389,7 +389,7 @@ struct bnep_compressed_ethernet_source_only bnep_c_s; struct bnep_compressed_ethernet bnep_c; void *bhdr; - int i, j, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len= =3D 0; + int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len = =3D 0; u16 proto, payload_proto;=20 int send_packet =3D 0; int dest =3D 1; @@ -420,36 +420,29 @@ } =20=09 /* Check multicast filters */ - if (eth->h_dest[0] =3D=3D 1) { - D_XMIT(__FUNCTION__": Multicast or broadcast packet\n"); + if (eth->h_dest[0] & 1) { + D_XMIT(__FUNCTION__": Multicast packet, dest =3D %02x:%02x:%02x:%02x:%02= x:%02x\n",=20 + eth->h_dest[0], eth->h_dest[1], eth->h_dest[2], + eth->h_dest[3], eth->h_dest[3], eth->h_dest[5]); =20=09=09 /* Step through filter range by filter range */ for (i =3D 0; (i < BNEP_MAX_MCAST_FILTER_RANGES) && (!send_packet); i++)= { D_MISC(__FUNCTION__": Trying multicast filter range %d\n",i);=09=09=09 - /* Make sure that destination address is equal or within range */ - /* Double 'i' in order to get the start range in each filter */ - for (j =3D 0; j < 6 && - ((local->filter_multi_addr_list[i*2].addr[j] <=3D eth->h_dest[j])= && - (local->filter_multi_addr_list[i*2+1].addr[j] >=3D eth->h_dest[j= ])); - j++) {=09=09 - /* Each byte in destination address is within filter range */ - if (j >=3D 5) - { + if (memcmp(local->filter_multi_addr_list[i*2].addr, eth->h_dest, 6) >= =3D 0 && + memcmp(local->filter_multi_addr_list[i*2+1].addr, eth->h_dest, 6) <= =3D 0) { D_MISC(__FUNCTION__": Multicast filter range %d OK\n",i); send_packet =3D 1; - break; } } =20 /* All filter ranges have been examined */ - if (i >=3D (BNEP_MAX_MCAST_FILTER_RANGES-1)) { + if (!send_packet) { D_XMIT(__FUNCTION__": Discarding multicast packet\n"); local->stats.tx_dropped++; dev_kfree_skb(skb); return 0; } } - } =20 /* Check protocol filters; first examine if 802.1p header */=20 if (proto =3D=3D 0x8100) { @@ -893,7 +886,7 @@ struct net_device *dev; struct net_local *local; struct bnep_filter_response_msg rsp;=20=20 - int n,i,j, size =3D 0; + int n, i, size =3D 0; bt_tx_buf *tx_buf; u16 *filter; =20=09 @@ -1129,16 +1122,17 @@ } else {=20 /* Set filter */ for (i =3D 0; i < n; i++) { - for (j =3D 0; j < 6; j++) { - local->filter_multi_addr_list[(used_filters+i)*2].addr[j] =3D=20 - data[j*i+j+2]; - local->filter_multi_addr_list[(used_filters+i)*2+1].addr[j] =3D=20 - data[6*(i+1)+j+2]; + print_data("Adding multicast filter: ", data+2+i*12, 12); =20=09=09=09=09=09 - D_MISC("Setting multi addr filter %02x - %02x \n", - local->filter_multi_addr_list[i*2].addr[j], - local->filter_multi_addr_list[i*2+1].addr[j]); - } + /* Start address. */ + memcpy(local->filter_multi_addr_list[(used_filters+i)*2].addr, + data+2+i*12, + 6); + + /* End address. */ + memcpy(local->filter_multi_addr_list[(used= _filters+i)*2+1].addr, + data+2+i*12+6, + 6); } used_filters +=3D n; } --- bnep_test.c 2002/01/24 16:08:47 1.1 +++ bnep_test.c 2002/01/29 09:00:37 1.2 @@ -512,7 +512,10 @@ local =3D dev->priv; l2cap =3D local->l2cap; =20=09 - D_MISC("Set remote protocol filter \n"); + printk("Set remote multicast filter %02x:%02x:%02x:%02x:%02x:%02x - " + "%02x:%02x:%02x:%02x:%02x:%02x", + filter[0], filter[1], filter[2], filter[3], filter[4], filter[5], + filter[6], filter[7], filter[8], filter[9], filter[10], filter[11]); =20=09 bnep.bnep_type =3D BNEP_CONTROL; bnep.bnep_control_type =3D BNEP_FILTER_NET_TYPE_SET_MSG; |
From: Fredrik S. <fre...@us...> - 2002-01-29 15:57:27
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.220 1.221=20=20=20=20=20=20=20=20=20=20=20 bnep.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Close BNEP sessions before shutting down stack. The diff of the modified file(s): --- bluetooth.c 2002/01/24 16:08:47 1.220 +++ bluetooth.c 2002/01/29 15:57:26 1.221 @@ -256,6 +256,7 @@ =20 #ifdef CONFIG_BLUETOOTH_PAN void bnep_init(void); +void bnep_shutdown(void); u32 bnep_connect_req(u8 *bd_addr); u32 bnep_test(u8 *p); u32 bnep_set_multicast_filter(u8 *filter); @@ -3065,6 +3066,10 @@ =20 #ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER sec_client_shutdown(); /* Inform that stack is getting closed */ +#endif + +#ifdef CONFIG_BLUETOOTH_PAN + bnep_shutdown(); #endif =20 rfcomm_close(); --- bnep.c 2002/01/29 09:00:37 1.2 +++ bnep.c 2002/01/29 15:57:26 1.3 @@ -111,6 +111,8 @@ #define PRINTIPPKT(data, len) #endif =20 +#define BNEP_INTERFACES 7 + /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ @@ -121,7 +123,7 @@ /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 static u8 bd_addr[6] =3D { 0x00, 0x40, 0x8c, 0xcd, 0x00, 0x00 }; -struct net_device dev_bnep[7]; /* Got 7 Interfaces */ +struct net_device dev_bnep[BNEP_INTERFACES]; static protocol_layer this_layer; =20 /****************** LOCAL FUNCTION DECLARATION SECTION *******************= ***/ @@ -163,9 +165,9 @@ int i, err; struct net_device *d; =20=09 - printk("BNEP driver v0.1 (c) 2001 Axis Communications AB\n"); + printk("BNEP driver v0.1 (c) 2002 Axis Communications AB\n"); D_MISC("Init BNEP interfaces\n"); - for (i =3D 0; i < 7; i++) { + for (i =3D 0; i < BNEP_INTERFACES; i++) { d =3D &dev_bnep[i]; d->init =3D bnep_init_interface; err =3D dev_alloc_name(d, "bnep%d"); @@ -184,6 +186,68 @@ } =20 /*=20 + * Final init of the BNEP driver. + * Must be called after the Bluetooth driver has been completely initalize= d. + * - Registers the BNEP layer with L2CAP. + * - Reads the BD address through HCI. + * - Sets the MAC address =3D the BD address for all BNEP interfaces. + */ +void +bnep_init(void) +{ + int i, j; + char temp[8]; +=09 + DSYS("Initializing BNEP\n"); +=09 + /* Set the confirm and indication functions for the L2CAP-layer */ + this_layer.con_ind =3D bnep_connect_ind; + this_layer.con_pnd =3D bnep_connect_pnd; + this_layer.conf_ind =3D bnep_config_ind; + this_layer.disc_ind =3D bnep_disconnect_ind; + this_layer.con_cfm =3D bnep_connect_cfm; + this_layer.conf_cfm =3D bnep_config_cfm; + this_layer.disc_cfm =3D bnep_disconnect_cfm; + this_layer.receive_data =3D bnep_receive_packet; +=09 + /* Register BNEP in the L2CAP layer. */ + l2cap_register_upper(BNEP_LAYER, &this_layer); +=09 + /* Read BD address (converting to big endian) */ + D_MISC("Read local BD addr\n"); + hci_read_local_bd(bd_addr); + for (i =3D 0; i < 6; i++) { + temp[7-i] =3D bd_addr[i]; + } +=09 + /* Set MAC address for all 7 interfaces. */ + for (j =3D 0; j < BNEP_INTERFACES; j++) { + bnep_set_mac_address(&dev_bnep[j], &temp); + } + + D_MISC("BNEP Initialized\n"); +} + +/* + * Shutdown all BNEP sessions. + */ +void +bnep_shutdown(void) +{ + struct net_local *local; + int i; + + DSYS("Shutting down BNEP\n"); + for (i =3D 0; i < BNEP_INTERFACES; i++) { + local =3D dev_bnep[i].priv; + if (local->l2cap !=3D NULL) { + D_MISC("Disconnecting %s\n", dev_bnep[i].name); + l2ca_disconnect_req(local->l2cap); + } + } +} + +/*=20 * Init routine for BNEP interfaces. */ static int __init @@ -234,49 +298,6 @@ } =20 /*=20 - * Final init of the BNEP driver. - * Must be called after the Bluetooth driver has been completely initalize= d. - * - Registers the BNEP layer with L2CAP. - * - Reads the BD address through HCI. - * - Sets the MAC address =3D the BD address for all BNEP interfaces. - */ -void -bnep_init(void) -{ - int i, j; - char temp[8]; -=09 - DSYS("Initializing BNEP\n"); -=09 - /* Set the confirm and indication functions for the L2CAP-layer */ - this_layer.con_ind =3D bnep_connect_ind; - this_layer.con_pnd =3D bnep_connect_pnd; - this_layer.conf_ind =3D bnep_config_ind; - this_layer.disc_ind =3D bnep_disconnect_ind; - this_layer.con_cfm =3D bnep_connect_cfm; - this_layer.conf_cfm =3D bnep_config_cfm; - this_layer.disc_cfm =3D bnep_disconnect_cfm; - this_layer.receive_data =3D bnep_receive_packet; -=09 - /* Register BNEP in the L2CAP layer. */ - l2cap_register_upper(BNEP_LAYER, &this_layer); -=09 - /* Read BD address (converting to big endian) */ - D_MISC("Read local BD addr\n"); - hci_read_local_bd(bd_addr); - for (i =3D 0; i < 6; i++) { - temp[7-i] =3D bd_addr[i]; - } -=09 - /* Set MAC address for all 7 interfaces. */ - for (j =3D 0; j < 7; j++) { - bnep_set_mac_address(&dev_bnep[j], &temp); - } - - D_MISC("BNEP Initialized\n"); -} - -/* * Open/initialize a BNEP interface. This is called (in the current kernel) * sometime after booting when the 'ifconfig' program is run. * @@ -424,6 +445,7 @@ D_XMIT(__FUNCTION__": Multicast packet, dest =3D %02x:%02x:%02x:%02x:%02= x:%02x\n",=20 eth->h_dest[0], eth->h_dest[1], eth->h_dest[2], eth->h_dest[3], eth->h_dest[3], eth->h_dest[5]); + local->stats.multicast++; =20=09=09 /* Step through filter range by filter range */ for (i =3D 0; (i < BNEP_MAX_MCAST_FILTER_RANGES) && (!send_packet); i++)= { @@ -559,7 +581,7 @@ strip 4 bytes when it comes from the LAN.=20 Found during UPF7 but can't reproduce it here.*/ #if 0 - for(i =3D 0 ; i < 7 ; i++) { + for(i =3D 0 ; i < BNEP_INTERFACES; i++) { other =3D dev_bnep[i].priv; if(other->state !=3D CONNECTED) { continue; @@ -1437,5 +1459,3 @@ =20=09 return 0; } - - |
From: Anders J. <and...@us...> - 2002-02-11 17:52:40
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bnep.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20 l2cap.c 1.128 1.129=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Deny multiple bnepconnections from the same client. * Don't delete the connection if non-initiator when replying negative on a connection request. The diff of the modified file(s): --- bnep.c 29 Jan 2002 15:57:26 -0000 1.3 +++ bnep.c 11 Feb 2002 17:52:38 -0000 1.4 @@ -410,7 +410,7 @@ struct bnep_compressed_ethernet_source_only bnep_c_s; struct bnep_compressed_ethernet bnep_c; void *bhdr; - int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len = =3D 0; + int i, bhdrlen, ethhdrlen =3D sizeof(struct ethhdr), buflen, strip_len = =3D 0, j; u16 proto, payload_proto;=20 int send_packet =3D 0; int dest =3D 1; @@ -1239,10 +1239,30 @@ static void=20 bnep_connect_ind(l2cap_con *l2cap)=20 { - int i; + int i, j, dupe; struct net_local *local; D_MISC("bnep_connect_ind: remote cid %d\n", l2cap->remote_cid); =20=09 + for (i=3D0 ; i < BNEP_MAX_CON ; i++) { + local =3D dev_bnep[i].priv; + if(local->l2cap) { + dupe =3D 1; + for (j =3D 0; j < 6; j++) { + if (l2cap->remote_bd[j] !=3D local->l2cap->remote_bd[j]) { + dupe =3D 0; + break; + } + } + if(dupe) { + D_ERR(__FUNCTION__ ": Already have a bnep connection from that client\= n"); + if (l2ca_connect_rsp(l2cap, RES_NOSRC, STAT_NOINFO)) { + D_ERR("bnep_connect_ind: l2ca_connect_rsp failed\n"); + } + return; + }=09 + } + } + /* Check for free interfaces */ for (i=3D0 ; i < BNEP_MAX_CON ;i++) { local =3D dev_bnep[i].priv; --- l2cap.c 24 Jan 2002 12:41:31 -0000 1.128 +++ l2cap.c 11 Feb 2002 17:52:38 -0000 1.129 @@ -1788,8 +1788,12 @@ ENTERSTATE(con, CLOSED); PRINTSTATE(con); =20 - /* remove connection */ + /* As the hcihdl is stored in the l2cap connection + object we need to keep it if we are non-initiator + */ + if(con->initiator || (count_con(con->hci_hdl) > 1)) { delete_con(con); + } }=20=20 return result; } |
From: Fredrik S. <fre...@us...> - 2002-02-12 11:02:23
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bnep.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20 hci.c 1.191 1.192=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Fixed a problem with running out of ACL buffers when a client disconnects u= ngracefully. The diff of the modified file(s): --- bnep.c 11 Feb 2002 17:52:38 -0000 1.4 +++ bnep.c 12 Feb 2002 11:02:21 -0000 1.5 @@ -1407,10 +1407,11 @@ /* acknowledge the disconnect */ if (l2ca_disconnect_rsp(l2cap)) { D_ERR("ether_disconnect_ind: l2ca_disconnect_rsp failed\n"); - return; + //return; } local =3D dev->priv; local->l2cap =3D NULL; + local->state =3D DISCONNECTED; } =20 static void=20 --- hci.c 6 Feb 2002 11:23:15 -0000 1.191 +++ hci.c 12 Feb 2002 11:02:21 -0000 1.192 @@ -714,6 +714,8 @@ update_ncp(u8 nbr_of_hdl, u8 *pkt) { s32 i; + u16 hci_hdl; + u16 count; #ifdef __KERNEL__ unsigned long flags; =20 @@ -729,7 +731,18 @@ that have been sent */ =20 for (i =3D 0; i < 4 * nbr_of_hdl; i +=3D 4) { - hci_ctrl.hc_buf.acl_num +=3D le16_to_cpuu(&pkt[i+2]); + hci_hdl =3D hci_handle(&pkt[i]); + count =3D le16_to_cpuu(&pkt[i+2]); + hci_ctrl.hc_buf.acl_num +=3D count; + + D_REC(__FUNCTION__ ": free %d for handle %d\n", count, hci_hdl); + + if (hci_ctrl.acl_buf_count[hci_hdl] < count) { + D_ERR(__FUNCTION__ ": completed packets > pending, hdl %d\n", hci_hdl); + hci_ctrl.acl_buf_count[hci_hdl] =3D 0; + } else { + hci_ctrl.acl_buf_count[hci_hdl] -=3D count; + } } =20=09 D_QUEUE("<NCP:%d>\n", hci_ctrl.hc_buf.acl_num); @@ -836,6 +849,7 @@ if (lp_connect_cfm(buf + 3, (u32) buf[0], hci_hdl)) { hci_ctrl.nbr_of_connections++; hci_update_load_factor(); + hci_ctrl.acl_buf_count[hci_hdl] =3D 0; } =20 #ifndef HCI_EMULATION @@ -897,27 +911,37 @@ break; =20 case DISCONNECTION_COMPLETE: + { + u16 hci_hdl =3D hci_handle(&buf[1]); DSYS(__FUNCTION__ ": DISCONNECTION_COMPLETE %s\n", get_err_msg(buf[3])); =20 release_cmd_timer(); wake_up_interruptible(&hci_wq); =20 - if (lp_disconnect_ind(hci_handle(&buf[1]))) + if (lp_disconnect_ind(hci_hdl)) if (hci_ctrl.nbr_of_connections > 0) { hci_ctrl.nbr_of_connections--; hci_update_load_factor(); } =20 + if (hci_ctrl.acl_buf_count[hci_hdl] > 0) { + DSYS(__FUNCTION__ ": Reset %d pending packets for handle %d\n",=20 + hci_ctrl.acl_buf_count[hci_hdl], hci_hdl); + hci_ctrl.hc_buf.acl_num +=3D hci_ctrl.acl_buf_count[hci_hdl]; + hci_ctrl.acl_buf_count[hci_hdl] =3D 0; + } + /* FIXME: No more NBR_OF_COMPLETE_PACKETS will arrive for this connection handle, if we only support point-to-point connections we can acl_num by reading the buffersizes again, but this will not work in a multipoint connection. */ =20 - reset_hci_con_bd(hci_handle(&buf[1])); + reset_hci_con_bd(hci_hdl); =20=09=09 if (hci_ctrl.nbr_of_connections <=3D 0) { hci_read_buffer_size(HCI_NON_BLOCK); } + } break; =20 case AUTHENTICATION_COMPLETE: @@ -3423,6 +3447,7 @@ if (sent_bytes !=3D 0) { bytes2send -=3D sent_bytes; cli(); + hci_ctrl.acl_buf_count[tx_buf->hci_hdl]++; hci_ctrl.hc_buf.acl_num--; sti(); } else { |
From: Fredrik S. <fre...@us...> - 2002-02-12 13:54:02
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.222 1.223=20=20=20=20=20=20=20=20=20=20=20 bnep.c 1.5 1.6=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Patch from Fabrizio Gennari <fab...@ph...>: Fix compiler er= rors when building the stack as a module. The diff of the modified file(s): --- bluetooth.c 6 Feb 2002 11:23:13 -0000 1.222 +++ bluetooth.c 12 Feb 2002 13:54:00 -0000 1.223 @@ -2556,6 +2556,9 @@ =20 hci_module_init(); rfcomm_module_init(); +#ifdef CONFIG_BLUETOOTH_PAN + bnep_init_module(); +#endif =20=20=20=20=20=20=20=20=20 return 0; /* success */ } @@ -3269,6 +3272,10 @@ bnep_status_remove_proc_file(); #endif #endif /* CONFIG_BLUETOOTH_PROC */ + +#ifdef CONFIG_BLUETOOTH_PAN + bnep_exit_module(); +#endif =20 DSYS("Bluetooth Driver unregistered\n"); } --- bnep.c 12 Feb 2002 11:02:21 -0000 1.5 +++ bnep.c 12 Feb 2002 13:54:00 -0000 1.6 @@ -128,8 +128,6 @@ =20 /****************** LOCAL FUNCTION DECLARATION SECTION *******************= ***/ =20 -static int bnep_init_module(void); - /* Ethernet interface */ static int __init bnep_init_interface(struct net_device *dev); static int bnep_close(struct net_device *dev); @@ -153,13 +151,10 @@ =20 /****************** FUNCTION DEFINITION SECTION **************************= ***/ =20 -/* Tell the kernel to call my init routine. */ -module_init(bnep_init_module); - /*=20 * Init routine for the BNEP driver.=20 */ -static int +int bnep_init_module(void) { int i, err; @@ -183,6 +178,20 @@ } } return 0; +} + +void +bnep_exit_module(void) +{ + int i; + struct net_device *d; + + for (i =3D 0; i < BNEP_INTERFACES; i++) { + d =3D &dev_bnep[i]; + + D_MISC("Unregister netdev %s\n", d->name); + unregister_netdev(d); + } } =20 /*=20 |
From: Anders J. <and...@us...> - 2002-02-28 15:45:12
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- Makefile 1.30 1.31=20=20=20=20=20=20=20=20=20=20=20=20 sec_client.c 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Added hci_sec.c to makefile. * Corrected typo. The diff of the modified file(s): --- Makefile 4 Feb 2002 11:53:45 -0000 1.30 +++ Makefile 28 Feb 2002 15:45:08 -0000 1.31 @@ -4,7 +4,7 @@ =20 OBJS =3D bluetooth.o bt_proc.o btdebug.o btmem.o hci.o hci_vendor.o \ l2cap.o l2cap_con.o l2cap_sec.o rfcomm.o rfcomm_sec.o \ - sec_client.o sdp.o tcs.o test.o + sec_client.o sdp.o tcs.o test.o hci_sec.o =20 BOBJS =3D bcsp.o bcsp_datagram.o bcsp_integrity.o bcsp_mux.o \ bcsp_sequence.o bcsp_slip.o --- sec_client.c 22 Feb 2002 14:02:40 -0000 1.21 +++ sec_client.c 28 Feb 2002 15:45:08 -0000 1.22 @@ -725,7 +725,7 @@ break; =20=09=09 case HCI: - D_PROC(FNC"Message to HCI\n"); + D_PROC(__FUNCTION__ ": Message to HCI\n"); hci_process_sec_man_response(sec_hdl->request_result, sec_hdl->originator_data, sec_hdl->request_value, |
From: Fredrik S. <fre...@us...> - 2002-03-08 09:41:42
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- bluetooth.c 1.224 1.225=20=20=20=20=20=20=20=20=20=20=20 bnep.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: If BD address is changed also change MAC address of all BNEP interfaces. The diff of the modified file(s): --- bluetooth.c 28 Feb 2002 20:12:14 -0000 1.224 +++ bluetooth.c 8 Mar 2002 09:41:42 -0000 1.225 @@ -258,15 +258,6 @@ void bt_linebuf_send(s32 line); #endif =20 -#ifdef CONFIG_BLUETOOTH_PAN -void bnep_init(void); -void bnep_shutdown(void); -u32 bnep_connect_req(u8 *bd_addr); -u32 bnep_test(u8 *p); -u32 bnep_set_multicast_filter(u8 *filter); -u32 bnep_set_protocol_filter(u16 *filter); -#endif - /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 extern hci_controller hci_ctrl; @@ -1034,11 +1025,18 @@ } =20=09 case HCIWRITEBDADDR: + { copy_from_user(&bd_addr, (s32*)arg, size); BT_DRIVER(__FUNCTION__ ": Setting BD_ADDR to\n"); print_data("bd:",(u8*)bd_addr,6); hci_set_bd_addr(bd_addr); + +#ifdef CONFIG_BLUETOOTH_PAN + bnep_set_mac_address_all(bd_addr); +#endif + break; + } =20=09=09 /* | len (1) | hci header (4) | data (max 256)| */ case HCISENDRAWDATA: --- bnep.c 25 Feb 2002 14:28:18 -0000 1.10 +++ bnep.c 8 Mar 2002 09:41:42 -0000 1.11 @@ -204,8 +204,8 @@ void bnep_init(void) { - int i, j; - char temp[8]; + int i; + char temp[6]; =20=09 DSYS("Initializing BNEP\n"); =20=09 @@ -224,15 +224,13 @@ =20=09 /* Read BD address (converting to big endian) */ D_MISC("Read local BD addr\n"); - hci_read_local_bd(bd_addr); + hci_read_local_bd(temp); for (i =3D 0; i < 6; i++) { - temp[7-i] =3D bd_addr[i]; + bd_addr[5-i] =3D temp[i]; } =20=09 /* Set MAC address for all 7 interfaces. */ - for (j =3D 0; j < BNEP_INTERFACES; j++) { - bnep_set_mac_address(&dev_bnep[j], &temp); - } + bnep_set_mac_address_all(bd_addr); =20 D_MISC("BNEP Initialized\n"); } @@ -341,10 +339,27 @@ { struct sockaddr *addr =3D p; memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); - D_MISC("%s: changed MAC to %02X:%02x:%02x:%02x:%02x:%02x\n", dev->name, + DSYS("%s: changed MAC to %02x:%02x:%02x:%02x:%02x:%02x\n", dev->name, dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],=20 dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); return 0; +} + +/*=20 + * Set MAC address for all BNEP interfaces. + */ +void +bnep_set_mac_address_all(u8 *addr) +{ + int j; + struct sockaddr saddr; + + memcpy(saddr.sa_data, addr, 6); + + /* Set MAC address for all 7 interfaces. */ + for (j =3D 0; j < BNEP_INTERFACES; j++) { + bnep_set_mac_address(&dev_bnep[j], &saddr); + } } =20 /* |
From: Alain P. <apa...@us...> - 2002-05-10 12:28:22
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- Config.in 1.21 1.22=20=20=20=20=20=20=20=20=20=20=20=20=20=20 hci_vendor.c 1.63 1.64=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added settings and functions for new bluetooth hardware from Texas Instrume= nts. The diff of the modified file(s): --- Config.in 18 Dec 2001 09:33:20 -0000 1.21 +++ Config.in 10 May 2002 12:27:51 -0000 1.22 @@ -14,6 +14,7 @@ Digianswer CONFIG_BLUETOOTH_DIGIANSWER \ Ericsson CONFIG_BLUETOOTH_ERICSSON \ Infineon CONFIG_BLUETOOTH_INFINEON_BMI \ + Texas_Instruments CONFIG_BLUETOOTH_TEXASINSTRUMENTS \ Generic CONFIG_BLUETOOTH_GENERIC \ USB CONFIG_BLUETOOTH_USBMODULE" Ericsson =20 --- hci_vendor.c 11 Apr 2002 10:16:48 -0000 1.63 +++ hci_vendor.c 10 May 2002 12:27:51 -0000 1.64 @@ -88,6 +88,11 @@ /* Digianswer defines */ #endif =20 +#ifdef CONFIG_BLUETOOTH_TEXASINSTRUMENTS +/* Texas instrument defines */ +#define TEXAS_SET_SLEEP_MODE 0x0C +#endif + #define BT_HW_INFO_MAX 255 =20 /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ @@ -1430,6 +1435,54 @@ bt_hw_vendor(void) { return "Infineon"; +} + + +#elif defined(CONFIG_BLUETOOTH_TEXASINSTRUMENTS) + +/*************************************************************************= ****/ +/************** Functions for Texas Instrument Bluetooth chips ***********= ****/ +/*************************************************************************= ****/ + +#define VENDOR " [Texas Instruments]" + +s32=20 +hci_set_bd_addr(u8 bd[6]) +{ + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); + return 0; +} + +s32 +hci_read_firmware_rev_info(void) +{ + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); + return 0; +} + +s32=20 +hci_set_baudrate(u32 baudrate) +{ + D_ERR(__FUNCTION__ VENDOR " not supported.\n"); + return 0; +} + +void +process_vendor_event(u8 *buf, u32 len, u32 event_code) +{ + D_REC(__FUNCTION__ VENDOR " Texas specific: Unknown event.\n"); +} + +void +process_vendor_return_param(u32 ocf, u8* r_val) +{ + D_ERR(__FUNCTION__ VENDOR " Texas specific: Invalid reply (0x%x)\n", ocf); +} + +char* +bt_hw_vendor(void) +{ + return "Texas Instruments"; } =20 #else |
From: Alain P. <apa...@us...> - 2002-07-31 08:21:47
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bluetooth.c 1.228 1.229=20=20=20=20=20=20=20=20=20=20=20=20=20 bt_proc.c 1.22 1.23=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added a new proc file. This profile is only for read, and is blocking. When a new connection from remote device happen, it recieve next informatio= n : <line>:<server channel> Note that it recieves the same thing when we localy initiate the connection. proc file : bt_channel_con The diff of the modified file(s): --- bluetooth.c 16 May 2002 15:05:52 -0000 1.228 +++ bluetooth.c 31 Jul 2002 08:21:16 -0000 1.229 @@ -264,10 +264,29 @@ =20 /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 -extern hci_controller hci_ctrl; static u8 btdm_pid =3D 0; + +/****************** EXTERN VARIABLE DECLARATION SECTION ******************= ***/ + +extern hci_controller hci_ctrl; extern u8 name_request_response[BT_NAME_LENGTH + 1]; =20 +/* Use global variables to store line and server channel of a new incoming= connection */ +#ifdef CONFIG_BLUETOOTH_PROC +extern int new_con_srv_channel; +extern int new_con_line; + +#ifdef __KERNEL__ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +extern struct wait_queue *channel_con_wq =3D NULL; +#else +extern wait_queue_head_t channel_con_wq; +#endif /* LINUX_VERSION_CODE */ +#endif /* __KERNEL__ */ + +#endif /* CONFIG_BLUETOOTH_PROC */ + + /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) @@ -2374,7 +2393,12 @@ =20 BT_DRIVER(__FUNCTION__ ": Line %d [%s]\n", line, psmname(psm)); - +#ifdef CONFIG_BLUETOOTH_PROC + new_con_srv_channel =3D bt_ctrl.session[line].dlci >> 1; + new_con_line =3D line; + /* Wake up if someone reads the proc file */ + wake_up_interruptible(&channel_con_wq);=09=09 +#endif release_wq_timer(&bt_ctrl.bt_timer[line]); wake_up_interruptible(&bt_ctrl.connect_wq[line]); wake_up_interruptible(&bt_ctrl.any_wq); @@ -2694,6 +2718,14 @@ DSYS("Registering BT proc files\n"); =20=20 #ifdef CONFIG_BLUETOOTH_PROC + + procfs_status =3D channel_con_create_proc_file(); + if (procfs_status < 0) { + D_ERR("Couldn't register proc file bt_channel_con %d\n",=20 + procfs_status); + } + + #if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) { procfs_status =3D -1; --- bt_proc.c 11 Apr 2002 10:14:04 -0000 1.22 +++ bt_proc.c 31 Jul 2002 08:21:16 -0000 1.23 @@ -78,18 +78,174 @@ =20 /****************** CONSTANT AND MACRO SECTION ***************************= ***/ =20 +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,2,14) +#define USE_NEW_PROC +#endif + /****************** TYPE DEFINITION SECTION ******************************= ***/ =20 /****************** LOCAL FUNCTION DECLARATION SECTION *******************= ***/ =20 +#ifdef __KERNEL__ +#ifdef CONFIG_BLUETOOTH_PROC +#ifdef USE_NEW_PROC +static ssize_t channel_con_read(struct file * file, char * buf, + size_t count, loff_t *offset); +#else +static s32 channel_con_read(struct inode *inode, struct file * file, + char * buf, s32 count); +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +static s32 channel_con_proc_dir_entry_read(char *buf, char **start, off_t = offset, + s32 len, s32 unused); +#endif /* LINUX_VERSION_CODE */ +#endif /* CONFIG_BLUETOOTH_PROC */ +#endif /* __KERNEL__ */ /****************** GLOBAL VARIABLE DECLARATION SECTION ******************= ***/ =20 /****************** LOCAL VARIABLE DECLARATION SECTION *******************= ***/ =20 +/****************** EXTERNAL VARIABLES DECLARATION SECTION ***************= ***/ + +/**************** VARIABLES FOR CHANNEL CONNECTION PROC FILE *************= *******/ + +#ifdef CONFIG_BLUETOOTH_PROC + +/* Next variables are declared in bluetooth.c */ +int new_con_srv_channel; +int new_con_line; + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +struct wait_queue *channel_con_wq =3D NULL; +#else +wait_queue_head_t channel_con_wq; +#endif /* LINUX_VERSION_CODE */ +#endif /* CONFIG_BLUETOOTH_PROC */ + +/**************** TYPES FOR CHANNEL CONNECTION PROC FILE *****************= ***/ + +#ifdef CONFIG_BLUETOOTH_PROC + +#ifdef __KERNEL__ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +static struct file_operations channel_con_procfile_operation =3D { + NULL, /* lseek - default */ + channel_con_read, /* read - bad */ + NULL, /* write - bad */ + NULL, /* readdir */ + NULL, /* select - default */ + NULL, /* ioctl - default */ + NULL, /* mmap */ + NULL, /* no special open code */ + NULL, /* no special release code */ + NULL /* can't fsync */ +}; +#else=20 +static struct file_operations channel_con_procfile_operation =3D { + NULL, /* module owner */ + NULL, /* lseek - default */ + channel_con_read, /* read - bad */ + NULL, /* write - bad */ + NULL, /* readdir */ + NULL, /* select - default */ + NULL, /* ioctl - default */ + NULL, /* mmap */ + NULL, /* no special open code */ + NULL, /* no special release code */ + NULL /* can't fsync */ +}; +#endif /* LINUX_VERSION_CODE */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +static struct inode_operations channel_con_proc_inode_operations =3D { + &channel_con_procfile_operation, /* default net file-ops */ + NULL, /* create */ + NULL, /* lookup */ + NULL, /* link */ + NULL, /* unlink */ + NULL, /* symlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* mknod */ + NULL, /* rename */ + NULL, /* readlink */ + NULL, /* follow_link */ + NULL, /* readpage */ + NULL, /* writepage */ + NULL, /* bmap */ + NULL, /* truncate */ + NULL /* permission */ +}; +#else +static struct inode_operations channel_con_proc_inode_operations =3D { + NULL, /* create */ + NULL, /* lookup */ + NULL, /* link */ + NULL, /* unlink */ + NULL, /* symlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* mknod */ + NULL, /* rename */ + NULL, /* readlink */ + NULL, /* follow_link */ + NULL, /* readpage */ + NULL, /* writepage */ + NULL, /* bmap */ + NULL, /* truncate */ + NULL /* permission */ +}; +#endif /* LINUX_VERSION_CODE */ +#endif /* __KERNEL__ */ + + +#ifdef __KERNEL__ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +static struct proc_dir_entry channel_con_proc_entry =3D { + 0, + 7, "bt_channel_con", + S_IFREG | S_IRUGO | S_IWUSR, + 1, 0, 0, + 0, + &channel_con_proc_inode_operations, + channel_con_proc_dir_entry_read, +}; +#else +static struct proc_dir_entry channel_con_proc_entry =3D { + 0, + 7, "bt_channel_con", + S_IFREG | S_IRUGO | S_IWUSR, + 1, 0, 0, + 0, + &channel_con_proc_inode_operations, + &channel_con_procfile_operation, +}; +#endif /* LINUX_VERSION_CODE */ +#endif /* __KERNEL__ */ + +#endif /* CONFIG_BLUETOOTH_PROC */ + /****************** FUNCTION DEFINITION SECTION **************************= ***/ =20 #ifdef __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) +s32 channel_con_proc_dir_entry_read(char *buf, char **start, off_t offset, + s32 len, s32 unused) +{ +#ifdef USE_NEW_PROC + return channel_con_read(NULL, buf, len, 0); +#else + return channel_con_read(NULL, NULL, buf, len); +#endif +} +#endif /* LINUX_VERSION_CODE */ +#endif /* __KERNEL__ */ + + +#ifdef __KERNEL__ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) static s32 bt_read_status(char *buf, char **start, off_t offset,=20 int len, int unused) #else @@ -172,6 +328,85 @@ len +=3D sprintf(buf + len, "\n-----------------------------------= ----\n"); return len; } + +#ifdef __KERNEL__ +#ifdef CONFIG_BLUETOOTH_PROC +s32 +channel_con_create_proc_file(void) +{ + s32 procfs_status =3D -ENOENT; + + /* The sec_man_wq wait queue must be initialised before anyone tries + to read from the /proc/sec_srv file, so we initialise the wait + queue here */ +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) + init_waitqueue_head(&channel_con_wq); +#endif /* LINUX_VERSION_CODE */ + +#if LINUX_VERSION_CODE >=3D KERNEL_VERSION(2,4,0) + { + struct proc_dir_entry *entry; + procfs_status =3D -1; + if ((entry =3D create_proc_entry(channel_con_proc_entry.name, + channel_con_proc_entry.mode, + &proc_root))) { + /*---------------------------------------------------*/ + /* If the proc entry was registered successfully, */ + /* then set all the necessary structure information. */ + /*---------------------------------------------------*/ + entry->proc_iops =3D channel_con_proc_entry.proc_iops; + entry->proc_fops =3D channel_con_proc_entry.proc_fops; + entry->get_info =3D channel_con_proc_entry.get_info; + procfs_status =3D 0; + } + } +#elif LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0) + procfs_status =3D proc_register(&proc_root, &channel_con_proc_entry); +#else + procfs_status =3D proc_register_dynamic(&proc_root, &channel_con_proc_ent= ry); +#endif /* LINUX_VERSION_CODE */ + + if (procfs_status < 0) { + D_ERR("Couldn't register proc file for security manager %d\n", + procfs_status); + } + + return procfs_status; +} +#endif /* CONFIG_BLUETOOTH_PROC */ +#endif /* __KERNEL__ */ + + + +#ifdef __KERNEL__ +#ifdef CONFIG_BLUETOOTH_PROC +#ifdef USE_NEW_PROC +ssize_t channel_con_read(struct file * file, char * buf, size_t count, + loff_t *offset) +#else +s32 channel_con_read(struct inode *inode, struct file * file, + char * buf, s32 count) +#endif +{ + s32 position; + cli(); +=09 + interruptible_sleep_on(&channel_con_wq); + + sti(); + + /* Format of the response : <line>:<server channel number> */ + /* Maximum : 6:30, so 5 characters with \0 */ + + position =3D 0; + position +=3D sprintf(buf + position,"%d", new_con_line); + position +=3D sprintf(buf + position, ":"); + position +=3D sprintf(buf + position, "%d", new_con_srv_channel); +=09 + return position;=09 +} +#endif /* CONFIG_BLUETOOTH_PROC */ +#endif /* __KERNEL__ */ =20 =20 /* |
From: Peter K. <pk...@us...> - 2002-08-01 16:18:04
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- test.c 1.35 1.36=20=20=20=20=20=20=20=20=20=20=20=20=20=20 unplug_test.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Fixed a couple of compiler warnings. The diff of the modified file(s): --- test.c 11 Apr 2002 11:51:29 -0000 1.35 +++ test.c 1 Aug 2002 16:18:00 -0000 1.36 @@ -1,9 +1,9 @@ /* * test.c -- Test layer used to verify stack=20=20=20=20=20=20=20 * - * Copyright (C) 2000, 2001 Axis Communications AB + * Copyright (C) 2000, 2001, 2002 Axis Communications AB * - * Author: Mats Friden <mat...@ax...> + * Author: Mats Friden <mat...@ax...> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -55,6 +55,8 @@ #include <linux/bluetooth/btcommon.h> #include <linux/bluetooth/btmem.h> #include <linux/bluetooth/l2cap.h> +#include <linux/bluetooth/l2cap_con.h> +#include <linux/bluetooth/hci.h> #include <linux/bluetooth/unplug_test.h> #else #include <string.h> @@ -254,7 +256,6 @@ return; } =20=09 -=09 if (disable_testpsm =3D=3D 1) { /* send back psm not supp */ @@ -333,8 +334,6 @@ D_ERR("test_config_cfm : Configuration request failed\n"); } } =20=09=09 -=09=09 -=09=09 /* store connection */ if (con->psm =3D=3D L2CAP_TEST_LAYER) testcon =3D con; @@ -357,13 +356,11 @@ if(dont_accept_mtu) { if (l2ca_config_rsp(con, 640, NULL, CONF_FAILURE)) { D_ERR("test_config_ind : Configuration response failed\n"); -=09=09=09 } dont_accept_mtu =3D 0; } else if (l2ca_config_rsp(con, 0, NULL, CONF_SUCCESS)) { D_ERR("test_config_ind : Configuration response failed\n"); -=09=09=09 } =20 /* Are we ready with our sides configuration */=20 @@ -465,7 +462,6 @@ return -1; } =20=09 - /* tx bufs are all the same for each upper layer ... FIX one common */ tx_buf =3D subscribe_bt_buf(sizeof(rfcomm_tx_buf) + len); =20 @@ -488,8 +484,9 @@ test_process_cmd(unsigned char *cmd, s32 size) {=20 #ifdef CONFIG_BLUETOOTH_UNPLUG_TEST - int testcase, tmp[10], i; + int testcase, i; unsigned char bd[6], char_buf[4]; + char_buf[3] =3D 0; if(!strncmp(cmd, "bb_conn ", 8)) { char *p =3D cmd + 8; @@ -515,6 +512,7 @@ } else { printk("test_process_cmd: Couldn't parse testcase\n"); + return -1; } } else if(!strncmp(cmd, "bb_disc ", 8)) { @@ -558,7 +556,7 @@ =20 return test_send_data(con, testdata, len); } else if(!strncmp(cmd, "set_error ", 10)) { - int pos =3D 10, n =3D 0; + int n =3D 0; if(*(cmd + 10) =3D=3D '-') { n =3D -(strtoul(cmd + 11, NULL, 0)); } else { @@ -567,6 +565,7 @@ printk("Setting l2cap size error value =3D %d\n", n); =20=09=09 add_value =3D n; + return 0; } else if(!strncmp(cmd, "sdptest ", 8)) { int n =3D strtoul(cmd+8, NULL, 0);=09 return do_sdp_test(n); --- unplug_test.c 15 May 2002 13:29:42 -0000 1.12 +++ unplug_test.c 1 Aug 2002 16:17:59 -0000 1.13 @@ -1061,11 +1061,13 @@ return test_send_data(testcon, testdata, 672);=09 } =20 +#if 0 static s32 test_2_13_6(void) { printk("test_2_13_6, server sending 672 bytes\n");=20 return test_send_data(testcon, testdata, 672);=09 } +#endif =20 /* * SDP Stuff @@ -1214,7 +1216,6 @@ static s32 sdp_test_53111(void) { static int t =3D 0; - s32 retval; if(!t) { t =3D 1; return sdp_send_data(&sdp_con_list[0], sdp_data_53111_1, sdp_data_53111_= 1[4] + 5); @@ -1222,7 +1223,6 @@ t =3D 0; return sdp_send_data(&sdp_con_list[0], sdp_data_53111_2, sdp_data_53111_= 2[4] + 5); } -=09 } =20 static s32 sdp_test_53112(void) @@ -1707,14 +1707,12 @@ retval =3D sdp_send_data(&sdp_con_list[0], sdp_data_55111_8, sdp_data_55= 111_8[4] + 5); t =3D 0; break; -=09=09 }=20 return retval; } =20 static s32 sdp_test_55112(void) { -=20=20 static int t =3D 0; s32 retval =3D 0; =20 @@ -1990,6 +1988,7 @@ return rfcomm_rpn_msg(&rfcomm_con_list[0], MCC_CMD, 4, 1); } =20 +#if 0 static s32 spp_test_55111(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ @@ -1999,7 +1998,9 @@ =20 return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } +#endif =20 +#if 0 static s32 spp_test_55112(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ @@ -2011,7 +2012,9 @@ =20 return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } +#endif =20 +#if 0 static s32 spp_test_55113(void) { /* Establish a L2CAP channel on PSM 1 (SDP) before doing this test */ @@ -2023,6 +2026,7 @@ =20 return sdp_send_data(&sdp_con_list[0], sdp_query, sdp_query[4] + 5); } +#endif =20 =20 static s32 spp_test_56211(void) @@ -2300,11 +2304,13 @@ return 0; } =20 +#if 0 static s32 test_4_25_3(void) { printk("test_4_25_3\n"); return rfcomm_sabm_msg(&rfcomm_con_list[0], 2); } +#endif =20 static s32 test_4_26(void) { @@ -2581,7 +2587,7 @@ =20=20=20=20=20=20=20=20=20 case 99999:=20 emulate_hw_error =3D 1; - break; + return 0; default: printk("Unknown test case\n"); return -1; |
From: Anders J. <and...@us...> - 2002-11-01 10:30:17
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bluetooth.c 1.233 1.234=20=20=20=20=20=20=20=20=20=20=20=20=20 rfcomm.c 1.137 1.138=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Don't initialize an extern variable. The diff of the modified file(s): --- bluetooth.c 12 Aug 2002 12:52:39 -0000 1.233 +++ bluetooth.c 1 Nov 2002 10:30:16 -0000 1.234 @@ -282,7 +282,7 @@ =20 #ifdef __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -extern struct wait_queue *channel_con_wq =3D NULL; +extern struct wait_queue *channel_con_wq; #else extern wait_queue_head_t channel_con_wq; #endif /* LINUX_VERSION_CODE */ --- rfcomm.c 27 Sep 2002 12:54:11 -0000 1.137 +++ rfcomm.c 1 Nov 2002 10:30:16 -0000 1.138 @@ -512,7 +512,7 @@ =20 #ifdef __KERNEL__ #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) -extern struct wait_queue *channel_con_wq =3D NULL; +extern struct wait_queue *channel_con_wq; #else extern wait_queue_head_t channel_con_wq; #endif /* LINUX_VERSION_CODE */ |
From: Peter K. <pk...@us...> - 2002-11-19 14:13:11
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bluetooth.c 1.234 1.235=20=20=20=20=20=20=20=20=20=20=20=20=20 hci.c 1.205 1.206=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added BTREADREMOTENAME ioctl to get the Bluetooth name of a remote client. The diff of the modified file(s): --- bluetooth.c 1 Nov 2002 10:30:16 -0000 1.234 +++ bluetooth.c 19 Nov 2002 14:13:10 -0000 1.235 @@ -1,7 +1,7 @@ /* * bluetooth.c -- Linux kernel integration code for bluetooth stack * - * Copyright (C) 2000, 2001 Axis Communications AB + * Copyright (C) 2000, 2001, 2002 Axis Communications AB * * Author: Mattias Agren <mat...@ax...> * @@ -631,9 +631,8 @@ =20 case BTDISCONNECT_BB: { - /* Disconnect the BB connection (Consafe)=20 - The bd_addr is reversed=20 - */ + /* Disconnect the BB connection + The bd_addr is reversed */ u8 bd_addr[6]; l2cap_con *con_str; =20 @@ -643,8 +642,7 @@ bd_addr[0], bd_addr[1], bd_addr[2], bd_addr[3], bd_addr[4], bd_addr[5]); =20=09=09 - if ((con_str =3D get_con(bd_addr, ANY_STATE))=3D=3D NULL)=20 - { + if (!(con_str =3D get_con(bd_addr, ANY_STATE))) { D_ERR(__FUNCTION__ ": couldn't find l2cap con!\n"); return -MSGCODE(MSG_BT_INTERFACE, BT_NOTCONNECTED); } @@ -701,14 +699,31 @@ =20 copy_from_user(&line, (s32*)arg, size); =20 - get_remote_bd(line, bd_addr); + err =3D get_remote_bd(line, bd_addr); =20 /* return as big endian */ for (i =3D 0; i < 6; i++) { rev_bd[5-i] =3D bd_addr[i]; } copy_to_user((s32*)arg, rev_bd, 6); - break; + return err; + } + + case BTREADREMOTENAME: + { + u8 remote_name[BT_NAME_LENGTH]; + s32 line; + u32 length; + + BT_DRIVER(__FUNCTION__ ": BTREADREMOTENAME\n"); + + copy_from_user(&line, (s32*)arg, sizeof line); + copy_from_user(&length, (s32*)arg + 1, sizeof length); + + err =3D get_remote_name(line, remote_name, length); + + copy_to_user((s32*)arg, remote_name, BT_NAME_LENGTH); + return err; } =20 case BTRESETPHYSICALHW: @@ -729,8 +744,8 @@ break; =20 case BTSENDTESTDATA: - copy_from_user(&tmp, (s32*)arg, 4); - copy_from_user(&utmp, (s32*)arg + 1, 4); + copy_from_user(&tmp, (s32*)arg, sizeof tmp); + copy_from_user(&utmp, (s32*)arg + 1, sizeof utmp); rfcomm_send_testdata(tmp, utmp); break; =20 --- hci.c 15 Nov 2002 12:13:29 -0000 1.205 +++ hci.c 19 Nov 2002 14:13:10 -0000 1.206 @@ -3335,14 +3335,38 @@ memset(bd, 0, 6); =20 if (line >=3D 0 && line < MAX_NBR_OF_CONNECTIONS) { + if (hci_ctrl.con[line].state !=3D NOT_CONNECTED) { memcpy(bd, hci_ctrl.con[line].bd, 6); + } DSYS(__FUNCTION__ ": %02x:%02x:%02x:%02x:%02x:%02x\n", bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]); return 0; } else { /* No connection yet */ D_WARN(__FUNCTION__ ": Unknown line: %d!\n", line); - return -1; + return -EINVAL; + } +} + +/* + * This function will return the remote name for a specific line + */ + +s32 +get_remote_name(s32 line, u8 *name, u32 length) +{ + D_CMD(__FUNCTION__ "\n"); + + if (line >=3D 0 && line < MAX_NBR_OF_CONNECTIONS) { + memset(name, '\0', min(length, BT_NAME_LENGTH)); + if (hci_ctrl.con[line].state !=3D NOT_CONNECTED) { + strncpy(name, hci_ctrl.con[line].name, min(length, BT_NAME_LENGTH)-1); + } + return 0; + } else { + /* No connection yet */ + D_WARN(__FUNCTION__ ": Unknown line: %d!\n", line); + return -EINVAL; } } =20 |
From: Anders J. <and...@us...> - 2003-02-06 15:36:53
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bluetooth.c 1.236 1.237=20=20=20=20=20=20=20=20=20=20=20=20=20 hci.c 1.207 1.208=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: get_remote_name and get_remote_bd now uses hci_hdl to refer to a connection as bt_ctrl.session[line] !=3D hci_ctrl[line] !!=20=20 The diff of the modified file(s): --- bluetooth.c 13 Jan 2003 19:48:26 -0000 1.236 +++ bluetooth.c 6 Feb 2003 15:36:20 -0000 1.237 @@ -546,7 +546,7 @@ s32 err =3D 0; s32 size =3D _IOC_SIZE(cmd); bt_connection btcon; - u8 bd_addr[6]; + u8 bd_addr[6] =3D {0, 0, 0, 0, 0, 0}; #ifdef CONFIG_BLUETOOTH_SUPPORT_BCSP static u8 dfu_data[2044]; #endif @@ -693,13 +693,20 @@ { BD_ADDR rev_bd; s32 line; - u16 i; + s32 i; =20 BT_DRIVER(__FUNCTION__ ": BTREADREMOTEBDADDR\n"); =20 copy_from_user(&line, (s32*)arg, size); =20 - err =3D get_remote_bd(line, bd_addr); + /* Get the session for this line */ + i =3D bt_get_conhdl_from_line(line); +=09=09 + if(i >=3D 0) { + err =3D get_remote_bd(i, bd_addr); + } else { + err =3D -EINVAL; + } =20 /* return as big endian */ for (i =3D 0; i < 6; i++) { @@ -729,14 +736,21 @@ u8 remote_name[BT_NAME_LENGTH]; s32 line; u32 length; + s32 con_hdl; =20 BT_DRIVER(__FUNCTION__ ": BTREADREMOTENAME\n"); =20 + memset(remote_name, 0, BT_NAME_LENGTH); + copy_from_user(&line, (s32*)arg, sizeof line); copy_from_user(&length, (s32*)arg + 1, sizeof length); =20 - err =3D get_remote_name(line, remote_name, length); - + con_hdl =3D bt_get_conhdl_from_line(line); + if(con_hdl >=3D 0) { + err =3D get_remote_name(con_hdl, remote_name, length); + } else { + err =3D -EINVAL; + } copy_to_user((s32*)arg, remote_name, BT_NAME_LENGTH); return err; } @@ -3226,6 +3240,25 @@ =20 return pos; } + +s32 +bt_get_conhdl_from_line(s32 line)=20 +{ + rfcomm_con *con; +=09 + if(line >=3D BT_NBR_DATAPORTS) { + return -1; + } + + con =3D bt_ctrl.session[line].rfcomm; +=09 + if(con && con->l2cap) { + return (*(con->l2cap)).hci_hdl; + } + + return -1; +} + =20 /* * FIXME -- make this register function more general i.e --- hci.c 13 Jan 2003 19:48:30 -0000 1.207 +++ hci.c 6 Feb 2003 15:36:20 -0000 1.208 @@ -3328,22 +3328,29 @@ /* Consider changing bd to BD_ADDR */ =20 s32 -get_remote_bd(s32 line, u8 *bd) +get_remote_bd(u16 con_hdl, u8 *bd) { + u32 i; D_CMD(__FUNCTION__ "\n"); =20 + for (i =3D 0 ; i < MAX_NBR_OF_CONNECTIONS ; i ++) { + if (hci_ctrl.con[i].con_hdl =3D=3D con_hdl) { + break; + } + } + memset(bd, 0, 6); =20 - if (line >=3D 0 && line < MAX_NBR_OF_CONNECTIONS) { - if (hci_ctrl.con[line].state !=3D NOT_CONNECTED) { - memcpy(bd, hci_ctrl.con[line].bd, 6); + if (i >=3D 0 && i < MAX_NBR_OF_CONNECTIONS) { + if (hci_ctrl.con[i].state !=3D NOT_CONNECTED) { + memcpy(bd, hci_ctrl.con[i].bd, 6); } DSYS(__FUNCTION__ ": %02x:%02x:%02x:%02x:%02x:%02x\n", bd[5], bd[4], bd[3], bd[2], bd[1], bd[0]); return 0; } else { /* No connection yet */ - D_WARN(__FUNCTION__ ": Unknown line: %d!\n", line); + D_WARN(__FUNCTION__ ": Can't find connection with hci_hdl: %d!\n", con_h= dl); return -EINVAL; } } @@ -3353,19 +3360,26 @@ */ =20 s32 -get_remote_name(s32 line, u8 *name, u32 length) +get_remote_name(u16 con_hdl, u8 *name, u32 length) { + u32 i; D_CMD(__FUNCTION__ "\n"); =20 - if (line >=3D 0 && line < MAX_NBR_OF_CONNECTIONS) { + for (i =3D 0 ; i < MAX_NBR_OF_CONNECTIONS ; i ++) { + if (hci_ctrl.con[i].con_hdl =3D=3D con_hdl) { + break; + } + } + + if (i >=3D 0 && i < MAX_NBR_OF_CONNECTIONS) { memset(name, '\0', min(length, BT_NAME_LENGTH)); - if (hci_ctrl.con[line].state !=3D NOT_CONNECTED) { - strncpy(name, hci_ctrl.con[line].name, min(length, BT_NAME_LENGTH)-1); + if (hci_ctrl.con[i].state !=3D NOT_CONNECTED) { + strncpy(name, hci_ctrl.con[i].name, min(length, BT_NAME_LENGTH)-1); } return 0; } else { /* No connection yet */ - D_WARN(__FUNCTION__ ": Unknown line: %d!\n", line); + D_WARN(__FUNCTION__ ": Unknown hci_hdl: %d!\n", con_hdl); return -EINVAL; } } |
From: Anders J. <and...@us...> - 2003-04-14 16:11:08
|
The following files were modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- rfcomm.c 1.139 1.140=20=20=20=20=20=20=20=20=20=20=20=20=20 sdp.c 1.89 1.90=20=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Respond with a negative reply if we are out of TTY:s in RFCOMM. Corrected possible problem with get_free_sdp_con. The diff of the modified file(s): --- rfcomm.c 6 Mar 2003 16:04:05 -0000 1.139 +++ rfcomm.c 14 Apr 2003 16:11:03 -0000 1.140 @@ -843,9 +843,9 @@ D_CTRL("rfcomm_connect_ind\n"); if (!(rfcomm =3D get_new_rfcomm_con())) { D_ERR("rfcomm_connect_ind: error: couldn't find free tty\n"); - - /* fixme -- respond neg ! */ - + if(l2ca_connect_rsp(l2cap, RES_NOSRC, STAT_NOINFO)) { + D_ERR("rfcomm_connect_ind: l2ca_connect_rsp failed\n"); + } return; } else { if (l2ca_connect_rsp(l2cap, RES_SUCCESS, STAT_NOINFO)) { --- sdp.c 1 Aug 2002 16:15:11 -0000 1.89 +++ sdp.c 14 Apr 2003 16:11:05 -0000 1.90 @@ -1052,7 +1052,7 @@ } =20 if (i =3D=3D MAX_NBR_SDP) { - return 0; + return NULL; } =20 return &sdp_con_list[i]; |