bccmd(csr_bcsp.c) bug Report
Dear all
Recently I found the bccmd bug.
I think that do_command function (csr_bcsp.c) could have a problem
if we receive both UBCSP_PACKET_SENT and UBCSP_PACKET_RECEIVED simultaneously from ubcsp_poll function.
An expected scenario is that UBCSP_PACKET_SENT comes earlier than UBCSP_PACKET_RECEIVED.
But if we get them at the same time this could be a problem because “sent=1” is located after checking “sent==1”.
It means that this program doesn’t know UBCSP_PACKET_SENT even if we already receive it.
I there anyone who know this bug?
If you let me know how to check-in code,
I would like to do it!
Regards.
Chan-Yeol Park (박 찬 열)
Engineer
Mobile S/W Platform Lab.
Telecommunication R&D Center
SAMSUNG ELECTRONICS CO., LTD.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerSGksCgo+IEkgdGhpbmsgdGhhdCBkb19jb21tYW5kIGZ1bmN0aW9uIChjc3JfYmNzcC5jKSBjb3Vs ZCBoYXZlIGEgcHJvYmxlbSAKPiAKPiBpZiB3ZSByZWNlaXZlIGJvdGggVUJDU1BfUEFDS0VUX1NF TlQgYW5kIFVCQ1NQX1BBQ0tFVF9SRUNFSVZFRAo+IHNpbXVsdGFuZW91c2x5IGZyb20gdWJjc3Bf cG9sbCBmdW5jdGlvbi4KPgo+IEFuIGV4cGVjdGVkIHNjZW5hcmlvIGlzIHRoYXQgVUJDU1BfUEFD S0VUX1NFTlQgY29tZXMgZWFybGllciB0aGFuCj4gVUJDU1BfUEFDS0VUX1JFQ0VJVkVELgo+IAo+ IEJ1dCBpZiB3ZSBnZXQgdGhlbSBhdCB0aGUgc2FtZSB0aW1lIHRoaXMgY291bGQgYmUgYSBwcm9i bGVtIGJlY2F1c2UKPiDigJxzZW50PTHigJ0gaXMgbG9jYXRlZCBhZnRlciBjaGVja2luZyDigJxz ZW50PT0x4oCdLgo+Cj4gSXQgbWVhbnMgdGhhdCB0aGlzIHByb2dyYW0gZG9lc27igJl0IGtub3cg VUJDU1BfUEFDS0VUX1NFTlQgZXZlbiBpZiB3ZQo+IGFscmVhZHkgcmVjZWl2ZSBpdC4KCnBsZWFz ZSBzZW50IGEgcGF0Y2ggKHVuaWZpZWQgZGlmZikgZm9yIGl0LgoKUmVnYXJkcwoKTWFyY2VsCgoK Ci0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0KQ2hlY2sgb3V0IHRoZSBuZXcgU291cmNlRm9yZ2UubmV0IE1hcmtl dHBsYWNlLgpJdCdzIHRoZSBiZXN0IHBsYWNlIHRvIGJ1eSBvciBzZWxsIHNlcnZpY2VzIGZvcgpq dXN0IGFib3V0IGFueXRoaW5nIE9wZW4gU291cmNlLgpodHRwOi8vc291cmNlZm9yZ2UubmV0L3Nl cnZpY2VzL2J1eS9pbmRleC5waHAKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX18KQmx1ZXotZGV2ZWwgbWFpbGluZyBsaXN0CkJsdWV6LWRldmVsQGxpc3RzLnNv dXJjZWZvcmdlLm5ldApodHRwczovL2xpc3RzLnNvdXJjZWZvcmdlLm5ldC9saXN0cy9saXN0aW5m by9ibHVlei1kZXZlbAo=
Quoted 13 lines · Marcel Holtmann
Hi,
Quoted 11 lines
I think that
do_commandfunction (csr_bcsp.c) could have a problemif we receive both
UBCSP_PACKET_SENTandUBCSP_PACKET_RECEIVEDsimultaneously fromubcsp_pollfunction.An expected scenario is that
UBCSP_PACKET_SENTcomes earlier thanUBCSP_PACKET_RECEIVED.But if we get them at the same time this could be a problem because “sent=1” is located after checking “sent==1”.
Quoted 8 lines
Quoted 2 lines
It means that this program doesn’t know
UBCSP_PACKET_SENTeven if we already receive it.please sent a patch (unified diff) for it.
Regards
Marcel
Hi Marcel,
I sent in a patch for this back in August 2006
(http://article.gmane.org/gmane.linux.bluez.devel/8836).
The patch still applies to the latest CVS source. I have attached it to this post.
Regards
../fam
Signature · 3 lines
Frank Mandarino fmandarino(a)endrelia.com Endrelia Technologies Inc. Toronto, Ontario, Canada
Index: utils/tools/csr_bcsp.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/csr_bcsp.c,v
retrieving revision 1.6
tools/csr_bcsp.c +13 -13
@@ -188,19 +188,6 @@while (1 ) { delay =ubcsp_poll (&activity); -if (activity &UBCSP_PACKET_RECEIVED ) { -if (sent && receive_packet.channel ==5 && - receive_packet.payload[0 ] ==0xff ) { -memcpy (rp, receive_packet.payload, - receive_packet.length); -break ; - } - - receive_packet.length =512 ; -ubcsp_receive_packet (&receive_packet); - timeout =0 ; - } -if (activity &UBCSP_PACKET_SENT ) {switch (varid) {case CSR_VARID_COLD_RESET :
@@ -214,6 +201,19 @@ timeout =0 ; } +if (activity &UBCSP_PACKET_RECEIVED ) { +if (sent && receive_packet.channel ==5 && + receive_packet.payload[0 ] ==0xff ) { +memcpy (rp, receive_packet.payload, + receive_packet.length); +break ; + } + + receive_packet.length =512 ; +ubcsp_receive_packet (&receive_packet); + timeout =0 ; + } +if (delay) {usleep (delay *100 );
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Frank,
Quoted 5 lines
I sent in a patch for this back in August 2006
(http://article.gmane.org/gmane.linux.bluez.devel/8836).The patch still applies to the latest CVS source. I have attached it to this post.
committed to the CVS now. Thanks.
Regards
Marcel
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel