Revert "Bluetooth: Remove LE Rand workaround for mynewt firmware"

The current documentation points to MyNewt 0.9 which doesn't have the
necessary fix, so revert the workaround until the next release of
MyNewt is out. A minor change to the original patch is that we also
have a delay in prng_init() which seems to be needed since this is now
called earlier during the HCI init sequence.

This reverts commit d75acb44c3.

Change-Id: Ic4919e01bddbfaca477825c3f7fdcb549c8d10ec
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-06-13 10:58:26 +03:00
commit bd066867e4

View file

@ -2111,6 +2111,20 @@ static void hci_cmd_status(struct net_buf *buf)
} }
} }
static inline void mynewt_rand_delay(void)
{
#if defined(CONFIG_BOARD_ARDUINO_101)
/* FIXME: Temporary hack for MyNewt HCI firmware which
* crashes if it receives too rapid LE_Rand commands.
*/
if (sys_execution_context_type_get() == NANO_CTX_FIBER) {
fiber_sleep(MSEC(30));
} else {
task_sleep(MSEC(30));
}
#endif
}
static int prng_reseed(struct tc_hmac_prng_struct *h) static int prng_reseed(struct tc_hmac_prng_struct *h)
{ {
uint8_t seed[32]; uint8_t seed[32];
@ -2121,6 +2135,11 @@ static int prng_reseed(struct tc_hmac_prng_struct *h)
struct bt_hci_rp_le_rand *rp; struct bt_hci_rp_le_rand *rp;
struct net_buf *rsp; struct net_buf *rsp;
/* FIXME: Temporary hack for MyNewt HCI firmware which
* crashes if it receives too rapid LE_Rand commands.
*/
mynewt_rand_delay();
ret = bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, NULL, &rsp); ret = bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, NULL, &rsp);
if (ret) { if (ret) {
return ret; return ret;
@ -2150,6 +2169,11 @@ static int prng_init(struct tc_hmac_prng_struct *h)
struct net_buf *rsp; struct net_buf *rsp;
int ret; int ret;
/* FIXME: Temporary hack for MyNewt HCI firmware which
* crashes if it receives too rapid LE_Rand commands.
*/
mynewt_rand_delay();
ret = bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, NULL, &rsp); ret = bt_hci_cmd_send_sync(BT_HCI_OP_LE_RAND, NULL, &rsp);
if (ret) { if (ret) {
return ret; return ret;