v01d commented on a change in pull request #878:
URL: https://github.com/apache/mynewt-nimble/pull/878#discussion_r537731511



##########
File path: nimble/host/src/ble_hs_hci.c
##########
@@ -339,11 +339,13 @@ ble_hs_hci_cmd_tx(uint16_t opcode, const void *cmd, 
uint8_t cmd_len,
 static void
 ble_hs_hci_rx_ack(uint8_t *ack_ev)
 {
+#if 0
     if (ble_npl_sem_get_count(&ble_hs_hci_sem) > 0) {
         /* This ack is unexpected; ignore it. */
         ble_hci_trans_buf_free(ack_ev);
         return;
     }
+#endif

Review comment:
       Ok, I looked further into the issue and it was not a race condition 
after all. The problem is that ble_npl_sem_get_count() returns unsigned integer 
and NuttX returns negative numbers in sem_getvalue() to indicate number of lock 
count (this is a valid option as per the man page). So this would generate 
65536 as the sem value and the if would get triggered.
   It now works as expected.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to