public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Mandarino <fmandarino@endrelia.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] bccmd(csr_bcsp.c) bug Report
Date: Wed, 02 Jul 2008 14:47:24 -0400	[thread overview]
Message-ID: <486BCD3C.7090203@endrelia.com> (raw)
In-Reply-To: <1214806529.11537.12.camel@violet.holtmann.net>

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

Marcel Holtmann wrote:
> Hi,
> 
>> 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.
> 
> 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
-- 
Frank Mandarino                                fmandarino(a)endrelia.com
Endrelia Technologies Inc.
Toronto, Ontario, Canada

[-- Attachment #2: csr_bcsp.c.txt --]
[-- Type: text/plain, Size: 1209 bytes --]

Index: utils/tools/csr_bcsp.c
===================================================================
RCS file: /cvsroot/bluez/utils/tools/csr_bcsp.c,v
retrieving revision 1.6
diff -u -r1.6 csr_bcsp.c
--- utils/tools/csr_bcsp.c	26 Jul 2006 13:32:45 -0000	1.6
+++ utils/tools/csr_bcsp.c	30 Aug 2006 15:06:56 -0000
@@ -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);
 

[-- Attachment #3: Type: text/plain, Size: 347 bytes --]

-------------------------------------------------------------------------
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

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2008-07-02 18:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-30  6:08 [Bluez-devel] bccmd(csr_bcsp.c) bug Report Chan-Yeol Park
2008-06-30  6:15 ` Marcel Holtmann
2008-07-02 18:47   ` Frank Mandarino [this message]
2008-07-11  6:49     ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=486BCD3C.7090203@endrelia.com \
    --to=fmandarino@endrelia.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox