Reduce bccmd "Operation timed out" errors
PATCH 1/1 Reduce bccmd "Operation timed out" errors
Hi Marcel,
The attached bccmd patch reverses the order of processing the PACKET_RECEIVED and PACKET_SENT activity bits returned by ubcsp_poll(), to handle the case where both bits are set. This condition occurs when the received packet contains the acknowledgment for the previously sent packet. It happens quite often on my system, and results in an "Operation timed out" error.
Currently, when both bits are set, the PACKET_RECEIVED bit is processed first, and the received packet is ignored because it hasn't yet processed the PACKET_SENT bit. Then when the PACKET_SENT bit is processed, it sets a flag to indicate that the next received packet will contain the result, and the loop should be exited at that time. Since no further packets are received, the loop times out.
By reversing the order of processing, the packet sent flag gets set before the PACKET_RECEIVED bit is processed, and the loop is exited.
After making this change, I haven't seen a single operation timed out error.
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 );
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Bluez-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel