From: Peter K. <pk...@us...> - 2001-10-04 14:53:00
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.120 1.121=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Do not dereference rfcomm in rfcomm_disconnect_ind() if it is NULL. The diff of the modified file(s): --- rfcomm.c 2001/09/28 14:54:15 1.120 +++ rfcomm.c 2001/10/04 14:52:59 1.121 @@ -972,13 +972,11 @@ =20 DSYS(FNC"remote cid %d\n", l2cap->remote_cid); =20 - rfcomm =3D ((rfcomm_con*) l2cap->upper_con); - + if ((rfcomm =3D (rfcomm_con*)l2cap->upper_con)) { /* This l2cap connection is going down, remove all rfcomm cons=20 and notify upper tty */ =20 - if (!l2cap->link_up) - { + if (!l2cap->link_up) { DSYS(FNC"Baseband is down, reset this RFCOMM session\n"); #ifdef __KERNEL__ bt_unregister_rfcomm(rfcomm->line); @@ -987,6 +985,7 @@ } =20 rfcomm_reset_con(rfcomm->line); + } =20 /* always try to send back rsp (if link is down con is deleted) */ if (l2ca_disconnect_rsp(l2cap)) { |
From: Anders J. <and...@us...> - 2001-10-16 14:43:49
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.124 1.125=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * When we receving a PN message we should fix the frame_size after=20 determine if it's a long packet. The diff of the modified file(s): --- rfcomm.c 2001/10/12 12:03:22 1.124 +++ rfcomm.c 2001/10/16 09:30:12 1.125 @@ -1571,7 +1571,6 @@ case PN: /*DLC parameter negotiation*/ { pn_msg *pn_pkt =3D (pn_msg*) data; - swap_pn_msg(pn_pkt); D_CTRL(FNC"Received DLC parameter negotiation, PN\n"); if (longpkt) { /* If a long length field is used, then move the @@ -1579,6 +1578,7 @@ data++; pn_pkt =3D (pn_msg*) data; }=20=20 + swap_pn_msg(pn_pkt); if (pn_pkt->mcc_s_head.type.cr =3D=3D MCC_CMD) { u8 tmp_dlci; u16 frame_size; |
From: Peter K. <pk...@us...> - 2001-10-16 14:59:45
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.125 1.126=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Replaced swap_pn_msg() with use of le16_to_cpuu(), and put_unaligned() and cpu_to_le16() to make sure it works on unaligned addresses (thanks to Alain Paschoud for pointing this out). The diff of the modified file(s): --- rfcomm.c 2001/10/16 09:30:12 1.125 +++ rfcomm.c 2001/10/16 14:59:29 1.126 @@ -52,6 +52,8 @@ #include <linux/string.h> #include <linux/sched.h> =20 +#include <asm/unaligned.h> + #include <linux/bluetooth/rfcomm.h> #include <linux/bluetooth/rfcomm_sec.h> #include <linux/bluetooth/btmem.h> @@ -145,25 +147,24 @@ #define UIH 0xef =20 /* The values in the type field in a multiplexer command packet */ -#define TEST 0x8 +#define TEST 0x08 #define FCON 0x28 #define FCOFF 0x18 #define MSC 0x38 #define RPN 0x24 #define RLS 0x14 #define PN 0x20 -#define NSC 0x4 +#define NSC 0x04 =20 /* Define of some V.24 signals modem control signals in RFCOMM */ -#define FC 0x2 -#define RTC 0x4 -#define RTR 0x8 +#define FC 0x02 +#define RTC 0x04 +#define RTR 0x08 #define DV 0x80 =20 /* endian-swapping macros for structs */ #define swap_long_frame(x) ((x)->h.length.val =3D le16_to_cpu((x)->h.lengt= h.val)) #define swap_mcc_long_frame(x) (swap_long_frame(x)) -#define swap_pn_msg(x) ((x)->frame_size =3D le16_to_cpu((x)->frame_size)) =20 #define RFCOMM_CON_TIMEOUT (5*HZ) =20 @@ -190,8 +191,8 @@ =20 typedef union long_length { struct bits { - u8 ea:1; - unsigned short len:15; + u16 ea:1; + u16 len:15; } __attribute__ ((packed)) bits; u16 val; } __attribute__ ((packed)) long_length; @@ -337,8 +338,8 @@ =20 typedef union long_length { struct bits { - unsigned short len:15; - u8 ea:1; + u16 len:15; + u16 ea:1; } __attribute__ ((packed)) bits; u16 val; } __attribute__ ((packed)) long_length; @@ -1568,17 +1569,19 @@ } break; } + case PN: /*DLC parameter negotiation*/ { - pn_msg *pn_pkt =3D (pn_msg*) data; + pn_msg *pn_pkt; + D_CTRL(FNC"Received DLC parameter negotiation, PN\n"); if (longpkt) { /* If a long length field is used, then move the payload pointer one byte ahead */ data++; - pn_pkt =3D (pn_msg*) data; }=20=20 - swap_pn_msg(pn_pkt); + pn_pkt =3D (pn_msg*) data; + if (pn_pkt->mcc_s_head.type.cr =3D=3D MCC_CMD) { u8 tmp_dlci; u16 frame_size; @@ -1588,7 +1591,7 @@ back a response */ =20 tmp_dlci =3D pn_pkt->dlci; - frame_size =3D pn_pkt->frame_size; + frame_size =3D le16_to_cpuu(&pn_pkt->frame_size); =20 frame_size =3D MIN(frame_size, rfcomm->l2cap->local_mtu - RFCOMM_MAX_HD= R_SIZE); credit =3D pn_pkt->credit_flow; @@ -1615,11 +1618,11 @@ u8 tmp_dlci; tmp_dlci =3D pn_pkt->dlci; D_CTRL(FNC"received PN response with:\n"); - D_CTRL(FNC"Frame size:%d\n",pn_pkt->frame_size); + D_CTRL(FNC"Frame size:%d\n", le16_to_cpuu(&pn_pkt->frame_size)); D_CTRL(FNC"credit_flow:%d\n", pn_pkt->credit_flow); D_CTRL(FNC"credits:%d\n", pn_pkt->credits); =20=09=09=09 - rfcomm->dlci[tmp_dlci].mtu =3D pn_pkt->frame_size; + rfcomm->dlci[tmp_dlci].mtu =3D le16_to_cpuu(&pn_pkt->frame_size); =20=09=09=09 if (pn_pkt->credit_flow =3D=3D 0xe) { DSYS(FNC"Credit flow control used\n"); @@ -1634,10 +1637,9 @@ if (rfcomm->dlci[tmp_dlci].state =3D=3D NEGOTIATING) { send_sabm(rfcomm, tmp_dlci); } - - } } break; + } =20=20=20=20=20 case NSC: /*Non supported command resonse*/ D_CTRL(FNC"Received Non supported command response\n"); @@ -1650,7 +1652,6 @@ =20=20=20=20=20 break; } - } =20 =20 @@ -2247,8 +2248,7 @@ D_CTRL("send_pn_msg: DLCI 0x%02x, prior:0x%02x, frame_size:%d, credit_flo= w:%x, credits:%d, cr:%x\n", dlci, prior, frame_size, credit_flow, credits, cr); =20 - /* FIXME: Can't use structures here, sizeof doesn't work... */ - rfcomm_frame_size =3D 14; //sizeof(pn_msg); + rfcomm_frame_size =3D sizeof *pn_pkt; tx_buf =3D subscribe_bt_buf(sizeof(rfcomm_tx_buf) + rfcomm_frame_size); =20 if (!tx_buf) { @@ -2280,12 +2280,10 @@ pn_pkt->credit_flow =3D credit_flow; pn_pkt->prior =3D prior; pn_pkt->ack_timer =3D 0; - pn_pkt->frame_size =3D frame_size; + put_unaligned(cpu_to_le16(frame_size), &pn_pkt->frame_size); pn_pkt->credits =3D credits; pn_pkt->max_nbrof_retrans =3D 0; =20=20=20 - swap_pn_msg(pn_pkt); - return l2cap_send_data(tx_buf,rfcomm->l2cap); } =20 |
From: Anders J. <and...@us...> - 2001-10-23 10:10:28
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.127 1.128=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Minimum limit when sending credits set to 6. * Only send credits in an empty packet if we run out of them, otherwise=20 always try to send them together with any outgoing data. The diff of the modified file(s): --- rfcomm.c 2001/10/18 15:49:25 1.127 +++ rfcomm.c 2001/10/23 10:10:28 1.128 @@ -136,7 +136,7 @@ =20 #define MAX_CREDITS 30 #define START_CREDITS 7 -#define MIN_CREDITS 15 +#define MIN_CREDITS 6 =20 #define DEF_RFCOMM_MTU 127 =20 @@ -1302,13 +1302,18 @@ u32 con_id =3D CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci); =20 if (rfcomm->credit_flow) { + if(rfcomm->dlci[tmp_dlci].remote_credits) { --rfcomm->dlci[tmp_dlci].remote_credits; + } +=09=09=09=09 D_CTRL(FNC": Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credi= ts); - if (rfcomm->dlci[tmp_dlci].remote_credits < MIN_CREDITS) { + /* Send new credits in packet only if we totally run out of them. When= we send + data to the other side we usually send credits needed together with= the data + (piggy-backed) */ + if (rfcomm->dlci[tmp_dlci].remote_credits =3D=3D 0) { u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[tmp_dlci].remote_credits; - rfcomm_send_credits(rfcomm, tmp_dlci, newcredits); rfcomm->dlci[tmp_dlci].remote_credits +=3D newcredits; -=09=09=09=09=09 + rfcomm_send_credits(rfcomm, tmp_dlci, newcredits); D_SND(FNC"Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credits= ); =20=09=09=09=09=09 } @@ -1831,6 +1836,7 @@ u32 rfcomm_frame_size; u8 send_credit =3D 0; s32 retval =3D 0; + u8 newcredits =3D 0; =20=09=09 D_CTRL(FNC"Creating UIH packet with %d bytes data to DLCI %d\n", len, dlci); @@ -1847,6 +1853,8 @@ if (rfcomm->credit_flow &&(rfcomm->dlci[dlci].remote_credits < MIN_CREDIT= S)) { D_SND(FNC"Sending more credits to remote port\n"); send_credit =3D 1; + newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits; + rfcomm->dlci[dlci].remote_credits +=3D newcredits; } =20=09 if (len > SHORT_PAYLOAD_SIZE) { @@ -1872,10 +1880,8 @@ l_pkt =3D (long_frame*) (tx_buf->data + sizeof(rfcomm_tx_buf)); set_uih_hdr((void*) l_pkt, dlci, len, rfcomm->initiator); if (send_credit) { - u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits; l_pkt->h.control =3D SET_PF(UIH); l_pkt->data[0] =3D (newcredits); - rfcomm->dlci[dlci].remote_credits +=3D newcredits; D_SND(FNC": Remote credits: %d\n",rfcomm->dlci[dlci].remote_credits); memcpy(l_pkt->data + 1, data, len); } else { @@ -1905,11 +1911,8 @@ /* Always one */ set_uih_hdr((void*) s_pkt, dlci, len, rfcomm->initiator); if (send_credit) { - u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits; -=09=09=09 s_pkt->h.control =3D SET_PF(UIH); s_pkt->data[0] =3D (newcredits); - rfcomm->dlci[dlci].remote_credits +=3D newcredits; D_SND(FNC": Remote credits: %d\n",rfcomm->dlci[dlci].remote_credits); memcpy(s_pkt->data + 1, data, len); } else { @@ -2538,6 +2541,13 @@ rfcomm_con_list[i].line,=20 rfcomm_con_list[i].dlci[j].mtu); =20=09=09=09=09 + if(j) { + len +=3Dsprintf(buf+len, " lc[%d] rc[%d] ", + rfcomm_con_list[i].dlci[j].local_credits, + rfcomm_con_list[i].dlci[j].remote_credits); + } +=09=09=09=09 + len+=3Dsprintf(buf+len, "dlci#%d state[%s]\n",=20 j, state2name(rfcomm_con_list[i].dlci[j].state)); } |
From: Anders J. <and...@us...> - 2001-12-03 11:31:32
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- rfcomm.c 1.129 1.130=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: * Decrease length by one when sending creditinformation to keep=20 the l2cap payload constant. The diff of the modified file(s): --- rfcomm.c 2001/11/22 14:02:41 1.129 +++ rfcomm.c 2001/12/03 11:31:31 1.130 @@ -1861,6 +1861,11 @@ send_credit =3D 1; newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits; rfcomm->dlci[dlci].remote_credits +=3D newcredits; + /* Decrease length by one to compensate for the creditfield and + keep the l2cap payload size constant */ + if(len) { + len -=3D 1; + } } =20=09 if (len > SHORT_PAYLOAD_SIZE) { |
From: Willy S. <sag...@us...> - 2002-04-11 10:30:37
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- rfcomm.c 1.132 1.133=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Added linux version ifdef for malloc.h/slab.h The diff of the modified file(s): --- rfcomm.c 25 Feb 2002 14:28:19 -0000 1.132 +++ rfcomm.c 11 Apr 2002 10:19:50 -0000 1.133 @@ -47,7 +47,11 @@ #ifdef __KERNEL__=20 #include <linux/config.h> #include <linux/bluetooth/sysdep-2.1.h> +#if LINUX_VERSION_CODE >=3D 0x20200 +#include <linux/slab.h> +#else #include <linux/malloc.h> +#endif #include <linux/types.h> #include <linux/string.h> #include <linux/sched.h> |
From: Alain P. <apa...@us...> - 2002-08-09 07:15:55
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- rfcomm.c 1.134 1.135=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: Inform Proc file of deconnection even if on dlci 0. I added that because otherwise if the remote device uses BlueZ stack, the p= roc file is not informed of the deconnection. FIXE ME : I can't get the server channel number that will be disconnected. The diff of the modified file(s): --- rfcomm.c 5 Aug 2002 15:38:11 -0000 1.134 +++ rfcomm.c 9 Aug 2002 07:15:53 -0000 1.135 @@ -1243,6 +1243,16 @@ =20 DSYS("RFCOMM control ch disconnected (remotely) [line:%d]\n",=20 rfcomm->line); +#ifdef CONFIG_BLUETOOTH_PROC + /* Fix me : channel 0 is not the right channel. How to get the channel */ + /* number that will be disconnected ? */ + new_con_srv_channel =3D tmp_dlci >> 1; + new_con_line =3D rfcomm->line; + new_con_connected =3D 0; // Disconnection + /* Wake up if someone reads the proc file */ + wake_up_interruptible(&channel_con_wq);=09=09 +#endif + send_ua(rfcomm, 0); } else { rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED; |
From: Alain P. <apa...@us...> - 2002-08-09 09:03:38
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- rfcomm.c 1.135 1.136=20=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: I temporarly removed the information of the server channel during deconnect= ion, because the behavior is not always the same. It depends on what stack = is on the other side. You now still have deconnection information, but it will always say "0" as = server channel. I hope I'll correct that soon. The diff of the modified file(s): --- rfcomm.c 9 Aug 2002 07:15:53 -0000 1.135 +++ rfcomm.c 9 Aug 2002 09:03:36 -0000 1.136 @@ -1258,6 +1258,7 @@ rfcomm->dlci[tmp_dlci].state =3D DISCONNECTED; send_ua(rfcomm, tmp_dlci); =20=09=09=09 +#if 0 /* Removed temporarly, because this generates two informations (wit= h the previous) */=09=09 #ifdef CONFIG_BLUETOOTH_PROC new_con_srv_channel =3D tmp_dlci >> 1; new_con_line =3D rfcomm->line; @@ -1265,6 +1266,7 @@ /* Wake up if someone reads the proc file */ wake_up_interruptible(&channel_con_wq);=09=09 #endif +#endif /* if 0 */ D_CTRL("dlci %d was disconnected\n", tmp_dlci); bt_disconnect_ind(CREATE_RFCOMM_ID(rfcomm->line,=20 tmp_dlci)); |