Re: bccmd(csr_bcsp.c) bug Report
Frank Mandarino <[email protected]> Wed, 02 Jul 2008 14:47:24 -0400
| Newsgroups | gmane.linux.bluez.devel |
|---|---|
| Organization | Endrelia Technologies Inc. |
| Message-ID | <[email protected]> |
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 ------------------------------------------------------------------------- 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
csr_bcsp.c.txt
(text/plain, 1.2 KB)
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);