|
From: Mats F. <ma...@us...> - 2001-05-25 14:21:09
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
hci.c 1.148 1.149=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added function for trigging hci send data
* Check status of send_acl_pkt before decreasing acl_num
The diff of the modified file(s):
--- hci.c 2001/05/22 09:45:53 1.148
+++ hci.c 2001/05/25 14:21:09 1.149
@@ -678,6 +678,23 @@
}
#endif
=20
+s32
+hci_trig_send(void)
+{
+=09
+ if (buf_count()) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+ queue_task(&send_data_task, &tq_scheduler);
+#else
+ queue_task(&send_data_task, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+#endif
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
void
update_ncp(u8 nbr_of_hdl, u8 *pkt)
{
@@ -694,6 +711,9 @@
tmp =3D CHAR2INT16(pkt[i+3], pkt[i+2]);
hci_ctrl.hc_buf.acl_num +=3D CHAR2INT16(pkt[i+3], pkt[i+2]);
}
+=09
+ D_QUEUE("<NCP:%d>\n",hci_ctrl.hc_buf.acl_num);
+
D_REC(__FUNCTION__", acl_num after : %d\n", hci_ctrl.hc_buf.acl_num);
=20
/* We've just been notified that the hardware has free buffers.
@@ -804,13 +824,13 @@
reset_hci_con_bd(hci_hdl);
} else {
DSYS(__FUNCTION__", ACL link is up\n");
- change_connection_packet_type(hci_hdl,=20
- DM3|DH3|DM5|DH5);
+ change_connection_packet_type(hci_hdl,DM1|DH1|=20
+ DM3|DH3);
set_hci_con(buf + 3, hci_hdl);
remote_name_request(buf + 3);
=20
/* enable m/s switch */=20
- write_link_policy_settings(hci_hdl, 0x01);
+ write_link_policy_settings(hci_hdl, 0x04);
=20
/* we demand role switch as server */
if (force_msswitch && !i_am_initiator) {
@@ -993,8 +1013,6 @@
=20
update_ncp(buf[0], buf + 1);
=20
- D_QUEUE("<NCP:%d>\n",hci_ctrl.hc_buf.acl_num);
-
break;
=20
case MODE_CHANGE:
@@ -2804,13 +2822,26 @@
c_pkt.opcode =3D hci_put_opcode(READ_BUFFER_SIZE, HCI_IP);
c_pkt.len =3D 0;
=20
- if (block)
- return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE=
N);
+ if (block) {
+ int ret =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_H=
DR_LEN);
+#if 0
+ if (ret >=3D 0 &&
+ hci_ctrl.hc_buf.acl_len =3D=3D 256 &&
+ hci_ctrl.hc_buf.acl_num =3D=3D 4 &&
+ hci_set_buffer_sizes(hci_ctrl.hc_buf.acl_len / 2,
+ hci_ctrl.hc_buf.acl_num * 2) >=3D=
0) {
+ c_pkt.type =3D CMD_PKT;
+ c_pkt.opcode =3D hci_put_opcode(READ_BUFFER_SIZE, =
HCI_IP);
+ c_pkt.len =3D 0;
+ ret =3D send_cmd_block((u8*) &c_pkt ,c_pkt.len + C=
MD_HDR_LEN + HCI_HDR_LEN);
+ }
+#endif
+ return ret;
+ }
else
return send_cmd((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN);
}
=20
-
#if 0
s32
hci_read_local_version_info(s32 block)
@@ -3226,6 +3257,7 @@
send_acl_data_task(void)
{
s32 bytes2send =3D 0;=09
+ s32 sent_bytes =3D 0;
bt_tx_buf *tx_buf;
=20=09
/* get pointer to next unsent transmission chunk */
@@ -3245,13 +3277,22 @@
interrupt can change hci_ctrl.hc_buf.acl_num. */
cli();
while ((hci_ctrl.hc_buf.acl_num > 0) && bytes2send) {
- hci_ctrl.hc_buf.acl_num--;
sti();
=20=09=09
/* FIXME -- what if send_acl_packet fails ???=20
Then acl_num will decrease anyway ... */=20
=20
- bytes2send -=3D send_acl_packet(tx_buf);
+ sent_bytes =3D send_acl_packet(tx_buf);
+
+ if (sent_bytes !=3D 0) {
+ bytes2send -=3D sent_bytes;
+ cli();
+ hci_ctrl.hc_buf.acl_num--;
+ sti();
+ } else {
+ break;
+ }
+
=20=09=09
D_QUEUE("<--%d (%d)\n", buf_byte_count(),=20
hci_ctrl.hc_buf.acl_num);
|